mirror of
https://github.com/bitwarden/mobile
synced 2025-12-11 13:53:29 +00:00
more do once checks
This commit is contained in:
@@ -11,6 +11,18 @@ namespace Bit.App.Pages
|
||||
|
||||
public DateTime? LastPageAction { get; set; }
|
||||
|
||||
public bool DoOnce(Action action = null, int milliseconds = 1000)
|
||||
{
|
||||
if(LastPageAction.HasValue && (DateTime.UtcNow - LastPageAction.Value).TotalMilliseconds < milliseconds)
|
||||
{
|
||||
// Last action occurred recently.
|
||||
return false;
|
||||
}
|
||||
LastPageAction = DateTime.UtcNow;
|
||||
action?.Invoke();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void SetActivityIndicator()
|
||||
{
|
||||
Content = new ActivityIndicator
|
||||
@@ -56,17 +68,5 @@ namespace Bit.App.Pages
|
||||
Device.BeginInvokeOnMainThread(() => input.Focus());
|
||||
});
|
||||
}
|
||||
|
||||
protected bool DoOnce(Action action = null, int milliseconds = 1000)
|
||||
{
|
||||
if(LastPageAction.HasValue && (DateTime.UtcNow - LastPageAction.Value).TotalMilliseconds < milliseconds)
|
||||
{
|
||||
// Last action occurred recently.
|
||||
return false;
|
||||
}
|
||||
LastPageAction = DateTime.UtcNow;
|
||||
action?.Invoke();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user