diff --git a/Meditate/manifest.xml b/Meditate/manifest.xml index ab5ab7b..bd6ae01 100644 --- a/Meditate/manifest.xml +++ b/Meditate/manifest.xml @@ -1,7 +1,7 @@ - + diff --git a/Meditate/resources-deu/strings/strings.xml b/Meditate/resources-deu/strings/strings.xml index cb9f5f0..496b52b 100644 --- a/Meditate/resources-deu/strings/strings.xml +++ b/Meditate/resources-deu/strings/strings.xml @@ -94,7 +94,11 @@ 3 Min 4 Min 5 Min - + + Benachrichtigungen + Ein (Standard) + Aus + Intervall-Alerts Neu hinzufügen Bearbeiten @@ -159,7 +163,7 @@ HRV Bereit HRV aus - Meditate 8.0.0 + Meditate 8.1.0 vtrifonov dliedke diff --git a/Meditate/resources-por/strings/strings.xml b/Meditate/resources-por/strings/strings.xml index 88e47a4..e0beae6 100644 --- a/Meditate/resources-por/strings/strings.xml +++ b/Meditate/resources-por/strings/strings.xml @@ -95,6 +95,10 @@ 4 min 5 min + Notificações + Ligado (Padrão) + Desligado + Intervalo de Alerta Adicionar Editar @@ -160,7 +164,7 @@ VFC Pronto VFC Deslig. - Meditate 8.0.0 + Meditate 8.1.0 vtrifonov dliedke diff --git a/Meditate/resources-spa/strings/strings.xml b/Meditate/resources-spa/strings/strings.xml index 130f146..bb7ea8c 100644 --- a/Meditate/resources-spa/strings/strings.xml +++ b/Meditate/resources-spa/strings/strings.xml @@ -80,7 +80,7 @@ Des. Resultados - Claro (Predeterminado) + Claro (Predet.) Oscuro Preparación @@ -95,6 +95,10 @@ 4 min 5 min + Notificaciones + Activado (Predet.) + Desactivado + Alertas Intervalo Agregar Nueva Editar @@ -159,7 +163,7 @@ HRV Listo HRV apagado - Meditate 8.0.0 + Meditate 8.1.0 vtrifonov dliedke diff --git a/Meditate/resources/menus/globalSettings/globalSettingsMenu.xml b/Meditate/resources/menus/globalSettings/globalSettingsMenu.xml index 748fd8a..c1e6e19 100644 --- a/Meditate/resources/menus/globalSettings/globalSettingsMenu.xml +++ b/Meditate/resources/menus/globalSettings/globalSettingsMenu.xml @@ -4,6 +4,7 @@ + diff --git a/Meditate/resources/menus/globalSettings/notificationOptionsMenu.xml b/Meditate/resources/menus/globalSettings/notificationOptionsMenu.xml new file mode 100644 index 0000000..17c067c --- /dev/null +++ b/Meditate/resources/menus/globalSettings/notificationOptionsMenu.xml @@ -0,0 +1,4 @@ + + + + diff --git a/Meditate/resources/strings/strings.xml b/Meditate/resources/strings/strings.xml index dd7d4f0..cbae1cf 100644 --- a/Meditate/resources/strings/strings.xml +++ b/Meditate/resources/strings/strings.xml @@ -94,7 +94,11 @@ 3 min 4 min 5 min - + + Notifications + On (Default) + Off + Interval Alerts Add New Edit @@ -159,7 +163,7 @@ HRV Ready HRV off - Meditate 8.0.0 + Meditate 8.1.0 vtrifonov dliedke diff --git a/Meditate/source/activity/MeditateDelegate.mc b/Meditate/source/activity/MeditateDelegate.mc index 7bb6f15..624fc68 100644 --- a/Meditate/source/activity/MeditateDelegate.mc +++ b/Meditate/source/activity/MeditateDelegate.mc @@ -119,7 +119,7 @@ class MeditateDelegate extends Ui.BehaviorDelegate { try { // Touch screen to disable/enable backlight during activity - // This will still respect the backligh timeout configured in the device + // This will still respect the backlight timeout configured in the device if ((Attention has :backlight) ) { backlightOn = !backlightOn; Attention.backlight(backlightOn); diff --git a/Meditate/source/activity/Vibe.mc b/Meditate/source/activity/Vibe.mc index aa6fb16..8e8186a 100644 --- a/Meditate/source/activity/Vibe.mc +++ b/Meditate/source/activity/Vibe.mc @@ -2,6 +2,13 @@ using Toybox.Attention; class Vibe { static function vibrate(pattern) { + + // Check if notifications are enabled, if not return + var notificationsEnabled = GlobalSettings.loadNotification(); + if (notificationsEnabled == Notification.Off) { + return; + } + var vibeProfile; switch (pattern) { case VibePattern.LongContinuous: diff --git a/Meditate/source/globalSettings/GlobalSettings.mc b/Meditate/source/globalSettings/GlobalSettings.mc index 9627a93..c8aa6a0 100644 --- a/Meditate/source/globalSettings/GlobalSettings.mc +++ b/Meditate/source/globalSettings/GlobalSettings.mc @@ -96,6 +96,22 @@ class GlobalSettings { App.Storage.setValue(AutoStopKey, autoStop); } + private static const NotificationKey = "globalSettings_notification"; + + static function loadNotification() { + var notification = App.Storage.getValue(NotificationKey); + if (notification == null) { + return Notification.On; // 'On' is the default value for Notification + } else { + return notification; + } + } + + static function saveNotification(notification) { + App.Storage.setValue(NotificationKey, notification); + } + + private static const ResultsThemeKey = "globalSettings_resultsTheme"; static function loadResultsTheme() { @@ -176,6 +192,13 @@ module AutoStop { } } +module Notification { + enum { + Off = 0, + On = 1 + } +} + module ResultsTheme { enum { Light = 0, diff --git a/Meditate/source/globalSettings/GlobalSettingsMenuDelegate.mc b/Meditate/source/globalSettings/GlobalSettingsMenuDelegate.mc index a94b586..17d1f93 100644 --- a/Meditate/source/globalSettings/GlobalSettingsMenuDelegate.mc +++ b/Meditate/source/globalSettings/GlobalSettingsMenuDelegate.mc @@ -49,6 +49,10 @@ class GlobalSettingsMenuDelegate extends Ui.MenuInputDelegate { var autoStopDelegate = new MenuOptionsDelegate(method(:onAutoStopPicked)); Ui.pushView(new Rez.Menus.autoStopOptionMenu(), autoStopDelegate, Ui.SLIDE_LEFT); } + else if (item == :notification) { + var notificationDelegate = new MenuOptionsDelegate(method(:onNotificationPicked)); + Ui.pushView(new Rez.Menus.notificationOptionMenu(), notificationDelegate, Ui.SLIDE_LEFT); + } else if (item ==:resultsTheme) { var resultsDelegate = new MenuOptionsDelegate(method(:onResultsPicked)); Ui.pushView(new Rez.Menus.resultsThemeOptionsMenu(), resultsDelegate, Ui.SLIDE_LEFT); @@ -98,6 +102,16 @@ class GlobalSettingsMenuDelegate extends Ui.MenuInputDelegate { mOnGlobalSettingsChanged.invoke(); } + function onNotificationPicked(item) { + if (item == :on) { + GlobalSettings.saveNotification(Notification.On); + } + else if (item == :off) { + GlobalSettings.saveNotification(Notification.Off); + } + mOnGlobalSettingsChanged.invoke(); + } + function onResultsPicked(item) { if (item == :Light) { GlobalSettings.saveResultsTheme(ResultsTheme.Light);