diff --git a/src/App/App.csproj b/src/App/App.csproj
index d80d75b04..a8d4320c5 100644
--- a/src/App/App.csproj
+++ b/src/App/App.csproj
@@ -28,7 +28,7 @@
GeneratorPage.xaml
-
+
ViewPage.xaml
diff --git a/src/App/Pages/GroupingsPage/GroupingsPage.xaml b/src/App/Pages/GroupingsPage/GroupingsPage.xaml
index 64e894d77..4f0ec579c 100644
--- a/src/App/Pages/GroupingsPage/GroupingsPage.xaml
+++ b/src/App/Pages/GroupingsPage/GroupingsPage.xaml
@@ -72,6 +72,7 @@
CachingStrategy="RecycleElement"
ItemTemplate="{StaticResource listItemDataTemplateSelector}"
IsGroupingEnabled="True"
+ ItemSelected="RowSelected"
StyleClass="list, list-platform">
diff --git a/src/App/Pages/GroupingsPage/GroupingsPage.xaml.cs b/src/App/Pages/GroupingsPage/GroupingsPage.xaml.cs
index c6d6198bc..d7455a2c3 100644
--- a/src/App/Pages/GroupingsPage/GroupingsPage.xaml.cs
+++ b/src/App/Pages/GroupingsPage/GroupingsPage.xaml.cs
@@ -22,6 +22,7 @@ namespace Bit.App.Pages
_broadcasterService = ServiceContainer.Resolve("broadcasterService");
_syncService = ServiceContainer.Resolve("syncService");
_viewModel = BindingContext as GroupingsPageViewModel;
+ _viewModel.Page = this;
}
protected async override void OnAppearing()
@@ -55,5 +56,22 @@ namespace Bit.App.Pages
base.OnDisappearing();
_broadcasterService.Unsubscribe(nameof(GroupingsPage));
}
+
+ private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
+ {
+ if(!(e.SelectedItem is GroupingsPageListItem item))
+ {
+ return;
+ }
+
+ if(item.Cipher != null)
+ {
+ await _viewModel.SelectCipherAsync(item.Cipher);
+ }
+ else if(item.Folder != null || item.Collection != null)
+ {
+ // TODO
+ }
+ }
}
}
diff --git a/src/App/Pages/GroupingsPage/GroupingsPageViewModel.cs b/src/App/Pages/GroupingsPage/GroupingsPageViewModel.cs
index 149f2a625..4a8782a4b 100644
--- a/src/App/Pages/GroupingsPage/GroupingsPageViewModel.cs
+++ b/src/App/Pages/GroupingsPage/GroupingsPageViewModel.cs
@@ -99,6 +99,12 @@ namespace Bit.App.Pages
}
}
+ public async Task SelectCipherAsync(CipherView cipher)
+ {
+ var page = new ViewPage(cipher.Id);
+ await Page.Navigation.PushModalAsync(new NavigationPage(page));
+ }
+
private async Task LoadFoldersAsync()
{
if(!ShowFolders)
diff --git a/src/App/Pages/Vault/ViewPage.xaml b/src/App/Pages/Vault/ViewPage.xaml
new file mode 100644
index 000000000..bf8083c67
--- /dev/null
+++ b/src/App/Pages/Vault/ViewPage.xaml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/App/Pages/Vault/ViewPage.xaml.cs b/src/App/Pages/Vault/ViewPage.xaml.cs
new file mode 100644
index 000000000..711cd4101
--- /dev/null
+++ b/src/App/Pages/Vault/ViewPage.xaml.cs
@@ -0,0 +1,54 @@
+using Bit.Core.Abstractions;
+using Bit.Core.Utilities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace Bit.App.Pages
+{
+ public partial class ViewPage : ContentPage
+ {
+ private readonly IBroadcasterService _broadcasterService;
+ private ViewPageViewModel _vm;
+
+ public ViewPage(string cipherId)
+ {
+ InitializeComponent();
+ _broadcasterService = ServiceContainer.Resolve("broadcasterService");
+ _vm = BindingContext as ViewPageViewModel;
+ _vm.Page = this;
+ _vm.CipherId = cipherId;
+ }
+
+ protected async override void OnAppearing()
+ {
+ base.OnAppearing();
+ _broadcasterService.Subscribe(nameof(ViewPage), async (message) =>
+ {
+ if(message.Command == "syncCompleted")
+ {
+ var data = message.Data as Dictionary;
+ if(data.ContainsKey("successfully"))
+ {
+ var success = data["successfully"] as bool?;
+ if(success.HasValue && success.Value)
+ {
+ await _vm.LoadAsync();
+ }
+ }
+ }
+ });
+ await _vm.LoadAsync();
+ }
+
+ protected override void OnDisappearing()
+ {
+ base.OnDisappearing();
+ _broadcasterService.Unsubscribe(nameof(ViewPage));
+ }
+ }
+}
diff --git a/src/App/Pages/Vault/ViewPageViewModel.cs b/src/App/Pages/Vault/ViewPageViewModel.cs
new file mode 100644
index 000000000..5a1716ea3
--- /dev/null
+++ b/src/App/Pages/Vault/ViewPageViewModel.cs
@@ -0,0 +1,50 @@
+using Bit.App.Abstractions;
+using Bit.App.Resources;
+using Bit.Core.Abstractions;
+using Bit.Core.Models.View;
+using Bit.Core.Utilities;
+using System.Threading.Tasks;
+
+namespace Bit.App.Pages
+{
+ public class ViewPageViewModel : BaseViewModel
+ {
+ private readonly IDeviceActionService _deviceActionService;
+ private readonly ICipherService _cipherService;
+ private readonly IUserService _userService;
+ private CipherView _cipher;
+ private bool _canAccessPremium;
+
+ public ViewPageViewModel()
+ {
+ _deviceActionService = ServiceContainer.Resolve("deviceActionService");
+ _cipherService = ServiceContainer.Resolve("cipherService");
+ _userService = ServiceContainer.Resolve("userService");
+
+ PageTitle = AppResources.ViewItem;
+ }
+
+ public string CipherId { get; set; }
+ public CipherView Cipher
+ {
+ get => _cipher;
+ set => SetProperty(ref _cipher, value);
+ }
+ public bool CanAccessPremium
+ {
+ get => _canAccessPremium;
+ set => SetProperty(ref _canAccessPremium, value);
+ }
+
+ public async Task LoadAsync()
+ {
+ // TODO: Cleanup
+
+ var cipher = await _cipherService.GetAsync(CipherId);
+ Cipher = await cipher.DecryptAsync();
+ CanAccessPremium = await _userService.CanAccessPremiumAsync();
+
+ // TODO: Totp
+ }
+ }
+}
diff --git a/src/App/Pages/ViewPage.xaml b/src/App/Pages/ViewPage.xaml
deleted file mode 100644
index 29e1e9978..000000000
--- a/src/App/Pages/ViewPage.xaml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/App/Pages/ViewPage.xaml.cs b/src/App/Pages/ViewPage.xaml.cs
deleted file mode 100644
index dd4228043..000000000
--- a/src/App/Pages/ViewPage.xaml.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Xamarin.Forms;
-using Xamarin.Forms.Xaml;
-
-namespace Bit.App.Pages
-{
- public partial class ViewPage : ContentPage
- {
- private ViewPageViewModel _vm;
-
- public ViewPage()
- {
- InitializeComponent();
- _vm = BindingContext as ViewPageViewModel;
- _vm.Page = this;
- }
- }
-}
diff --git a/src/App/Pages/ViewPageViewModel.cs b/src/App/Pages/ViewPageViewModel.cs
deleted file mode 100644
index 8af152eb5..000000000
--- a/src/App/Pages/ViewPageViewModel.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Bit.App.Abstractions;
-using Bit.App.Resources;
-using Bit.Core.Abstractions;
-using Bit.Core.Exceptions;
-using Bit.Core.Utilities;
-using System.Threading.Tasks;
-using System.Windows.Input;
-using Xamarin.Forms;
-
-namespace Bit.App.Pages
-{
- public class ViewPageViewModel : BaseViewModel
- {
- private readonly IDeviceActionService _deviceActionService;
- private readonly IAuthService _authService;
- private readonly ISyncService _syncService;
-
- public ViewPageViewModel()
- {
- _deviceActionService = ServiceContainer.Resolve("deviceActionService");
- _authService = ServiceContainer.Resolve("authService");
- _syncService = ServiceContainer.Resolve("syncService");
-
- PageTitle = AppResources.Bitwarden;
- ShowPasswordCommand = new Command(() =>
- Page.DisplayAlert("Button 1 Command", "Button 1 message", "Cancel"));
- }
-
- public ICommand ShowPasswordCommand { get; }
- public string Email { get; set; }
- public string MasterPassword { get; set; }
- }
-}