feat(mobile): configurable background backup delay (#1068)

let's the user configure how much to delay the trigger for running the backup whenever assets are changed on the device
This commit is contained in:
Fynn Petersen-Frey 2022-12-08 16:51:36 +01:00 committed by GitHub
parent a97b761eda
commit c23b2479f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 122 additions and 12 deletions

View file

@ -86,6 +86,8 @@ class BackgroundService {
Future<bool> configureService({
bool requireUnmetered = true,
bool requireCharging = false,
int triggerUpdateDelay = 5000,
int triggerMaxDelay = 50000,
}) async {
if (!Platform.isAndroid) {
return true;
@ -93,7 +95,12 @@ class BackgroundService {
try {
final bool ok = await _foregroundChannel.invokeMethod(
'configure',
[requireUnmetered, requireCharging],
[
requireUnmetered,
requireCharging,
triggerUpdateDelay,
triggerMaxDelay
],
);
return ok;
} catch (error) {