mirror of
https://github.com/bitwarden/mobile.git
synced 2024-09-10 01:08:23 +02:00
stop timer when page disappears. autofocus camera.
This commit is contained in:
parent
dbdc660464
commit
679859fb37
@ -11,6 +11,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
private readonly ZXingScannerView _zxing;
|
||||
private readonly OverlayGrid _overlay;
|
||||
private bool _pageDisappeared = true;
|
||||
|
||||
public ScanPage(Action<string> callback)
|
||||
: base(updateActivity: false)
|
||||
@ -78,12 +79,24 @@ namespace Bit.App.Pages
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
_pageDisappeared = false;
|
||||
base.OnAppearing();
|
||||
_zxing.IsScanning = true;
|
||||
Device.StartTimer(new TimeSpan(0, 0, 2), () =>
|
||||
{
|
||||
if(_pageDisappeared)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_zxing.AutoFocus();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnDisappearing()
|
||||
{
|
||||
_pageDisappeared = true;
|
||||
_zxing.IsScanning = false;
|
||||
base.OnDisappearing();
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
private readonly IGoogleAnalyticsService _googleAnalyticsService;
|
||||
private readonly IAppInfoService _appInfoService;
|
||||
private bool _pageDisappeared = false;
|
||||
|
||||
public ToolsAutofillServicePage()
|
||||
{
|
||||
@ -170,6 +171,11 @@ namespace Bit.App.Pages
|
||||
UpdateEnabled();
|
||||
Device.StartTimer(new TimeSpan(0, 0, 3), () =>
|
||||
{
|
||||
if(_pageDisappeared)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UpdateEnabled();
|
||||
return true;
|
||||
});
|
||||
@ -178,6 +184,18 @@ namespace Bit.App.Pages
|
||||
Content = ScrollView;
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
_pageDisappeared = false;
|
||||
base.OnAppearing();
|
||||
}
|
||||
|
||||
protected override void OnDisappearing()
|
||||
{
|
||||
_pageDisappeared = true;
|
||||
base.OnDisappearing();
|
||||
}
|
||||
|
||||
private void UpdateEnabled()
|
||||
{
|
||||
ScrollView.Content = _appInfoService.AutofillServiceEnabled ? EnabledStackLayout : DisabledStackLayout;
|
||||
|
@ -21,6 +21,7 @@ namespace Bit.App.Pages
|
||||
private readonly IUserDialogs _userDialogs;
|
||||
private readonly IDeviceActionService _deviceActionService;
|
||||
private readonly ITokenService _tokenService;
|
||||
private bool _pageDisappeared = true;
|
||||
|
||||
public VaultViewLoginPage(string loginId)
|
||||
{
|
||||
@ -153,6 +154,7 @@ namespace Bit.App.Pages
|
||||
|
||||
protected async override void OnAppearing()
|
||||
{
|
||||
_pageDisappeared = false;
|
||||
NotesCell.Tapped += NotesCell_Tapped;
|
||||
EditItem.InitEvents();
|
||||
|
||||
@ -217,6 +219,11 @@ namespace Bit.App.Pages
|
||||
TotpTick(totpKey);
|
||||
Device.StartTimer(new TimeSpan(0, 0, 1), () =>
|
||||
{
|
||||
if(_pageDisappeared)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TotpTick(totpKey);
|
||||
return true;
|
||||
});
|
||||
@ -253,6 +260,7 @@ namespace Bit.App.Pages
|
||||
|
||||
protected override void OnDisappearing()
|
||||
{
|
||||
_pageDisappeared = true;
|
||||
NotesCell.Tapped -= NotesCell_Tapped;
|
||||
EditItem.Dispose();
|
||||
CleanupAttachmentCells();
|
||||
|
Loading…
Reference in New Issue
Block a user