mirror of
https://github.com/immich-app/immich.git
synced 2024-12-21 01:39:59 +02:00
8dcc01b2be
* add shared links page * feat(mobile): shared link items * feat(mobile): create / edit shared links page * server: add changeExpiryTime to SharedLinkEditDto * fix(mobile): edit expiry to never * mobile: add icon when shares list is empty * mobile: create new share from album / timeline * mobile: add translation texts * mobile: minor ui fixes * fix: handle serverURL with /api path * mobile: show share link on successful creation * mobile: shared links list - 2 column layout * mobile: use sharedlink pod class instead of dto * mobile: show error on link creation * mobile: show share icon only when remote assets are in selection * mobile: use server endpoint instead of server url * styling * styling --------- Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
30 lines
907 B
Dart
30 lines
907 B
Dart
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/modules/shared_link/models/shared_link.dart';
|
|
import 'package:immich_mobile/modules/shared_link/services/shared_link.service.dart';
|
|
|
|
class SharedLinksNotifier extends StateNotifier<AsyncValue<List<SharedLink>>> {
|
|
final SharedLinkService _sharedLinkService;
|
|
|
|
SharedLinksNotifier(this._sharedLinkService) : super(const AsyncLoading()) {
|
|
fetchLinks();
|
|
}
|
|
|
|
Future<void> fetchLinks() async {
|
|
state = await _sharedLinkService.getAllSharedLinks();
|
|
}
|
|
|
|
Future<void> deleteLink(String id) async {
|
|
await _sharedLinkService.deleteSharedLink(id);
|
|
state = const AsyncLoading();
|
|
fetchLinks();
|
|
}
|
|
}
|
|
|
|
final sharedLinksStateProvider =
|
|
StateNotifierProvider<SharedLinksNotifier, AsyncValue<List<SharedLink>>>(
|
|
(ref) {
|
|
return SharedLinksNotifier(
|
|
ref.watch(sharedLinkServiceProvider),
|
|
);
|
|
});
|