feat: Implement logger
This commit is contained in:
parent
e09f2071dc
commit
e7de6d9e25
13 changed files with 80 additions and 131 deletions
|
|
@ -1,73 +0,0 @@
|
|||
import 'package:fluffychat/components/adaptive_page_layout.dart';
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
import 'package:fluffychat/utils/beautify_string_extension.dart';
|
||||
import 'package:fluffychat/views/chat_list.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:olm/olm.dart' as olm;
|
||||
|
||||
class AppInfoView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AdaptivePageLayout(
|
||||
primaryPage: FocusPage.SECOND,
|
||||
firstScaffold: ChatList(),
|
||||
secondScaffold: AppInfo(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppInfo extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var client = Matrix.of(context).client;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(L10n.of(context).accountInformation),
|
||||
),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
title: Text(L10n.of(context).yourOwnUsername + ':'),
|
||||
subtitle: Text(client.userID),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('Homeserver:'),
|
||||
subtitle: Text(client.homeserver.toString()),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('Device name:'),
|
||||
subtitle: Text(client.userDeviceKeys[client.userID]
|
||||
?.deviceKeys[client.deviceID]?.deviceDisplayName ??
|
||||
L10n.of(context).unknownDevice),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('Device ID:'),
|
||||
subtitle: Text(client.deviceID),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('Encryption enabled:'),
|
||||
subtitle: Text(client.encryptionEnabled.toString()),
|
||||
),
|
||||
if (client.encryptionEnabled)
|
||||
Column(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
title: Text('Your public fingerprint key:'),
|
||||
subtitle: Text(client.fingerprintKey.beautified),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('Your public identity key:'),
|
||||
subtitle: Text(client.identityKey.beautified),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('LibOlm version:'),
|
||||
subtitle: Text(olm.get_library_version().join('.')),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import 'package:fluffychat/views/settings_style.dart';
|
|||
import 'package:flushbar/flushbar_helper.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:file_picker_cross/file_picker_cross.dart';
|
||||
import 'package:fluffychat/utils/beautify_string_extension.dart';
|
||||
|
||||
import 'package:fluffychat/app_config.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
|
|
@ -16,6 +17,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:logger_flutter/logger_flutter.dart';
|
||||
|
||||
import '../components/adaptive_page_layout.dart';
|
||||
import '../components/content_banner.dart';
|
||||
|
|
@ -24,7 +26,6 @@ import '../components/matrix.dart';
|
|||
import '../utils/app_route.dart';
|
||||
import '../app_config.dart';
|
||||
import '../config/setting_keys.dart';
|
||||
import 'app_info.dart';
|
||||
import 'chat_list.dart';
|
||||
import 'settings_emotes.dart';
|
||||
|
||||
|
|
@ -433,16 +434,6 @@ class _SettingsState extends State<Settings> {
|
|||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
trailing: Icon(Icons.account_circle_outlined),
|
||||
title: Text(L10n.of(context).accountInformation),
|
||||
onTap: () => Navigator.of(context).push(
|
||||
AppRoute.defaultRoute(
|
||||
context,
|
||||
AppInfoView(),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
trailing: Icon(Icons.bug_report_outlined),
|
||||
title: Text(L10n.of(context).sendBugReports),
|
||||
|
|
@ -450,7 +441,7 @@ class _SettingsState extends State<Settings> {
|
|||
),
|
||||
Divider(thickness: 1),
|
||||
ListTile(
|
||||
trailing: Icon(Icons.vpn_key_outlined),
|
||||
trailing: Icon(Icons.security_outlined),
|
||||
title: Text(
|
||||
L10n.of(context).changePassword,
|
||||
),
|
||||
|
|
@ -589,6 +580,15 @@ class _SettingsState extends State<Settings> {
|
|||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context).yourPublicKey),
|
||||
onTap: () => showOkAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).yourPublicKey,
|
||||
message: client.fingerprintKey.beautified,
|
||||
),
|
||||
trailing: Icon(Icons.vpn_key_outlined),
|
||||
),
|
||||
Divider(thickness: 1),
|
||||
ListTile(
|
||||
title: Text(
|
||||
|
|
@ -598,6 +598,14 @@ class _SettingsState extends State<Settings> {
|
|||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
onTap: () => Navigator.of(context).push(
|
||||
AppRoute.defaultRoute(
|
||||
context,
|
||||
LogConsole(
|
||||
showCloseButton: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
trailing: Icon(Icons.help_outlined),
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ class _EmotesSettingsState extends State<EmotesSettings> {
|
|||
if (readonly) {
|
||||
return;
|
||||
}
|
||||
debugPrint('Saving....');
|
||||
final client = Matrix.of(context).client;
|
||||
// be sure to preserve any data not in "short"
|
||||
Map<String, dynamic> content;
|
||||
|
|
@ -72,7 +71,6 @@ class _EmotesSettingsState extends State<EmotesSettings> {
|
|||
content = client.accountData['im.ponies.user_emotes']?.content ??
|
||||
<String, dynamic>{};
|
||||
}
|
||||
debugPrint(content.toString());
|
||||
if (!(content['emoticons'] is Map)) {
|
||||
content['emoticons'] = <String, dynamic>{};
|
||||
}
|
||||
|
|
@ -95,7 +93,6 @@ class _EmotesSettingsState extends State<EmotesSettings> {
|
|||
}
|
||||
// remove the old "short" key
|
||||
content.remove('short');
|
||||
debugPrint(content.toString());
|
||||
if (widget.room != null) {
|
||||
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
client.sendState(widget.room.id, 'im.ponies.room_emotes', content,
|
||||
|
|
|
|||
|
|
@ -89,7 +89,6 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
|||
return setState(() => loading = false);
|
||||
}
|
||||
} catch (exception) {
|
||||
debugPrint(exception);
|
||||
setState(() => passwordError = exception.toString());
|
||||
return setState(() => loading = false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue