Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Commit

Permalink
Replace connectivity plugin with Xamarin.Essentials
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantvc committed May 23, 2018
1 parent 93a1d5a commit af43c7a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
7 changes: 0 additions & 7 deletions MyShop.UWP/project.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,6 @@
"Refractored.MvvmHelpers": "1.3.0",
"SQLitePCLRaw.bundle_green": "1.1.9",
"SQLitePCLRaw.core": "1.1.9",
"Xam.Plugin.Connectivity": "3.1.1",
"Xam.Plugin.EmbeddedResource": "1.0.1",
"Xam.Plugin.ExternalMaps": "4.0.1",
"Xam.Plugins.Forms.ImageCircle": "2.0.2",
Expand Down Expand Up @@ -2090,7 +2089,6 @@
"Refractored.MvvmHelpers": "1.3.0",
"SQLitePCLRaw.bundle_green": "1.1.9",
"SQLitePCLRaw.core": "1.1.9",
"Xam.Plugin.Connectivity": "3.1.1",
"Xam.Plugin.EmbeddedResource": "1.0.1",
"Xam.Plugin.ExternalMaps": "4.0.1",
"Xam.Plugins.Forms.ImageCircle": "2.0.2",
Expand Down Expand Up @@ -3334,7 +3332,6 @@
"Refractored.MvvmHelpers": "1.3.0",
"SQLitePCLRaw.bundle_green": "1.1.9",
"SQLitePCLRaw.core": "1.1.9",
"Xam.Plugin.Connectivity": "3.1.1",
"Xam.Plugin.EmbeddedResource": "1.0.1",
"Xam.Plugin.ExternalMaps": "4.0.1",
"Xam.Plugins.Forms.ImageCircle": "2.0.2",
Expand Down Expand Up @@ -4522,7 +4519,6 @@
"Refractored.MvvmHelpers": "1.3.0",
"SQLitePCLRaw.bundle_green": "1.1.9",
"SQLitePCLRaw.core": "1.1.9",
"Xam.Plugin.Connectivity": "3.1.1",
"Xam.Plugin.EmbeddedResource": "1.0.1",
"Xam.Plugin.ExternalMaps": "4.0.1",
"Xam.Plugins.Forms.ImageCircle": "2.0.2",
Expand Down Expand Up @@ -5766,7 +5762,6 @@
"Refractored.MvvmHelpers": "1.3.0",
"SQLitePCLRaw.bundle_green": "1.1.9",
"SQLitePCLRaw.core": "1.1.9",
"Xam.Plugin.Connectivity": "3.1.1",
"Xam.Plugin.EmbeddedResource": "1.0.1",
"Xam.Plugin.ExternalMaps": "4.0.1",
"Xam.Plugins.Forms.ImageCircle": "2.0.2",
Expand Down Expand Up @@ -6954,7 +6949,6 @@
"Refractored.MvvmHelpers": "1.3.0",
"SQLitePCLRaw.bundle_green": "1.1.9",
"SQLitePCLRaw.core": "1.1.9",
"Xam.Plugin.Connectivity": "3.1.1",
"Xam.Plugin.EmbeddedResource": "1.0.1",
"Xam.Plugin.ExternalMaps": "4.0.1",
"Xam.Plugins.Forms.ImageCircle": "2.0.2",
Expand Down Expand Up @@ -8198,7 +8192,6 @@
"Refractored.MvvmHelpers": "1.3.0",
"SQLitePCLRaw.bundle_green": "1.1.9",
"SQLitePCLRaw.core": "1.1.9",
"Xam.Plugin.Connectivity": "3.1.1",
"Xam.Plugin.EmbeddedResource": "1.0.1",
"Xam.Plugin.ExternalMaps": "4.0.1",
"Xam.Plugins.Forms.ImageCircle": "2.0.2",
Expand Down
1 change: 0 additions & 1 deletion MyShop/MyShop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<PackageReference Include="Refractored.MvvmHelpers" Version="1.3.0" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.9" />
<PackageReference Include="SQLitePCLRaw.core" Version="1.1.9" />
<PackageReference Include="Xam.Plugin.Connectivity" Version="3.1.1" />
<PackageReference Include="Xam.Plugin.EmbeddedResource" Version="1.0.1.0" />
<PackageReference Include="Xam.Plugin.ExternalMaps" Version="4.0.1" />
<PackageReference Include="Xam.Plugins.Forms.ImageCircle" Version="2.0.2" />
Expand Down
14 changes: 6 additions & 8 deletions MyShop/Services/AzureDataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.MobileServices;
using System.Linq;
using Microsoft.WindowsAzure.MobileServices.SQLiteStore;
using Microsoft.WindowsAzure.MobileServices.Sync;
using System.Diagnostics;
using System;
using Xamarin.Forms;

//Comment back in to use azure
using MyShop;
using Plugin.Connectivity;
using Xamarin.Essentials;

//[assembly: Dependency(typeof(AzureDataStore))]
namespace MyShop
Expand Down Expand Up @@ -119,8 +116,8 @@ public async Task<IEnumerable<Store>> GetStoresAsync()
public async Task SyncStoresAsync()
{
try
{
if (!CrossConnectivity.Current.IsConnected || !Settings.NeedsSync)
{
if (!IsInternetAvailable || !Settings.NeedsSync)
return;

await storeTable.PullAsync("allStores", storeTable.CreateQuery());
Expand All @@ -138,10 +135,9 @@ public async Task SyncFeedbacksAsync()
try
{
Settings.NeedSyncFeedback = true;
if (!CrossConnectivity.Current.IsConnected)
if (!IsInternetAvailable)
return;


await MobileService.SyncContext.PushAsync();
Settings.NeedSyncFeedback = false;
}
Expand All @@ -151,6 +147,8 @@ public async Task SyncFeedbacksAsync()
}
}

bool IsInternetAvailable => Connectivity.NetworkAccess == NetworkAccess.Internet;

static readonly AzureDataStore instance = new AzureDataStore();
/// <summary>
/// Gets the instance of the Azure Web Service
Expand Down

0 comments on commit af43c7a

Please sign in to comment.