From dcf4c4cd00b51c99926ff5b5b645b97180701db0 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 18 Sep 2020 12:58:22 +0200 Subject: [PATCH] feat: Add license page --- lib/components/matrix.dart | 1 - lib/config/app_config.dart | 4 ++++ lib/views/homeserver_picker.dart | 7 +++--- lib/views/settings.dart | 9 ++++++-- pubspec.lock | 37 +++++++++++++++++++++++++++++++- 5 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 lib/config/app_config.dart diff --git a/lib/components/matrix.dart b/lib/components/matrix.dart index a446dd6..b977b79 100644 --- a/lib/components/matrix.dart +++ b/lib/components/matrix.dart @@ -19,7 +19,6 @@ import '../utils/app_route.dart'; class Matrix extends StatefulWidget { static const String callNamespace = 'chat.fluffy.jitsi_call'; - static const String defaultHomeserver = 'tchncs.de'; final Widget child; diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart new file mode 100644 index 0000000..3b042ce --- /dev/null +++ b/lib/config/app_config.dart @@ -0,0 +1,4 @@ +abstract class AppConfig { + static const String applicationName = 'FluffyChat'; + static const String defaultHomeserver = 'matrix.tchncs.de'; +} diff --git a/lib/views/homeserver_picker.dart b/lib/views/homeserver_picker.dart index 0fcfde4..a0ab930 100644 --- a/lib/views/homeserver_picker.dart +++ b/lib/views/homeserver_picker.dart @@ -2,6 +2,7 @@ import 'dart:math'; import 'package:fluffychat/components/dialogs/simple_dialogs.dart'; import 'package:fluffychat/components/matrix.dart'; +import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/l10n/l10n.dart'; import 'package:fluffychat/utils/app_route.dart'; import 'package:fluffychat/utils/sentry_controller.dart'; @@ -12,7 +13,7 @@ class HomeserverPicker extends StatelessWidget { Future _setHomeserverAction(BuildContext context) async { final homeserver = await SimpleDialogs(context).enterText( titleText: L10n.of(context).enterYourHomeserver, - hintText: Matrix.defaultHomeserver, + hintText: AppConfig.defaultHomeserver, prefixText: 'https://', keyboardType: TextInputType.url); if (homeserver?.isEmpty ?? true) return; @@ -83,7 +84,7 @@ class HomeserverPicker extends StatelessWidget { style: TextStyle(color: Colors.white, fontSize: 16), ), onPressed: () => _checkHomeserverAction( - Matrix.defaultHomeserver, context), + AppConfig.defaultHomeserver, context), ), ), ), @@ -94,7 +95,7 @@ class HomeserverPicker extends StatelessWidget { opacity: 0.75, child: Text( L10n.of(context).byDefaultYouWillBeConnectedTo( - Matrix.defaultHomeserver), + AppConfig.defaultHomeserver), textAlign: TextAlign.center, style: TextStyle( fontSize: 16, diff --git a/lib/views/settings.dart b/lib/views/settings.dart index 24636d3..9e52a3b 100644 --- a/lib/views/settings.dart +++ b/lib/views/settings.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:famedlysdk/famedlysdk.dart'; import 'package:fluffychat/components/settings_themes.dart'; +import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/utils/sentry_controller.dart'; import 'package:fluffychat/views/settings_devices.dart'; import 'package:flutter/foundation.dart'; @@ -481,8 +482,12 @@ class _SettingsState extends State { ListTile( trailing: Icon(Icons.code), title: Text(L10n.of(context).sourceCode), - onTap: () => launch( - 'https://gitlab.com/ChristianPauly/fluffychat-flutter'), + onTap: () => showLicensePage( + context: context, + applicationIcon: + Image.asset('assets/logo.png', width: 100, height: 100), + applicationName: AppConfig.applicationName, + ), ), ], ), diff --git a/pubspec.lock b/pubspec.lock index 4b93d53..5398fe8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -220,13 +220,41 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.1" + firebase: + dependency: transitive + description: + name: firebase + url: "https://pub.dartlang.org" + source: hosted + version: "7.3.0" + firebase_core: + dependency: transitive + description: + name: firebase_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" firebase_messaging: dependency: "direct main" description: name: firebase_messaging url: "https://pub.dartlang.org" source: hosted - version: "6.0.16" + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -683,6 +711,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.4.4" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" random_string: dependency: "direct main" description: