1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-13 14:53:18 +00:00
This commit is contained in:
Matt Portune
2022-01-17 23:15:32 -05:00
parent e3a8d3bb55
commit e20ae26808
10 changed files with 69 additions and 67 deletions

View File

@@ -33,4 +33,3 @@ namespace Bit.App.Controls
} }
} }
} }

View File

@@ -43,7 +43,7 @@ namespace Bit.App.Controls
} }
var bgColor = StringToColor(upperData); var bgColor = StringToColor(upperData);
var textColor = Color.White;; var textColor = Color.White;
var size = 50; var size = 50;
var bitmap = new SKBitmap( var bitmap = new SKBitmap(

View File

@@ -15,14 +15,6 @@
</ContentPage.BindingContext> </ContentPage.BindingContext>
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<ToolbarItem
Icon="cog_environment.png" Clicked="Environment_Clicked" Order="Primary"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Options}" />
</ContentPage.ToolbarItems>
<ContentPage.Resources>
<ResourceDictionary>
<controls:ExtendedToolbarItem <controls:ExtendedToolbarItem
x:Name="_accountAvatar" x:Name="_accountAvatar"
x:Key="accountAvatar" x:Key="accountAvatar"
@@ -34,8 +26,15 @@
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Account}" /> AutomationProperties.Name="{u:I18n Account}" />
<ToolbarItem x:Name="_closeItem" x:Key="closeItem" Text="{u:I18n Close}" <ToolbarItem x:Name="_closeItem" x:Key="closeItem" Text="{u:I18n Close}"
Clicked="Close_Clicked" Order="Primary" /> Clicked="Close_Clicked" Order="Primary" Priority="-1" />
<ToolbarItem
Icon="cog_environment.png" Clicked="Environment_Clicked" Order="Primary"
AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Options}" />
</ContentPage.ToolbarItems>
<ContentPage.Resources>
<ResourceDictionary>
<StackLayout x:Name="_mainLayout" x:Key="mainLayout" Spacing="0" Padding="10, 5"> <StackLayout x:Name="_mainLayout" x:Key="mainLayout" Spacing="0" Padding="10, 5">
<StackLayout VerticalOptions="CenterAndExpand" Spacing="20"> <StackLayout VerticalOptions="CenterAndExpand" Spacing="20">
<Image <Image

View File

@@ -14,8 +14,6 @@ namespace Bit.App.Pages
private readonly AppOptions _appOptions; private readonly AppOptions _appOptions;
private IBroadcasterService _broadcasterService; private IBroadcasterService _broadcasterService;
private bool _appeared;
public HomePage(AppOptions appOptions = null) public HomePage(AppOptions appOptions = null)
{ {
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService"); _broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
@@ -29,9 +27,9 @@ namespace Bit.App.Pages
_vm.StartEnvironmentAction = () => Device.BeginInvokeOnMainThread(async () => await StartEnvironmentAsync()); _vm.StartEnvironmentAction = () => Device.BeginInvokeOnMainThread(async () => await StartEnvironmentAsync());
UpdateLogo(); UpdateLogo();
if (_appOptions?.IosExtension ?? false) if (!_appOptions?.IosExtension ?? false)
{ {
ToolbarItems.Add(_closeItem); ToolbarItems.Remove(_closeItem);
} }
} }
@@ -44,6 +42,15 @@ namespace Bit.App.Pages
protected override async void OnAppearing() protected override async void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
_mainContent.Content = _mainLayout;
if (await HasMultipleAccountsAsync())
{
_vm.AvatarImageSource = await GetAvatarImageSourceAsync(false);
}
else
{
ToolbarItems.Remove(_accountAvatar);
}
_broadcasterService.Subscribe(nameof(HomePage), async (message) => _broadcasterService.Subscribe(nameof(HomePage), async (message) =>
{ {
if (message.Command == "updatedTheme") if (message.Command == "updatedTheme")
@@ -54,17 +61,6 @@ namespace Bit.App.Pages
}); });
} }
}); });
if (_appeared)
{
return;
}
_appeared = true;
_mainContent.Content = _mainLayout;
if (await HasMultipleAccountsAsync())
{
ToolbarItems.Add(_accountAvatar);
_vm.AvatarImageSource = await GetAvatarImageSourceAsync(false);
}
} }
protected override void OnDisappearing() protected override void OnDisappearing()

View File

@@ -15,9 +15,7 @@
<pages:LockPageViewModel /> <pages:LockPageViewModel />
</ContentPage.BindingContext> </ContentPage.BindingContext>
<ContentPage.Resources> <ContentPage.ToolbarItems>
<ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" />
<controls:ExtendedToolbarItem <controls:ExtendedToolbarItem
x:Name="_accountAvatar" x:Name="_accountAvatar"
x:Key="accountAvatar" x:Key="accountAvatar"
@@ -28,6 +26,11 @@
UseOriginalImage="True" UseOriginalImage="True"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Account}" /> AutomationProperties.Name="{u:I18n Account}" />
</ContentPage.ToolbarItems>
<ContentPage.Resources>
<ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" />
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary" <ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary"
x:Name="_moreItem" x:Key="moreItem" x:Name="_moreItem" x:Key="moreItem"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"

View File

@@ -64,9 +64,12 @@ namespace Bit.App.Pages
_mainContent.Content = _mainLayout; _mainContent.Content = _mainLayout;
if (await HasMultipleAccountsAsync()) if (await HasMultipleAccountsAsync())
{ {
ToolbarItems.Add(_accountAvatar);
_vm.AvatarImageSource = await GetAvatarImageSourceAsync(); _vm.AvatarImageSource = await GetAvatarImageSourceAsync();
} }
else
{
ToolbarItems.Remove(_accountAvatar);
}
await _vm.InitAsync(); await _vm.InitAsync();
if (!_vm.BiometricLock) if (!_vm.BiometricLock)
{ {

View File

@@ -16,13 +16,6 @@
</ContentPage.BindingContext> </ContentPage.BindingContext>
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<ToolbarItem x:Name="_closeItem" x:Key="closeItem" Text="{u:I18n Close}"
Clicked="Close_Clicked" Order="Primary" Priority="-1" />
</ContentPage.ToolbarItems>
<ContentPage.Resources>
<ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" />
<controls:ExtendedToolbarItem <controls:ExtendedToolbarItem
x:Name="_accountAvatar" x:Name="_accountAvatar"
x:Key="accountAvatar" x:Key="accountAvatar"
@@ -33,6 +26,13 @@
UseOriginalImage="True" UseOriginalImage="True"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"
AutomationProperties.Name="{u:I18n Account}" /> AutomationProperties.Name="{u:I18n Account}" />
<ToolbarItem x:Name="_closeItem" x:Key="closeItem" Text="{u:I18n Close}"
Clicked="Close_Clicked" Order="Primary" Priority="-1" />
</ContentPage.ToolbarItems>
<ContentPage.Resources>
<ResourceDictionary>
<u:InverseBoolConverter x:Key="inverseBool" />
<ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary" <ToolbarItem Icon="more_vert.png" Clicked="More_Clicked" Order="Primary"
x:Name="_moreItem" x:Key="moreItem" x:Name="_moreItem" x:Key="moreItem"
AutomationProperties.IsInAccessibleTree="True" AutomationProperties.IsInAccessibleTree="True"

View File

@@ -12,7 +12,6 @@ namespace Bit.App.Pages
private readonly LoginPageViewModel _vm; private readonly LoginPageViewModel _vm;
private readonly AppOptions _appOptions; private readonly AppOptions _appOptions;
private bool _appeared;
private bool _inputFocused; private bool _inputFocused;
public LoginPage(string email = null, AppOptions appOptions = null) public LoginPage(string email = null, AppOptions appOptions = null)
@@ -47,6 +46,11 @@ namespace Bit.App.Pages
{ {
ToolbarItems.Add(_getPasswordHint); ToolbarItems.Add(_getPasswordHint);
} }
if (!_appOptions?.IosExtension ?? false)
{
ToolbarItems.Remove(_closeItem);
}
} }
public Entry MasterPasswordEntry { get; set; } public Entry MasterPasswordEntry { get; set; }
@@ -54,24 +58,21 @@ namespace Bit.App.Pages
protected override async void OnAppearing() protected override async void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
_mainContent.Content = _mainLayout;
if (await HasMultipleAccountsAsync())
{
_vm.AvatarImageSource = await GetAvatarImageSourceAsync();
}
else
{
ToolbarItems.Remove(_accountAvatar);
}
await _vm.InitAsync(); await _vm.InitAsync();
if (!_inputFocused) if (!_inputFocused)
{ {
RequestFocus(string.IsNullOrWhiteSpace(_vm.Email) ? _email : _masterPassword); RequestFocus(string.IsNullOrWhiteSpace(_vm.Email) ? _email : _masterPassword);
_inputFocused = true; _inputFocused = true;
} }
if (_appeared)
{
return;
}
_appeared = true;
_mainContent.Content = _mainLayout;
if (await HasMultipleAccountsAsync())
{
ToolbarItems.Add(_accountAvatar);
ToolbarItems.Remove(_closeItem);
_vm.AvatarImageSource = await GetAvatarImageSourceAsync();
}
} }
private async void LogIn_Clicked(object sender, EventArgs e) private async void LogIn_Clicked(object sender, EventArgs e)

View File

@@ -123,6 +123,7 @@ namespace Bit.Core.Services
{ {
await ScaffoldNewAccountAsync(account); await ScaffoldNewAccountAsync(account);
await SetActiveUserAsync(account.Profile.UserId); await SetActiveUserAsync(account.Profile.UserId);
await RefreshAccountViews();
} }
public async Task ClearAsync(string userId) public async Task ClearAsync(string userId)