π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix: sort codes correctly based on pinning status
Prateek Sunal5cc25c6ef794
diff --git a/auth/lib/l10n/arb/app_en.arb b/auth/lib/l10n/arb/app_en.arbindex c7c8cac068..c0894a5477 100644--- a/auth/lib/l10n/arb/app_en.arb+++ b/auth/lib/l10n/arb/app_en.arb@@ -423,5 +423,6 @@"invalidEndpointMessage": "Sorry, the endpoint you entered is invalid. Please enter a valid endpoint and try again.","endpointUpdatedMessage": "Endpoint updated successfully","customEndpoint": "Connected to {endpoint}",- "pinText": "Pin"+ "pinText": "Pin",+ "unpinText": "Unpin"}\ No newline at end of filediff --git a/auth/lib/models/code.dart b/auth/lib/models/code.dartindex 2610b62da3..6abbb61ea2 100644--- a/auth/lib/models/code.dart+++ b/auth/lib/models/code.dart@@ -105,6 +105,7 @@ class Code {_getType(uri),_getCounter(uri),rawData,+ display: display,);} catch (e) {// if account name contains # without encoding,@@ -150,7 +151,7 @@ class Code {Map<String, dynamic> toExportJson() {return {'rawData': rawData,- 'display': display?.toJson(),+ if (display != null) 'display': display?.toJson(),};}@@ -236,7 +237,8 @@ class Code {other.secret == secret &&other.counter == counter &&other.type == type &&- other.rawData == rawData;+ other.rawData == rawData &&+ other.display == display;}@override@@ -251,6 +253,11 @@ class Code {rawData.hashCode ^display.hashCode;}++ @override+ String toString() {+ return 'Code(account: $account, issuer: $issuer, digits: $digits, period: $period, secret: $secret, algorithm: $algorithm, type: $type, counter: $counter, rawData: $rawData, display: $display)';+ }}enum Type {diff --git a/auth/lib/ui/code_widget.dart b/auth/lib/ui/code_widget.dartindex b1a6a3f052..ad4f134569 100644--- a/auth/lib/ui/code_widget.dart+++ b/auth/lib/ui/code_widget.dart@@ -99,7 +99,7 @@ class _CodeWidgetState extends State<CodeWidget> {onSelected: () => _onShowQrPressed(null),),MenuItem(- label: l10n.pinText,+ label: widget.code.isPinned ? l10n.unpinText : l10n.pinText,icon: widget.code.isPinned? Icons.push_pin: Icons.push_pin_outlined,@@ -156,7 +156,7 @@ class _CodeWidgetState extends State<CodeWidget> {icon: widget.code.isPinned? Icons.push_pin: Icons.push_pin_outlined,- label: l10n.pinText,+ label: widget.code.isPinned ? l10n.unpinText : l10n.pinText,padding: const EdgeInsets.only(left: 4, right: 0),spacing: 8,),@@ -202,7 +202,16 @@ class _CodeWidgetState extends State<CodeWidget> {return ClipRRect(borderRadius: BorderRadius.circular(8),child: Container(- color: Theme.of(context).colorScheme.codeCardBackgroundColor,+ decoration: BoxDecoration(+ color: Theme.of(context).colorScheme.codeCardBackgroundColor,+ boxShadow: [+ BoxShadow(+ color: Theme.of(context).colorScheme.shadow,+ blurRadius: 8,+ offset: const Offset(0, 4),+ ),+ ],+ ),child: Material(color: Colors.transparent,child: InkWell(@@ -233,34 +242,47 @@ class _CodeWidgetState extends State<CodeWidget> {Widget _getCardContents(AppLocalizations l10n) {return SizedBox(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- mainAxisAlignment: MainAxisAlignment.center,+ child: Stack(children: [- if (widget.code.type == Type.totp)- CodeTimerProgress(- period: widget.code.period,- ),- const SizedBox(- height: 16,- ),- Row(+ Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisAlignment: MainAxisAlignment.center,children: [- _shouldShowLargeIcon ? _getIcon() : const SizedBox.shrink(),- Expanded(- child: Column(- children: [- _getTopRow(),- const SizedBox(height: 4),- _getBottomRow(l10n),- ],+ if (widget.code.type == Type.totp)+ CodeTimerProgress(+ period: widget.code.period,),+ const SizedBox(+ height: 16,+ ),+ Row(+ children: [+ _shouldShowLargeIcon ? _getIcon() : const SizedBox.shrink(),+ Expanded(+ child: Column(+ children: [+ _getTopRow(),+ const SizedBox(height: 4),+ _getBottomRow(l10n),+ ],+ ),+ ),+ ],+ ),+ const SizedBox(+ height: 20,),],),- const SizedBox(- height: 20,- ),+ if (widget.code.isPinned)+ const Positioned(+ right: 4,+ top: 4,+ child: Icon(+ Icons.push_pin,+ size: 12,+ ),+ ),],),);