From afca978b88e75d90d6ff1c0fd6eb2af17c67a6e6 Mon Sep 17 00:00:00 2001
From: Tom graham <tomg@questps.com.au>
Date: Fri, 27 Dec 2024 21:28:55 +1100
Subject: [PATCH] Sort albums in backup selection alphabetically with Recent
 (isAll) at top.

---
 mobile/lib/repositories/album_media.repository.dart | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mobile/lib/repositories/album_media.repository.dart b/mobile/lib/repositories/album_media.repository.dart
index dac9ccd4da..43e97ed6e7 100644
--- a/mobile/lib/repositories/album_media.repository.dart
+++ b/mobile/lib/repositories/album_media.repository.dart
@@ -1,3 +1,4 @@
+import 'package:collection/collection.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:immich_mobile/entities/album.entity.dart';
 import 'package:immich_mobile/entities/asset.entity.dart';
@@ -15,7 +16,9 @@ class AlbumMediaRepository implements IAlbumMediaRepository {
         await PhotoManager.getAssetPathList(
       hasAll: true,
     );
-    return assetPathEntities.map(_toAlbum).toList();
+    return assetPathEntities.map(_toAlbum).sortedBy((a) {
+      return a.isAll ? "" : a.name.toLowerCase();
+    }).toList();
   }
 
   @override