π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Fix Faces on avatar not loading on app start
ashilknb1b70a0d0852
diff --git a/mobile/lib/main.dart b/mobile/lib/main.dartindex f44a3d799f..fd63288c11 100644--- a/mobile/lib/main.dart+++ b/mobile/lib/main.dart@@ -282,11 +282,16 @@ Future<void> _init(bool isBackground, {String via = ''}) async {_logger.info("PushService/HomeWidget done $tlog");unawaited(SemanticSearchService.instance.init());unawaited(MLService.instance.init());- PersonService.init(+ final stopwatch = Stopwatch()..start();+ await PersonService.init(entityService,MLDataDB.instance,preferences,);+ _logger.info(+ "PersonService init took ${stopwatch.elapsedMilliseconds}ms",+ );+ stopwatch.stop();initComplete = true;_logger.info("Initialization done $tlog");} catch (e, s) {diff --git a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart b/mobile/lib/services/machine_learning/face_ml/person/person_service.dartindex 8a13ab893c..59c2011f06 100644--- a/mobile/lib/services/machine_learning/face_ml/person/person_service.dart+++ b/mobile/lib/services/machine_learning/face_ml/person/person_service.dart@@ -37,13 +37,13 @@ class PersonService {late Logger logger = Logger("PersonService");- static init(+ static Future<void> init(EntityService entityService,MLDataDB faceMLDataDB,SharedPreferences prefs,- ) {+ ) async {_instance = PersonService(entityService, faceMLDataDB, prefs);- _instance!._resetEmailToNameCache();+ await _instance!._resetEmailToNameCache();}Map<String, String> get emailToNameMapCache => _emailToNameMapCache;@@ -52,9 +52,9 @@ class PersonService {_emailToNameMapCache.clear();}- void _resetEmailToNameCache() {+ Future<void> _resetEmailToNameCache() async {_emailToNameMapCache.clear();- _instance!.getPersons().then((value) {+ await _instance!.getPersons().then((value) {for (var person in value) {if (person.data.email != null && person.data.email!.isNotEmpty) {_instance!._emailToNameMapCache[person.data.email!] =@@ -66,12 +66,18 @@ class PersonService {}Future<List<PersonEntity>> getPersons() async {+ final stopwatch = Stopwatch()..start();final entities = await entityService.getEntities(EntityType.cgroup);- return entities+ final res = entities.map((e) => PersonEntity(e.id, PersonData.fromJson(json.decode(e.data))),).toList();+ logger.info(+ "Got ${res.length} persons in ${stopwatch.elapsedMilliseconds}ms",+ );+ stopwatch.stop();+ return res;}Future<PersonEntity?> getPerson(String id) {diff --git a/mobile/lib/ui/sharing/user_avator_widget.dart b/mobile/lib/ui/sharing/user_avator_widget.dartindex c9abe72433..366cac15d7 100644--- a/mobile/lib/ui/sharing/user_avator_widget.dart+++ b/mobile/lib/ui/sharing/user_avator_widget.dart@@ -91,6 +91,14 @@ class _UserAvatarWidgetState extends State<UserAvatarWidget> {thumbnailView: widget.thumbnailView,type: widget.type,);+ } else if (snapshot.connectionState == ConnectionState.done &&+ snapshot.data == null) {+ return _FirstLetterAvatar(+ user: widget.user,+ currentUserID: widget.currentUserID,+ thumbnailView: widget.thumbnailView,+ type: widget.type,+ );}return const SizedBox.shrink();},