mirror of
https://github.com/bitwarden/mobile
synced 2025-12-16 00:03:22 +00:00
[EC-325] Settings option to allow screen capture on Android (#1914)
* settings option to allow screen capture on Android * Improved code on Screen Capture and added prompt to the user to allow screen capture * EC-325 Removed async on OnCreate of MainActivity given that's not necessary anymore Co-authored-by: Federico Maccaroni <fedemkr@gmail.com>
This commit is contained in:
committed by
GitHub
parent
cb0c52fb26
commit
cf222bd0c3
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Abstractions;
|
||||
@@ -558,6 +559,27 @@ namespace Bit.Core.Services
|
||||
await SaveAccountAsync(account, reconciledOptions);
|
||||
}
|
||||
|
||||
public async Task<bool> GetScreenCaptureAllowedAsync(string userId = null)
|
||||
{
|
||||
if (CoreHelpers.ForceScreenCaptureEnabled())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return (await GetAccountAsync(
|
||||
ReconcileOptions(new StorageOptions { UserId = userId }, await GetDefaultStorageOptionsAsync())
|
||||
))?.Settings?.ScreenCaptureAllowed ?? false;
|
||||
}
|
||||
|
||||
public async Task SetScreenCaptureAllowedAsync(bool value, string userId = null)
|
||||
{
|
||||
var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId },
|
||||
await GetDefaultStorageOptionsAsync());
|
||||
var account = await GetAccountAsync(reconciledOptions);
|
||||
account.Settings.ScreenCaptureAllowed = value;
|
||||
await SaveAccountAsync(account, reconciledOptions);
|
||||
}
|
||||
|
||||
public async Task<DateTime?> GetLastFileCacheClearAsync()
|
||||
{
|
||||
var options = await GetDefaultStorageOptionsAsync();
|
||||
@@ -1461,6 +1483,7 @@ namespace Bit.Core.Services
|
||||
var existingAccount = state.Accounts[account.Profile.UserId];
|
||||
account.Settings.VaultTimeout = existingAccount.Settings.VaultTimeout;
|
||||
account.Settings.VaultTimeoutAction = existingAccount.Settings.VaultTimeoutAction;
|
||||
account.Settings.ScreenCaptureAllowed = existingAccount.Settings.ScreenCaptureAllowed;
|
||||
}
|
||||
|
||||
// New account defaults
|
||||
|
||||
Reference in New Issue
Block a user