fix(mobile): avoid duplicate viewer pop on empty timeline
parent
c72009d789
commit
c93c40a2c8
|
|
@ -86,6 +86,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
|||
|
||||
late int _currentPage = widget.initialIndex;
|
||||
late int _totalAssets = ref.read(timelineServiceProvider).totalAssets;
|
||||
bool _isPopping = false;
|
||||
|
||||
StreamSubscription? _reloadSubscription;
|
||||
KeepAliveLink? _stackChildrenKeepAlive;
|
||||
|
|
@ -228,6 +229,10 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
|||
final totalAssets = timelineService.totalAssets;
|
||||
|
||||
if (totalAssets == 0) {
|
||||
if (_isPopping) {
|
||||
return;
|
||||
}
|
||||
_isPopping = true;
|
||||
context.maybePop();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ 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/domain/models/events.model.dart';
|
||||
import 'package:immich_mobile/domain/services/timeline.service.dart';
|
||||
import 'package:immich_mobile/domain/utils/event_stream.dart';
|
||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/action_buttons/add_action_button.widget.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/action_buttons/delete_action_button.widget.dart';
|
||||
|
|
@ -140,9 +138,6 @@ class ViewerBottomBar extends ConsumerWidget {
|
|||
|
||||
void _updateView(ActionResult result, WidgetRef ref) {
|
||||
Future.delayed(Durations.extralong4, () {
|
||||
if (result.success) {
|
||||
EventStream.shared.emit(const TimelineReloadEvent());
|
||||
}
|
||||
if (ref.context.mounted) {
|
||||
ref.read(assetViewerProvider.notifier).setControls(true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue