|
@@ -9,7 +9,9 @@ import 'package:photos/events/two_factor_status_change_event.dart';
|
|
|
import 'package:photos/services/user_service.dart';
|
|
|
import 'package:photos/ui/app_lock.dart';
|
|
|
import 'package:photos/ui/loading_widget.dart';
|
|
|
+import 'package:photos/ui/sessions_page.dart';
|
|
|
import 'package:photos/ui/settings/settings_section_title.dart';
|
|
|
+import 'package:photos/ui/settings/settings_text_item.dart';
|
|
|
import 'package:photos/utils/auth_util.dart';
|
|
|
import 'package:photos/utils/toast_util.dart';
|
|
|
|
|
@@ -128,86 +130,113 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
|
|
|
),
|
|
|
]);
|
|
|
if (Platform.isAndroid) {
|
|
|
- children.addAll([
|
|
|
- Padding(padding: EdgeInsets.all(4)),
|
|
|
- Divider(height: 4),
|
|
|
- Padding(padding: EdgeInsets.all(4)),
|
|
|
- SizedBox(
|
|
|
- height: 36,
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- Text("hide from recents"),
|
|
|
- Switch(
|
|
|
- value: _config.shouldHideFromRecents(),
|
|
|
- onChanged: (value) async {
|
|
|
- if (value) {
|
|
|
- AlertDialog alert = AlertDialog(
|
|
|
- title: 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,
|
|
|
+ children.addAll(
|
|
|
+ [
|
|
|
+ Padding(padding: EdgeInsets.all(4)),
|
|
|
+ Divider(height: 4),
|
|
|
+ Padding(padding: EdgeInsets.all(4)),
|
|
|
+ SizedBox(
|
|
|
+ height: 36,
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Text("hide from recents"),
|
|
|
+ Switch(
|
|
|
+ value: _config.shouldHideFromRecents(),
|
|
|
+ onChanged: (value) async {
|
|
|
+ if (value) {
|
|
|
+ AlertDialog alert = AlertDialog(
|
|
|
+ title: 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,
|
|
|
+ Padding(padding: EdgeInsets.all(8)),
|
|
|
+ Text(
|
|
|
+ "are you sure?",
|
|
|
+ style: TextStyle(
|
|
|
+ height: 1.5,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- actions: [
|
|
|
- TextButton(
|
|
|
- child:
|
|
|
- Text("no", style: TextStyle(color: Colors.white)),
|
|
|
- onPressed: () {
|
|
|
- Navigator.of(context, rootNavigator: true)
|
|
|
- .pop('dialog');
|
|
|
- },
|
|
|
- ),
|
|
|
- TextButton(
|
|
|
- child: Text("yes",
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white.withOpacity(0.8))),
|
|
|
- onPressed: () async {
|
|
|
- Navigator.of(context, rootNavigator: true)
|
|
|
- .pop('dialog');
|
|
|
- await _config.setShouldHideFromRecents(true);
|
|
|
- await FlutterWindowManager.addFlags(
|
|
|
- FlutterWindowManager.FLAG_SECURE);
|
|
|
- setState(() {});
|
|
|
- },
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ],
|
|
|
- );
|
|
|
+ actions: [
|
|
|
+ TextButton(
|
|
|
+ child: Text("no",
|
|
|
+ style: TextStyle(color: Colors.white)),
|
|
|
+ onPressed: () {
|
|
|
+ Navigator.of(context, rootNavigator: true)
|
|
|
+ .pop('dialog');
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ TextButton(
|
|
|
+ child: Text("yes",
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white.withOpacity(0.8))),
|
|
|
+ onPressed: () async {
|
|
|
+ Navigator.of(context, rootNavigator: true)
|
|
|
+ .pop('dialog');
|
|
|
+ await _config.setShouldHideFromRecents(true);
|
|
|
+ await FlutterWindowManager.addFlags(
|
|
|
+ FlutterWindowManager.FLAG_SECURE);
|
|
|
+ setState(() {});
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
|
|
|
- showDialog(
|
|
|
- context: context,
|
|
|
- builder: (BuildContext context) {
|
|
|
- return alert;
|
|
|
- },
|
|
|
- );
|
|
|
- } else {
|
|
|
- await _config.setShouldHideFromRecents(false);
|
|
|
- await FlutterWindowManager.clearFlags(
|
|
|
- FlutterWindowManager.FLAG_SECURE);
|
|
|
- setState(() {});
|
|
|
- }
|
|
|
- },
|
|
|
- ),
|
|
|
- ],
|
|
|
+ showDialog(
|
|
|
+ context: context,
|
|
|
+ builder: (BuildContext context) {
|
|
|
+ return alert;
|
|
|
+ },
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ await _config.setShouldHideFromRecents(false);
|
|
|
+ await FlutterWindowManager.clearFlags(
|
|
|
+ FlutterWindowManager.FLAG_SECURE);
|
|
|
+ setState(() {});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- ]);
|
|
|
+ Padding(padding: EdgeInsets.all(4)),
|
|
|
+ Divider(height: 4),
|
|
|
+ Padding(padding: EdgeInsets.all(2)),
|
|
|
+ GestureDetector(
|
|
|
+ behavior: HitTestBehavior.translucent,
|
|
|
+ onTap: () async {
|
|
|
+ AppLock.of(context).setEnabled(false);
|
|
|
+ final result = await requestAuthentication();
|
|
|
+ AppLock.of(context)
|
|
|
+ .setEnabled(Configuration.instance.shouldShowLockScreen());
|
|
|
+ if (!result) {
|
|
|
+ showToast("please authenticate to view your active sessions");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Navigator.of(context).push(
|
|
|
+ MaterialPageRoute(
|
|
|
+ builder: (BuildContext context) {
|
|
|
+ return SessionsPage();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ child: SettingsTextItem(
|
|
|
+ text: "active sessions", icon: Icons.navigate_next),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ );
|
|
|
}
|
|
|
return Column(
|
|
|
children: children,
|