Browse Source

Remove setting to hide app from recents on Android

vishnukvmd 2 years ago
parent
commit
9a8ef0ea34
4 changed files with 0 additions and 107 deletions
  1. 0 9
      lib/core/configuration.dart
  2. 0 90
      lib/ui/settings/security_section_widget.dart
  3. 0 7
      pubspec.lock
  4. 0 1
      pubspec.yaml

+ 0 - 9
lib/core/configuration.dart

@@ -64,7 +64,6 @@ class Configuration {
   // keyShouldKeepDeviceAwake is used to determine whether the device screen
   // keyShouldKeepDeviceAwake is used to determine whether the device screen
   // should be kept on while the app is in foreground.
   // should be kept on while the app is in foreground.
   static const keyShouldKeepDeviceAwake = "should_keep_device_awake";
   static const keyShouldKeepDeviceAwake = "should_keep_device_awake";
-  static const keyShouldHideFromRecents = "should_hide_from_recents";
   static const keyShouldShowLockScreen = "should_show_lock_screen";
   static const keyShouldShowLockScreen = "should_show_lock_screen";
   static const keyHasSelectedAnyBackupFolder =
   static const keyHasSelectedAnyBackupFolder =
       "has_selected_any_folder_for_backup";
       "has_selected_any_folder_for_backup";
@@ -606,14 +605,6 @@ class Configuration {
     return _preferences.setBool(keyShouldShowLockScreen, value);
     return _preferences.setBool(keyShouldShowLockScreen, value);
   }
   }
 
 
-  bool shouldHideFromRecents() {
-    return _preferences.getBool(keyShouldHideFromRecents) ?? false;
-  }
-
-  Future<void> setShouldHideFromRecents(bool value) {
-    return _preferences.setBool(keyShouldHideFromRecents, value);
-  }
-
   void setVolatilePassword(String? volatilePassword) {
   void setVolatilePassword(String? volatilePassword) {
     _volatilePassword = volatilePassword;
     _volatilePassword = volatilePassword;
   }
   }

+ 0 - 90
lib/ui/settings/security_section_widget.dart

@@ -1,8 +1,6 @@
 import 'dart:async';
 import 'dart:async';
-import 'dart:io';
 
 
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
-import 'package:flutter_windowmanager/flutter_windowmanager.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/core/event_bus.dart';
 import 'package:photos/core/event_bus.dart';
 import 'package:photos/ente_theme_data.dart';
 import 'package:photos/ente_theme_data.dart';
@@ -114,24 +112,6 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
         ),
         ),
       ),
       ),
       sectionOptionSpacing,
       sectionOptionSpacing,
-    ]);
-    if (Platform.isAndroid) {
-      children.addAll(
-        [
-          MenuItemWidget(
-            captionedTextWidget: const CaptionedTextWidget(
-              title: "Hide from recents",
-            ),
-            trailingWidget: ToggleSwitchWidget(
-              value: () => _config.shouldHideFromRecents(),
-              onChanged: _hideFromRecentsOnChanged,
-            ),
-          ),
-          sectionOptionSpacing,
-        ],
-      );
-    }
-    children.addAll([
       MenuItemWidget(
       MenuItemWidget(
         captionedTextWidget: const CaptionedTextWidget(
         captionedTextWidget: const CaptionedTextWidget(
           title: "View active sessions",
           title: "View active sessions",
@@ -205,74 +185,4 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
       },
       },
     );
     );
   }
   }
-
-  Future<void> _hideFromRecentsOnChanged() async {
-    if (!_config.shouldHideFromRecents()) {
-      final AlertDialog alert = AlertDialog(
-        title: const Text("Hide from recents?"),
-        content: SingleChildScrollView(
-          child: Column(
-            mainAxisAlignment: MainAxisAlignment.start,
-            crossAxisAlignment: CrossAxisAlignment.start,
-            children: const [
-              Text(
-                "Hiding from the task switcher will prevent you from taking screenshots in this app.",
-                style: TextStyle(
-                  height: 1.5,
-                ),
-              ),
-              Padding(padding: EdgeInsets.all(8)),
-              Text(
-                "Are you sure?",
-                style: TextStyle(
-                  height: 1.5,
-                ),
-              ),
-            ],
-          ),
-        ),
-        actions: [
-          TextButton(
-            child: Text(
-              "No",
-              style: TextStyle(
-                color: Theme.of(context).colorScheme.defaultTextColor,
-              ),
-            ),
-            onPressed: () {
-              Navigator.of(context, rootNavigator: true).pop('dialog');
-            },
-          ),
-          TextButton(
-            child: Text(
-              "Yes",
-              style: TextStyle(
-                color: Theme.of(context).colorScheme.defaultTextColor,
-              ),
-            ),
-            onPressed: () async {
-              Navigator.of(context, rootNavigator: true).pop('dialog');
-              await _config.setShouldHideFromRecents(true);
-              await FlutterWindowManager.addFlags(
-                FlutterWindowManager.FLAG_SECURE,
-              );
-              setState(() {});
-            },
-          ),
-        ],
-      );
-
-      await showDialog(
-        context: context,
-        builder: (BuildContext context) {
-          return alert;
-        },
-      );
-    } else {
-      await _config.setShouldHideFromRecents(false);
-      await FlutterWindowManager.clearFlags(
-        FlutterWindowManager.FLAG_SECURE,
-      );
-    }
-  }
 }
 }

+ 0 - 7
pubspec.lock

@@ -553,13 +553,6 @@ packages:
     description: flutter
     description: flutter
     source: sdk
     source: sdk
     version: "0.0.0"
     version: "0.0.0"
-  flutter_windowmanager:
-    dependency: "direct main"
-    description:
-      name: flutter_windowmanager
-      url: "https://pub.dartlang.org"
-    source: hosted
-    version: "0.2.0"
   fluttertoast:
   fluttertoast:
     dependency: "direct main"
     dependency: "direct main"
     description:
     description:

+ 0 - 1
pubspec.yaml

@@ -63,7 +63,6 @@ dependencies:
   flutter_secure_storage: ^4.2.0
   flutter_secure_storage: ^4.2.0
   flutter_sodium: ^0.2.0
   flutter_sodium: ^0.2.0
   flutter_typeahead: ^4.0.0
   flutter_typeahead: ^4.0.0
-  flutter_windowmanager: ^0.2.0
   fluttertoast: ^8.0.6
   fluttertoast: ^8.0.6
   google_nav_bar: ^5.0.5
   google_nav_bar: ^5.0.5
   http: ^0.13.4
   http: ^0.13.4