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