Skip to content

Commit

Permalink
8.1.0 - New global notifications configuration (default On)
Browse files Browse the repository at this point in the history
  • Loading branch information
dliedke committed Aug 31, 2024
1 parent 4c76abe commit b0973d6
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Meditate/manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- This is a generated file. It is highly recommended that you DO NOT edit this file. -->
<iq:manifest xmlns:iq="http://www.garmin.com/xml/connectiq" version="3">
<iq:application entry="MeditateApp" id="9abb375dcf7c4ace87ff66f4f774f6c8" launcherIcon="@Drawables.launcherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watch-app" version="8.0.0">
<iq:application entry="MeditateApp" id="9abb375dcf7c4ace87ff66f4f774f6c8" launcherIcon="@Drawables.launcherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watch-app" version="8.1.0">
<iq:products>
<iq:product id="approachs62"/>
<iq:product id="approachs7042mm"/>
Expand Down
8 changes: 6 additions & 2 deletions Meditate/resources-deu/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@
<string id="menuPrepareTimeOptions_3m">3 Min</string>
<string id="menuPrepareTimeOptions_4m">4 Min</string>
<string id="menuPrepareTimeOptions_5m">5 Min</string>


<string id="menuNotificationOptions_title">Benachrichtigungen</string>
<string id="menuNotificationOptions_on">Ein (Standard)</string>
<string id="menuNotificationOptions_off">Aus</string>

<string id="menuIntervalAlertSettings_Title">Intervall-Alerts</string>
<string id="menuIntervalAlertSettings_addNew">Neu hinzufügen</string>
<string id="menuIntervalAlertSettings_edit">Bearbeiten</string>
Expand Down Expand Up @@ -159,7 +163,7 @@
<string id="HRVready">HRV Bereit</string>
<string id="HRVoff">HRV aus</string>

<string id="about_AppVersion">Meditate 8.0.0</string>
<string id="about_AppVersion">Meditate 8.1.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
6 changes: 5 additions & 1 deletion Meditate/resources-por/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
<string id="menuPrepareTimeOptions_4m">4 min</string>
<string id="menuPrepareTimeOptions_5m">5 min</string>

<string id="menuNotificationOptions_title">Notificações</string>
<string id="menuNotificationOptions_on">Ligado (Padrão)</string>
<string id="menuNotificationOptions_off">Desligado</string>

<string id="menuIntervalAlertSettings_Title">Intervalo de Alerta</string>
<string id="menuIntervalAlertSettings_addNew">Adicionar</string>
<string id="menuIntervalAlertSettings_edit">Editar</string>
Expand Down Expand Up @@ -160,7 +164,7 @@
<string id="HRVready">VFC Pronto</string>
<string id="HRVoff">VFC Deslig.</string>

<string id="about_AppVersion">Meditate 8.0.0</string>
<string id="about_AppVersion">Meditate 8.1.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
8 changes: 6 additions & 2 deletions Meditate/resources-spa/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<string id="menuAutoStopOptions_off">Des.</string>

<string id="menuResultsThemeOptions_title">Resultados</string>
<string id="menuResultsThemeOptions_light">Claro (Predeterminado)</string>
<string id="menuResultsThemeOptions_light">Claro (Predet.)</string>
<string id="menuResultsThemeOptions_dark">Oscuro</string>

<string id="menuPrepareTimeOptions_title">Preparación</string>
Expand All @@ -95,6 +95,10 @@
<string id="menuPrepareTimeOptions_4m">4 min</string>
<string id="menuPrepareTimeOptions_5m">5 min</string>

<string id="menuNotificationOptions_title">Notificaciones</string>
<string id="menuNotificationOptions_on">Activado (Predet.)</string>
<string id="menuNotificationOptions_off">Desactivado</string>

<string id="menuIntervalAlertSettings_Title">Alertas Intervalo</string>
<string id="menuIntervalAlertSettings_addNew">Agregar Nueva</string>
<string id="menuIntervalAlertSettings_edit">Editar</string>
Expand Down Expand Up @@ -159,7 +163,7 @@
<string id="HRVready">HRV Listo</string>
<string id="HRVoff">HRV apagado</string>

<string id="about_AppVersion">Meditate 8.0.0</string>
<string id="about_AppVersion">Meditate 8.1.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<menu-item id="confirmSaveActivity" label="@Strings.menuGlobalSettings_confirmSaveActivity" />
<menu-item id="prepareTime" label="@Strings.menuGlobalSettings_prepareTime" />
<menu-item id="finalizeTime" label="@Strings.menuGlobalSettings_finalizeTime" />
<menu-item id="notification" label="@Strings.menuNotificationOptions_title" />
<menu-item id="newActivityType" label="@Strings.menuGlobalSettings_newActivityType" />
<menu-item id="hrvTracking" label="@Strings.menuGlobalSettings_newHrvTracking" />
<menu-item id="respirationRate" label="@Strings.menuGlobalSettings_respirationRate" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<menu id="notificationOptionMenu" title="@Strings.menuNotificationOptions_title">
<menu-item id="on" label="@Strings.menuNotificationOptions_on" />
<menu-item id="off" label="@Strings.menuNotificationOptions_off" />
</menu>
8 changes: 6 additions & 2 deletions Meditate/resources/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@
<string id="menuPrepareTimeOptions_3m">3 min</string>
<string id="menuPrepareTimeOptions_4m">4 min</string>
<string id="menuPrepareTimeOptions_5m">5 min</string>


<string id="menuNotificationOptions_title">Notifications</string>
<string id="menuNotificationOptions_on">On (Default)</string>
<string id="menuNotificationOptions_off">Off</string>

<string id="menuIntervalAlertSettings_Title">Interval Alerts</string>
<string id="menuIntervalAlertSettings_addNew">Add New</string>
<string id="menuIntervalAlertSettings_edit">Edit</string>
Expand Down Expand Up @@ -159,7 +163,7 @@
<string id="HRVready">HRV Ready</string>
<string id="HRVoff">HRV off</string>

<string id="about_AppVersion">Meditate 8.0.0</string>
<string id="about_AppVersion">Meditate 8.1.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
2 changes: 1 addition & 1 deletion Meditate/source/activity/MeditateDelegate.mc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions Meditate/source/activity/Vibe.mc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
23 changes: 23 additions & 0 deletions Meditate/source/globalSettings/GlobalSettings.mc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -176,6 +192,13 @@ module AutoStop {
}
}

module Notification {
enum {
Off = 0,
On = 1
}
}

module ResultsTheme {
enum {
Light = 0,
Expand Down
14 changes: 14 additions & 0 deletions Meditate/source/globalSettings/GlobalSettingsMenuDelegate.mc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b0973d6

Please sign in to comment.