feat: Enhanced configuration
							parent
							
								
									11c2a8bb26
								
							
						
					
					
						commit
						8eb2e2fb9d
					
				| 
		 Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB  | 
@ -1,11 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "application_name": "FluffyChat",
 | 
			
		||||
  "default_homeserver": "matrix.tchncsde",
 | 
			
		||||
  "privacy_url": "https://fluffychat.im/en/privacy.html",
 | 
			
		||||
  "source_code_url": "https://gitlab.com/ChristianPauly/fluffychat-flutter",
 | 
			
		||||
  "support_url": "https://gitlab.com/ChristianPauly/fluffychat-flutter/issues",
 | 
			
		||||
  "sentry_dns": "https://8591d0d863b646feb4f3dda7e5dcab38@o256755.ingest.sentry.io/5243143",
 | 
			
		||||
  "render_html": false,
 | 
			
		||||
  "hide_redacted_events": false,
 | 
			
		||||
  "hide_unknown_events": false
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,27 @@
 | 
			
		||||
abstract class AppConfig {
 | 
			
		||||
  static const String applicationName = 'FluffyChat';
 | 
			
		||||
  static const String applicationWelcomeMessage = null;
 | 
			
		||||
  static const String defaultHomeserver = 'matrix.org';
 | 
			
		||||
  static String jitsiInstance = 'https://meet.jit.si/';
 | 
			
		||||
  static const bool allowOtherHomeservers = true;
 | 
			
		||||
  static const bool enableRegistration = true;
 | 
			
		||||
  static const String privacyUrl = 'https://fluffychat.im/en/privacy.html';
 | 
			
		||||
  static const String sourceCodeUrl =
 | 
			
		||||
      'https://gitlab.com/ChristianPauly/fluffychat-flutter';
 | 
			
		||||
  static const String supportUrl =
 | 
			
		||||
      'https://gitlab.com/ChristianPauly/fluffychat-flutter/issues';
 | 
			
		||||
  static const bool enableSentry = true;
 | 
			
		||||
  static const String sentryDns =
 | 
			
		||||
      'https://8591d0d863b646feb4f3dda7e5dcab38@o256755.ingest.sentry.io/5243143';
 | 
			
		||||
  static bool renderHtml = false;
 | 
			
		||||
  static bool hideRedactedEvents = false;
 | 
			
		||||
  static bool hideUnknownEvents = false;
 | 
			
		||||
  static const String inviteLinkPrefix = 'https://matrix.to/#/';
 | 
			
		||||
  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';
 | 
			
		||||
  static const String pushNotificationsGatewayUrl = 'https://janian.de:7023/';
 | 
			
		||||
  static const String pushNotificationsPusherFormat = 'event_id_only';
 | 
			
		||||
}
 | 
			
		||||
@ -1,52 +0,0 @@
 | 
			
		||||
abstract class AppConfig {
 | 
			
		||||
  static String get applicationName => _applicationName;
 | 
			
		||||
  static String _applicationName = 'FluffyChat';
 | 
			
		||||
  static String get defaultHomeserver => _defaultHomeserver;
 | 
			
		||||
  static String _defaultHomeserver = 'matrix-client.matrix.org';
 | 
			
		||||
  static String get privacyUrl => _privacyUrl;
 | 
			
		||||
  static String _privacyUrl = 'https://fluffychat.im/en/privacy.html';
 | 
			
		||||
  static String get sourceCodeUrl => _sourceCodeUrl;
 | 
			
		||||
  static String _sourceCodeUrl =
 | 
			
		||||
      'https://gitlab.com/ChristianPauly/fluffychat-flutter';
 | 
			
		||||
  static String get supportUrl => _supportUrl;
 | 
			
		||||
  static String _supportUrl =
 | 
			
		||||
      'https://gitlab.com/ChristianPauly/fluffychat-flutter/issues';
 | 
			
		||||
  static String get sentryDsn => _sentryDsn;
 | 
			
		||||
  static String _sentryDsn =
 | 
			
		||||
      'https://8591d0d863b646feb4f3dda7e5dcab38@o256755.ingest.sentry.io/5243143';
 | 
			
		||||
  // these settings can be re-set at runtime depending on what the in-app settings are
 | 
			
		||||
  static bool renderHtml = false;
 | 
			
		||||
  static bool hideRedactedEvents = false;
 | 
			
		||||
  static bool hideUnknownEvents = false;
 | 
			
		||||
  static String matrixToLinkPrefix = 'https://matrix.to/#/';
 | 
			
		||||
 | 
			
		||||
  static void loadFromJson(Map<String, dynamic> json) {
 | 
			
		||||
    if (json['application_name'] is String) {
 | 
			
		||||
      _applicationName = json['application_name'];
 | 
			
		||||
    }
 | 
			
		||||
    if (json['default_homeserver'] is String) {
 | 
			
		||||
      _defaultHomeserver = json['default_homeserver'];
 | 
			
		||||
    }
 | 
			
		||||
    if (json['privacy_url'] is String) {
 | 
			
		||||
      _privacyUrl = json['privacy_url'];
 | 
			
		||||
    }
 | 
			
		||||
    if (json['source_code_url'] is String) {
 | 
			
		||||
      _sourceCodeUrl = json['source_code_url'];
 | 
			
		||||
    }
 | 
			
		||||
    if (json['support_url'] is String) {
 | 
			
		||||
      _supportUrl = json['support_url'];
 | 
			
		||||
    }
 | 
			
		||||
    if (json['sentry_dsn'] is String) {
 | 
			
		||||
      _sentryDsn = json['sentry_dsn'];
 | 
			
		||||
    }
 | 
			
		||||
    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'];
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue