Skip to content

Commit

Permalink
Refactor ApplicationCustomization to use raw subject prefix variables…
Browse files Browse the repository at this point in the history
… for crash and feedback emails
  • Loading branch information
frankmer committed Nov 22, 2024
1 parent dcc4a98 commit 2717d8d
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions lib/utils/customization/application_customization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class ApplicationCustomization {
final String appName;
final String websiteLink;
final String crashRecipient;
final String _crashSubjectPrefix;
String get crashSubjectPrefix => _crashSubjectPrefix.replaceAll(prefixVersionVariable, InfoUtils.currentVersionAndBuildNumber);
final String rawCrashSubjectPrefix;
String get crashSubjectPrefix => rawCrashSubjectPrefix.replaceAll(prefixVersionVariable, InfoUtils.currentVersionAndBuildNumber);
final String feedbackRecipient;
final String _feedbackSubjectPrefix;
String get feedbackSubjectPrefix => _feedbackSubjectPrefix.replaceAll(prefixVersionVariable, InfoUtils.currentVersionAndBuildNumber);
final String rawFeedbackSubjectPrefix;
String get feedbackSubjectPrefix => rawFeedbackSubjectPrefix.replaceAll(prefixVersionVariable, InfoUtils.currentVersionAndBuildNumber);
final WidgetImage appbarIcon;
static const String appbarIconFileName = 'appbar_icon';
final WidgetImage splashScreenImage;
Expand All @@ -95,9 +95,9 @@ class ApplicationCustomization {
this.appName = _defaultAppName,
this.websiteLink = _defaultWebsiteLink,
this.crashRecipient = _defaultCrashRecipient,
String crashSubjectPrefix = _defaultCrashSubjectPrefix,
this.rawCrashSubjectPrefix = _defaultCrashSubjectPrefix,
this.feedbackRecipient = _defaultFeedbackRecipient,
String feedbackSubjectPrefix = _defaultFeedbackSubjectPrefix,
this.rawFeedbackSubjectPrefix = _defaultFeedbackSubjectPrefix,
this.fontFamilyName = _defaultFontName,
this.customFontBytes,
WidgetImage? appbarIcon,
Expand All @@ -107,9 +107,7 @@ class ApplicationCustomization {
this.lightTheme = ThemeCustomization.defaultLightTheme,
this.darkTheme = ThemeCustomization.defaultDarkTheme,
this.disabledFeatures = const {},
}) : _crashSubjectPrefix = crashSubjectPrefix,
_feedbackSubjectPrefix = feedbackSubjectPrefix,
appbarIcon = appbarIcon ?? WidgetImage(fileType: ImageFileType.png, imageData: defaultIconUint8List, fileName: appbarIconFileName),
}) : appbarIcon = appbarIcon ?? WidgetImage(fileType: ImageFileType.png, imageData: defaultIconUint8List, fileName: appbarIconFileName),
splashScreenImage =
splashScreenImage ?? WidgetImage(fileType: ImageFileType.png, imageData: defaultImageUint8List, fileName: splashScreenImageFileName),
backgroundImage = backgroundImage ?? WidgetImage(fileType: ImageFileType.png, imageData: defaultImageUint8List, fileName: backgroundImageFileName),
Expand All @@ -135,9 +133,9 @@ class ApplicationCustomization {
appName: appName ?? this.appName,
websiteLink: websiteLink ?? this.websiteLink,
crashRecipient: crashRecipient ?? this.crashRecipient,
crashSubjectPrefix: crashSubjectPrefix ?? _crashSubjectPrefix,
rawCrashSubjectPrefix: crashSubjectPrefix ?? rawCrashSubjectPrefix,
feedbackRecipient: feedbackRecipient ?? this.feedbackRecipient,
feedbackSubjectPrefix: feedbackSubjectPrefix ?? _feedbackSubjectPrefix,
rawFeedbackSubjectPrefix: feedbackSubjectPrefix ?? rawFeedbackSubjectPrefix,
fontFamilyName: fontFamilyName,
customFontBytes: customFontBytes,
appbarIcon: appbarIcon ?? this.appbarIcon,
Expand All @@ -156,9 +154,9 @@ class ApplicationCustomization {
appName == other.appName &&
websiteLink == other.websiteLink &&
crashRecipient == other.crashRecipient &&
_crashSubjectPrefix == other._crashSubjectPrefix &&
rawCrashSubjectPrefix == other.rawCrashSubjectPrefix &&
feedbackRecipient == other.feedbackRecipient &&
_feedbackSubjectPrefix == other._feedbackSubjectPrefix &&
rawFeedbackSubjectPrefix == other.rawFeedbackSubjectPrefix &&
fontFamilyName == other.fontFamilyName &&
customFontBytes == other.customFontBytes &&
appbarIcon == other.appbarIcon &&
Expand All @@ -174,9 +172,9 @@ class ApplicationCustomization {
appName,
websiteLink,
crashRecipient,
_crashSubjectPrefix,
rawCrashSubjectPrefix,
feedbackRecipient,
_feedbackSubjectPrefix,
rawFeedbackSubjectPrefix,
fontFamilyName,
customFontBytes,
appbarIcon,
Expand All @@ -193,9 +191,9 @@ class ApplicationCustomization {
appName: appName,
websiteLink: websiteLink,
crashRecipient: crashRecipient,
crashSubjectPrefix: _crashSubjectPrefix,
rawCrashSubjectPrefix: rawCrashSubjectPrefix,
feedbackRecipient: feedbackRecipient,
feedbackSubjectPrefix: _feedbackSubjectPrefix,
rawFeedbackSubjectPrefix: rawFeedbackSubjectPrefix,
fontFamilyName: fontName,
customFontBytes: fontBytes,
appbarIcon: appbarIcon,
Expand Down Expand Up @@ -225,9 +223,9 @@ class ApplicationCustomization {
appName: json['appName'] as String? ?? _defaultAppName,
websiteLink: json['websiteLink'] as String? ?? _defaultWebsiteLink,
crashRecipient: json['crashRecipient'] as String? ?? _defaultCrashRecipient,
crashSubjectPrefix: json['crashSubjectPrefix'] as String? ?? _defaultCrashSubjectPrefix,
rawCrashSubjectPrefix: json['crashSubjectPrefix'] as String? ?? _defaultCrashSubjectPrefix,
feedbackRecipient: json['feedbackRecipient'] as String? ?? _defaultFeedbackRecipient,
feedbackSubjectPrefix: json['feedbackSubjectPrefix'] as String? ?? _defaultFeedbackSubjectPrefix,
rawFeedbackSubjectPrefix: json['feedbackSubjectPrefix'] as String? ?? _defaultFeedbackSubjectPrefix,
customFontBytes: json['customFontBytes'] != null ? base64Decode(json['customFontBytes'] as String) : null,
fontFamilyName: json['fontFamilyName'] as String? ?? _defaultFontName,
appbarIcon: json['appbarIcon'] != null
Expand Down Expand Up @@ -260,9 +258,9 @@ class ApplicationCustomization {
'appName': appName,
'websiteLink': websiteLink,
'crashRecipient': crashRecipient,
'crashSubjectPrefix': _crashSubjectPrefix,
'crashSubjectPrefix': rawCrashSubjectPrefix,
'feedbackRecipient': feedbackRecipient,
'feedbackSubjectPrefix': _feedbackSubjectPrefix,
'feedbackSubjectPrefix': rawFeedbackSubjectPrefix,
'fontFamilyName': fontFamilyName,
'customFontBytes': customFontBytes != null ? base64Encode(customFontBytes!) : null,
'appbarIcon': appbarIcon.toJson(),
Expand Down

0 comments on commit 2717d8d

Please sign in to comment.