π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
change interval time type from int to Duration in debouncer
ashilkn6a26e01af092
diff --git a/lib/states/all_sections_examples_state.dart b/lib/states/all_sections_examples_state.dartindex 2cb24063c3..4f29cf1142 100644--- a/lib/states/all_sections_examples_state.dart+++ b/lib/states/all_sections_examples_state.dart@@ -38,7 +38,7 @@ class _AllSectionsExamplesProviderStatefinal _debouncer = Debouncer(const Duration(seconds: 4),- executionIntervalInMilliSeconds: 15000,+ executionInterval: const Duration(seconds: 15),);@overridediff --git a/lib/ui/map/map_view.dart b/lib/ui/map/map_view.dartindex ce3c1839af..471ca70983 100644--- a/lib/ui/map/map_view.dart+++ b/lib/ui/map/map_view.dart@@ -42,7 +42,7 @@ class _MapViewState extends State<MapView> {late List<Marker> _markers;final _debouncer = Debouncer(const Duration(milliseconds: 300),- executionIntervalInMilliSeconds: 750,+ executionInterval: const Duration(milliseconds: 750),);@overridediff --git a/lib/utils/debouncer.dart b/lib/utils/debouncer.dartindex afa3b2cdec..b9185f8a4b 100644--- a/lib/utils/debouncer.dart+++ b/lib/utils/debouncer.dart@@ -12,19 +12,19 @@ class Debouncer {/// If executionIntervalInSeconds is not null, then the debouncer will execute the/// current callback it has in run() method repeatedly in the given interval./// This is useful for example when you want to execute a callback every 5 seconds- final int? executionIntervalInMilliSeconds;+ final Duration? executionInterval;Timer? _debounceTimer;- Debouncer(this._duration, {this.executionIntervalInMilliSeconds});+ Debouncer(this._duration, {this.executionInterval});final Stopwatch _stopwatch = Stopwatch();void run(FutureVoidCallback fn) {bool shouldRunImmediately = false;- if (executionIntervalInMilliSeconds != null) {+ if (executionInterval != null) {// ensure the stop watch is running_stopwatch.start();- if (_stopwatch.elapsedMilliseconds > executionIntervalInMilliSeconds!) {+ if (_stopwatch.elapsedMilliseconds > executionInterval!.inMilliseconds) {shouldRunImmediately = true;_stopwatch.stop();_stopwatch.reset();