1
0
mirror of https://github.com/bitwarden/mobile synced 2026-02-27 18:03:48 +00:00

enable context loading and vm init

This commit is contained in:
André Bispo
2022-06-04 20:19:03 +01:00
parent 655b51b6a5
commit 31d1a2e083
28 changed files with 85611 additions and 24 deletions

View File

@@ -9,6 +9,10 @@
x:DataType="authenticator:AuthenticatorPageViewModel"
Title="{Binding PageTitle}">
<ContentPage.BindingContext>
<authenticator:AuthenticatorPageViewModel />
</ContentPage.BindingContext>
<StackLayout>
<RefreshView
IsVisible="{Binding ShowList}"

View File

@@ -23,13 +23,13 @@ namespace Bit.App.Pages.Authenticator
public AuthenticatorPage(bool fromTabPage, Action<string> selectAction = null, TabsPage tabsPage = null)
{
//_tabsPage = tabsPage;
_tabsPage = tabsPage;
InitializeComponent();
//_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
_vm = BindingContext as AuthenticatorPageViewModel;
//_vm.Page = this;
//_fromTabPage = fromTabPage;
//_selectAction = selectAction;
_vm.Page = this;
_fromTabPage = fromTabPage;
_selectAction = selectAction;
//var isIos = Device.RuntimePlatform == Device.iOS;
//if (selectAction != null)
//{
@@ -64,20 +64,20 @@ namespace Bit.App.Pages.Authenticator
protected async override void OnAppearing()
{
base.OnAppearing();
//if (!_fromTabPage)
//{
// await InitAsync();
//}
//_broadcasterService.Subscribe(nameof(GeneratorPage), async (message) =>
//{
// if (message.Command == "updatedTheme")
// {
// Device.BeginInvokeOnMainThread(() =>
// {
// //_vm.RedrawPassword();
// });
// }
//});
if (!_fromTabPage)
{
await InitAsync();
}
_broadcasterService.Subscribe(nameof(GeneratorPage), async (message) =>
{
if (message.Command == "updatedTheme")
{
Device.BeginInvokeOnMainThread(() =>
{
//_vm.RedrawPassword();
});
}
});
}
protected override void OnDisappearing()

View File

@@ -13,7 +13,7 @@ namespace Bit.App.Pages.Authenticator
private readonly IClipboardService _clipboardService;
private bool _showList = true;
private bool _refreshing;
private readonly IUserService _userService;
private readonly IStateService _stateService;
private readonly IVaultTimeoutService _vaultTimeoutService;
#endregion
@@ -22,7 +22,7 @@ namespace Bit.App.Pages.Authenticator
public AuthenticatorPageViewModel()
{
_userService = ServiceContainer.Resolve<IUserService>("userService");
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
}
@@ -30,7 +30,7 @@ namespace Bit.App.Pages.Authenticator
#region Methods
public async Task InitAsync() { }
public async Task InitAsync() { await LoadAsync(); }
public async Task CopyAsync()
{
@@ -41,7 +41,7 @@ namespace Bit.App.Pages.Authenticator
public async Task LoadAsync()
{
var authed = await _userService.IsAuthenticatedAsync();
var authed = await _stateService.IsAuthenticatedAsync();
if (!authed)
{
return;

View File

@@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Bit.App.Effects;
using Bit.App.Models;
using Bit.App.Pages.Authenticator;
using Bit.App.Resources;
using Bit.Core.Abstractions;
using Bit.Core.Models.Data;
@@ -36,7 +37,7 @@ namespace Bit.App.Pages
Children.Add(_groupingsPage);
_authenticatorPage = new NavigationPage(new Authenticator.AuthenticatorPage(true, null, this))
_authenticatorPage = new NavigationPage(new AuthenticatorPage(true, null, this))
{
Title = AppResources.Authenticator,
IconImageSource = "info.png"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@


View File

@@ -0,0 +1 @@


File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff