add popup about disable battery unoptimized; fix mute policy loading
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dan Ballard 2022-04-13 14:09:17 -07:00
parent c377a09748
commit a94fd3547b
16 changed files with 88 additions and 32 deletions

View File

@ -1,7 +1,9 @@
{
"@@locale": "cy",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "da",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "de",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "el",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "en",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "es",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,9 +1,11 @@
{
"@@locale": "fr",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "Cette fonctionnalité nécessite que lexpérience Groupes soit activée dans Paramètres",
"settingAndroidPowerExemptionDescription": "Android applique par défaut un profil de gestion de l'énergie \"optimisé\" aux applications, ce qui peut entraîner leur arrêt ou leur suppression. Demandez à Android d'exempter Cwtch de ce profil pour une meilleure stabilité mais une plus grande consommation d'énergie.",
"settingAndroidPowerExemption": "Android ignore les optimisations de la batterie",
"messageFormattingDescription": "Activer la mise en forme de texte enrichi dans les messages affichés, par exemple **gras** et *italique*",
"formattingExperiment": "Mise en forme des messages",
"clickableLinksWarning": "L'ouverture de cette URL lancera une application en dehors de Cwtch et peut révéler des métadonnées ou compromettre la sécurité de Cwtch. N'ouvrez que les URLs de personnes en qui vous avez confiance. Êtes-vous sûr de vouloir continuer ?",

View File

@ -1,7 +1,9 @@
{
"@@locale": "it",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "lb",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "no",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "pl",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "pt",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,7 +1,9 @@
{
"@@locale": "ro",
"@@last_modified": "2022-04-13T02:54:41+02:00",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -1,6 +1,9 @@
{
"@@locale": "ru",
"settingAndroidPowerExemptionDescription": "Android by default applies an \"optimized\" power management profile to apps which can result in them being stopped or killed. Request Android to exempt Cwtch from this for better stability but more power use.",
"@@last_modified": "2022-04-13T22:56:39+02:00",
"okButton": "OK",
"settingsAndroidPowerReenablePopup": "Cannot re-enable Battery Optimization from within Cwtch. Please go to Android \/ Settings \/ Apps \/ Cwtch \/ Battery and set Usage to 'Optimized'",
"settingAndroidPowerExemptionDescription": "Optional: Request Android to exempt Cwtch from optimized power management. This will result in better stability at the cost of greater battery use.",
"settingAndroidPowerExemption": "Android Ignore Battery Optimizations",
"thisFeatureRequiresGroupExpermientsToBeEnabled": "This feature requires the Groups Experiment to be enabled in Settings",
"messageFormattingDescription": "Enable rich text formatting in displayed messages e.g. **bold** and *italic*",

View File

@ -109,8 +109,8 @@ class Settings extends ChangeNotifier {
// single pane vs dual pane preferences
_uiColumnModePortrait = uiColumnModeFromString(settings["UIColumnModePortrait"]);
_uiColumnModeLandscape = uiColumnModeFromString(settings["UIColumnModeLandscape"]);
_notificationPolicy = notificationPolicyFromString(settings["NotificationPolicy"]);
_notificationContent = notificationContentFromString(settings["NotificationContent"]);
// auto-download folder
@ -275,7 +275,7 @@ class Settings extends ChangeNotifier {
static NotificationPolicy notificationPolicyFromString(String? np) {
switch (np) {
case "NotificationPolicy.None":
case "NotificationPolicy.Mute":
return NotificationPolicy.Mute;
case "NotificationPolicy.OptIn":
return NotificationPolicy.OptIn;

View File

@ -227,7 +227,8 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
if (value) {
requestBatteryExemption();
} else {
// We don't ask for it to be turned off, user has to manually in android settings, so this is a NOP
// We can't ask for it to be turned off, show an informational popup
showBatteryDialog(context);
}
},
activeTrackColor: settings.theme.defaultButtonColor,
@ -467,6 +468,32 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
});
});
}
showBatteryDialog(BuildContext context) {
Widget okButton = ElevatedButton(
child: Text(AppLocalizations.of(context)!.okButton),
onPressed: () {
Navigator.of(context).pop();
},
);
// set up the AlertDialog
AlertDialog alert = AlertDialog(
title: Text(AppLocalizations.of(context)!.settingsAndroidPowerReenablePopup),
actions: [
okButton,
],
);
// show the dialog
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}
}
/// Construct a version string from Package Info