diff --git a/src/App/App.csproj b/src/App/App.csproj
index ff19d424d..6b3979c98 100644
--- a/src/App/App.csproj
+++ b/src/App/App.csproj
@@ -41,6 +41,9 @@
GeneratorHistoryPage.xaml
+
+ SyncPage.xaml
+
AttachmentsPage.xaml
diff --git a/src/App/Pages/Settings/SettingsPage.xaml.cs b/src/App/Pages/Settings/SettingsPage.xaml.cs
index b91a7780c..331d177c7 100644
--- a/src/App/Pages/Settings/SettingsPage.xaml.cs
+++ b/src/App/Pages/Settings/SettingsPage.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using Bit.App.Resources;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -19,7 +20,7 @@ namespace Bit.App.Pages
_vm.Page = this;
}
- private void RowSelected(object sender, SelectedItemChangedEventArgs e)
+ private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
{
((ListView)sender).SelectedItem = null;
if(!DoOnce())
@@ -31,7 +32,10 @@ namespace Bit.App.Pages
return;
}
- // TODO
+ if(item.Name == AppResources.Sync)
+ {
+ await Navigation.PushModalAsync(new NavigationPage(new SyncPage()));
+ }
}
}
}
diff --git a/src/App/Pages/Settings/SyncPage.xaml b/src/App/Pages/Settings/SyncPage.xaml
new file mode 100644
index 000000000..7faf7bb8f
--- /dev/null
+++ b/src/App/Pages/Settings/SyncPage.xaml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/App/Pages/Settings/SyncPage.xaml.cs b/src/App/Pages/Settings/SyncPage.xaml.cs
new file mode 100644
index 000000000..a03d44a69
--- /dev/null
+++ b/src/App/Pages/Settings/SyncPage.xaml.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace Bit.App.Pages
+{
+ public partial class SyncPage : BaseContentPage
+ {
+ private readonly SyncPageViewModel _vm;
+
+ public SyncPage()
+ {
+ InitializeComponent();
+ _vm = BindingContext as SyncPageViewModel;
+ _vm.Page = this;
+ }
+
+ private async void Sync_Clicked(object sender, EventArgs e)
+ {
+ if(DoOnce())
+ {
+ await _vm.SyncAsync();
+ }
+ }
+ }
+}
diff --git a/src/App/Pages/Settings/SyncPageViewModel.cs b/src/App/Pages/Settings/SyncPageViewModel.cs
new file mode 100644
index 000000000..a360acb94
--- /dev/null
+++ b/src/App/Pages/Settings/SyncPageViewModel.cs
@@ -0,0 +1,41 @@
+using Bit.App.Abstractions;
+using Bit.App.Resources;
+using Bit.Core.Abstractions;
+using Bit.Core.Exceptions;
+using Bit.Core.Utilities;
+using System.Threading.Tasks;
+
+namespace Bit.App.Pages
+{
+ public class SyncPageViewModel : BaseViewModel
+ {
+ private readonly IDeviceActionService _deviceActionService;
+ private readonly IPlatformUtilsService _platformUtilsService;
+ private readonly ISyncService _syncService;
+
+ public SyncPageViewModel()
+ {
+ _deviceActionService = ServiceContainer.Resolve("deviceActionService");
+ _platformUtilsService = ServiceContainer.Resolve("platformUtilsService");
+ _syncService = ServiceContainer.Resolve("syncService");
+
+ PageTitle = AppResources.Sync;
+ }
+
+ public async Task SyncAsync()
+ {
+ try
+ {
+ await _deviceActionService.ShowLoadingAsync(AppResources.Syncing);
+ await _syncService.FullSyncAsync(true);
+ await _deviceActionService.HideLoadingAsync();
+ _platformUtilsService.ShowToast("success", null, AppResources.SyncingComplete);
+ }
+ catch(ApiException e)
+ {
+ await _deviceActionService.HideLoadingAsync();
+ await Page.DisplayAlert(AppResources.AnErrorHasOccurred, e.Error.GetSingleMessage(), AppResources.Ok);
+ }
+ }
+ }
+}