π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Chore
ashilkn1aa38253a39c
diff --git a/mobile/lib/states/all_sections_examples_state.dart b/mobile/lib/states/all_sections_examples_state.dartindex 716de8db56..9feb3d96bd 100644--- a/mobile/lib/states/all_sections_examples_state.dart+++ b/mobile/lib/states/all_sections_examples_state.dart@@ -109,7 +109,7 @@ class _AllSectionsExamplesProviderState_onPeopleChangedEvent.cancel();_filesUpdatedEvent.cancel();_tabChangeEvent.cancel();- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();super.dispose();}diff --git a/mobile/lib/states/location_state.dart b/mobile/lib/states/location_state.dartindex 3fc773b99a..8ab32e55e8 100644--- a/mobile/lib/states/location_state.dart+++ b/mobile/lib/states/location_state.dart@@ -86,7 +86,7 @@ class _LocationTagStateProviderState extends State<LocationTagStateProvider> {}void _updateSelectedRadius(double radius) {- _selectedRadiusDebouncer.cancelDebounce();+ _selectedRadiusDebouncer.cancelDebounceTimer();_selectedRadiusDebouncer.run(() async {if (mounted) {setState(() {diff --git a/mobile/lib/ui/collections/device/device_folders_grid_view.dart b/mobile/lib/ui/collections/device/device_folders_grid_view.dartindex cd3ee47dc6..b9c2588613 100644--- a/mobile/lib/ui/collections/device/device_folders_grid_view.dart+++ b/mobile/lib/ui/collections/device/device_folders_grid_view.dart@@ -102,7 +102,7 @@ class _DeviceFoldersGridViewState extends State<DeviceFoldersGridView> {void dispose() {_backupFoldersUpdatedEvent?.cancel();_localFilesSubscription?.cancel();- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();super.dispose();}}diff --git a/mobile/lib/ui/collections/device/device_folders_vertical_grid_view.dart b/mobile/lib/ui/collections/device/device_folders_vertical_grid_view.dartindex 7b417c3d63..f465878ff5 100644--- a/mobile/lib/ui/collections/device/device_folders_vertical_grid_view.dart+++ b/mobile/lib/ui/collections/device/device_folders_vertical_grid_view.dart@@ -158,7 +158,7 @@ class _DeviceFolderVerticalGridViewBodyStatevoid dispose() {_backupFoldersUpdatedEvent?.cancel();_localFilesSubscription?.cancel();- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();super.dispose();}}diff --git a/mobile/lib/ui/components/buttons/button_widget.dart b/mobile/lib/ui/components/buttons/button_widget.dartindex 2e4d2d1dc2..7590735b10 100644--- a/mobile/lib/ui/components/buttons/button_widget.dart+++ b/mobile/lib/ui/components/buttons/button_widget.dart@@ -416,13 +416,13 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {onError: (error, stackTrace) {executionState = ExecutionState.error;_exception = error as Exception;- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();},);widget.shouldShowSuccessConfirmation && _debouncer.isActive()? executionState = ExecutionState.successful: null;- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();if (executionState == ExecutionState.successful) {setState(() {});}diff --git a/mobile/lib/ui/components/menu_item_widget/menu_item_widget.dart b/mobile/lib/ui/components/menu_item_widget/menu_item_widget.dartindex 21e88eb403..cb18f9b26f 100644--- a/mobile/lib/ui/components/menu_item_widget/menu_item_widget.dart+++ b/mobile/lib/ui/components/menu_item_widget/menu_item_widget.dart@@ -227,9 +227,9 @@ class _MenuItemWidgetState extends State<MenuItemWidget> {? executionStateNotifier.value = ExecutionState.successful: null;},- onError: (error, stackTrace) => _debouncer.cancelDebounce(),+ onError: (error, stackTrace) => _debouncer.cancelDebounceTimer(),);- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();if (widget.alwaysShowSuccessState) {Future.delayed(const Duration(seconds: 2), () {executionStateNotifier.value = ExecutionState.idle;diff --git a/mobile/lib/ui/components/text_input_widget.dart b/mobile/lib/ui/components/text_input_widget.dartindex 0d4fd7aeca..900a402df9 100644--- a/mobile/lib/ui/components/text_input_widget.dart+++ b/mobile/lib/ui/components/text_input_widget.dart@@ -275,7 +275,7 @@ class _TextInputWidgetState extends State<TextInputWidget> {await widget.onSubmit!.call(_textController.text);} catch (e) {executionState = ExecutionState.error;- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();_exception = e as Exception;if (e.toString().contains("Incorrect password")) {_logger.warning("Incorrect password");@@ -288,7 +288,7 @@ class _TextInputWidgetState extends State<TextInputWidget> {widget.alwaysShowSuccessState && _debouncer.isActive()? executionState = ExecutionState.successful: null;- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();if (executionState == ExecutionState.successful) {setState(() {});}diff --git a/mobile/lib/ui/components/toggle_switch_widget.dart b/mobile/lib/ui/components/toggle_switch_widget.dartindex de6507c1f5..fb132cedf0 100644--- a/mobile/lib/ui/components/toggle_switch_widget.dart+++ b/mobile/lib/ui/components/toggle_switch_widget.dart@@ -121,12 +121,12 @@ class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {});final Stopwatch stopwatch = Stopwatch()..start();await widget.onChanged.call().onError(- (error, stackTrace) => _debouncer.cancelDebounce(),+ (error, stackTrace) => _debouncer.cancelDebounceTimer(),);//for toggle feedback on short unsuccessful onChangedawait _feedbackOnUnsuccessfulToggle(stopwatch);//debouncer gets canceled if onChanged takes less than debounce time- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();final newValue = widget.value.call();setState(() {diff --git a/mobile/lib/ui/tabs/shared_collections_tab.dart b/mobile/lib/ui/tabs/shared_collections_tab.dartindex 2994a293c2..8f4b61b38a 100644--- a/mobile/lib/ui/tabs/shared_collections_tab.dart+++ b/mobile/lib/ui/tabs/shared_collections_tab.dart@@ -330,7 +330,7 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>_localFilesSubscription.cancel();_collectionUpdatesSubscription.cancel();_loggedOutEvent.cancel();- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();super.dispose();}diff --git a/mobile/lib/ui/tabs/user_collections_tab.dart b/mobile/lib/ui/tabs/user_collections_tab.dartindex 20a012d0c2..333241f20e 100644--- a/mobile/lib/ui/tabs/user_collections_tab.dart+++ b/mobile/lib/ui/tabs/user_collections_tab.dart@@ -298,7 +298,7 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>_loggedOutEvent.cancel();_favoritesServiceInitCompleteEvent.cancel();_scrollController.dispose();- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();super.dispose();}diff --git a/mobile/lib/ui/viewer/file/file_widget.dart b/mobile/lib/ui/viewer/file/file_widget.dartindex 92c7a1523f..7f91efa8a5 100644--- a/mobile/lib/ui/viewer/file/file_widget.dart+++ b/mobile/lib/ui/viewer/file/file_widget.dart@@ -1,11 +1,8 @@-import "dart:io";-import "package:flutter/foundation.dart";import 'package:flutter/material.dart';import 'package:logging/logging.dart';import 'package:photos/models/file/file.dart';import 'package:photos/models/file/file_type.dart';-import "package:photos/ui/viewer/file/video_widget.dart";import "package:photos/ui/viewer/file/video_widget_native.dart";import "package:photos/ui/viewer/file/zoomable_live_image_new.dart";@@ -44,13 +41,13 @@ class FileWidget extends StatelessWidget {} else if (file.fileType == FileType.video) {// use old video widget on iOS simulator as the new one crashes while// playing certain videos on iOS simulator- if (kDebugMode && Platform.isIOS) {- return VideoWidget(- file,- tagPrefix: tagPrefix,- playbackCallback: playbackCallback,- );- }+ // if (kDebugMode && Platform.isIOS) {+ // return VideoWidget(+ // file,+ // tagPrefix: tagPrefix,+ // playbackCallback: playbackCallback,+ // );+ // }return VideoWidgetNative(file,tagPrefix: tagPrefix,diff --git a/mobile/lib/ui/viewer/file/video_widget_native.dart b/mobile/lib/ui/viewer/file/video_widget_native.dartindex f3ef3cb2c3..671477aa0c 100644--- a/mobile/lib/ui/viewer/file/video_widget_native.dart+++ b/mobile/lib/ui/viewer/file/video_widget_native.dart@@ -148,7 +148,7 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>_showControls.dispose();_isSeeking.removeListener(_seekListener);_isSeeking.dispose();- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();super.dispose();}diff --git a/mobile/lib/ui/viewer/gallery/gallery.dart b/mobile/lib/ui/viewer/gallery/gallery.dartindex 3155617060..be41f11ff2 100644--- a/mobile/lib/ui/viewer/gallery/gallery.dart+++ b/mobile/lib/ui/viewer/gallery/gallery.dart@@ -243,7 +243,7 @@ class GalleryState extends State<Gallery> {for (final subscription in _forceReloadEventSubscriptions) {subscription.cancel();}- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();super.dispose();}diff --git a/mobile/lib/ui/viewer/search/search_widget.dart b/mobile/lib/ui/viewer/search/search_widget.dartindex 89002b1e14..1983c5cb69 100644--- a/mobile/lib/ui/viewer/search/search_widget.dart+++ b/mobile/lib/ui/viewer/search/search_widget.dart@@ -96,7 +96,7 @@ class SearchWidgetState extends State<SearchWidget> {@overridevoid dispose() {- _debouncer.cancelDebounce();+ _debouncer.cancelDebounceTimer();focusNode.dispose();_tabDoubleTapEvent?.cancel();textController.removeListener(textControllerListener);diff --git a/mobile/lib/utils/debouncer.dart b/mobile/lib/utils/debouncer.dartindex 99b9ce9a89..31e9709521 100644--- a/mobile/lib/utils/debouncer.dart+++ b/mobile/lib/utils/debouncer.dart@@ -3,6 +3,8 @@ import 'dart:async';import 'package:flutter/material.dart';import "package:photos/models/typedefs.dart";+///Do not forget to cancel the debounce's timer using [cancelDebounceTimer]+///when the debouncer is no longer neededclass Debouncer {final Duration _duration;@@ -43,7 +45,7 @@ class Debouncer {_debounceActiveNotifier.value = true;}- void cancelDebounce() {+ void cancelDebounceTimer() {if (_debounceTimer != null) {_debounceTimer!.cancel();}