Merge pull request 'Turn on Message Formatting by Default' (#488) from default_message_formatting into trunk
continuous-integration/drone/push Build is failing Details

Reviewed-on: #488
This commit is contained in:
Dan Ballard 2022-06-22 21:34:22 +00:00
commit 0c426a129a
3 changed files with 25 additions and 19 deletions

View File

@ -52,7 +52,8 @@ class RemoteServerInfoState extends ChangeNotifier {
void updateSyncProgressFor(DateTime point) {
var range = lastPreSyncMessagTime.toUtc().difference(DateTime.now().toUtc());
var pointFromStart = lastPreSyncMessagTime.toUtc().difference(point.toUtc());
if (!pointFromStart.isNegative) { // ! is Negative cus all the duration's we're calculating incidently are negative
if (!pointFromStart.isNegative) {
// ! is Negative cus all the duration's we're calculating incidently are negative
// this message is from before we think we should be syncing with the server
// Can be because of a new server or a full resync, either way, use this (oldest message) as our lastPreSyncMessageTime
this.lastPreSyncMessagTime = point;

View File

@ -85,6 +85,13 @@ class Settings extends ChangeNotifier {
return this.experiments[experiment]! == true;
}
}
// If message formatting has not explicitly been turned off, then
// turn it on by default.
if (experiment == FormattingExperiment) {
return true;
}
return false;
}

View File

@ -222,6 +222,22 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
inactiveTrackColor: settings.theme.defaultButtonDisabledColor,
secondary: Icon(CwtchIcons.streamer_bunnymask, color: settings.current().mainTextColor),
),
SwitchListTile(
title: Text(AppLocalizations.of(context)!.formattingExperiment, style: TextStyle(color: settings.current().mainTextColor)),
subtitle: Text(AppLocalizations.of(context)!.messageFormattingDescription),
value: settings.isExperimentEnabled(FormattingExperiment),
onChanged: (bool value) {
if (value) {
settings.enableExperiment(FormattingExperiment);
} else {
settings.disableExperiment(FormattingExperiment);
}
saveSettings(context);
},
activeTrackColor: settings.theme.defaultButtonActiveColor,
inactiveTrackColor: settings.theme.defaultButtonDisabledColor,
secondary: Icon(Icons.text_fields, color: settings.current().mainTextColor),
),
SizedBox(
height: 40,
),
@ -444,24 +460,6 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
inactiveTrackColor: settings.theme.defaultButtonDisabledColor,
secondary: Icon(Icons.link, color: settings.current().mainTextColor),
)),
Visibility(
visible: settings.experimentsEnabled,
child: SwitchListTile(
title: Text(AppLocalizations.of(context)!.formattingExperiment, style: TextStyle(color: settings.current().mainTextColor)),
subtitle: Text(AppLocalizations.of(context)!.messageFormattingDescription),
value: settings.isExperimentEnabled(FormattingExperiment),
onChanged: (bool value) {
if (value) {
settings.enableExperiment(FormattingExperiment);
} else {
settings.disableExperiment(FormattingExperiment);
}
saveSettings(context);
},
activeTrackColor: settings.theme.defaultButtonActiveColor,
inactiveTrackColor: settings.theme.defaultButtonDisabledColor,
secondary: Icon(Icons.text_fields, color: settings.current().mainTextColor),
)),
AboutListTile(
icon: appIcon,
applicationIcon: Padding(padding: EdgeInsets.all(5), child: Icon(CwtchIcons.cwtch_knott)),