π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add localization strings for usage card and update user details model for family usage
AmanRajSinghMourya991bc08618c2
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arbindex 3072927d18..63a54fa746 100644--- a/mobile/apps/locker/lib/l10n/app_en.arb+++ b/mobile/apps/locker/lib/l10n/app_en.arb@@ -975,5 +975,9 @@"example": "3"}}- }+ },+ "itemsStored": "Items stored",+ "of_": "of",+ "usageYou": "You",+ "usageFamily": "Family"}diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dartindex 32eedc146b..87880ec1a9 100644--- a/mobile/apps/locker/lib/l10n/app_localizations.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart@@ -2835,6 +2835,30 @@ abstract class AppLocalizations {/// In en, this message translates to:/// **'{count, plural, =1{1 collection deleted successfully} other{{count} collections deleted successfully}}'**String collectionsDeletedSuccessfully(int count);++ /// No description provided for @itemsStored.+ ///+ /// In en, this message translates to:+ /// **'Items stored'**+ String get itemsStored;++ /// No description provided for @of_.+ ///+ /// In en, this message translates to:+ /// **'of'**+ String get of_;++ /// No description provided for @usageYou.+ ///+ /// In en, this message translates to:+ /// **'You'**+ String get usageYou;++ /// No description provided for @usageFamily.+ ///+ /// In en, this message translates to:+ /// **'Family'**+ String get usageFamily;}class _AppLocalizationsDelegatediff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dartindex f47b23f6fe..c0e9e87c6a 100644--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart@@ -1677,4 +1677,16 @@ class AppLocalizationsEn extends AppLocalizations {);return '$_temp0';}++ @override+ String get itemsStored => 'Items stored';++ @override+ String get of_ => 'of';++ @override+ String get usageYou => 'You';++ @override+ String get usageFamily => 'Family';}diff --git a/mobile/apps/locker/lib/ui/components/usage_card_widget.dart b/mobile/apps/locker/lib/ui/components/usage_card_widget.dartindex 0ba8ef02a3..869489f44e 100644--- a/mobile/apps/locker/lib/ui/components/usage_card_widget.dart+++ b/mobile/apps/locker/lib/ui/components/usage_card_widget.dart@@ -107,16 +107,14 @@ class _UsageContent extends StatelessWidget {100;final userFileCount = userDetails?.fileCount ?? 0;- // TODO: Aman enable family breakdown when API provides family file count data.- const showFamilyBreakup = false;-- final familyTotalFileCount =- showFamilyBreakup ? _getFamilyTotalFileCount() : userFileCount;+ final showFamilyBreakup = _shouldShowFamilyBreakup();final userProgress =isLoading ? 0.0 : (userFileCount / maxFileCount).clamp(0.0, 1.0);- final familyProgress =- isLoading ? 0.0 : (familyTotalFileCount / maxFileCount).clamp(0.0, 1.0);+ final familyProgress = showFamilyBreakup && !isLoading+ ? (userDetails!.lockerFamilyUsage!.familyFileCount / maxFileCount)+ .clamp(0.0, 1.0)+ : 0.0;final formattedUsed = NumberFormat().format(userFileCount);final formattedMax = NumberFormat().format(maxFileCount);@@ -252,10 +250,6 @@ class _UsageContent extends StatelessWidget {bool _shouldShowFamilyBreakup() {if (userDetails == null) return false;if (!userDetails!.isPartOfFamily()) return false;- return userDetails!.familyMemberStorageLimit() == null;- }-- int _getFamilyTotalFileCount() {- return userDetails?.fileCount ?? 0;+ return userDetails!.lockerFamilyUsage != null;}}diff --git a/mobile/apps/locker/lib/ui/drawer/security_section_widget.dart b/mobile/apps/locker/lib/ui/drawer/security_section_widget.dartindex 7ac903b9dc..d5e9628860 100644--- a/mobile/apps/locker/lib/ui/drawer/security_section_widget.dart+++ b/mobile/apps/locker/lib/ui/drawer/security_section_widget.dart@@ -20,7 +20,6 @@ import "package:locker/services/configuration.dart";import "package:locker/ui/components/expandable_menu_item_widget.dart";import "package:logging/logging.dart";-class SecuritySectionWidget extends StatefulWidget {const SecuritySectionWidget({super.key});diff --git a/mobile/packages/accounts/lib/models/user_details.dart b/mobile/packages/accounts/lib/models/user_details.dartindex c99f630606..77b82d602e 100644--- a/mobile/packages/accounts/lib/models/user_details.dart+++ b/mobile/packages/accounts/lib/models/user_details.dart@@ -14,6 +14,7 @@ class UserDetails {final FamilyData? familyData;final ProfileData? profileData;final BonusData? bonusData;+ final LockerFamilyUsage? lockerFamilyUsage;const UserDetails(this.email,@@ -25,6 +26,7 @@ class UserDetails {this.familyData,this.profileData,this.bonusData,+ this.lockerFamilyUsage,);// Locker-specific limits computed client-side based on subscription@@ -134,6 +136,7 @@ class UserDetails {FamilyData.fromMap(map['familyData']),ProfileData.fromJson(map['profileData']),BonusData.fromJson(map['bonusData']),+ LockerFamilyUsage.fromJson(map['lockerFamilyUsage']),);}@@ -148,6 +151,7 @@ class UserDetails {'familyData': familyData?.toMap(),'profileData': profileData?.toJson(),'bonusData': bonusData?.toJson(),+ 'lockerFamilyUsage': lockerFamilyUsage?.toJson(),};}@@ -285,3 +289,21 @@ class FamilyData {factory FamilyData.fromJson(String source) =>FamilyData.fromMap(json.decode(source));}++class LockerFamilyUsage {+ final int familyFileCount;++ const LockerFamilyUsage(this.familyFileCount);++ factory LockerFamilyUsage.fromJson(Map<String, dynamic>? json) {+ return LockerFamilyUsage(+ (json?['familyFileCount'] ?? 0) as int,+ );+ }++ Map<String, dynamic> toJson() {+ return {+ 'familyFileCount': familyFileCount,+ };+ }+}