Remove setting to hide app from recents on Android

This commit is contained in:
vishnukvmd 2023-01-08 16:50:18 +05:30
parent 6b17a8b5e3
commit 9a8ef0ea34
4 changed files with 0 additions and 107 deletions

View file

@ -64,7 +64,6 @@ class Configuration {
// keyShouldKeepDeviceAwake is used to determine whether the device screen
// should be kept on while the app is in foreground.
static const keyShouldKeepDeviceAwake = "should_keep_device_awake";
static const keyShouldHideFromRecents = "should_hide_from_recents";
static const keyShouldShowLockScreen = "should_show_lock_screen";
static const keyHasSelectedAnyBackupFolder =
"has_selected_any_folder_for_backup";
@ -606,14 +605,6 @@ class Configuration {
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) {
_volatilePassword = volatilePassword;
}

View file

@ -1,8 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_windowmanager/flutter_windowmanager.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart';
import 'package:photos/ente_theme_data.dart';
@ -114,24 +112,6 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
),
),
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(
captionedTextWidget: const CaptionedTextWidget(
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,
);
}
}
}

View file

@ -553,13 +553,6 @@ packages:
description: flutter
source: sdk
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:
dependency: "direct main"
description:

View file

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