diff --git a/package.json b/package.json index 0e237bb..2a0e880 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "author": "cheeseisdisgusting@gmail.com", "dependencies": { - "pebble-clay": "^1.0.3" + "pebble-clay": "^1.0.4" }, "keywords": [], "name": "breathe", @@ -16,11 +16,12 @@ "backgroundColor", "circleColor", "vibrationEnabled", - "heartRateEnabled", "reminderHours", "reminderHoursStart", "rememberDuration", - "breathsPerMinute" + "breathsPerMinute", + "vibrationType", + "displayText" ], "projectType": "native", "resources": { @@ -54,5 +55,5 @@ "watchface": false } }, - "version": "0.28.0" + "version": "0.29.0" } diff --git a/src/c/appglance.c b/src/c/appglance.c index 192d14a..de5b54b 100644 --- a/src/c/appglance.c +++ b/src/c/appglance.c @@ -16,7 +16,7 @@ void appglance_update_app_glance(AppGlanceReloadSession *session, size_t limit, .icon = APP_GLANCE_SLICE_DEFAULT_ICON, .subtitle_template_string = message }, - // TODO: Change to APP_GLANCE_SLICE_NO_EXPIRATION in SDK 4-dp2 + .expiration_time = APP_GLANCE_SLICE_NO_EXPIRATION }; diff --git a/src/c/breathe_window.c b/src/c/breathe_window.c index 713297d..695d9e3 100644 --- a/src/c/breathe_window.c +++ b/src/c/breathe_window.c @@ -7,7 +7,7 @@ static Window *s_main_window; static Layer *s_circle_layer, *s_inside_text_layer, *s_upper_text_layer, *s_lower_text_layer; -static AppTimer *s_animation_completed_timer, *s_main_animation_ended_timer, *animationTimer[69], *s_show_relax_text_timer, *s_show_inhale_timer, *s_hide_exhale_timer, *s_show_exhale_timer, *s_hide_lower_text_layer, *s_click_provider_timer; +static AppTimer *s_animation_completed_timer, *s_main_animation_ended_timer, *animationTimer[69], *s_show_relax_text_timer, *s_show_inhale_timer, *s_show_exhale_timer, *s_hide_lower_text_layer, *s_click_provider_timer; static GRect bounds; static uint8_t s_radius_final, s_radius = 0; static int s_min_to_breathe = 1, s_min_breathed_today = 0, s_times_played = 0, s_breath_duration, s_breaths_per_minute; @@ -29,7 +29,7 @@ static void inside_text_layer_update_proc(Layer *s_inside_text_layer, GContext * // Draws text at top of screen static void upper_text_layer_update_proc(Layer *s_inside_text_layer, GContext *ctx) { - graphics_draw_upper_text(ctx, bounds, s_animating, settings_get_heartRateEnabled(), settings_get_textColor(), s_greet_text); + graphics_draw_upper_text(ctx, bounds, s_animating, settings_get_displayText(), settings_get_textColor(), s_greet_text); } // Draws text at bottom of screen @@ -153,9 +153,6 @@ static void main_animation() { layer_set_hidden(s_inside_text_layer, true); #endif - layer_set_hidden(s_upper_text_layer, true); - layer_set_hidden(s_lower_text_layer, true); - // Circle expands for 3 seconds and delays for 1 second Animation *circle_expand = animation_create(); animation_set_duration(circle_expand, s_breath_duration); @@ -182,37 +179,49 @@ static void main_animation() { s_times_played++; // Used to keep track to see how many should be played to fill time if (settings_get_vibrationEnabled()) { - // Vibrations! (play for 0, rest for 1500, play for 25, rest for 25, etc.) - static uint32_t segments[52]; - switch(s_breaths_per_minute) { - case 4: ; // 15000 milliseconds long, with an empty statement after a label before a declaration - static const uint32_t four_segments[52] = {0, 2500, 25, 50, 25, 50, 25, 65, 25, 65, 25, 75, 25, 75, 25, 80, 25, 80, 25, 100, 25, 100, 25, 150, 25, 150, 25, 175, 25, 175, 25, 225, 25, 225, 25, 275, 25, 275, 25, 375, 25, 375, 25, 450, 25, 450, 25, 500, 25, 7300}; - memcpy(segments, four_segments, sizeof(four_segments)); - break; - case 5: ; // 12000 milliseconds long (actually 11665 but who cares) - static const uint32_t five_segments[45] = {0, 2000, 25, 50, 25, 50, 25, 65, 25, 65, 25, 75, 25, 75, 25, 80, 25, 80, 25, 100, 25, 100, 25, 150, 25, 150, 25, 175, 25, 175, 25, 225, 25, 225, 25, 275, 25, 275, 25, 375, 25, 375, 25, 6000}; - memcpy(segments, five_segments, sizeof(five_segments)); - break; - case 6: - case 7: ; // 8000 milliseconds long (actually 7650 milliseconds long), with an empty statement after a label before a declaration - static const uint32_t seven_segments[31] = {0, 1500, 25, 25, 25, 25, 25, 25, 25, 25, 25, 50, 25, 75, 25, 125, 25, 125, 25, 125, 25, 125, 25, 200, 25, 325, 25, 550, 25, 4000}; - memcpy(segments, seven_segments, sizeof(seven_segments)); + switch(settings_get_vibrationType()) { + case 0: ; + // Vibrations! (play for 0, rest for 1500, play for 25, rest for 25, etc.) + static uint32_t segments[52]; + switch(s_breaths_per_minute) { + case 4: ; // 15000 milliseconds long, with an empty statement after a label before a declaration + static const uint32_t four_segments[52] = {0, 2500, 25, 50, 25, 50, 25, 65, 25, 65, 25, 75, 25, 75, 25, 80, 25, 80, 25, 100, 25, 100, 25, 150, 25, 150, 25, 175, 25, 175, 25, 225, 25, 225, 25, 275, 25, 275, 25, 375, 25, 375, 25, 450, 25, 450, 25, 500, 25, 7300}; + memcpy(segments, four_segments, sizeof(four_segments)); + break; + case 5: ; // 12000 milliseconds long (actually 11665 but who cares) + static const uint32_t five_segments[45] = {0, 2000, 25, 50, 25, 50, 25, 65, 25, 65, 25, 75, 25, 75, 25, 80, 25, 80, 25, 100, 25, 100, 25, 150, 25, 150, 25, 175, 25, 175, 25, 225, 25, 225, 25, 275, 25, 275, 25, 375, 25, 375, 25, 6000}; + memcpy(segments, five_segments, sizeof(five_segments)); + break; + case 6: + case 7: ; // 8000 milliseconds long (actually 7650 milliseconds long), with an empty statement after a label before a declaration + static const uint32_t seven_segments[31] = {0, 1500, 25, 25, 25, 25, 25, 25, 25, 25, 25, 50, 25, 75, 25, 125, 25, 125, 25, 125, 25, 125, 25, 200, 25, 325, 25, 550, 25, 4000}; + memcpy(segments, seven_segments, sizeof(seven_segments)); + break; + case 8: // 7000 milliseconds long (actually 7000) (wow!!) + case 9: ; + static const uint32_t nine_segments[29] = {0, 1500, 25, 25, 25, 25, 25, 25, 25, 50, 25, 75, 25, 100, 25, 125, 25, 150, 25, 200, 25, 250, 25, 300, 25, 350, 25, 3500}; + memcpy(segments, nine_segments, sizeof(nine_segments)); + break; + default: ; // 6000 milliseconds long (actually 5075) + static const uint32_t ten_segments[31] = {0, 1100, 25, 25, 25, 25, 25, 25, 25, 50, 25, 75, 25, 100, 25, 100, 25, 125, 25, 125, 25, 150, 25, 250, 25, 275, 25, 300, 25, 2000}; + memcpy(segments, ten_segments, sizeof(ten_segments)); + break; + } + VibePattern vibes = { + .durations = segments, + .num_segments = ARRAY_LENGTH(segments), + }; + vibes_enqueue_custom_pattern(vibes); break; - case 8: // 7000 milliseconds long (actually 7000) (wow!!) - case 9: ; - static const uint32_t nine_segments[29] = {0, 1500, 25, 25, 25, 25, 25, 25, 25, 50, 25, 75, 25, 100, 25, 125, 25, 150, 25, 200, 25, 250, 25, 300, 25, 350, 25, 3500}; - memcpy(segments, nine_segments, sizeof(nine_segments)); - break; - default: ; // 6000 milliseconds long (actually 5075) - static const uint32_t ten_segments[31] = {0, 1100, 25, 25, 25, 25, 25, 25, 25, 50, 25, 75, 25, 100, 25, 100, 25, 125, 25, 125, 25, 150, 25, 250, 25, 275, 25, 300, 25, 2000}; - memcpy(segments, ten_segments, sizeof(ten_segments)); + default: ;// 1000 delay for animation, 50 play, 100 stop, 50 play, rest for breath duration and delay and subtract (50 + 100 + 50), and vibrate again. + const uint32_t segments_simple[] = {0, 1000, 50, 100, 50, settings_get_breathDuration() + 1000 - 200, 50, 100, 50, settings_get_breathDuration() - 300}; + VibePattern vibes_simple = { + .durations = segments_simple, + .num_segments = ARRAY_LENGTH(segments_simple), + }; + vibes_enqueue_custom_pattern(vibes_simple); break; } - VibePattern vibes = { - .durations = segments, - .num_segments = ARRAY_LENGTH(segments), - }; - vibes_enqueue_custom_pattern(vibes); } } @@ -220,6 +229,10 @@ static void main_animation() { static void main_animation_callback () { if (s_times_played < s_breaths_per_minute * s_min_to_breathe) { animationTimer[s_times_played] = app_timer_register(2 * s_breath_duration + 2000, main_animation_callback, NULL); + if (!layer_get_hidden(s_upper_text_layer) || !layer_get_hidden(s_lower_text_layer)) { + layer_set_hidden(s_upper_text_layer, true); + layer_set_hidden(s_lower_text_layer, true); + } main_animation(); } } @@ -240,11 +253,6 @@ static void first_breath_out_callback(void *context) { layer_set_hidden(s_lower_text_layer, false); } -// Hides bottom text -static void first_breath_out_hide_callback(void *context) { - layer_set_hidden(s_lower_text_layer, true); -} - // Start animation show text static void animation_start_callback(void *context) { // Sets strings as English, change if watch is set to another language @@ -396,8 +404,6 @@ static void select_click_handler(ClickRecognizerRef recognizer, void *context) { /* Shows the instruction to exhale at after one breathe in Also hides the first instruction */ s_show_exhale_timer = app_timer_register(7100 + s_breath_duration, first_breath_out_callback, NULL); - // Hides the instruction to exhale after one breath in and one breath out - s_hide_exhale_timer = app_timer_register(7100 + 2 * s_breath_duration, first_breath_out_hide_callback, NULL); // First animationTimer, which will schedule the next time the circle expands or contracts animationTimer[0] = app_timer_register(6000, main_animation_callback, NULL); diff --git a/src/c/graphics.c b/src/c/graphics.c index 12f3d1f..bc74cad 100644 --- a/src/c/graphics.c +++ b/src/c/graphics.c @@ -34,7 +34,7 @@ static GPath *s_up_triangle, *s_down_triangle; #endif // Method for updating the upper text layer -void graphics_draw_upper_text(GContext *ctx, GRect bounds, bool is_animating, bool heart_rate, GColor textColor, char *greet_text) { +void graphics_draw_upper_text(GContext *ctx, GRect bounds, bool is_animating, int display_text, GColor textColor, char *greet_text) { #if defined(PBL_HEALTH) const char *steps_buffer = data_get_current_steps_buffer(); // Pebble Health exists; fetch the number of steps walked today #endif @@ -48,15 +48,28 @@ void graphics_draw_upper_text(GContext *ctx, GRect bounds, bool is_animating, bo GRect((bounds.size.w - greet_text_bounds.w) / 2, PBL_IF_RECT_ELSE(5, 15), greet_text_bounds.w, greet_text_bounds.h), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } else { - if (heart_rate && data_get_current_heart_rate() > 0) { // If heart rate monitor is enabled in configuration and is available, show heart rate + if (display_text == 2 && data_get_current_heart_rate() > 0) { // If heart rate monitor is enabled in configuration and is available, show heart rate + APP_LOG(APP_LOG_LEVEL_DEBUG, "The app is showing the heart rate."); const char *heart_rate_buffer = data_get_current_heart_rate_buffer(); graphics_draw_text(ctx, heart_rate_buffer, fonts_get_system_font(FONT_KEY), GRect((bounds.size.w - greet_text_bounds.w) / 2, PBL_IF_RECT_ELSE(5, 15), greet_text_bounds.w, greet_text_bounds.h), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } else { // Otherwise, show step counts if Pebble Health, and string if not. - graphics_draw_text(ctx, PBL_IF_HEALTH_ELSE(steps_buffer, greet_text), fonts_get_system_font(FONT_KEY), + switch(display_text) { + case 0: + APP_LOG(APP_LOG_LEVEL_DEBUG, "The app is showing the default greeting text."); + graphics_draw_text(ctx, greet_text, fonts_get_system_font(FONT_KEY), GRect((bounds.size.w - greet_text_bounds.w) / 2, PBL_IF_RECT_ELSE(5, 15), greet_text_bounds.w, greet_text_bounds.h), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); + break; + case 1: + case 2: + APP_LOG(APP_LOG_LEVEL_DEBUG, "The app is showing the number of steps."); + graphics_draw_text(ctx, PBL_IF_HEALTH_ELSE(steps_buffer, greet_text), fonts_get_system_font(FONT_KEY), + GRect((bounds.size.w - greet_text_bounds.w) / 2, PBL_IF_RECT_ELSE(5, 15), greet_text_bounds.w, greet_text_bounds.h), + GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); + break; + } } } } diff --git a/src/c/graphics.h b/src/c/graphics.h index 9e31234..439718d 100644 --- a/src/c/graphics.h +++ b/src/c/graphics.h @@ -8,7 +8,7 @@ #define FONT_KEY FONT_KEY_GOTHIC_14_BOLD #endif -void graphics_draw_upper_text(GContext *ctx, GRect bounds, bool is_animating, bool heart_rate, GColor textColor, char *); +void graphics_draw_upper_text(GContext *ctx, GRect bounds, bool is_animating, int displayText, GColor textColor, char *); void graphics_draw_lower_text(GContext *ctx, GRect bounds, bool is_animating, GColor textColor, char *); diff --git a/src/c/localize.c b/src/c/localize.c index 4fbb077..06a98d6 100644 --- a/src/c/localize.c +++ b/src/c/localize.c @@ -72,7 +72,7 @@ char * localize_get_hello_text() { } else if (strncmp(localize_get_locale(), "es", 2) == 0) { return "¡HOLA!"; } else { - return "HELLO."; + return "HELLO!"; } } diff --git a/src/c/main.c b/src/c/main.c index fce432b..3dbc028 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -9,7 +9,7 @@ #include "src/c/appglance.h" static void init() { - APP_LOG(APP_LOG_LEVEL_INFO, "You are running version 0.2.8 of the Breathe app."); + APP_LOG(APP_LOG_LEVEL_INFO, "You are running version 0.2.9 of the Breathe app."); #if PBL_HEALTH health_init(); // Subscribe to health service if health API is available #endif diff --git a/src/c/settings.c b/src/c/settings.c index 6f0752c..2c8994e 100644 --- a/src/c/settings.c +++ b/src/c/settings.c @@ -10,11 +10,12 @@ void settings_init() { settings.circleColor = PBL_IF_COLOR_ELSE(GColorJaegerGreen, GColorWhite); settings.textColor = GColorWhite; settings.vibrationEnabled = true; + settings.vibrationType = 0; settings.rememberDuration = false; #if PBL_API_EXISTS(health_service_peek_current_value) - settings.heartRateEnabled = true; + settings.displayText = 2; #else - settings.heartRateEnabled = false; + settings.displayText = 1; #endif settings.reminderHours = 4; settings.reminderHoursStart = 8; @@ -52,9 +53,15 @@ void settings_handle_settings(DictionaryIterator *iter, void *context) { settings.vibrationEnabled = vibration_enabled_t->value->int32 == 1; } - Tuple *heartRate_enabled_t = dict_find(iter, MESSAGE_KEY_heartRateEnabled); - if (heartRate_enabled_t) { - settings.heartRateEnabled = heartRate_enabled_t->value->int32 == 1; + Tuple *vibration_type_t = dict_find(iter, MESSAGE_KEY_vibrationType); + if (vibration_type_t) { + settings.vibrationType = vibration_type_t->value->int8; + } + + Tuple *displayText_t = dict_find(iter, MESSAGE_KEY_displayText); + if (displayText_t) { + settings.displayText = displayText_t->value->int8; + APP_LOG(APP_LOG_LEVEL_DEBUG, "The displayText value is %d.", settings.displayText); } Tuple *reminder_hours_start_t = dict_find(iter, MESSAGE_KEY_reminderHoursStart); @@ -101,8 +108,12 @@ bool settings_get_vibrationEnabled() { return settings.vibrationEnabled; } -bool settings_get_heartRateEnabled() { - return settings.heartRateEnabled; +int settings_get_vibrationType() { + return settings.vibrationType; +} + +int settings_get_displayText() { + return settings.displayText; } int settings_get_reminderHours() { diff --git a/src/c/settings.h b/src/c/settings.h index 4de52ac..7a39f3c 100644 --- a/src/c/settings.h +++ b/src/c/settings.h @@ -10,7 +10,8 @@ typedef struct ClaySettings { GColor circleColor; GColor textColor; bool vibrationEnabled; - bool heartRateEnabled; + int vibrationType; + int displayText; int reminderHours; bool rememberDuration; int reminderHoursStart; @@ -25,7 +26,8 @@ GColor settings_get_backgroundColor(); GColor settings_get_circleColor(); GColor settings_get_textColor(); bool settings_get_vibrationEnabled(); -bool settings_get_heartRateEnabled(); +int settings_get_vibrationType(); +int settings_get_displayText(); int settings_get_reminderHours(); bool settings_get_rememberDuration(); int settings_get_reminderHoursStart(); diff --git a/src/pkjs/config-es.js b/src/pkjs/config-es.js index 5ccd798..73f9ab3 100644 --- a/src/pkjs/config-es.js +++ b/src/pkjs/config-es.js @@ -5,7 +5,7 @@ module.exports = [ }, { "type": "text", - "defaultValue": "Esta es la página de ajustes para la app Breathe. Estás usando la version 0.2.8 de la app.", + "defaultValue": "Esta es la página de ajustes para la app Breathe. Estás usando la versión 0.2.9 de la app.", }, { "type": "section", @@ -49,6 +49,23 @@ module.exports = [ "defaultValue": true, "label": "¿Activar las vibraciones durante la respiración?", }, + { + "type": "select", + "messageKey": "vibrationType", + "defaultValue": "0", + "label": "Tipo de vibración", + "description": "La condición base es como el Apple Watch; Simple es un doble toque.", + "options": [ + { + "label": "Condicón base", + "value": "0" + }, + { + "label": "Simple", + "value": "1" + } + ] + }, { "type": "slider", "messageKey": "breathsPerMinute", @@ -62,18 +79,32 @@ module.exports = [ }, { "type": "section", - "capabilities": ["NOT_PLATFORM_APLITE", "NOT_PLATFORM_BASALT", "NOT_PLATFORM_CHALK"], + "capabilities": ["NOT_PLATFORM_APLITE"], "items": [ {"type": "heading", "defaultValue": "Salud" }, { - "type": "toggle", - "messageKey": "heartRateEnabled", - "defaultValue": true, - "label": "¿Mostrar el ritmo cardiaco?", - "description": "Si activado, el app mostrará el ritmo cardiaco en el menú principal. Si no, el app mostrará el número de pasos que has tomado hoy." - } + "type": "select", + "messageKey": "displayText", + "defaultValue": "1", + "label": "Mostrar...", + "description": "Esto determina lo que está mostrado en el menu principal. NOTA: El ritmo cardiaco requiere un reloj con un monitor de ritmo cardiaco.", + "options": [ + { + "label": "Saludo", + "value": "0" + }, + { + "label": "Pasos hoy", + "value": "1" + }, + { + "label": "Ritmo cardiaco", + "value": "2" + } + ] + }, ] }, { @@ -130,7 +161,7 @@ module.exports = [ }, { "type": "text", - "defaultValue": "
Muchas gracias a los probadores beta:
Paula Bosca, Nikita Cheng, Ayush Gupta, Ellen Huang, Yvonne Tan, y David Voicu
", + "defaultValue": "
Muchas gracias a los probadores beta:
Paula Bosca, Nikita Cheng, Ayush Gupta, Ellen Huang, Yvonne Tan, David Voicu, y /u/PiwwowPants
", }, { "type": "submit", diff --git a/src/pkjs/config-fr.js b/src/pkjs/config-fr.js index 3995d06..96535e5 100644 --- a/src/pkjs/config-fr.js +++ b/src/pkjs/config-fr.js @@ -5,7 +5,7 @@ module.exports = [ }, { "type": "text", - "defaultValue": "Ceci est la page de configuration pour l'app Breathe. Vous utilisez version 0.2.8 de l'app.", + "defaultValue": "Ceci est la page de configuration pour l'app Breathe. Vous utilisez version 0.2.9 de l'app.", }, { "type": "section", @@ -49,6 +49,23 @@ module.exports = [ "defaultValue": true, "label": "Activer les vibrations pendant les respirations?", }, + { + "type": "select", + "messageKey": "vibrationType", + "defaultValue": "0", + "label": "Type de vibration", + "description": "Défaut est comme celui du Apple Watch; Simple tappe deux fois.", + "options": [ + { + "label": "Défaut", + "value": "0" + }, + { + "label": "Simple", + "value": "1" + } + ] + }, { "type": "slider", "messageKey": "breathsPerMinute", @@ -62,18 +79,32 @@ module.exports = [ }, { "type": "section", - "capabilities": ["NOT_PLATFORM_APLITE", "NOT_PLATFORM_BASALT", "NOT_PLATFORM_CHALK"], + "capabilities": ["NOT_PLATFORM_APLITE"], "items": [ {"type": "heading", "defaultValue": "Santé" }, { - "type": "toggle", - "messageKey": "heartRateEnabled", - "defaultValue": true, - "label": "Montrer le rhythme cardiaque", - "description": "Si activé, l'app montre le rhythme cardiaque dans le menu principal. Sinon, le nombre de pas marchés aujourd'hui sera montré." - } + "type": "select", + "messageKey": "displayText", + "defaultValue": "1", + "label": "Montrer...", + "description": "Ceci détermine ce qui est montré en haut du menu principal. Montrer le rhythme cardiaque requiert une montre avec un moniteur cardiaque.", + "options": [ + { + "label": "Salut", + "value": "0" + }, + { + "label": "Nombre de pas pris aujourd'hui", + "value": "1" + }, + { + "label": "Rhythme cardiaque", + "value": "2" + } + ] + }, ] }, { @@ -130,7 +161,7 @@ module.exports = [ }, { "type": "text", - "defaultValue": "
Un grand merci aux bêta-testeurs:
Paula Bosca, Nikita Cheng, Ayush Gupta, Ellen Huang, Yvonne Tan, et David Voicu
", + "defaultValue": "
Un grand merci aux bêta-testeurs:
Paula Bosca, Nikita Cheng, Ayush Gupta, Ellen Huang, Yvonne Tan, David Voicu, et /u/PiwwowPants
", }, { "type": "submit", diff --git a/src/pkjs/config.js b/src/pkjs/config.js index 79a7741..d8eeeec 100644 --- a/src/pkjs/config.js +++ b/src/pkjs/config.js @@ -5,7 +5,7 @@ module.exports = [ }, { "type": "text", - "defaultValue": "This is the settings page for the Breathe app. You are running version 0.2.8 of Breathe.", + "defaultValue": "This is the settings page for the Breathe app. You are running version 0.2.9 of Breathe.", }, { "type": "section", @@ -49,6 +49,23 @@ module.exports = [ "defaultValue": true, "label": "Enable vibrations on inhale", }, + { + "type": "select", + "messageKey": "vibrationType", + "defaultValue": "0", + "label": "Vibration Type", + "description": "Default is like the Apple Watch, Simple is double tap.", + "options": [ + { + "label": "Default", + "value": "0" + }, + { + "label": "Simple", + "value": "1" + } + ] + }, { "type": "slider", "messageKey": "breathsPerMinute", @@ -62,18 +79,32 @@ module.exports = [ }, { "type": "section", - "capabilities": ["NOT_PLATFORM_APLITE", "NOT_PLATFORM_BASALT", "NOT_PLATFORM_CHALK"], + "capabilities": ["NOT_PLATFORM_APLITE"], "items": [ {"type": "heading", "defaultValue": "Health" }, { - "type": "toggle", - "messageKey": "heartRateEnabled", - "defaultValue": true, - "label": "Show heart rate", - "description": "If enabled, the app shows the heart rate. If disabled, the app shows the number of steps taken today." - } + "type": "select", + "messageKey": "displayText", + "defaultValue": "1", + "label": "Show...", + "description": "This determines what the app shows at the top part of the main menu. Heart rate requires a watch with a heart rate monitor.", + "options": [ + { + "label": "Greeting", + "value": "0" + }, + { + "label": "Steps today", + "value": "1" + }, + { + "label": "Heart Rate", + "value": "2" + } + ] + }, ] }, { @@ -81,7 +112,7 @@ module.exports = [ "items": [ { "type": "heading", - "defaultValue": "Reminders" + "defaultValue": "Reminders" }, { "type": "select", @@ -130,7 +161,7 @@ module.exports = [ }, { "type": "text", - "defaultValue": "
Many thanks to the beta testers:
Paula Bosca, Nikita Cheng, Ayush Gupta, Ellen Huang, Yvonne Tan, and David Voicu
", + "defaultValue": "
Many thanks to the beta testers:
Paula Bosca, Nikita Cheng, Ayush Gupta, Ellen Huang, Yvonne Tan, David Voicu, and /u/PiwwowPants.
", }, { "type": "submit", diff --git a/src/pkjs/custom-clay.js b/src/pkjs/custom-clay.js index 5eafa2e..e1a2a0f 100644 --- a/src/pkjs/custom-clay.js +++ b/src/pkjs/custom-clay.js @@ -11,11 +11,23 @@ module.exports = function(minified) { clayConfig.getItemByMessageKey('reminderHoursStart').disable(); } } + + function toggleVibration() { + if (this.get() !== false) { + clayConfig.getItemByMessageKey('vibrationType').enable(); + } else { + clayConfig.getItemByMessageKey('vibrationType').disable(); + } + } clayConfig.on(clayConfig.EVENTS.AFTER_BUILD, function() { var reminderSelect = clayConfig.getItemByMessageKey('reminderHours'); toggleReminder.call(reminderSelect); reminderSelect.on('change', toggleReminder); + + var vibrationEnabledToggle = clayConfig.getItemByMessageKey('vibrationEnabled'); + toggleVibration.call(vibrationEnabledToggle); + vibrationEnabledToggle.on('change', toggleVibration); }); }; \ No newline at end of file diff --git a/src/pkjs/index.js b/src/pkjs/index.js index 4dc18fb..03dbe6a 100644 --- a/src/pkjs/index.js +++ b/src/pkjs/index.js @@ -30,17 +30,20 @@ Pebble.addEventListener('webviewclosed', function(e) { // Get the keys and values from each config item var dict = clay.getSettings(e.response); dict[messageKeys.reminderHours] = parseInt(dict[messageKeys.reminderHours]); - var platform = clay.meta.activeWatchInfo.platform; - if (platform === 'aplite' || platform === 'basalt' || platform === 'chalk') { - dict[messageKeys.heartRateEnabled] = false; // Just in case - } + dict[messageKeys.displayText] = parseInt(dict[messageKeys.displayText]); + dict[messageKeys.vibrationType] = parseInt(dict[messageKeys.vibrationType]); +// var platform = clay.meta.activeWatchInfo.platform; +// if (platform === 'aplite' || platform === 'basalt' || platform === 'chalk') { +// dict[messageKeys.heartRateEnabled] = false; // Just in case +// } // Log all the settings for fun console.log('The reminderHours sent to Pebble is ' + dict[messageKeys.reminderHours] + '.'); console.log('The backgroundColor sent to Pebble is ' + dict[messageKeys.backgroundColor] + '.'); console.log('The circleColor sent to Pebble is ' + dict[messageKeys.circleColor] + '.'); console.log('The vibrationEnabled sent to Pebble is ' + dict[messageKeys.vibrationEnabled] + '.'); - console.log('The heartRateEnabled sent to Pebble is ' + dict[messageKeys.heartRateEnabled] + '.'); + console.log('The vibrationType sent to Pebble is ' + dict[messageKeys.vibrationType] + '.'); + console.log('The displayText sent to Pebble is ' + dict[messageKeys.displayText] + '.'); console.log('The rememberDuration sent to Pebble is ' + dict[messageKeys.rememberDuration] + '.'); console.log('The reminderHoursStart sent to Pebble is ' + dict[messageKeys.reminderHoursStart] + '.'); console.log('The breathsPerMinute sent to Pebble is ' + dict[messageKeys.breathsPerMinute] + '.');