add account settings view

This commit is contained in:
otsmr 2025-02-08 00:31:30 +01:00
parent e7f0488a10
commit 1b47c11aaa
8 changed files with 110 additions and 50 deletions

View file

@ -10,13 +10,17 @@ Don't be lonely, get twonly! Send pictures to a friend in real time and be sure
- Nachrichten nach 24h Stunden löschen
- Real deployment aufsetzen, direkt auf Netcup?
- Pro Invitation codes
- Push Notification (Android)
- FIX: Problem Bild falsch, wenn handy schräg...
- MediaView:
- Bei weiteren geladenen Bildern -> Direkt anzeigen ohne zu popen
## TODOS bevor first release
- Webpage
- Instagam
- Instagam & Marketing vorbereiten
- IT-Startup der TU Darmstadt anschreiben
- iOS version
## Later todos
- Videos
- Sealed Sender

View file

@ -26,7 +26,7 @@ class PermissionHandlerViewState extends State<PermissionHandlerView> {
Map<Permission, PermissionStatus> statuses = await [
Permission.camera,
Permission.microphone,
//add more permission to request here.
Permission.notification
].request();
if (statuses[Permission.microphone]!.isPermanentlyDenied) {

View file

@ -42,9 +42,14 @@
"settingsHelpLicenses": "Licenses",
"settingsHelpLegal": "Terms & Privacy Policy",
"settingsAppearanceTheme": "Theme",
"settingsAccountDeleteAccount": "Delete account",
"settingsAccountDeleteModalTitle": "Are you sure?",
"settingsAccountDeleteModalBody": "Your account will be deleted. There is no change to restore it.",
"undo": "Undo",
"redo": "Redo",
"close": "Close",
"cancel": "Cancel",
"ok": "Ok",
"switchFrontAndBackCamera": "Switch between front and back camera.",
"addTextItem": "Text",
"protectAsARealTwonly": "Send as real twonly!",

View file

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:convert';
import 'package:logging/logging.dart';
import 'package:twonly/main.dart';
@ -186,11 +187,22 @@ class _RegisterViewState extends State<RegisterView> {
}
}
showAlertDialog(BuildContext context, String title, String content) {
Future<bool> showAlertDialog(
BuildContext context, String title, String content) async {
Completer<bool> completer = Completer<bool>();
// set up the button
Widget okButton = TextButton(
child: Text("OK"),
child: Text(context.lang.ok),
onPressed: () {
completer.complete(true); // Complete the future with true
Navigator.pop(context);
},
);
Widget cancelButton = TextButton(
child: Text(context.lang.cancel),
onPressed: () {
completer.complete(false); // Complete the future with true
Navigator.pop(context);
},
);
@ -200,6 +212,7 @@ showAlertDialog(BuildContext context, String title, String content) {
title: Text(title),
content: Text(content),
actions: [
cancelButton,
okButton,
],
);
@ -211,4 +224,5 @@ showAlertDialog(BuildContext context, String title, String content) {
return alert;
},
);
return completer.future;
}

View file

@ -1,14 +1,48 @@
import 'package:restart_app/restart_app.dart';
import 'package:flutter/material.dart';
import 'package:twonly/src/utils/misc.dart';
import 'package:twonly/src/utils/storage.dart';
import 'package:twonly/src/views/onboarding/register_view.dart';
class AccountView extends StatelessWidget {
const AccountView({super.key});
// FilledButton.icon(
// onPressed: () async {
// await deleteLocalUserData();
// Restart.restartApp(
// notificationTitle: 'Successfully logged out',
// notificationBody: 'Click here to open the app again',
// );
// },
// label: Text("Logout"),
// icon: Icon(Icons.no_accounts),
// ),
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(context.lang.settingsAccount),
),
body: ListView(
children: [
ListTile(
title: Text("Transfer account"),
subtitle: Text("Coming soon"),
onTap: () async {
showAlertDialog(context, "Coming soon",
"This feature is not yet implemented!");
},
),
ListTile(
title: Text(context.lang.settingsAccountDeleteAccount,
style: TextStyle(color: Colors.red)),
onTap: () async {
bool ok = await showAlertDialog(
context,
context.lang.settingsAccountDeleteModalTitle,
context.lang.settingsAccountDeleteModalBody);
if (ok) {
await deleteLocalUserData();
Restart.restartApp(
notificationTitle: 'Successfully logged out',
notificationBody: 'Click here to open the app again',
);
}
},
),
],
),
);
}
}

View file

@ -6,6 +6,7 @@ import 'package:twonly/src/model/json/user_data.dart';
import 'package:flutter/material.dart';
import 'package:twonly/src/utils/misc.dart';
import 'package:twonly/src/utils/storage.dart';
import 'package:twonly/src/views/settings/account_view.dart';
import 'package:twonly/src/views/settings/appearance_view.dart';
import 'package:twonly/src/views/settings/help_view.dart';
@ -80,7 +81,12 @@ class _ProfileViewState extends State<ProfileView> {
SettingsListTile(
icon: FontAwesomeIcons.user,
text: context.lang.settingsAccount,
onTap: () {},
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) {
return AccountView();
}));
},
),
SettingsListTile(
icon: FontAwesomeIcons.shieldHeart,
@ -110,17 +116,17 @@ class _ProfileViewState extends State<ProfileView> {
const AndroidNotificationDetails
androidNotificationDetails = AndroidNotificationDetails(
'0',
'Messages2',
'Messages',
channelDescription: 'Messages from other users.',
importance: Importance.max,
priority: Priority.max,
ticker: 'ticker',
ticker: 'You got a new message.',
);
const NotificationDetails notificationDetails =
NotificationDetails(
android: androidNotificationDetails);
await flutterLocalNotificationsPlugin.show(
1,
0,
'New message from x',
'You got a new message from XX',
notificationDetails,

View file

@ -5,15 +5,10 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "03f6da266a27a4538a69295ec142cb5717d7d4e5727b84658b63e1e1509bac9c"
sha256: dc27559385e905ad30838356c5f5d574014ba39872d732111cd07ac0beff4c57
url: "https://pub.dev"
source: hosted
version: "79.0.0"
_macros:
dependency: transitive
description: dart
source: sdk
version: "0.3.3"
version: "80.0.0"
adaptive_number:
dependency: transitive
description:
@ -26,10 +21,10 @@ packages:
dependency: transitive
description:
name: analyzer
sha256: c9040fc56483c22a5e04a9f6a251313118b1a3c42423770623128fa484115643
sha256: "192d1c5b944e7e53b24b5586db760db934b177d4147c42fbca8c8c5f1eb8d11e"
url: "https://pub.dev"
source: hosted
version: "7.2.0"
version: "7.3.0"
archive:
dependency: transitive
description:
@ -202,10 +197,10 @@ packages:
dependency: "direct main"
description:
name: connectivity_plus
sha256: "8a68739d3ee113e51ad35583fdf9ab82c55d09d693d3c39da1aebab87c938412"
sha256: "04bf81bb0b77de31557b58d052b24b3eee33f09a6e7a8c68a3e247c7df19ec27"
url: "https://pub.dev"
source: hosted
version: "6.1.2"
version: "6.1.3"
connectivity_plus_platform_interface:
dependency: transitive
description:
@ -327,10 +322,10 @@ packages:
dependency: transitive
description:
name: flutter_image_compress_common
sha256: "7f79bc6c8a363063620b4e372fa86bc691e1cb28e58048cd38e030692fbd99ee"
sha256: c5c5d50c15e97dd7dc72ff96bd7077b9f791932f2076c5c5b6c43f2c88607bfb
url: "https://pub.dev"
source: hosted
version: "1.0.5"
version: "1.0.6"
flutter_image_compress_macos:
dependency: transitive
description:
@ -550,10 +545,10 @@ packages:
dependency: transitive
description:
name: glob
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de
url: "https://pub.dev"
source: hosted
version: "2.1.2"
version: "2.1.3"
google_fonts:
dependency: "direct main"
description:
@ -590,10 +585,10 @@ packages:
dependency: transitive
description:
name: http
sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f
url: "https://pub.dev"
source: hosted
version: "1.2.2"
version: "1.3.0"
http_multi_server:
dependency: transitive
description:
@ -762,14 +757,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.3.1"
macros:
dependency: transitive
description:
name: macros
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
url: "https://pub.dev"
source: hosted
version: "0.1.3-main.0"
matcher:
dependency: transitive
description:
@ -1347,18 +1334,18 @@ packages:
dependency: "direct main"
description:
name: web_socket_channel
sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f"
sha256: "0b8e2457400d8a859b7b2030786835a28a8e80836ef64402abef392ff4f1d0e5"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.0.2"
win32:
dependency: transitive
description:
name: win32
sha256: "154360849a56b7b67331c21f09a386562d88903f90a1099c5987afc1912e1f29"
sha256: daf97c9d80197ed7b619040e86c8ab9a9dad285e7671ee7390f9180cc828a51e
url: "https://pub.dev"
source: hosted
version: "5.10.0"
version: "5.10.1"
x25519:
dependency: transitive
description:

View file

@ -77,6 +77,16 @@ flutter:
assets:
# Add assets from the images directory to the application.
# - assets/images/
# - assets/images/logo.jpg
- assets/images/logo.jpg
- assets/
- assets/images/
- assets/animations/present.lottie.json
- assets/animations/selfie.json
- assets/animations/messages.json
- assets/animations/local.json
- assets/animations/test.json
- assets/animations/product.json
- assets/animations/twonlies.json
- assets/animations/rocket.json
- assets/animations/e2e.json