diff --git a/mobile/lib/infrastructure/repositories/store.repository.dart b/mobile/lib/infrastructure/repositories/store.repository.dart index 0050eb9911..920863ecf8 100644 --- a/mobile/lib/infrastructure/repositories/store.repository.dart +++ b/mobile/lib/infrastructure/repositories/store.repository.dart @@ -1,5 +1,4 @@ import 'dart:convert'; - import 'package:drift/drift.dart'; import 'package:immich_mobile/domain/models/store.model.dart'; import 'package:immich_mobile/domain/models/user.model.dart'; @@ -87,7 +86,11 @@ class IsarStoreRepository extends IsarDatabaseRepository implements IStoreReposi const (DateTime) => entity.intValue == null ? null : DateTime.fromMillisecondsSinceEpoch(entity.intValue!), const (UserDto) => entity.strValue == null ? null : await IsarUserRepository(_db).getByUserId(entity.strValue!), - const (List) => jsonDecode(entity.strValue ?? '[]') as T, + const (List) => + (jsonDecode(entity.strValue ?? '[]') as List) + .map((d) => ActionButtonType.values.byName(d)) + .toList() + as T, _ => null, } as T?; @@ -179,7 +182,11 @@ class DriftStoreRepository extends DriftDatabaseRepository implements IStoreRepo const (DateTime) => entity.intValue == null ? null : DateTime.fromMillisecondsSinceEpoch(entity.intValue!), const (UserDto) => entity.stringValue == null ? null : await DriftAuthUserRepository(_db).get(entity.stringValue!), - const (List) => jsonDecode(entity.stringValue ?? '[]') as T, + const (List) => + (jsonDecode(entity.stringValue ?? '[]') as List) + .map((d) => ActionButtonType.values.byName(d)) + .toList() + as T, _ => null, } as T?; diff --git a/mobile/lib/utils/action_button.utils.dart b/mobile/lib/utils/action_button.utils.dart index b10dc7542b..40ae0e4157 100644 --- a/mobile/lib/utils/action_button.utils.dart +++ b/mobile/lib/utils/action_button.utils.dart @@ -67,7 +67,7 @@ enum ActionButtonType { unstack, likeActivity; - dynamic toJson() => name; + String toJson() => name; bool shouldShow(ActionButtonContext context) { return switch (this) {