From 5f66165cb4c697fbfbafeec89dae2d6bf0c3fa67 Mon Sep 17 00:00:00 2001 From: dyedgreen Date: Fri, 19 Aug 2016 19:32:50 +0200 Subject: [PATCH] App Store 1.7 * Added more clarity with the error displayed for the public transit navigation --- package.json | 2 +- src/directions_window.c | 9 ++++++++- src/error_window.c | 7 ++++++- src/error_window.h | 4 +++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 3211221..8de916c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pebble-directions", "author": "Dyedgreen", - "version": "1.6.0", + "version": "1.7.0", "keywords": [ "navigation", "maps", diff --git a/src/directions_window.c b/src/directions_window.c index b770e88..fa84945 100644 --- a/src/directions_window.c +++ b/src/directions_window.c @@ -268,7 +268,7 @@ static void app_message_send_search_data() { // Create a string with the correct length (len is the length w/o the '/0' char) const int len = strlen(address) + 1; char message[len + 1]; - // Format the string FIXME (cuts of after 'mee' for the test string ???) + // Format the string snprintf(message, sizeof(message), "%i%s", selected_type_enum, address); // Make sure the string is terminated correctely (just in case) message[len] = '\0'; @@ -504,6 +504,13 @@ void directions_window_push() { // Push window to screen window_stack_push(window, true); + // Display the not available error for transit FIXME: (Find a transit api / re-contact HERE) + if (selected_type_enum == Train) { + window_display_error(Unavailable); + // Abort all other operations in this function + return; + } + // Start the dictation session dictation_session_start_handler(); diff --git a/src/error_window.c b/src/error_window.c index ab9beac..26f3f48 100644 --- a/src/error_window.c +++ b/src/error_window.c @@ -43,11 +43,16 @@ static void window_load() { icon_error = gbitmap_create_with_resource(RESOURCE_ID_ICON_ERROR_API); text_error = "No route could be found"; break; - // Dictation + // Dictation case 2: icon_error = gbitmap_create_with_resource(RESOURCE_ID_ICON_ERROR_DICTATION); text_error = "Could not start dictation"; break; + // Unavailable + case 3: + icon_error = gbitmap_create_with_resource(RESOURCE_ID_ICON_ERROR_OTHER); + text_error = "Currently unavailable"; + break; // Other / Undefined default: icon_error = gbitmap_create_with_resource(RESOURCE_ID_ICON_ERROR_OTHER); diff --git a/src/error_window.h b/src/error_window.h index 318630f..4569179 100644 --- a/src/error_window.h +++ b/src/error_window.h @@ -11,8 +11,10 @@ enum ErrorType { Api = 1, // Error when trying to start the dictation Dictation = 2, + // Error when a feature is unavailable + Unavailable = 3, // Something simply went wrong - Other = 3 + Other = 4 }; void error_window_push(enum ErrorType);