Skip to content

Commit

Permalink
[auth] minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanRajSinghMourya committed Dec 17, 2024
1 parent 277d7fa commit 8fc9ff0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion auth/lib/models/code_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CodeDisplay {
this.tags = const [],
this.note = '',
this.position = 0,
this.iconSrc = 'ente',
this.iconSrc = '',
this.iconID = '',
});

Expand Down
28 changes: 14 additions & 14 deletions auth/lib/onboarding/view/setup_enter_secret_key_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
Expand All @@ -430,8 +430,8 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
),
);
setState(() {
_customIconSrc = newCustomIcon.title;
_iconID = newCustomIcon.type;
_customIconID = newCustomIcon.title;
_iconSrc = newCustomIcon.type;
});
}
}
2 changes: 1 addition & 1 deletion auth/lib/ui/code_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8fc9ff0

Please sign in to comment.