feat(mobile): quota (#6409)

* feat(mobile): quota

* openapi

* user entity update

* Render quota

* refresh usage upon opening the app bar

* stop backup when quota exceed
This commit is contained in:
Alex 2024-01-16 20:08:31 -06:00 committed by GitHub
parent abce82e235
commit 78de4f1312
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 386 additions and 76 deletions

View file

@ -363,6 +363,7 @@ class BackupService {
} else {
var data = await response.stream.bytesToString();
var error = jsonDecode(data);
var errorMessage = error['message'] ?? error['error'];
debugPrint(
"Error(${error['statusCode']}) uploading ${entity.id} | $originalFileName | Created on ${entity.createDateTime} | ${error['error']}",
@ -375,9 +376,14 @@ class BackupService {
fileCreatedAt: entity.createDateTime,
fileName: originalFileName,
fileType: _getAssetType(entity.type),
errorMessage: error['error'],
errorMessage: errorMessage,
),
);
if (errorMessage == "Quota has been exceeded!") {
anyErrors = true;
break;
}
continue;
}
}

View file

@ -57,9 +57,9 @@ class FailedBackupStatusPage extends HookConsumerWidget {
ConstrainedBox(
constraints: const BoxConstraints(
minWidth: 100,
minHeight: 150,
minHeight: 100,
maxWidth: 100,
maxHeight: 200,
maxHeight: 150,
),
child: ClipRRect(
borderRadius: const BorderRadius.only(
@ -95,9 +95,10 @@ class FailedBackupStatusPage extends HookConsumerWidget {
).toLocal(),
),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.grey[700],
color: context.isDarkTheme
? Colors.white70
: Colors.grey[800],
),
),
Icon(
@ -115,7 +116,6 @@ class FailedBackupStatusPage extends HookConsumerWidget {
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
color: context.primaryColor,
),
),
@ -123,9 +123,10 @@ class FailedBackupStatusPage extends HookConsumerWidget {
Text(
errorAsset.errorMessage,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Colors.grey[800],
color: context.isDarkTheme
? Colors.white70
: Colors.grey[800],
),
),
],