You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-08 23:07:06 +02:00
feat: album edit (#19936)
This commit is contained in:
@ -0,0 +1,39 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/album/album.model.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
|
||||
|
||||
final currentRemoteAlbumProvider =
|
||||
AutoDisposeNotifierProvider<CurrentAlbumNotifier, RemoteAlbum?>(
|
||||
CurrentAlbumNotifier.new,
|
||||
);
|
||||
|
||||
class CurrentAlbumNotifier extends AutoDisposeNotifier<RemoteAlbum?> {
|
||||
KeepAliveLink? _keepAliveLink;
|
||||
StreamSubscription<RemoteAlbum?>? _assetSubscription;
|
||||
|
||||
@override
|
||||
RemoteAlbum? build() => null;
|
||||
|
||||
void setAlbum(RemoteAlbum album) {
|
||||
_keepAliveLink?.close();
|
||||
_assetSubscription?.cancel();
|
||||
state = album;
|
||||
|
||||
_assetSubscription = ref
|
||||
.watch(remoteAlbumServiceProvider)
|
||||
.watchAlbum(album.id)
|
||||
.listen((updatedAlbum) {
|
||||
if (updatedAlbum != null) {
|
||||
state = updatedAlbum;
|
||||
}
|
||||
});
|
||||
_keepAliveLink = ref.keepAlive();
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
_keepAliveLink?.close();
|
||||
_assetSubscription?.cancel();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user