2021-01-24 15:38:25 +00:00
|
|
|
import 'dart:ui';
|
|
|
|
|
2021-11-13 16:57:55 +00:00
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
|
2020-12-11 13:14:33 +00:00
|
|
|
abstract class AppConfig {
|
2020-12-18 10:43:13 +00:00
|
|
|
static String _applicationName = 'FluffyChat';
|
|
|
|
static String get applicationName => _applicationName;
|
2021-11-19 19:15:07 +00:00
|
|
|
static String? _applicationWelcomeMessage;
|
|
|
|
static String? get applicationWelcomeMessage => _applicationWelcomeMessage;
|
2021-06-06 14:55:31 +00:00
|
|
|
static String _defaultHomeserver = 'matrix.org';
|
2020-12-18 10:43:13 +00:00
|
|
|
static String get defaultHomeserver => _defaultHomeserver;
|
2021-11-13 12:06:36 +00:00
|
|
|
static double fontSizeFactor = 1;
|
2022-05-18 06:54:50 +00:00
|
|
|
static const Color chatColor = primaryColor;
|
2022-05-18 10:13:59 +00:00
|
|
|
static Color? colorSchemeSeed = primaryColor;
|
2024-07-26 19:02:58 +00:00
|
|
|
static const double messageFontSize = 16.0;
|
2020-12-11 13:14:33 +00:00
|
|
|
static const bool allowOtherHomeservers = true;
|
|
|
|
static const bool enableRegistration = true;
|
2023-03-19 18:59:50 +00:00
|
|
|
static const Color primaryColor = Color(0xFF5625BA);
|
2021-01-31 22:54:33 +00:00
|
|
|
static const Color primaryColorLight = Color(0xFFCCBDEA);
|
2021-05-31 15:43:27 +00:00
|
|
|
static const Color secondaryColor = Color(0xFF41a2bc);
|
2021-11-05 08:53:27 +00:00
|
|
|
static String _privacyUrl =
|
2023-07-23 07:20:25 +00:00
|
|
|
'https://github.com/krille-chan/fluffychat/blob/main/PRIVACY.md';
|
2020-12-18 10:43:13 +00:00
|
|
|
static String get privacyUrl => _privacyUrl;
|
2021-11-05 08:53:27 +00:00
|
|
|
static const String enablePushTutorial =
|
2023-07-23 07:20:25 +00:00
|
|
|
'https://github.com/krille-chan/fluffychat/wiki/Push-Notifications-without-Google-Services';
|
2022-12-26 16:47:08 +00:00
|
|
|
static const String encryptionTutorial =
|
2023-07-23 07:20:25 +00:00
|
|
|
'https://github.com/krille-chan/fluffychat/wiki/How-to-use-end-to-end-encryption-in-FluffyChat';
|
2023-11-19 11:49:15 +00:00
|
|
|
static const String startChatTutorial =
|
|
|
|
'https://github.com/krille-chan/fluffychat/wiki/How-to-Find-Users-in-FluffyChat';
|
2021-01-18 21:59:02 +00:00
|
|
|
static const String appId = 'im.fluffychat.FluffyChat';
|
2021-02-01 11:12:28 +00:00
|
|
|
static const String appOpenUrlScheme = 'im.fluffychat';
|
2021-06-18 13:38:01 +00:00
|
|
|
static String _webBaseUrl = 'https://fluffychat.im/web';
|
|
|
|
static String get webBaseUrl => _webBaseUrl;
|
2023-07-14 23:51:09 +00:00
|
|
|
static const String sourceCodeUrl =
|
|
|
|
'https://github.com/krille-chan/fluffychat';
|
2020-12-11 13:14:33 +00:00
|
|
|
static const String supportUrl =
|
2023-07-14 23:51:09 +00:00
|
|
|
'https://github.com/krille-chan/fluffychat/issues';
|
2024-07-31 13:23:25 +00:00
|
|
|
static const String changelogUrl =
|
|
|
|
'https://github.com/krille-chan/fluffychat/blob/main/CHANGELOG.md';
|
2023-05-16 16:45:39 +00:00
|
|
|
static final Uri newIssueUrl = Uri(
|
|
|
|
scheme: 'https',
|
2023-07-23 07:23:18 +00:00
|
|
|
host: 'github.com',
|
|
|
|
path: '/krille-chan/fluffychat/issues/new',
|
2023-05-16 16:45:39 +00:00
|
|
|
);
|
2021-04-09 15:40:14 +00:00
|
|
|
static bool renderHtml = true;
|
2020-12-11 13:14:33 +00:00
|
|
|
static bool hideRedactedEvents = false;
|
2021-04-09 15:40:14 +00:00
|
|
|
static bool hideUnknownEvents = true;
|
2022-10-15 08:38:06 +00:00
|
|
|
static bool hideUnimportantStateEvents = true;
|
2022-04-03 17:00:35 +00:00
|
|
|
static bool separateChatTypes = false;
|
2021-08-07 17:36:42 +00:00
|
|
|
static bool autoplayImages = true;
|
2023-07-27 16:15:50 +00:00
|
|
|
static bool sendTypingNotifications = true;
|
2024-01-20 08:13:53 +00:00
|
|
|
static bool sendPublicReadReceipts = true;
|
2024-06-03 22:31:37 +00:00
|
|
|
static bool swipeRightToLeftToReply = true;
|
2023-12-23 08:17:31 +00:00
|
|
|
static bool? sendOnEnter;
|
2024-02-11 16:04:46 +00:00
|
|
|
static bool showPresences = true;
|
2022-02-19 10:58:21 +00:00
|
|
|
static bool experimentalVoip = false;
|
2020-12-12 16:01:59 +00:00
|
|
|
static const bool hideTypingUsernames = false;
|
2020-12-12 08:27:17 +00:00
|
|
|
static const bool hideAllStateEvents = false;
|
2020-12-11 13:14:33 +00:00
|
|
|
static const String inviteLinkPrefix = 'https://matrix.to/#/';
|
2021-11-22 18:19:18 +00:00
|
|
|
static const String deepLinkPrefix = 'im.fluffychat://chat/';
|
2021-01-10 17:00:27 +00:00
|
|
|
static const String schemePrefix = 'matrix:';
|
2020-12-11 13:14:33 +00:00
|
|
|
static const String pushNotificationsChannelId = 'fluffychat_push';
|
|
|
|
static const String pushNotificationsAppId = 'chat.fluffy.fluffychat';
|
2021-01-14 17:00:16 +00:00
|
|
|
static const String pushNotificationsGatewayUrl =
|
2023-09-15 06:52:05 +00:00
|
|
|
'https://push.fluffychat.im/_matrix/push/v1/notify';
|
2020-12-11 13:14:33 +00:00
|
|
|
static const String pushNotificationsPusherFormat = 'event_id_only';
|
2021-01-20 18:53:19 +00:00
|
|
|
static const String emojiFontName = 'Noto Emoji';
|
|
|
|
static const String emojiFontUrl =
|
|
|
|
'https://github.com/googlefonts/noto-emoji/';
|
2024-03-10 14:18:36 +00:00
|
|
|
static const double borderRadius = 18.0;
|
2021-05-23 11:11:55 +00:00
|
|
|
static const double columnWidth = 360.0;
|
2023-12-23 07:22:43 +00:00
|
|
|
static final Uri homeserverList = Uri(
|
|
|
|
scheme: 'https',
|
|
|
|
host: 'servers.joinmatrix.org',
|
|
|
|
path: 'servers.json',
|
|
|
|
);
|
2020-12-18 10:43:13 +00:00
|
|
|
|
|
|
|
static void loadFromJson(Map<String, dynamic> json) {
|
2021-11-13 16:57:55 +00:00
|
|
|
if (json['chat_color'] != null) {
|
|
|
|
try {
|
2022-05-18 10:13:59 +00:00
|
|
|
colorSchemeSeed = Color(json['chat_color']);
|
2021-11-13 16:57:55 +00:00
|
|
|
} catch (e) {
|
|
|
|
Logs().w(
|
2023-03-02 09:57:52 +00:00
|
|
|
'Invalid color in config.json! Please make sure to define the color in this format: "0xffdd0000"',
|
|
|
|
e,
|
|
|
|
);
|
2021-11-13 16:57:55 +00:00
|
|
|
}
|
|
|
|
}
|
2020-12-18 10:43:13 +00:00
|
|
|
if (json['application_name'] is String) {
|
|
|
|
_applicationName = json['application_name'];
|
|
|
|
}
|
|
|
|
if (json['application_welcome_message'] is String) {
|
|
|
|
_applicationWelcomeMessage = json['application_welcome_message'];
|
|
|
|
}
|
|
|
|
if (json['default_homeserver'] is String) {
|
|
|
|
_defaultHomeserver = json['default_homeserver'];
|
|
|
|
}
|
|
|
|
if (json['privacy_url'] is String) {
|
2024-07-14 11:57:52 +00:00
|
|
|
_privacyUrl = json['privacy_url'];
|
2021-06-18 13:38:01 +00:00
|
|
|
}
|
|
|
|
if (json['web_base_url'] is String) {
|
2024-07-14 11:57:52 +00:00
|
|
|
_webBaseUrl = json['web_base_url'];
|
2020-12-18 10:43:13 +00:00
|
|
|
}
|
|
|
|
if (json['render_html'] is bool) {
|
|
|
|
renderHtml = json['render_html'];
|
|
|
|
}
|
|
|
|
if (json['hide_redacted_events'] is bool) {
|
|
|
|
hideRedactedEvents = json['hide_redacted_events'];
|
|
|
|
}
|
|
|
|
if (json['hide_unknown_events'] is bool) {
|
|
|
|
hideUnknownEvents = json['hide_unknown_events'];
|
|
|
|
}
|
|
|
|
}
|
2020-12-11 13:14:33 +00:00
|
|
|
}
|