Browse Source

Listen to appropriate event and refresh UI

Vishnu Mohandas 4 years ago
parent
commit
c33d5096d8
1 changed files with 4 additions and 6 deletions
  1. 4 6
      lib/ui/shared_collections_gallery.dart

+ 4 - 6
lib/ui/shared_collections_gallery.dart

@@ -7,7 +7,7 @@ import 'package:photos/core/configuration.dart';
 import 'package:photos/core/event_bus.dart';
 import 'package:photos/db/collections_db.dart';
 import 'package:photos/db/files_db.dart';
-import 'package:photos/events/remote_sync_event.dart';
+import 'package:photos/events/collection_updated_event.dart';
 import 'package:photos/models/collection_items.dart';
 import 'package:photos/ui/common_elements.dart';
 import 'package:photos/ui/loading_widget.dart';
@@ -24,14 +24,12 @@ class SharedCollectionGallery extends StatefulWidget {
 
 class _SharedCollectionGalleryState extends State<SharedCollectionGallery> {
   Logger _logger = Logger("SharedCollectionGallery");
-  StreamSubscription<RemoteSyncEvent> _subscription;
+  StreamSubscription<CollectionUpdatedEvent> _subscription;
 
   @override
   void initState() {
-    _subscription = Bus.instance.on<RemoteSyncEvent>().listen((event) {
-      if (event.success) {
-        setState(() {});
-      }
+    _subscription = Bus.instance.on<CollectionUpdatedEvent>().listen((event) {
+      setState(() {});
     });
     super.initState();
   }