mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-23 16:27:51 +01:00
log user activity
This commit is contained in:
parent
3eb1ab0452
commit
84c9516659
@ -1,4 +1,7 @@
|
|||||||
using System;
|
using Bit.Core;
|
||||||
|
using Bit.Core.Abstractions;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
@ -6,11 +9,25 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
public class BaseContentPage : ContentPage
|
public class BaseContentPage : ContentPage
|
||||||
{
|
{
|
||||||
|
private IStorageService _storageService;
|
||||||
|
|
||||||
protected int AndroidShowModalAnimationDelay = 400;
|
protected int AndroidShowModalAnimationDelay = 400;
|
||||||
protected int AndroidShowPageAnimationDelay = 100;
|
protected int AndroidShowPageAnimationDelay = 100;
|
||||||
|
|
||||||
public DateTime? LastPageAction { get; set; }
|
public DateTime? LastPageAction { get; set; }
|
||||||
|
|
||||||
|
protected override void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
SaveActivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDisappearing()
|
||||||
|
{
|
||||||
|
base.OnDisappearing();
|
||||||
|
SaveActivity();
|
||||||
|
}
|
||||||
|
|
||||||
public bool DoOnce(Action action = null, int milliseconds = 1000)
|
public bool DoOnce(Action action = null, int milliseconds = 1000)
|
||||||
{
|
{
|
||||||
if(LastPageAction.HasValue && (DateTime.UtcNow - LastPageAction.Value).TotalMilliseconds < milliseconds)
|
if(LastPageAction.HasValue && (DateTime.UtcNow - LastPageAction.Value).TotalMilliseconds < milliseconds)
|
||||||
@ -84,5 +101,19 @@ namespace Bit.App.Pages
|
|||||||
Device.BeginInvokeOnMainThread(() => input.Focus());
|
Device.BeginInvokeOnMainThread(() => input.Focus());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetStorageService()
|
||||||
|
{
|
||||||
|
if(_storageService == null)
|
||||||
|
{
|
||||||
|
_storageService = ServiceContainer.Resolve<IStorageService>("storageService");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveActivity()
|
||||||
|
{
|
||||||
|
SetStorageService();
|
||||||
|
_storageService.SaveAsync(Constants.LastActiveKey, DateTime.UtcNow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user