Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] remove smart album sync overlay

r4khulb1b55322d252
diff --git a/mobile/apps/photos/lib/events/smart_album_syncing_event.dart b/mobile/apps/photos/lib/events/smart_album_syncing_event.dart
deleted file mode 100644
index de042f3bcc..0000000000
--- a/mobile/apps/photos/lib/events/smart_album_syncing_event.dart
+++ /dev/null
@@ -1,8 +0,0 @@
-import 'package:photos/events/event.dart';
-
-class SmartAlbumSyncingEvent extends Event {
- int? collectionId;
- bool isSyncing;
-
- SmartAlbumSyncingEvent({this.collectionId, this.isSyncing = false});
-}
diff --git a/mobile/apps/photos/lib/services/smart_albums_service.dart b/mobile/apps/photos/lib/services/smart_albums_service.dart
index 0b166c073e..ee4d919500 100644
--- a/mobile/apps/photos/lib/services/smart_albums_service.dart
+++ b/mobile/apps/photos/lib/services/smart_albums_service.dart
@@ -3,8 +3,6 @@ import "dart:convert";
import "package:logging/logging.dart";
import "package:photos/core/configuration.dart";
-import "package:photos/core/event_bus.dart";
-import "package:photos/events/smart_album_syncing_event.dart";
import "package:photos/gateways/entity/models/type.dart";
import "package:photos/models/collection/smart_album_config.dart";
import "package:photos/models/file/file.dart";
@@ -21,8 +19,6 @@ class SmartAlbumsService {
Future<Map<int, SmartAlbumConfig>>? _cachedConfigsFuture;
- (int, bool)? syncingCollection;
-
void clearCache() {
_cachedConfigsFuture = null;
_lastCacheRefreshTime = 0;
@@ -139,11 +135,6 @@ class SmartAlbumsService {
continue;
}
- syncingCollection = (collectionId, false);
- Bus.instance.fire(
- SmartAlbumSyncingEvent(collectionId: collectionId, isSyncing: false),
- );
-
final infoMap = config.infoMap;
final updatedAtMap = await entityService.getUpdatedAts(
@@ -182,11 +173,6 @@ class SmartAlbumsService {
pendingSyncFileSet = {...pendingSyncFileSet, ...fileIds};
}
- syncingCollection = (collectionId, true);
- Bus.instance.fire(
- SmartAlbumSyncingEvent(collectionId: collectionId, isSyncing: true),
- );
-
if (pendingSyncFiles.isNotEmpty) {
try {
await CollectionsService.instance.addOrCopyToCollection(
@@ -203,8 +189,6 @@ class SmartAlbumsService {
}
}
}
- syncingCollection = null;
- Bus.instance.fire(SmartAlbumSyncingEvent());
if (collectionIds != null && hasFailed) {
throw StateError("Failed to sync one or more smart albums");
}
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart
deleted file mode 100644
index 611bebb01f..0000000000
--- a/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart
+++ /dev/null
@@ -1,102 +0,0 @@
-import "dart:async";
-
-import "package:ente_strings/ente_strings.dart";
-import "package:ente_ui/components/fading_circle_progress_indicator.dart";
-import 'package:flutter/material.dart';
-import "package:photos/core/event_bus.dart";
-import "package:photos/events/smart_album_syncing_event.dart";
-import 'package:photos/models/collection/collection.dart';
-import "package:photos/service_locator.dart";
-import "package:photos/theme/ente_theme.dart";
-
-class SmartAlbumsStatusWidget extends StatefulWidget {
- final Collection? collection;
-
- const SmartAlbumsStatusWidget({this.collection, super.key});
-
- @override
- State<SmartAlbumsStatusWidget> createState() =>
- _SmartAlbumsStatusWidgetState();
-}
-
-class _SmartAlbumsStatusWidgetState extends State<SmartAlbumsStatusWidget> {
- (int, bool)? _syncingCollection;
- StreamSubscription<SmartAlbumSyncingEvent>? subscription;
-
- void updateData(SmartAlbumSyncingEvent event) {
- if (mounted) {
- setState(() {
- if (event.collectionId != null) {
- _syncingCollection = (event.collectionId!, event.isSyncing);
- } else {
- _syncingCollection = null;
- }
- });
- }
- }
-
- @override
- void initState() {
- super.initState();
- _syncingCollection = smartAlbumsService.syncingCollection;
- subscription = Bus.instance.on<SmartAlbumSyncingEvent>().listen(updateData);
- }
-
- @override
- void dispose() {
- subscription?.cancel();
- super.dispose();
- }
-
- @override
- Widget build(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
-
- return AnimatedCrossFade(
- firstCurve: Curves.easeInOutExpo,
- secondCurve: Curves.easeInOutExpo,
- sizeCurve: Curves.easeInOutExpo,
- crossFadeState:
- !(_syncingCollection == null ||
- _syncingCollection!.$1 != widget.collection?.id)
- ? CrossFadeState.showSecond
- : CrossFadeState.showFirst,
- duration: const Duration(milliseconds: 400),
- secondChild: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Container(
- padding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 12,
- ).copyWith(left: 14),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- color: Colors.black.withValues(alpha: 0.65),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- FadingCircleProgressIndicator(
- color: _syncingCollection?.$2 ?? true
- ? const Color(0xFF08C225)
- : const Color(0xFFF78426),
- ),
- const SizedBox(width: 8),
- Text(
- (_syncingCollection?.$2 ?? true)
- ? context.strings.addingPhotos
- : context.strings.gettingReady,
- style: textTheme.small.copyWith(color: Colors.white),
- ),
- ],
- ),
- ),
- const SizedBox(height: 50),
- ],
- ),
- firstChild: const SizedBox.shrink(),
- );
- }
-}
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
index 98db42aa78..19ca854b9e 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
@@ -14,7 +14,6 @@ import "package:photos/models/search/hierarchical/hierarchical_search_filter.dar
import 'package:photos/models/selected_files.dart';
import 'package:photos/services/ignored_files_service.dart';
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
-import "package:photos/ui/viewer/actions/smart_albums_status_widget.dart";
import "package:photos/ui/viewer/gallery/empty_album_state.dart";
import 'package:photos/ui/viewer/gallery/empty_state.dart';
import 'package:photos/ui/viewer/gallery/gallery.dart';
@@ -154,7 +153,6 @@ class CollectionPage extends StatelessWidget {
);
},
),
- SmartAlbumsStatusWidget(collection: c.collection),
FileSelectionOverlayBar(
galleryType,
_selectedFiles,