diff --git a/contact/pubspec.lock b/contact/pubspec.lock index 5689f4367..69757c387 100644 --- a/contact/pubspec.lock +++ b/contact/pubspec.lock @@ -612,7 +612,7 @@ packages: description: path: "." ref: sprint26_5aug - resolved-ref: "8dfee5c0386d3848e60673430ca7cb389fa61a54" + resolved-ref: "204c97eaa69c73af2d7740bff18ba4308fe8693f" url: "https://github.com/linagora/jmap-dart-client.git" source: git version: "0.1.0" diff --git a/email_recovery/pubspec.lock b/email_recovery/pubspec.lock index 97ad6de13..a9a85f3e8 100644 --- a/email_recovery/pubspec.lock +++ b/email_recovery/pubspec.lock @@ -296,7 +296,7 @@ packages: description: path: "." ref: sprint26_5aug - resolved-ref: "8dfee5c0386d3848e60673430ca7cb389fa61a54" + resolved-ref: "204c97eaa69c73af2d7740bff18ba4308fe8693f" url: "https://github.com/linagora/jmap-dart-client.git" source: git version: "0.1.0" diff --git a/fcm/pubspec.lock b/fcm/pubspec.lock index a0656a106..8e307fcd4 100644 --- a/fcm/pubspec.lock +++ b/fcm/pubspec.lock @@ -296,7 +296,7 @@ packages: description: path: "." ref: sprint26_5aug - resolved-ref: "8dfee5c0386d3848e60673430ca7cb389fa61a54" + resolved-ref: "204c97eaa69c73af2d7740bff18ba4308fe8693f" url: "https://github.com/linagora/jmap-dart-client.git" source: git version: "0.1.0" diff --git a/forward/pubspec.lock b/forward/pubspec.lock index a0656a106..8e307fcd4 100644 --- a/forward/pubspec.lock +++ b/forward/pubspec.lock @@ -296,7 +296,7 @@ packages: description: path: "." ref: sprint26_5aug - resolved-ref: "8dfee5c0386d3848e60673430ca7cb389fa61a54" + resolved-ref: "204c97eaa69c73af2d7740bff18ba4308fe8693f" url: "https://github.com/linagora/jmap-dart-client.git" source: git version: "0.1.0" diff --git a/lib/features/public_asset/data/network/public_asset_api.dart b/lib/features/public_asset/data/network/public_asset_api.dart index 3e0e0dff4..49932ee0e 100644 --- a/lib/features/public_asset/data/network/public_asset_api.dart +++ b/lib/features/public_asset/data/network/public_asset_api.dart @@ -1,6 +1,7 @@ import 'package:jmap_dart_client/http/converter/identities/public_asset_identities_converter.dart'; import 'package:jmap_dart_client/http/http_client.dart'; import 'package:jmap_dart_client/jmap/account_id.dart'; +import 'package:jmap_dart_client/jmap/core/error/method/error_method_response.dart'; import 'package:jmap_dart_client/jmap/core/id.dart'; import 'package:jmap_dart_client/jmap/core/patch_object.dart'; import 'package:jmap_dart_client/jmap/core/session/session.dart'; @@ -88,15 +89,22 @@ class PublicAssetApi { .build() .execute(); final publicAsset = response.parse( - invocation.methodCallId, - SetPublicAssetResponse.deserialize + invocation.methodCallId, + SetPublicAssetResponse.deserialize )?.created?[generateCreateId]; - if (publicAsset == null) { - throw const CannotCreatePublicAssetException(); + final notCreatedError = response.parse( + invocation.methodCallId, + SetPublicAssetResponse.deserialize + )?.notCreated?[generateCreateId]; + + if (notCreatedError == null && publicAsset != null) return publicAsset; + + if (notCreatedError?.type == ErrorMethodResponse.overQuota) { + throw PublicAssetQuotaExceededException(message: notCreatedError?.description); } - return publicAsset; + throw const CannotCreatePublicAssetException(); } Future destroyPublicAssets( diff --git a/lib/features/public_asset/domain/exceptions/public_asset_exceptions.dart b/lib/features/public_asset/domain/exceptions/public_asset_exceptions.dart index 66302c268..ee3b40398 100644 --- a/lib/features/public_asset/domain/exceptions/public_asset_exceptions.dart +++ b/lib/features/public_asset/domain/exceptions/public_asset_exceptions.dart @@ -2,6 +2,12 @@ class CannotCreatePublicAssetException implements Exception { const CannotCreatePublicAssetException(); } +class PublicAssetQuotaExceededException implements Exception { + const PublicAssetQuotaExceededException({required this.message}); + + final String? message; +} + class CannotDestroyPublicAssetException implements Exception { const CannotDestroyPublicAssetException(); } diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb index 58cd43349..506a1fa08 100644 --- a/lib/l10n/intl_messages.arb +++ b/lib/l10n/intl_messages.arb @@ -2920,7 +2920,7 @@ "placeholders_order": [], "placeholders": {} }, - "pleaseChooseAnImageSizeCorrectly": "Please choose an image size <= {maxSize}KB", + "pleaseChooseAnImageSizeCorrectly": "Please choose an image with size less than {maxSize}KB", "@pleaseChooseAnImageSizeCorrectly": { "type": "text", "placeholders_order": [ @@ -3988,6 +3988,12 @@ "placeholders_order": [], "placeholders": {} }, + "generalSignatureImageUploadError": "There was an error while uploading the image. Please try again.", + "@generalSignatureImageUploadError": { + "type": "text", + "placeholders_order": [], + "placeholders": {} + }, "thisImageCannotBePastedIntoTheEditor": "This image cannot be pasted into the editor.", "@thisImageCannotBePastedIntoTheEditor": { "type": "text", diff --git a/lib/main/localizations/app_localizations.dart b/lib/main/localizations/app_localizations.dart index b6e33b7d6..ca07acc9a 100644 --- a/lib/main/localizations/app_localizations.dart +++ b/lib/main/localizations/app_localizations.dart @@ -3026,7 +3026,7 @@ class AppLocalizations { String pleaseChooseAnImageSizeCorrectly(int maxSize) { return Intl.message( - 'Please choose an image size <= ${maxSize}KB', + 'Please choose an image with size less than ${maxSize}KB', name: 'pleaseChooseAnImageSizeCorrectly', args: [maxSize]); } @@ -4177,6 +4177,12 @@ class AppLocalizations { ); } + String get generalSignatureImageUploadError { + return Intl.message( + 'There was an error while uploading the image. Please try again.', + name: 'generalSignatureImageUploadError'); + } + String get thisImageCannotBePastedIntoTheEditor { return Intl.message( 'This image cannot be pasted into the editor.', diff --git a/model/pubspec.lock b/model/pubspec.lock index 3ea94b3af..22ad6452f 100644 --- a/model/pubspec.lock +++ b/model/pubspec.lock @@ -604,7 +604,7 @@ packages: description: path: "." ref: sprint26_5aug - resolved-ref: "8dfee5c0386d3848e60673430ca7cb389fa61a54" + resolved-ref: "204c97eaa69c73af2d7740bff18ba4308fe8693f" url: "https://github.com/linagora/jmap-dart-client.git" source: git version: "0.1.0" diff --git a/pubspec.lock b/pubspec.lock index 9de4740f4..62e44f5b0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1196,7 +1196,7 @@ packages: description: path: "." ref: sprint26_5aug - resolved-ref: "8dfee5c0386d3848e60673430ca7cb389fa61a54" + resolved-ref: "204c97eaa69c73af2d7740bff18ba4308fe8693f" url: "https://github.com/linagora/jmap-dart-client.git" source: git version: "0.1.0" diff --git a/rule_filter/pubspec.lock b/rule_filter/pubspec.lock index a0656a106..8e307fcd4 100644 --- a/rule_filter/pubspec.lock +++ b/rule_filter/pubspec.lock @@ -296,7 +296,7 @@ packages: description: path: "." ref: sprint26_5aug - resolved-ref: "8dfee5c0386d3848e60673430ca7cb389fa61a54" + resolved-ref: "204c97eaa69c73af2d7740bff18ba4308fe8693f" url: "https://github.com/linagora/jmap-dart-client.git" source: git version: "0.1.0"