Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[auth] minor fix

Aman Raj8fc9ff0d9ff4
diff --git a/auth/lib/models/code_display.dart b/auth/lib/models/code_display.dart
index 382be73fd2..6b3d6bb1df 100644
--- a/auth/lib/models/code_display.dart
+++ b/auth/lib/models/code_display.dart
@@ -23,7 +23,7 @@ class CodeDisplay {
this.tags = const [],
this.note = '',
this.position = 0,
- this.iconSrc = 'ente',
+ this.iconSrc = '',
this.iconID = '',
});
diff --git a/auth/lib/onboarding/view/setup_enter_secret_key_page.dart b/auth/lib/onboarding/view/setup_enter_secret_key_page.dart
index 17eb59eacc..4857221638 100644
--- a/auth/lib/onboarding/view/setup_enter_secret_key_page.dart
+++ b/auth/lib/onboarding/view/setup_enter_secret_key_page.dart
@@ -47,8 +47,8 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
List<String> allTags = [];
StreamSubscription<CodesUpdatedEvent>? _streamSubscription;
bool isCustomIcon = false;
- String _customIconSrc = "";
- late IconType _iconID;
+ String _customIconID = "";
+ late IconType _iconSrc;
@override
void initState() {
@@ -91,11 +91,13 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
isCustomIcon = widget.code?.display.isCustomIcon ?? false;
if (isCustomIcon) {
- _customIconSrc = widget.code?.display.iconSrc ?? "ente";
+ _customIconID = widget.code?.display.iconID ?? "ente";
} else {
- _customIconSrc = widget.code!.issuer;
+ if (widget.code != null) {
+ _customIconID = widget.code!.issuer;
+ }
}
- _iconID = widget.code?.display.iconID == "simpleIcon"
+ _iconSrc = widget.code?.display.iconSrc == "simpleIcon"
? IconType.simpleIcon
: IconType.customIcon;
@@ -300,9 +302,7 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
),
const SizedBox(height: 32),
if (widget.code != null)
- CustomIconWidget(
- iconData: _customIconSrc,
- ),
+ CustomIconWidget(iconData: _customIconID),
const SizedBox(height: 24),
if (widget.code != null)
GestureDetector(
@@ -357,9 +357,9 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
CodeDisplay(tags: selectedTags);
display.note = notes;
- display.iconSrc = _customIconSrc.toLowerCase();
- display.iconID =
- _iconID == IconType.simpleIcon ? 'simpleIcon' : 'customIcon';
+ display.iconID = _customIconID.toLowerCase();
+ display.iconSrc =
+ _iconSrc == IconType.simpleIcon ? 'simpleIcon' : 'customIcon';
if (widget.code != null && widget.code!.secret != secret) {
ButtonResult? result = await showChoiceActionSheet(
@@ -415,7 +415,7 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
final allIcons = IconUtils.instance.getAllIcons();
String currentIcon;
if (widget.code!.display.isCustomIcon) {
- currentIcon = widget.code!.display.iconSrc;
+ currentIcon = widget.code!.display.iconID;
} else {
currentIcon = widget.code!.issuer;
}
@@ -430,8 +430,8 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
),
);
setState(() {
- _customIconSrc = newCustomIcon.title;
- _iconID = newCustomIcon.type;
+ _customIconID = newCustomIcon.title;
+ _iconSrc = newCustomIcon.type;
});
}
}
diff --git a/auth/lib/ui/code_widget.dart b/auth/lib/ui/code_widget.dart
index 40147003e1..faa4a11a9c 100644
--- a/auth/lib/ui/code_widget.dart
+++ b/auth/lib/ui/code_widget.dart
@@ -444,7 +444,7 @@ class _CodeWidgetState extends State<CodeWidget> {
Widget _getIcon() {
final String iconData;
if (widget.code.display.isCustomIcon) {
- iconData = widget.code.display.iconSrc;
+ iconData = widget.code.display.iconID;
} else {
iconData = widget.code.issuer;
}