Neeraj Gupta 3 anni fa
parent
commit
49d693b9cb

+ 2 - 1
lib/services/collections_service.dart

@@ -231,7 +231,7 @@ class CollectionsService {
     }
   }
 
-  Future<void> renameCollection(Collection collection, String newName) async {
+  Future<void> rename(Collection collection, String newName) async {
     try {
       final encryptedName = CryptoUtil.encryptSync(utf8.encode(newName), getCollectionKey(collection.id));
       await _dio.post(
@@ -244,6 +244,7 @@ class CollectionsService {
         options: Options(
             headers: {"X-Auth-Token": Configuration.instance.getToken()}),
       );
+      // trigger sync to fetch the latest name from server
       sync();
     } catch (e, s) {
       _logger.severe("failed to rename collection", e, s);

+ 1 - 1
lib/ui/gallery_app_bar_widget.dart

@@ -134,7 +134,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
     await dialog.show();
     try {
       await CollectionsService.instance
-          .renameCollection(widget.collection, result);
+          .rename(widget.collection, result);
       await dialog.hide();
       if (mounted) {
         appBarTitle = result;