fluffychat/lib/config/app_config.dart

96 lines
4.0 KiB
Dart
Raw Normal View History

2021-01-24 15:38:25 +00:00
import 'dart:ui';
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;
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;
static double bubbleSizeFactor = 1;
2021-11-13 12:06:36 +00:00
static double fontSizeFactor = 1;
static Color chatColor = primaryColor;
2021-11-13 12:06:36 +00:00
static const double messageFontSize = 15.75;
2020-12-11 13:14:33 +00:00
static const bool allowOtherHomeservers = true;
static const bool enableRegistration = true;
2021-01-24 15:38:25 +00:00
static const Color primaryColor = Color(0xFF5625BA);
2021-01-31 22:54:33 +00:00
static const Color primaryColorLight = Color(0xFFCCBDEA);
static const Color secondaryColor = Color(0xFF41a2bc);
2021-11-05 08:53:27 +00:00
static String _privacyUrl =
'https://gitlab.com/famedly/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 =
'https://www.reddit.com/r/fluffychat/comments/qn6liu/enable_push_notifications_without_google_services/';
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';
static String _webBaseUrl = 'https://fluffychat.im/web';
static String get webBaseUrl => _webBaseUrl;
2020-12-23 09:20:24 +00:00
static const String sourceCodeUrl = 'https://gitlab.com/famedly/fluffychat';
2020-12-11 13:14:33 +00:00
static const String supportUrl =
2020-12-23 09:15:25 +00:00
'https://gitlab.com/famedly/fluffychat/issues';
2020-12-11 13:14:33 +00:00
static const bool enableSentry = true;
static const String sentryDns =
2021-12-12 13:03:33 +00:00
'https://glet_5218c8eebefed3cb13511dc675fdbbdb@gitlab.com/api/v4/error_tracking/collector/16112282';
static bool renderHtml = true;
2020-12-11 13:14:33 +00:00
static bool hideRedactedEvents = false;
static bool hideUnknownEvents = true;
static bool autoplayImages = true;
2021-08-24 18:43:21 +00:00
static bool sendOnEnter = 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/';
static const String schemePrefix = 'matrix:';
2020-12-11 13:14:33 +00:00
static const String pushNotificationsChannelId = 'fluffychat_push';
static const String pushNotificationsChannelName = 'FluffyChat push channel';
static const String pushNotificationsChannelDescription =
'Push notifications for FluffyChat';
static const String pushNotificationsAppId = 'chat.fluffy.fluffychat';
2021-01-14 17:00:16 +00:00
static const String pushNotificationsGatewayUrl =
2021-03-12 06:55:53 +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/';
2021-11-13 12:06:36 +00:00
static const double borderRadius = 16.0;
2021-05-23 11:11:55 +00:00
static const double columnWidth = 360.0;
2020-12-18 10:43:13 +00:00
static void loadFromJson(Map<String, dynamic> json) {
if (json['chat_color'] != null) {
try {
chatColor = Color(json['application_name']);
} catch (e) {
Logs().w(
'Invalid color in config.json! Please make sure to define the color in this format: "0xffdd0000"',
e);
}
}
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) {
_webBaseUrl = json['privacy_url'];
}
if (json['web_base_url'] is String) {
_privacyUrl = 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
}