2026-06-26 02:25:06 +05:30
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:auto_route/auto_route.dart';
|
2026-08-01 08:06:42 +05:30
|
|
|
import 'package:collection/collection.dart';
|
2026-06-26 02:25:06 +05:30
|
|
|
import 'package:flutter/material.dart';
|
2026-07-31 02:32:14 +05:30
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2026-06-26 02:25:06 +05:30
|
|
|
import 'package:immich_mobile/generated/translations.g.dart';
|
|
|
|
|
import 'package:immich_mobile/presentation/actions/action.dart';
|
|
|
|
|
import 'package:immich_mobile/providers/infrastructure/setting.provider.dart';
|
|
|
|
|
import 'package:immich_mobile/routing/router.dart';
|
|
|
|
|
|
2026-07-31 02:32:14 +05:30
|
|
|
class AssetDebugAction extends AssetActionBuilder {
|
|
|
|
|
const AssetDebugAction({required super.source});
|
2026-06-26 02:25:06 +05:30
|
|
|
|
|
|
|
|
@override
|
2026-07-31 02:32:14 +05:30
|
|
|
ActionItem? create(BuildContext context, WidgetRef ref) {
|
2026-08-01 08:06:42 +05:30
|
|
|
final asset = ref.watch(assetsActionProvider(source)).assets.singleOrNull;
|
2026-07-31 02:32:14 +05:30
|
|
|
final troubleshootEnabled = ref.watch(settingsProvider.notifier).get(.advancedTroubleshooting);
|
2026-08-01 08:06:42 +05:30
|
|
|
if (!troubleshootEnabled || asset == null) {
|
2026-07-31 02:32:14 +05:30
|
|
|
return null;
|
|
|
|
|
}
|
2026-06-26 02:25:06 +05:30
|
|
|
|
2026-07-31 02:32:14 +05:30
|
|
|
return .new(
|
|
|
|
|
icon: Icons.help_outline_rounded,
|
|
|
|
|
label: context.t.troubleshoot,
|
2026-08-01 08:06:42 +05:30
|
|
|
onAction: () => unawaited(context.pushRoute(AssetTroubleshootRoute(asset: asset))),
|
2026-07-31 02:32:14 +05:30
|
|
|
);
|
|
|
|
|
}
|
2026-06-26 02:25:06 +05:30
|
|
|
}
|