You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-07-06 06:07:29 +02:00
feat: shared link action (#19610)
This commit is contained in:
@ -1,16 +1,52 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/constants/enums.dart';
|
||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
import 'package:immich_mobile/extensions/translate_extensions.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
|
||||
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
|
||||
class ShareLinkActionButton extends ConsumerWidget {
|
||||
const ShareLinkActionButton({super.key});
|
||||
final ActionSource source;
|
||||
|
||||
const ShareLinkActionButton({super.key, required this.source});
|
||||
|
||||
onAction(BuildContext context, WidgetRef ref) {
|
||||
switch (source) {
|
||||
case ActionSource.timeline:
|
||||
timelineAction(context, ref);
|
||||
case ActionSource.viewer:
|
||||
viewerAction(ref);
|
||||
}
|
||||
}
|
||||
|
||||
void timelineAction(BuildContext context, WidgetRef ref) {
|
||||
final ids = ref
|
||||
.read(multiSelectProvider.select((value) => value.selectedAssets))
|
||||
.whereType<RemoteAsset>()
|
||||
.toList()
|
||||
.map((asset) => asset.id)
|
||||
.toList();
|
||||
|
||||
context.pushRoute(
|
||||
SharedLinkEditRoute(
|
||||
assetsList: ids,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void viewerAction(WidgetRef _) {
|
||||
UnimplementedError("Viewer action for favorite is not implemented yet.");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return BaseActionButton(
|
||||
iconData: Icons.link_rounded,
|
||||
label: "share_link".t(context: context),
|
||||
onPressed: () => onAction(context, ref),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class HomeBottomAppBar extends ConsumerWidget {
|
||||
actions: [
|
||||
const ShareActionButton(),
|
||||
if (multiselect.hasRemote) ...[
|
||||
const ShareLinkActionButton(),
|
||||
const ShareLinkActionButton(source: ActionSource.timeline),
|
||||
const ArchiveActionButton(),
|
||||
const FavoriteActionButton(source: ActionSource.timeline),
|
||||
const DownloadActionButton(),
|
||||
|
Reference in New Issue
Block a user