Add button under account to show userid+tokens
This commit is contained in:
@@ -21,7 +21,7 @@ run-web: java gen
|
|||||||
run-android: java gen
|
run-android: java gen
|
||||||
ping -c1 10.10.10.177
|
ping -c1 10.10.10.177
|
||||||
adb connect 10.10.10.177:5555
|
adb connect 10.10.10.177:5555
|
||||||
flutter pub run build_runner build
|
dart run build_runner build
|
||||||
_JAVA_OPTIONS="" flutter run -d 10.10.10.177:5555
|
_JAVA_OPTIONS="" flutter run -d 10.10.10.177:5555
|
||||||
|
|
||||||
install-release: java gen
|
install-release: java gen
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class _FilterModalPriorityState extends State<FilterModalPriority> {
|
|||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Priority'),
|
title: const Text('Priority'),
|
||||||
content: Container(
|
content: Container(
|
||||||
width: 0,
|
width: 9000,
|
||||||
height: 200,
|
height: 200,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:simplecloudnotifier/api/api_client.dart';
|
|||||||
import 'package:simplecloudnotifier/components/error_display/error_display.dart';
|
import 'package:simplecloudnotifier/components/error_display/error_display.dart';
|
||||||
import 'package:simplecloudnotifier/models/user.dart';
|
import 'package:simplecloudnotifier/models/user.dart';
|
||||||
import 'package:simplecloudnotifier/pages/account/login.dart';
|
import 'package:simplecloudnotifier/pages/account/login.dart';
|
||||||
|
import 'package:simplecloudnotifier/pages/account/show_token_modal.dart';
|
||||||
import 'package:simplecloudnotifier/pages/channel_list/channel_list_extended.dart';
|
import 'package:simplecloudnotifier/pages/channel_list/channel_list_extended.dart';
|
||||||
import 'package:simplecloudnotifier/pages/client_list/client_list.dart';
|
import 'package:simplecloudnotifier/pages/client_list/client_list.dart';
|
||||||
import 'package:simplecloudnotifier/pages/filtered_message_view/filtered_message_view.dart';
|
import 'package:simplecloudnotifier/pages/filtered_message_view/filtered_message_view.dart';
|
||||||
@@ -268,7 +269,20 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
|||||||
_buildHeader(context, user),
|
_buildHeader(context, user),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Text(user.username ?? user.userID, overflow: TextOverflow.ellipsis, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20)),
|
Text(user.username ?? user.userID, overflow: TextOverflow.ellipsis, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20)),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 8),
|
||||||
|
if (acc.tokenSend != null || acc.tokenAdmin != null)
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: UI.button(
|
||||||
|
text: 'UserID & Token kopieren',
|
||||||
|
onPressed: () => _showTokenModal(context, acc),
|
||||||
|
icon: FontAwesomeIcons.copy,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
..._buildCards(context, user),
|
..._buildCards(context, user),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
_buildFooter(context, user),
|
_buildFooter(context, user),
|
||||||
@@ -460,14 +474,16 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
|||||||
text: 'Logout',
|
text: 'Logout',
|
||||||
onPressed: _logout,
|
onPressed: _logout,
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: UI.button(
|
child: UI.button(
|
||||||
text: 'Delete Account',
|
text: 'Delete Account',
|
||||||
onPressed: _deleteAccount,
|
onPressed: _deleteAccount,
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -717,4 +733,11 @@ class _AccountRootPageState extends State<AccountRootPage> {
|
|||||||
|
|
||||||
return completer.future;
|
return completer.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showTokenModal(BuildContext context, AppAuth acc) {
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => ShowTokenModal(account: acc),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
80
flutter/lib/pages/account/show_token_modal.dart
Normal file
80
flutter/lib/pages/account/show_token_modal.dart
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:simplecloudnotifier/components/badge_display/badge_display.dart';
|
||||||
|
import 'package:simplecloudnotifier/state/app_auth.dart';
|
||||||
|
import 'package:simplecloudnotifier/utils/toaster.dart';
|
||||||
|
import 'package:simplecloudnotifier/utils/ui.dart';
|
||||||
|
|
||||||
|
class ShowTokenModal extends StatelessWidget {
|
||||||
|
final AppAuth account;
|
||||||
|
|
||||||
|
const ShowTokenModal({
|
||||||
|
Key? key,
|
||||||
|
required this.account,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('UserID + Token'),
|
||||||
|
content: Container(
|
||||||
|
width: 9000,
|
||||||
|
height: 400,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
const BadgeDisplay(
|
||||||
|
text: "Use your UserID and Send-Token to send messages to your account.\n\nThe Admin-Token should not be shared.",
|
||||||
|
icon: null,
|
||||||
|
mode: BadgeMode.warn,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
if (this.account.userID != null)
|
||||||
|
UI.metaCard(
|
||||||
|
context: context,
|
||||||
|
icon: FontAwesomeIcons.solidUser,
|
||||||
|
title: 'UserID',
|
||||||
|
values: [this.account.userID!],
|
||||||
|
iconActions: [(FontAwesomeIcons.copy, null, () => _copy('UserID', this.account.userID!))],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
if (this.account.tokenSend != null)
|
||||||
|
UI.metaCard(
|
||||||
|
context: context,
|
||||||
|
icon: FontAwesomeIcons.solidKey,
|
||||||
|
title: 'Send-Token',
|
||||||
|
values: [this.account.tokenSend!],
|
||||||
|
iconActions: [(FontAwesomeIcons.copy, null, () => _copy('Send-Token', this.account.tokenSend!))],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
if (this.account.tokenSend != null)
|
||||||
|
UI.metaCard(
|
||||||
|
context: context,
|
||||||
|
icon: FontAwesomeIcons.solidKey,
|
||||||
|
title: 'Admin-Token',
|
||||||
|
values: [this.account.tokenAdmin!],
|
||||||
|
iconActions: [(FontAwesomeIcons.copy, null, () => _copy('Admin-Token', this.account.tokenAdmin!))],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('Close'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _copy(String txt, String v) {
|
||||||
|
Clipboard.setData(new ClipboardData(text: v));
|
||||||
|
Toaster.info("Clipboard", 'Copied ${txt} to Clipboard');
|
||||||
|
print('================= [CLIPBOARD] =================\n${v}\n================= [/CLIPBOARD] =================');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,7 +52,7 @@ class _KeyTokenCreateDialogState extends State<KeyTokenCreateDialog> {
|
|||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Create new key'),
|
title: const Text('Create new key'),
|
||||||
content: Container(
|
content: Container(
|
||||||
width: 0,
|
width: 9000,
|
||||||
height: 400,
|
height: 400,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class KeyTokenCreatedModal extends StatelessWidget {
|
|||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('A new key was created'),
|
title: const Text('A new key was created'),
|
||||||
content: Container(
|
content: Container(
|
||||||
width: 0,
|
width: 9000,
|
||||||
height: 350,
|
height: 350,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class _EditKeyTokenChannelsDialogState extends State<EditKeyTokenChannelsDialog>
|
|||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Channels'),
|
title: const Text('Channels'),
|
||||||
content: Container(
|
content: Container(
|
||||||
width: 0,
|
width: 9000,
|
||||||
height: 400,
|
height: 400,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class _EditKeyTokenPermissionsDialogState extends State<EditKeyTokenPermissionsD
|
|||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Permissions'),
|
title: const Text('Permissions'),
|
||||||
content: Container(
|
content: Container(
|
||||||
width: 0,
|
width: 9000,
|
||||||
height: 400,
|
height: 400,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: simplecloudnotifier
|
|||||||
description: "Receive push messages"
|
description: "Receive push messages"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 2.0.1+495
|
version: 2.0.1+496
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.2.6 <4.0.0'
|
sdk: '>=3.2.6 <4.0.0'
|
||||||
|
|||||||
Reference in New Issue
Block a user