mirror of
https://github.com/bitwarden/mobile
synced 2026-02-11 13:53:18 +00:00
WIP
This commit is contained in:
@@ -4,6 +4,6 @@
|
||||
android:viewportWidth="1792"
|
||||
android:viewportHeight="1792">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M1152,896q0,-106 -75,-181t-181,-75 -181,75 -75,181 75,181 181,75 181,-75 75,-181zM1664,787v222q0,12 -8,23t-20,13l-185,28q-19,54 -39,91 35,50 107,138 10,12 10,25t-9,23q-27,37 -99,108t-94,71q-12,0 -26,-9l-138,-108q-44,23 -91,38 -16,136 -29,186 -7,28 -36,28h-222q-14,0 -24.5,-8.5t-11.5,-21.5l-28,-184q-49,-16 -90,-37l-141,107q-10,9 -25,9 -14,0 -25,-11 -126,-114 -165,-168 -7,-10 -7,-23 0,-12 8,-23 15,-21 51,-66.5t54,-70.5q-27,-50 -41,-99l-183,-27q-13,-2 -21,-12.5t-8,-23.5v-222q0,-12 8,-23t19,-13l186,-28q14,-46 39,-92 -40,-57 -107,-138 -10,-12 -10,-24 0,-10 9,-23 26,-36 98.5,-107.5t94.5,-71.5q13,0 26,10l138,107q44,-23 91,-38 16,-136 29,-186 7,-28 36,-28h222q14,0 24.5,8.5t11.5,21.5l28,184q49,16 90,37l142,-107q9,-9 24,-9 13,0 25,10 129,119 165,170 7,8 7,22 0,12 -8,23 -15,21 -51,66.5t-54,70.5q26,50 41,98l183,28q13,2 21,12.5t8,23.5z" />
|
||||
</vector>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="70" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid
|
||||
@@ -64,7 +64,7 @@
|
||||
FontAttributes="Italic"
|
||||
LineBreakMode="NoWrap"
|
||||
HorizontalOptions="End"
|
||||
Margin="0,0,20,0"
|
||||
Margin="10,0,20,0"
|
||||
VerticalOptions="Center" />
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
</ContentPage.BindingContext>
|
||||
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem Icon="cog_environment.png" Clicked="Environment_Clicked" Order="Primary"
|
||||
AutomationProperties.IsInAccessibleTree="True"
|
||||
AutomationProperties.Name="{u:I18n Options}" />
|
||||
<ToolbarItem
|
||||
Icon="cog_environment.png" Clicked="Environment_Clicked" Order="Primary"
|
||||
AutomationProperties.IsInAccessibleTree="True"
|
||||
AutomationProperties.Name="{u:I18n Options}" />
|
||||
</ContentPage.ToolbarItems>
|
||||
|
||||
<ContentPage.Resources>
|
||||
@@ -34,7 +35,7 @@
|
||||
AutomationProperties.Name="{u:I18n Account}" />
|
||||
<ToolbarItem x:Name="_closeItem" x:Key="closeItem" Text="{u:I18n Close}"
|
||||
Clicked="Close_Clicked" Order="Primary" />
|
||||
|
||||
|
||||
<StackLayout x:Name="_mainLayout" x:Key="mainLayout" Spacing="0" Padding="10, 5">
|
||||
<StackLayout VerticalOptions="CenterAndExpand" Spacing="20">
|
||||
<Image
|
||||
@@ -43,9 +44,10 @@
|
||||
VerticalOptions="Center" />
|
||||
<Label Text="{u:I18n LoginOrCreateNewAccount}"
|
||||
StyleClass="text-lg"
|
||||
HorizontalTextAlignment="Center"></Label>
|
||||
HorizontalTextAlignment="Center">
|
||||
</Label>
|
||||
<StackLayout Spacing="5">
|
||||
<Button Text="{u:I18n LogIn}"
|
||||
<Button Text="{u:I18n LogIn}"
|
||||
StyleClass="btn-primary"
|
||||
Clicked="LogIn_Clicked" />
|
||||
<Button Text="{u:I18n CreateAccount}"
|
||||
@@ -57,7 +59,7 @@
|
||||
</StackLayout>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
|
||||
<AbsoluteLayout
|
||||
x:Name="_absLayout"
|
||||
VerticalOptions="FillAndExpand"
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace Bit.App.Pages
|
||||
}
|
||||
if (_appOptions?.ShowAccountSwitcher ?? false)
|
||||
{
|
||||
_appOptions.ShowAccountSwitcher = false;
|
||||
ToolbarItems.Add(_accountAvatar);
|
||||
}
|
||||
}
|
||||
@@ -50,6 +49,7 @@ namespace Bit.App.Pages
|
||||
_mainContent.Content = _mainLayout;
|
||||
if (_appOptions?.ShowAccountSwitcher ?? false)
|
||||
{
|
||||
_appOptions.ShowAccountSwitcher = false;
|
||||
_vm.AvatarImageSource = await GetAvatarImageSourceAsync();
|
||||
}
|
||||
_broadcasterService.Subscribe(nameof(HomePage), async (message) =>
|
||||
|
||||
@@ -123,8 +123,8 @@
|
||||
StyleClass="box-row"
|
||||
Padding="0, 10, 0, 0">
|
||||
<Label
|
||||
Text="{Binding LockedVerifyText}"
|
||||
StyleClass="box-footer-label" />
|
||||
Text="{Binding LockedVerifyText}"
|
||||
StyleClass="box-footer-label" />
|
||||
<Label
|
||||
Text="{Binding LoggedInAsText}"
|
||||
StyleClass="box-footer-label"
|
||||
@@ -137,7 +137,8 @@
|
||||
StyleClass="box-footer-label,text-danger,text-bold"
|
||||
IsVisible="{Binding BiometricIntegrityValid, Converter={StaticResource inverseBool}}" />
|
||||
<Button Text="{Binding BiometricButtonText}" Clicked="Biometric_Clicked"
|
||||
IsVisible="{Binding BiometricButtonVisible}"></Button>
|
||||
IsVisible="{Binding BiometricButtonVisible}">
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="_unlockButton"
|
||||
Text="{u:I18n Unlock}"
|
||||
@@ -148,7 +149,7 @@
|
||||
</ScrollView>
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
|
||||
|
||||
<AbsoluteLayout
|
||||
x:Name="_absLayout"
|
||||
VerticalOptions="FillAndExpand"
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
</ContentPage.BindingContext>
|
||||
|
||||
<ContentPage.ToolbarItems>
|
||||
<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" Priority="-1" />
|
||||
</ContentPage.ToolbarItems>
|
||||
|
||||
|
||||
<ContentPage.Resources>
|
||||
<ResourceDictionary>
|
||||
<u:InverseBoolConverter x:Key="inverseBool" />
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace Bit.App.Pages
|
||||
}
|
||||
if (_appOptions?.ShowAccountSwitcher ?? false)
|
||||
{
|
||||
_appOptions.ShowAccountSwitcher = false;
|
||||
ToolbarItems.Add(_accountAvatar);
|
||||
ToolbarItems.Remove(_closeItem);
|
||||
}
|
||||
@@ -62,6 +61,7 @@ namespace Bit.App.Pages
|
||||
_mainContent.Content = _mainLayout;
|
||||
if (_appOptions?.ShowAccountSwitcher ?? false)
|
||||
{
|
||||
_appOptions.ShowAccountSwitcher = false;
|
||||
_vm.AvatarImageSource = await GetAvatarImageSourceAsync();
|
||||
}
|
||||
await _vm.InitAsync();
|
||||
|
||||
@@ -215,8 +215,8 @@ namespace Bit.App.Pages
|
||||
{
|
||||
ResetPasswordKey = encryptedKey.EncryptedString
|
||||
};
|
||||
// Enroll user
|
||||
var userId = await _stateService.GetActiveUserIdAsync();
|
||||
// Enroll user
|
||||
await _apiService.PutOrganizationUserResetPasswordEnrollmentAsync(OrgId, userId, resetRequest);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
using Bit.App.Resources;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Request;
|
||||
using Bit.Core.Utilities;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
|
||||
@@ -121,19 +121,19 @@ namespace Bit.App.Pages
|
||||
if (isVisible)
|
||||
{
|
||||
// start listView in default (off-screen) position
|
||||
await listView.TranslateTo(0, listView.Height * -1,0);
|
||||
|
||||
await listView.TranslateTo(0, listView.Height * -1, 0);
|
||||
|
||||
// set overlay opacity to zero before making visible and start fade-in
|
||||
overlay.Opacity = 0;
|
||||
overlay.IsVisible = true;
|
||||
overlay.FadeTo(1, 100);
|
||||
|
||||
|
||||
if (Device.RuntimePlatform == Device.Android && fab != null)
|
||||
{
|
||||
// start fab fade-out
|
||||
fab.FadeTo(0, 200);
|
||||
}
|
||||
|
||||
|
||||
// slide account list into view
|
||||
await listView.TranslateTo(0, 0, 200, Easing.SinOut);
|
||||
}
|
||||
@@ -141,23 +141,24 @@ namespace Bit.App.Pages
|
||||
{
|
||||
// start overlay fade-out
|
||||
overlay.FadeTo(0, 200);
|
||||
|
||||
|
||||
if (Device.RuntimePlatform == Device.Android && fab != null)
|
||||
{
|
||||
// start fab fade-in
|
||||
fab.FadeTo(1, 200);
|
||||
}
|
||||
|
||||
|
||||
// slide account list out of view
|
||||
await listView.TranslateTo(0, listView.Height * -1, 200, Easing.SinIn);
|
||||
|
||||
|
||||
// remove overlay
|
||||
overlay.IsVisible = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task AccountRowSelectedAsync(object sender, SelectedItemChangedEventArgs e, View listView, View overlay, View fab = null)
|
||||
|
||||
protected async Task AccountRowSelectedAsync(object sender, SelectedItemChangedEventArgs e, View listView,
|
||||
View overlay, View fab = null)
|
||||
{
|
||||
if (!DoOnce())
|
||||
{
|
||||
@@ -167,7 +168,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
((Xamarin.Forms.ListView)sender).SelectedItem = null;
|
||||
await Task.Delay(100);
|
||||
await ShowAccountListAsync(false, listView, overlay, fab);
|
||||
|
||||
@@ -123,7 +123,6 @@ namespace Bit.App.Pages
|
||||
{
|
||||
return;
|
||||
}
|
||||
var userId = await _stateService.GetActiveUserIdAsync();
|
||||
if (await _stateService.GetSyncOnRefreshAsync() && Refreshing && !SyncRefreshing)
|
||||
{
|
||||
SyncRefreshing = true;
|
||||
|
||||
@@ -3,7 +3,6 @@ using Bit.App.Models;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Domain;
|
||||
using Bit.Core.Utilities;
|
||||
using Xamarin.Forms;
|
||||
|
||||
@@ -47,7 +46,7 @@ namespace Bit.App.Pages
|
||||
var settingsPage = new NavigationPage(new SettingsPage(this))
|
||||
{
|
||||
Title = AppResources.Settings,
|
||||
IconImageSource = "cogs.png"
|
||||
IconImageSource = "cog_settings.png"
|
||||
};
|
||||
Children.Add(settingsPage);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Pages;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Models.View;
|
||||
using Bit.Core.Utilities;
|
||||
@@ -15,7 +14,6 @@ using Bit.App.Models;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Domain;
|
||||
using Newtonsoft.Json;
|
||||
using Xamarin.Essentials;
|
||||
using Xamarin.Forms;
|
||||
@@ -336,28 +334,10 @@ namespace Bit.App.Utilities
|
||||
{
|
||||
var currentBuild = deviceActionService.GetBuildNumber();
|
||||
var lastBuild = await stateService.GetLastBuildAsync();
|
||||
// if (lastBuild == null)
|
||||
// {
|
||||
// // Installed
|
||||
// var currentTimeout = await stateService.GetVaultTimeoutAsync();
|
||||
// if (currentTimeout == null)
|
||||
// {
|
||||
// await stateService.SetVaultTimeoutAsync(15);
|
||||
// }
|
||||
//
|
||||
// var currentAction = await stateService.GetVaultTimeoutActionAsync();
|
||||
// if (currentAction == null)
|
||||
// {
|
||||
// await stateService.SetVaultTimeoutActionAsync("lock");
|
||||
// }
|
||||
// }
|
||||
if (lastBuild != currentBuild)
|
||||
if (lastBuild == null || lastBuild != currentBuild)
|
||||
{
|
||||
// Updated
|
||||
var tasks = Task.Run(() => syncService.FullSyncAsync(true));
|
||||
}
|
||||
if (lastBuild != currentBuild)
|
||||
{
|
||||
await stateService.SetLastBuildAsync(currentBuild);
|
||||
return true;
|
||||
}
|
||||
@@ -487,7 +467,7 @@ namespace Bit.App.Utilities
|
||||
{
|
||||
userId = await stateService.GetActiveUserIdAsync();
|
||||
}
|
||||
|
||||
|
||||
await Task.WhenAll(
|
||||
syncService.SetLastSyncAsync(DateTime.MinValue),
|
||||
tokenService.ClearTokenAsync(userId),
|
||||
@@ -503,7 +483,7 @@ namespace Bit.App.Utilities
|
||||
stateService.BiometricLocked = true;
|
||||
searchService.ClearIndex();
|
||||
}
|
||||
|
||||
|
||||
public static async Task ClearServiceCache()
|
||||
{
|
||||
var tokenService = ServiceContainer.Resolve<ITokenService>("tokenService");
|
||||
@@ -514,7 +494,7 @@ namespace Bit.App.Utilities
|
||||
"passwordGenerationService");
|
||||
var deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
|
||||
var searchService = ServiceContainer.Resolve<ISearchService>("searchService");
|
||||
|
||||
|
||||
await Task.WhenAll(
|
||||
cipherService.ClearCacheAsync(),
|
||||
deviceActionService.ClearCacheAsync());
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Services;
|
||||
using Bit.App.Styles;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Utilities;
|
||||
using Xamarin.Forms;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Bit.Core.Enums
|
||||
{
|
||||
public enum DiskStorageLocation
|
||||
{
|
||||
Default = 1,
|
||||
Preferences = 2,
|
||||
SecureStorage = 3
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace Bit.Core.Models.Domain
|
||||
public AccountKeys Keys;
|
||||
|
||||
public Account() { }
|
||||
|
||||
|
||||
public Account(AccountProfile profile, AccountTokens tokens)
|
||||
{
|
||||
Profile = profile;
|
||||
@@ -35,8 +35,11 @@ namespace Bit.Core.Models.Domain
|
||||
|
||||
public AccountProfile(AccountProfile copy)
|
||||
{
|
||||
if (copy == null) { return;}
|
||||
|
||||
if (copy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UserId = copy.UserId;
|
||||
Email = copy.Email;
|
||||
AuthStatus = copy.AuthStatus;
|
||||
@@ -44,7 +47,7 @@ namespace Bit.Core.Models.Domain
|
||||
KdfType = copy.KdfType;
|
||||
KdfIterations = copy.KdfIterations;
|
||||
}
|
||||
|
||||
|
||||
public string UserId;
|
||||
public string Email;
|
||||
public AuthenticationStatus? AuthStatus;
|
||||
@@ -52,45 +55,51 @@ namespace Bit.Core.Models.Domain
|
||||
public KdfType? KdfType;
|
||||
public int? KdfIterations;
|
||||
}
|
||||
|
||||
public class AccountTokens
|
||||
|
||||
public class AccountTokens
|
||||
{
|
||||
public AccountTokens() {}
|
||||
public AccountTokens() { }
|
||||
|
||||
public AccountTokens(AccountTokens copy)
|
||||
{
|
||||
if (copy == null) { return;}
|
||||
|
||||
if (copy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AccessToken = copy.AccessToken;
|
||||
RefreshToken = copy.RefreshToken;
|
||||
}
|
||||
|
||||
|
||||
public string AccessToken;
|
||||
public string RefreshToken;
|
||||
}
|
||||
|
||||
|
||||
public class AccountSettings
|
||||
{
|
||||
public AccountSettings() {}
|
||||
public AccountSettings() { }
|
||||
|
||||
public AccountSettings(AccountSettings copy)
|
||||
{
|
||||
if (copy == null) { return;}
|
||||
|
||||
if (copy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EnvironmentUrls = copy.EnvironmentUrls;
|
||||
PinProtected = copy.PinProtected;
|
||||
}
|
||||
|
||||
|
||||
public EnvironmentUrlData EnvironmentUrls;
|
||||
public EncString PinProtected;
|
||||
}
|
||||
|
||||
|
||||
public class AccountKeys
|
||||
{
|
||||
public SymmetricCryptoKey Key;
|
||||
public string KeyHash;
|
||||
public SymmetricCryptoKey EncKey;
|
||||
public Dictionary<string, SymmetricCryptoKey>
|
||||
public Dictionary<string, SymmetricCryptoKey>
|
||||
OrganizationKeys = new Dictionary<string, SymmetricCryptoKey>();
|
||||
public byte[] PrivateKey;
|
||||
public byte[] PublicKey;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Bit.Core.Models.Domain
|
||||
{
|
||||
public class GlobalState : Domain
|
||||
{
|
||||
public int? StateVersion { get; set; }
|
||||
public bool EnableBiometrics { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,13 @@ namespace Bit.Core.Models.View
|
||||
return;
|
||||
}
|
||||
IsAccount = true;
|
||||
|
||||
|
||||
UserId = a.Profile.UserId;
|
||||
Email = a.Profile.Email;
|
||||
Hostname = a.Settings.EnvironmentUrls.Base;
|
||||
AuthStatus = a.Profile.AuthStatus;
|
||||
}
|
||||
|
||||
|
||||
public bool IsAccount { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public string Email { get; set; }
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Bit.Core.Services
|
||||
{
|
||||
await _stateService.SetOrganizationsAsync(organizations);
|
||||
}
|
||||
|
||||
|
||||
public async Task ClearAllAsync(string userId)
|
||||
{
|
||||
await _stateService.SetOrganizationsAsync(null, new StorageOptions { UserId = userId });
|
||||
|
||||
@@ -477,7 +477,6 @@ namespace Bit.Core.Services
|
||||
}
|
||||
var newHistory = await EncryptHistoryAsync(currentHistory);
|
||||
token.ThrowIfCancellationRequested();
|
||||
var userId = await _stateService.GetActiveUserIdAsync();
|
||||
await _stateService.SetEncryptedPasswordGenerationHistoryAsync(newHistory);
|
||||
}
|
||||
|
||||
|
||||
@@ -1468,8 +1468,8 @@ namespace Bit.Core.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
var vaultTimeService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
|
||||
if (await vaultTimeService.IsLockedAsync(accountView.UserId))
|
||||
// var vaultTimeService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
|
||||
// if (await vaultTimeService.IsLockedAsync(accountView.UserId))
|
||||
// {
|
||||
// var action = await GetVaultTimeoutActionAsync(new StorageOptions { UserId = accountView.UserId });
|
||||
// if (action == "logOut")
|
||||
|
||||
Reference in New Issue
Block a user