mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 02:18:50 +01:00
Regression: only open dynamic collections after creating a new one
This commit is contained in:
parent
cc3780587b
commit
6b9175de18
8 changed files with 37 additions and 5 deletions
|
@ -58,6 +58,9 @@ class Collection with EquatableMixin {
|
|||
|
||||
CollectionSorter getSorter() => CollectionSorter.fromSortType(itemSort);
|
||||
|
||||
/// See [CollectionContentProvider.isDynamicCollection]
|
||||
bool get isDynamicCollection => contentProvider.isDynamicCollection;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
name,
|
||||
|
@ -127,4 +130,10 @@ abstract class CollectionContentProvider with EquatableMixin {
|
|||
int height, {
|
||||
bool? isKeepAspectRatio,
|
||||
});
|
||||
|
||||
/// Return whether this is a dynamic collection
|
||||
///
|
||||
/// A collection is defined as a dynamic one when the items are not specified
|
||||
/// explicitly by the user, but rather derived from some conditions
|
||||
bool get isDynamicCollection;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,9 @@ class CollectionAlbumProvider
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool get isDynamicCollection => album.provider is! AlbumStaticProvider;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [account, album];
|
||||
|
||||
|
|
|
@ -50,6 +50,9 @@ class CollectionLocationGroupProvider
|
|||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get isDynamicCollection => true;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [account, location];
|
||||
|
||||
|
|
|
@ -58,6 +58,9 @@ class CollectionMemoryProvider
|
|||
));
|
||||
}
|
||||
|
||||
@override
|
||||
bool get isDynamicCollection => true;
|
||||
|
||||
@override
|
||||
String toString() => _$toString();
|
||||
|
||||
|
|
|
@ -73,6 +73,9 @@ class CollectionNcAlbumProvider
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool get isDynamicCollection => false;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [account, album];
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ class CollectionPersonProvider
|
|||
size: math.max(width, height));
|
||||
}
|
||||
|
||||
@override
|
||||
bool get isDynamicCollection => true;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [account, person];
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ class CollectionTagProvider
|
|||
}) =>
|
||||
null;
|
||||
|
||||
@override
|
||||
bool get isDynamicCollection => true;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [account, tags];
|
||||
|
||||
|
|
|
@ -240,11 +240,16 @@ class _WrappedHomeCollectionsState extends State<_WrappedHomeCollections>
|
|||
if (collection == null) {
|
||||
return;
|
||||
}
|
||||
// open the newly created collection
|
||||
unawaited(Navigator.of(context).pushNamed(
|
||||
CollectionBrowser.routeName,
|
||||
arguments: CollectionBrowserArguments(collection),
|
||||
));
|
||||
// Right now we don't have a way to add photos inside the
|
||||
// CollectionBrowser, eventually we should add that and remove this
|
||||
// branching
|
||||
if (collection.isDynamicCollection) {
|
||||
// open the newly created collection
|
||||
unawaited(Navigator.of(context).pushNamed(
|
||||
CollectionBrowser.routeName,
|
||||
arguments: CollectionBrowserArguments(collection),
|
||||
));
|
||||
}
|
||||
} catch (e, stacktrace) {
|
||||
_log.shout("[_onNewCollectionPressed] Failed", e, stacktrace);
|
||||
SnackBarManager().showSnackBar(SnackBar(
|
||||
|
|
Loading…
Reference in a new issue