π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
added listener to root of app to know when user is interacting with app and when user is not
ashilkn6b6eed73a8c9
diff --git a/lib/app.dart b/lib/app.dartindex 82bb05e46d..e3bd1d8a64 100644--- a/lib/app.dart+++ b/lib/app.dart@@ -1,3 +1,4 @@+import "dart:async";import 'dart:io';import 'package:adaptive_theme/adaptive_theme.dart';@@ -43,6 +44,7 @@ class EnteApp extends StatefulWidget {class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {final _logger = Logger("EnteAppState");late Locale locale;+ late Timer _userInteractionTimer;@overridevoid initState() {@@ -51,6 +53,9 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {locale = widget.locale;setupIntentAction();WidgetsBinding.instance.addObserver(this);+ _userInteractionTimer = Timer(const Duration(seconds: 2), () {+ //start indexing+ });}setLocale(Locale newLocale) {@@ -69,31 +74,44 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {}}+ resetTimer() {+ _userInteractionTimer.cancel();+ _userInteractionTimer = Timer(const Duration(seconds: 2), () {+ //resume indexing+ });+ }+@overrideWidget build(BuildContext context) {if (Platform.isAndroid || kDebugMode) {- return AdaptiveTheme(- light: lightThemeData,- dark: darkThemeData,- initial: widget.savedThemeMode ?? AdaptiveThemeMode.system,- builder: (lightTheme, dartTheme) => MaterialApp(- title: "ente",- themeMode: ThemeMode.system,- theme: lightTheme,- darkTheme: dartTheme,- home: AppLifecycleService.instance.mediaExtensionAction.action ==- IntentAction.view- ? const FileViewer()- : const HomeWidget(),- debugShowCheckedModeBanner: false,- builder: EasyLoading.init(),- locale: locale,- supportedLocales: appSupportedLocales,- localeListResolutionCallback: localResolutionCallBack,- localizationsDelegates: const [- ...AppLocalizations.localizationsDelegates,- S.delegate,- ],+ return Listener(+ onPointerDown: (event) {+ //pause indexing+ resetTimer();+ },+ child: AdaptiveTheme(+ light: lightThemeData,+ dark: darkThemeData,+ initial: widget.savedThemeMode ?? AdaptiveThemeMode.system,+ builder: (lightTheme, dartTheme) => MaterialApp(+ title: "ente",+ themeMode: ThemeMode.system,+ theme: lightTheme,+ darkTheme: dartTheme,+ home: AppLifecycleService.instance.mediaExtensionAction.action ==+ IntentAction.view+ ? const FileViewer()+ : const HomeWidget(),+ debugShowCheckedModeBanner: false,+ builder: EasyLoading.init(),+ locale: locale,+ supportedLocales: appSupportedLocales,+ localeListResolutionCallback: localResolutionCallBack,+ localizationsDelegates: const [+ ...AppLocalizations.localizationsDelegates,+ S.delegate,+ ],+ ),),);} else {@@ -119,6 +137,7 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {@overridevoid dispose() {WidgetsBinding.instance.removeObserver(this);+ _userInteractionTimer.cancel();super.dispose();}