mirror of
https://github.com/bitwarden/android.git
synced 2024-12-20 16:21:55 +03:00
Moved to default lock of 15 minutes. Removed context options from vault list. Made folder add name selectable.
This commit is contained in:
parent
d5c8ce646a
commit
c44726bd54
5 changed files with 19 additions and 63 deletions
|
@ -35,7 +35,6 @@ namespace Bit.App.Pages
|
||||||
Intent = TableIntent.Settings,
|
Intent = TableIntent.Settings,
|
||||||
EnableScrolling = false,
|
EnableScrolling = false,
|
||||||
HasUnevenRows = true,
|
HasUnevenRows = true,
|
||||||
EnableSelection = false,
|
|
||||||
Root = new TableRoot
|
Root = new TableRoot
|
||||||
{
|
{
|
||||||
new TableSection()
|
new TableSection()
|
||||||
|
@ -94,7 +93,11 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel"));
|
ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
if(!_connectivity.IsConnected)
|
if(!_connectivity.IsConnected)
|
||||||
{
|
{
|
||||||
AlertNoConnection();
|
AlertNoConnection();
|
||||||
|
|
|
@ -107,7 +107,11 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel"));
|
ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
if(!_connectivity.IsConnected)
|
if(!_connectivity.IsConnected)
|
||||||
{
|
{
|
||||||
AlertNoConnection();
|
AlertNoConnection();
|
||||||
|
|
|
@ -205,10 +205,6 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 60);
|
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 60);
|
||||||
}
|
}
|
||||||
else if(selection == "5 minutes")
|
|
||||||
{
|
|
||||||
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 60 * 5);
|
|
||||||
}
|
|
||||||
else if(selection == "15 minutes")
|
else if(selection == "15 minutes")
|
||||||
{
|
{
|
||||||
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 60 * 15);
|
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 60 * 15);
|
||||||
|
@ -223,7 +219,7 @@ namespace Bit.App.Pages
|
||||||
}
|
}
|
||||||
else if(selection == "Never")
|
else if(selection == "Never")
|
||||||
{
|
{
|
||||||
_settings.Remove(Constants.SettingLockSeconds);
|
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
LockOptionsCell.Detail = selection;
|
LockOptionsCell.Detail = selection;
|
||||||
|
@ -349,29 +345,24 @@ namespace Bit.App.Pages
|
||||||
|
|
||||||
private string GetLockOptionsDetailsText()
|
private string GetLockOptionsDetailsText()
|
||||||
{
|
{
|
||||||
var lockSeconds = _settings.GetValueOrDefault<int?>(Constants.SettingLockSeconds);
|
var lockSeconds = _settings.GetValueOrDefault(Constants.SettingLockSeconds, 60 * 15);
|
||||||
if(!lockSeconds.HasValue)
|
if(lockSeconds == -1)
|
||||||
{
|
{
|
||||||
return "Never";
|
return "Never";
|
||||||
}
|
}
|
||||||
|
else if(lockSeconds == 60)
|
||||||
if(lockSeconds.Value == 60)
|
|
||||||
{
|
{
|
||||||
return "1 minute";
|
return "1 minute";
|
||||||
}
|
}
|
||||||
else if(lockSeconds.Value == 60 * 5)
|
else if(lockSeconds == 60 * 15)
|
||||||
{
|
|
||||||
return "5 minutes";
|
|
||||||
}
|
|
||||||
else if(lockSeconds.Value == 60 * 15)
|
|
||||||
{
|
{
|
||||||
return "15 minutes";
|
return "15 minutes";
|
||||||
}
|
}
|
||||||
else if(lockSeconds.Value == 60 * 60)
|
else if(lockSeconds == 60 * 60)
|
||||||
{
|
{
|
||||||
return "1 hour";
|
return "1 hour";
|
||||||
}
|
}
|
||||||
else if(lockSeconds.Value == 60 * 60 * 4)
|
else if(lockSeconds == 60 * 60 * 4)
|
||||||
{
|
{
|
||||||
return "4 hours";
|
return "4 hours";
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,30 +282,6 @@ namespace Bit.App.Pages
|
||||||
_userDialogs.Toast(string.Format(AppResources.ValueHasBeenCopied, alertLabel));
|
_userDialogs.Toast(string.Format(AppResources.ValueHasBeenCopied, alertLabel));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void DeleteClickedAsync(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if(!await _userDialogs.ConfirmAsync(AppResources.DoYouReallyWantToDelete, null, AppResources.Yes, AppResources.No))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var mi = sender as MenuItem;
|
|
||||||
var site = mi.CommandParameter as VaultListPageModel.Site;
|
|
||||||
var deleteCall = await _siteService.DeleteAsync(site.Id);
|
|
||||||
|
|
||||||
if(deleteCall.Succeeded)
|
|
||||||
{
|
|
||||||
var folder = PresentationFolders.Single(f => f.Id == site.FolderId);
|
|
||||||
var siteIndex = folder.Select((s, i) => new { s, i }).First(s => s.s.Id == site.Id).i;
|
|
||||||
folder.RemoveAt(siteIndex);
|
|
||||||
_userDialogs.Toast(AppResources.SiteDeleted);
|
|
||||||
}
|
|
||||||
else if(deleteCall.Errors.Count() > 0)
|
|
||||||
{
|
|
||||||
await DisplayAlert(AppResources.AnErrorHasOccurred, deleteCall.Errors.First().Message, AppResources.Ok);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AddSiteToolBarItem : ToolbarItem
|
private class AddSiteToolBarItem : ToolbarItem
|
||||||
{
|
{
|
||||||
private readonly VaultListSitesPage _page;
|
private readonly VaultListSitesPage _page;
|
||||||
|
@ -336,21 +312,10 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
_page = page;
|
_page = page;
|
||||||
|
|
||||||
var deleteAction = new MenuItem { Text = AppResources.Delete, IsDestructive = true };
|
|
||||||
deleteAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
|
|
||||||
deleteAction.Clicked += page.DeleteClickedAsync;
|
|
||||||
|
|
||||||
var moreAction = new MenuItem { Text = AppResources.More };
|
|
||||||
moreAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
|
|
||||||
moreAction.Clicked += MoreAction_Clicked;
|
|
||||||
|
|
||||||
SetBinding(SiteParameterProperty, new Binding("."));
|
SetBinding(SiteParameterProperty, new Binding("."));
|
||||||
Label.SetBinding<VaultListPageModel.Site>(Label.TextProperty, s => s.Name);
|
Label.SetBinding<VaultListPageModel.Site>(Label.TextProperty, s => s.Name);
|
||||||
Detail.SetBinding<VaultListPageModel.Site>(Label.TextProperty, s => s.Username);
|
Detail.SetBinding<VaultListPageModel.Site>(Label.TextProperty, s => s.Username);
|
||||||
|
|
||||||
ContextActions.Add(deleteAction);
|
|
||||||
ContextActions.Add(moreAction);
|
|
||||||
|
|
||||||
Button.Image = "more";
|
Button.Image = "more";
|
||||||
Button.Command = new Command(() => ShowMore());
|
Button.Command = new Command(() => ShowMore());
|
||||||
Button.BackgroundColor = Color.Transparent;
|
Button.BackgroundColor = Color.Transparent;
|
||||||
|
@ -364,13 +329,6 @@ namespace Bit.App.Pages
|
||||||
set { SetValue(SiteParameterProperty, value); }
|
set { SetValue(SiteParameterProperty, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoreAction_Clicked(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var menuItem = sender as MenuItem;
|
|
||||||
var site = menuItem.CommandParameter as VaultListPageModel.Site;
|
|
||||||
_page.MoreClickedAsync(site);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShowMore()
|
private void ShowMore()
|
||||||
{
|
{
|
||||||
_page.MoreClickedAsync(SiteParameter);
|
_page.MoreClickedAsync(SiteParameter);
|
||||||
|
|
|
@ -33,9 +33,9 @@ namespace Bit.App.Services
|
||||||
// Are we forcing a lock? (i.e. clicking a button to lock the app manually, immediately)
|
// Are we forcing a lock? (i.e. clicking a button to lock the app manually, immediately)
|
||||||
if(!forceLock && !_settings.GetValueOrDefault(Constants.SettingLocked, false))
|
if(!forceLock && !_settings.GetValueOrDefault(Constants.SettingLocked, false))
|
||||||
{
|
{
|
||||||
// Lock seconds tells if if they want to lock the app or not
|
// Lock seconds tells if they want to lock the app or not
|
||||||
var lockSeconds = _settings.GetValueOrDefault<int?>(Constants.SettingLockSeconds);
|
var lockSeconds = _settings.GetValueOrDefault(Constants.SettingLockSeconds, 60 * 15);
|
||||||
if(!lockSeconds.HasValue)
|
if(lockSeconds == -1)
|
||||||
{
|
{
|
||||||
return LockType.None;
|
return LockType.None;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ namespace Bit.App.Services
|
||||||
// Has it been longer than lockSeconds since the last time the app was backgrounded?
|
// Has it been longer than lockSeconds since the last time the app was backgrounded?
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
var lastBackground = _settings.GetValueOrDefault(Constants.SettingLastBackgroundedDate, now.AddYears(-1));
|
var lastBackground = _settings.GetValueOrDefault(Constants.SettingLastBackgroundedDate, now.AddYears(-1));
|
||||||
if((now - lastBackground).TotalSeconds < lockSeconds.Value)
|
if((now - lastBackground).TotalSeconds < lockSeconds)
|
||||||
{
|
{
|
||||||
return LockType.None;
|
return LockType.None;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue