π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Respect the order given in JSON of magic prompts on the UI
ashilknc9a96df72018
diff --git a/mobile/lib/services/magic_cache_service.dart b/mobile/lib/services/magic_cache_service.dartindex bbc1a9bd83..151b3a748a 100644--- a/mobile/lib/services/magic_cache_service.dart+++ b/mobile/lib/services/magic_cache_service.dart@@ -196,32 +196,25 @@ class MagicCacheService {return json["prompts"];}- ///Returns random non-empty magic results from magicPromptsData+ ///Returns non-empty magic results from magicPromptsData///Length is number of prompts, can be less if there are not enough non-empty///resultsFuture<List<MagicCache>> _nonEmptyMagicResults(List<dynamic> magicPromptsData,) async {final results = <MagicCache>[];- final randomIndexes = List.generate(- magicPromptsData.length,- (index) => index,- growable: false,- )..shuffle();- for (final index in randomIndexes) {- final files =- await _getMatchingFileIDsForPromptData(magicPromptsData[index]);+ for (dynamic prompt in magicPromptsData) {+ final files = await _getMatchingFileIDsForPromptData(+ prompt as Map<String, dynamic>,+ );if (files.isNotEmpty) {results.add(MagicCache(- magicPromptsData[index]["title"] as String,+ prompt["title"] as String,files,),);}- if (results.length >= magicPromptsData.length) {- break;- }}return results;}