feat: Enhanced configuration
This commit is contained in:
parent
11c2a8bb26
commit
8eb2e2fb9d
22 changed files with 191 additions and 236 deletions
|
|
@ -33,7 +33,7 @@ import 'package:swipe_to_action/swipe_to_action.dart';
|
|||
|
||||
import '../components/dialogs/send_file_dialog.dart';
|
||||
import '../components/input_bar.dart';
|
||||
import '../config/app_config.dart';
|
||||
import '../app_config.dart';
|
||||
import '../utils/matrix_file_extension.dart';
|
||||
import 'chat_details.dart';
|
||||
import 'chat_list.dart';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/app_config.dart';
|
||||
import 'package:fluffychat/utils/fluffy_share.dart';
|
||||
import 'package:fluffychat/views/chat_permissions_settings.dart';
|
||||
import 'package:flushbar/flushbar_helper.dart';
|
||||
|
|
@ -202,7 +202,7 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|||
IconButton(
|
||||
icon: Icon(Icons.share_outlined),
|
||||
onPressed: () => FluffyShare.share(
|
||||
AppConfig.matrixToLinkPrefix +
|
||||
AppConfig.inviteLinkPrefix +
|
||||
widget.room.canonicalAlias,
|
||||
context),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import 'package:fluffychat/components/connection_status_header.dart';
|
|||
import 'package:fluffychat/components/default_app_bar_search_field.dart';
|
||||
import 'package:fluffychat/components/default_drawer.dart';
|
||||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/app_config.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -105,7 +105,7 @@ class _ChatListState extends State<ChatList> {
|
|||
if (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).popUntil((r) => r.isFirst);
|
||||
}
|
||||
if (text.startsWith(AppConfig.matrixToLinkPrefix)) {
|
||||
if (text.startsWith(AppConfig.inviteLinkPrefix)) {
|
||||
UrlLauncher(context, text).openMatrixToUrl();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import 'package:adaptive_dialog/adaptive_dialog.dart';
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/app_config.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/utils/sentry_controller.dart';
|
||||
|
|
@ -12,6 +12,8 @@ import 'package:fluffychat/views/sign_up.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'login.dart';
|
||||
|
||||
class HomeserverPicker extends StatelessWidget {
|
||||
Future<void> _setHomeserverAction(BuildContext context) async {
|
||||
const prefix = 'https://';
|
||||
|
|
@ -42,7 +44,8 @@ class HomeserverPicker extends StatelessWidget {
|
|||
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
checkHomeserver(homeserver, Matrix.of(context).client));
|
||||
if (success == true) {
|
||||
await Navigator.of(context).push(AppRoute(SignUp()));
|
||||
await Navigator.of(context)
|
||||
.push(AppRoute(AppConfig.enableRegistration ? SignUp() : Login()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,35 +64,42 @@ class HomeserverPicker extends StatelessWidget {
|
|||
max((MediaQuery.of(context).size.width - 600) / 2, 0)),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Hero(
|
||||
tag: 'loginBanner',
|
||||
child: InkWell(
|
||||
onTap: () => showAboutDialog(
|
||||
context: context,
|
||||
children: [
|
||||
RaisedButton(
|
||||
child: Text(L10n.of(context).privacy),
|
||||
onPressed: () => launch(AppConfig.privacyUrl),
|
||||
)
|
||||
],
|
||||
applicationIcon:
|
||||
Image.asset('assets/logo.png', width: 100, height: 100),
|
||||
applicationName: AppConfig.applicationName,
|
||||
),
|
||||
child: Image.asset('assets/fluffychat-banner.png'),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
Hero(
|
||||
tag: 'loginBanner',
|
||||
child: InkWell(
|
||||
onTap: () => showAboutDialog(
|
||||
context: context,
|
||||
children: [
|
||||
RaisedButton(
|
||||
child: Text(L10n.of(context).privacy),
|
||||
onPressed: () => launch(AppConfig.privacyUrl),
|
||||
)
|
||||
],
|
||||
applicationIcon: Image.asset('assets/logo.png',
|
||||
width: 100, height: 100),
|
||||
applicationName: AppConfig.applicationName,
|
||||
),
|
||||
child: Image.asset('assets/banner.png'),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
AppConfig.applicationWelcomeMessage ??
|
||||
L10n.of(context).welcomeText,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
L10n.of(context).welcomeText,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
SizedBox(height: 16),
|
||||
Hero(
|
||||
tag: 'loginButton',
|
||||
child: Container(
|
||||
|
|
@ -123,16 +133,31 @@ class HomeserverPicker extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(
|
||||
L10n.of(context).changeTheHomeserver,
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: Colors.blue,
|
||||
fontSize: 16,
|
||||
Wrap(
|
||||
children: [
|
||||
if (AppConfig.allowOtherHomeservers)
|
||||
FlatButton(
|
||||
child: Text(
|
||||
L10n.of(context).changeTheHomeserver,
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
color: Theme.of(context).primaryColor,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
onPressed: () => _setHomeserverAction(context),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(
|
||||
L10n.of(context).privacy,
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
onPressed: () => launch(AppConfig.privacyUrl),
|
||||
),
|
||||
),
|
||||
onPressed: () => _setHomeserverAction(context),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class _LoginState extends State<Login> {
|
|||
await matrix.client.login(
|
||||
user: usernameController.text,
|
||||
password: passwordController.text,
|
||||
initialDeviceDisplayName: matrix.widget.clientName);
|
||||
initialDeviceDisplayName: matrix.clientName);
|
||||
} on MatrixException catch (exception) {
|
||||
setState(() => passwordError = exception.errorMessage);
|
||||
return setState(() => loading = false);
|
||||
|
|
@ -59,7 +59,7 @@ class _LoginState extends State<Login> {
|
|||
}
|
||||
await FirebaseController.setupFirebase(
|
||||
matrix,
|
||||
matrix.widget.clientName,
|
||||
matrix.clientName,
|
||||
).catchError(SentryController.captureException);
|
||||
|
||||
setState(() => loading = false);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import 'package:flushbar/flushbar_helper.dart';
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:file_picker_cross/file_picker_cross.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/app_config.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/utils/sentry_controller.dart';
|
||||
import 'package:fluffychat/views/settings_devices.dart';
|
||||
|
|
@ -22,7 +22,7 @@ import '../components/content_banner.dart';
|
|||
import '../components/dialogs/simple_dialogs.dart';
|
||||
import '../components/matrix.dart';
|
||||
import '../utils/app_route.dart';
|
||||
import '../config/app_config.dart';
|
||||
import '../app_config.dart';
|
||||
import '../config/setting_keys.dart';
|
||||
import 'app_info.dart';
|
||||
import 'chat_list.dart';
|
||||
|
|
@ -141,8 +141,7 @@ class _SettingsState extends State<Settings> {
|
|||
title: L10n.of(context).editJitsiInstance,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
initialText:
|
||||
Matrix.of(context).jitsiInstance.replaceFirst(prefix, ''),
|
||||
initialText: AppConfig.jitsiInstance.replaceFirst(prefix, ''),
|
||||
prefixText: prefix,
|
||||
),
|
||||
],
|
||||
|
|
@ -154,7 +153,7 @@ class _SettingsState extends State<Settings> {
|
|||
}
|
||||
final matrix = Matrix.of(context);
|
||||
await matrix.store.setItem(SettingKeys.jitsiInstance, jitsi);
|
||||
matrix.jitsiInstance = jitsi;
|
||||
AppConfig.jitsiInstance = jitsi;
|
||||
}
|
||||
|
||||
void setDisplaynameAction(BuildContext context) async {
|
||||
|
|
@ -411,7 +410,7 @@ class _SettingsState extends State<Settings> {
|
|||
ListTile(
|
||||
trailing: Icon(Icons.phone_outlined),
|
||||
title: Text(L10n.of(context).editJitsiInstance),
|
||||
subtitle: Text(Matrix.of(context).jitsiInstance),
|
||||
subtitle: Text(AppConfig.jitsiInstance),
|
||||
onTap: () => setJitsiInstanceAction(context),
|
||||
),
|
||||
ListTile(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import 'dart:io';
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/components/adaptive_page_layout.dart';
|
||||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:fluffychat/utils/firebase_controller.dart';
|
||||
import 'package:fluffychat/app_config.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
|
@ -68,9 +68,9 @@ class SettingsNotifications extends StatelessWidget {
|
|||
await NotificationSetting.configureChannel(
|
||||
NotificationDetails(
|
||||
android: AndroidNotificationDetails(
|
||||
FirebaseController.CHANNEL_ID,
|
||||
FirebaseController.CHANNEL_NAME,
|
||||
FirebaseController.CHANNEL_DESCRIPTION,
|
||||
AppConfig.pushNotificationsChannelId,
|
||||
AppConfig.pushNotificationsChannelName,
|
||||
AppConfig.pushNotificationsChannelDescription,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class _SignUpState extends State<SignUp> {
|
|||
children: <Widget>[
|
||||
Hero(
|
||||
tag: 'loginBanner',
|
||||
child: Image.asset('assets/fluffychat-banner.png'),
|
||||
child: Image.asset('assets/banner.png'),
|
||||
),
|
||||
ListTile(
|
||||
leading: CircleAvatar(
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
|||
await matrix.client.register(
|
||||
username: widget.username,
|
||||
password: passwordController.text,
|
||||
initialDeviceDisplayName: matrix.widget.clientName,
|
||||
initialDeviceDisplayName: matrix.clientName,
|
||||
auth: auth,
|
||||
);
|
||||
await waitForLogin;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue