Skip to content

armgit / ente

Public Imported from GitHub
0

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

[auth] add parameter to store details for custom icons

Aman Raj16e8aa380308
diff --git a/auth/lib/models/code_display.dart b/auth/lib/models/code_display.dart
index 71b74c68f5..451e48f815 100644
--- a/auth/lib/models/code_display.dart
+++ b/auth/lib/models/code_display.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
+import 'package:ente_auth/ui/utils/icon_utils.dart';
import 'package:flutter/foundation.dart';
import 'package:logging/logging.dart';
@@ -12,6 +13,9 @@ class CodeDisplay {
String note;
final List<String> tags;
int position;
+ String customIconData;
+ bool isCustomIcon;
+ IconType iconType;
CodeDisplay({
this.pinned = false,
@@ -21,6 +25,9 @@ class CodeDisplay {
this.tags = const [],
this.note = '',
this.position = 0,
+ this.customIconData = 'ente',
+ this.isCustomIcon = false,
+ this.iconType = IconType.simpleIcon,
});
// copyWith
@@ -32,6 +39,9 @@ class CodeDisplay {
List<String>? tags,
String? note,
int? position,
+ String? customIconData,
+ IconType? iconType,
+ bool? isCustomIcon,
}) {
final bool updatedPinned = pinned ?? this.pinned;
final bool updatedTrashed = trashed ?? this.trashed;
@@ -40,6 +50,9 @@ class CodeDisplay {
final List<String> updatedTags = tags ?? this.tags;
final String updatedNote = note ?? this.note;
final int updatedPosition = position ?? this.position;
+ final String updatedIconData = customIconData ?? this.customIconData;
+ final bool updatedIsCustomIcon = isCustomIcon ?? this.isCustomIcon;
+ final IconType updatedIconType = iconType ?? this.iconType;
return CodeDisplay(
pinned: updatedPinned,
@@ -49,6 +62,9 @@ class CodeDisplay {
tags: updatedTags,
note: updatedNote,
position: updatedPosition,
+ customIconData: updatedIconData,
+ isCustomIcon: updatedIsCustomIcon,
+ iconType: updatedIconType,
);
}
@@ -64,6 +80,11 @@ class CodeDisplay {
tags: List<String>.from(json['tags'] ?? []),
note: json['note'] ?? '',
position: json['position'] ?? 0,
+ customIconData: json['customIconData'] ?? 'ente',
+ isCustomIcon: json['isCustomIcon'] ?? false,
+ iconType: json['iconType'] == 'simpleIcon'
+ ? IconType.simpleIcon
+ : IconType.customIcon,
);
}
@@ -106,6 +127,9 @@ class CodeDisplay {
'tags': tags,
'note': note,
'position': position,
+ 'customIconData': customIconData,
+ 'isCustomIcon': isCustomIcon,
+ 'iconType': iconType == IconType.simpleIcon ? 'simpleIcon' : 'customIcon',
};
}