diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index a22a959..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/app/.lock-waf_darwin_build b/app/.lock-waf_darwin_build index 169f48a..d17b671 100644 --- a/app/.lock-waf_darwin_build +++ b/app/.lock-waf_darwin_build @@ -1,5 +1,5 @@ argv = ['/Users/dan/pebble-dev/PebbleSDK-2.0.2/Pebble/waf', 'configure', 'build'] -environ = {'TERM_SESSION_ID': '0E771BB8-6D47-41B3-A896-1B67A6BC492D', 'SSH_AUTH_SOCK': '/tmp/launch-mBweRR/Listeners', 'PYTHONPATH': '/Users/dan/pebble-dev/PebbleSDK-current/bin/../.env/lib/python2.7/site-packages', 'VERSIONER_PYTHON_PREFER_32_BIT': 'no', 'TERM_PROGRAM_VERSION': '326', 'SHELL': '/bin/bash', 'LOGNAME': 'dan', 'USER': 'dan', 'HOME': '/Users/dan', 'PATH': '/Users/dan/pebble-dev/PebbleSDK-2.0.2/arm-cs-tools/bin:/Users/dan/pebble-dev/PebbleSDK-current/bin:/Applications/Android Studio.app/sdk/tools/:/Applications/Android Studio.app/sdk/platform-tools/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin', 'DISPLAY': '/tmp/launch-FHtlTI/org.macosforge.xquartz:0', 'TMPDIR': '/var/folders/5l/h8wjt5t52cs2n6h7zcd3kw040000gn/T/', 'TERM_PROGRAM': 'Apple_Terminal', 'LANG': 'en_GB.UTF-8', 'TERM': 'xterm-256color', 'Apple_PubSub_Socket_Render': '/tmp/launch-BrNYWU/Render', 'VERSIONER_PYTHON_VERSION': '2.7', 'SHLVL': '2', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'PWD': '/Users/dan/Workspace/minewatch/app', '_': '/Users/dan/pebble-dev/PebbleSDK-2.0.2/Pebble/waf', '__CHECKFIX1436934': '1', 'PEBBLE_PHONE': '192.168.1.147'} +environ = {'TERM_SESSION_ID': '3CD8238C-58C7-4290-8ACF-B40F29CAA6DF', 'SSH_AUTH_SOCK': '/tmp/launch-6iGfhV/Listeners', 'PYTHONPATH': '/Users/dan/pebble-dev/PebbleSDK-current/bin/../.env/lib/python2.7/site-packages', 'VERSIONER_PYTHON_PREFER_32_BIT': 'no', 'TERM_PROGRAM_VERSION': '326', 'SHELL': '/bin/bash', 'LOGNAME': 'dan', 'USER': 'dan', 'HOME': '/Users/dan', 'PATH': '/Users/dan/pebble-dev/PebbleSDK-2.0.2/arm-cs-tools/bin:/Users/dan/pebble-dev/PebbleSDK-current/bin:/Applications/Android Studio.app/sdk/tools/:/Applications/Android Studio.app/sdk/platform-tools/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin', 'DISPLAY': '/tmp/launch-oMwao1/org.macosforge.xquartz:0', 'TMPDIR': '/var/folders/5l/h8wjt5t52cs2n6h7zcd3kw040000gn/T/', 'TERM_PROGRAM': 'Apple_Terminal', 'LANG': 'en_GB.UTF-8', 'TERM': 'xterm-256color', 'Apple_PubSub_Socket_Render': '/tmp/launch-YAZ4GK/Render', 'VERSIONER_PYTHON_VERSION': '2.7', 'SHLVL': '2', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'PWD': '/Users/dan/Workspace/minewatch/app', '_': '/Users/dan/pebble-dev/PebbleSDK-2.0.2/Pebble/waf', 'JAVA_HOME': '/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home', '__CHECKFIX1436934': '1', 'PEBBLE_PHONE': '192.168.1.147'} files = ['/Users/dan/Workspace/minewatch/app/wscript'] hash = 4672844372416070989 options = {'files': '', 'jobs': 4, 'verbose': 0, 'nocache': False, 'progress_bar': 0, 'timestamp': None, 'distcheck_args': None, 'top': '', 'destdir': '', 'keep': 0, 'zones': '', 'debug': False, 'prefix': '/usr/local/', 'download': False, 'force': False, 'targets': '', 'out': ''} diff --git a/app/appinfo.json b/app/appinfo.json index ee52f64..78fd6b3 100644 --- a/app/appinfo.json +++ b/app/appinfo.json @@ -3,13 +3,14 @@ "shortName": "MineWatch", "longName": "MineWatch", "companyName": "Daniel Head", - "versionCode": 2, - "versionLabel": "1.0.1", + "versionCode": 3, + "versionLabel": "1.0.2", "watchapp": { "watchface": true }, "capabilities": [ "configurable" ], "appKeys": { + "version":0, "response":1, "update":2, "dark":3, diff --git a/app/src/js/pebble-js-app.js b/app/src/js/pebble-js-app.js index 1750404..d3c4f09 100644 --- a/app/src/js/pebble-js-app.js +++ b/app/src/js/pebble-js-app.js @@ -1,4 +1,6 @@ var config = { + "jsversion":"1.0.2", + "pblversion":(localStorage.getItem("pblversion") || ""), "dark":((localStorage.getItem("dark") == "true")?true:false), "notify":((localStorage.getItem("notify") == "true")?true:false), "flick":((localStorage.getItem("flick") == "true")?true:false), @@ -35,13 +37,7 @@ var sendResponseWithUpdate = function(obj) { return; } var req = new XMLHttpRequest(); - req.timeout = 30000; - req.ontimeout = function() { - if(!obj) obj = {}; - obj["response"] = "TIMEOUT"; - Pebble.sendAppMessage(obj); - } - req.onload = function(e) { + req.onreadystatechange = function() { if (req.readyState == 4) { if(req.status == 200) { var response = JSON.parse(req.responseText); @@ -78,13 +74,15 @@ var sendResponseWithUpdate = function(obj) { obj["response"] = "InvAPI"; Pebble.sendAppMessage(obj); } - } else { - if(!obj) obj = {}; - obj["response"] = "TIMEOUT"; - Pebble.sendAppMessage(obj); } } req.open('GET', "https://mining.bitcoin.cz/accounts/profile/json/" + config.apikey, true); + req.timeout = 30000; + req.ontimeout = function() { + if(!obj) obj = {}; + obj["response"] = "TIMEOUT"; + Pebble.sendAppMessage(obj); + } req.send(null); } var getSettings = function() { @@ -101,6 +99,10 @@ Pebble.addEventListener("ready", function(e) { }); Pebble.addEventListener("appmessage", function(e) { + if(e.payload.version) { + config.pblversion = e.payload.version; + localStorage.setItem("pblversion",e.payload.version); + } sendResponseWithUpdate(); }); Pebble.addEventListener("showConfiguration", function(e) { diff --git a/app/src/minewatch.c b/app/src/minewatch.c index 46562a9..80e621e 100644 --- a/app/src/minewatch.c +++ b/app/src/minewatch.c @@ -4,6 +4,7 @@ static Window *window; static GFont font_xs, font_s, font_m, font_l; static InverterLayer *inverter_layer; +static char *version_number = "1.0.2"; //TIME/DATE static TextLayer *time_layer; @@ -13,7 +14,7 @@ static char date_text[] = "00 Xxxxxxxxx"; //REFRESH ICON static AppTimer *timeout_timer; -static int timeout_length = 15000; //ms +//static int timeout_length = 65000; //ms static BitmapLayer *refresh_layer; static GBitmap *refresh_icon; @@ -59,6 +60,7 @@ static int progress_width = 0; //KEYS enum { + VERSION = 0x0, RESPONSE = 0x1, UPDATE = 0x2, DARK = 0x3, @@ -100,8 +102,8 @@ static void fetch_msg(void) { //Make sure we don't request more than once per min (be nice to Mr Slush) if(current_min == last_update_min) return; last_update_min = current_min; - Tuplet fetch_tuple = TupletInteger(0x0, 1); - timeout_timer = app_timer_register(timeout_length,timeout_callback, NULL); + + //timeout_timer = app_timer_register(timeout_length,timeout_callback, NULL); show_refresh(true); DictionaryIterator *iter; app_message_outbox_begin(&iter); @@ -109,11 +111,11 @@ static void fetch_msg(void) { if (iter == NULL) { return; } - - dict_write_tuplet(iter, &fetch_tuple); + dict_write_cstring(iter, VERSION, version_number); dict_write_end(iter); - app_message_outbox_send(); + uint32_t appMsgResp = app_message_outbox_send(); + if(appMsgResp != APP_MSG_OK) show_refresh(false); } static void handle_flick(AccelAxisType axis, int32_t direction) { @@ -258,7 +260,7 @@ static void in_received_handler(DictionaryIterator *iter, void *context) { layer_set_hidden(btc_parent_layer,false); strcpy(last_update_text,time_text); } - app_timer_cancel(timeout_timer); + //app_timer_cancel(timeout_timer); if(strcmp(response_tuple->value->cstring,"TIMEOUT")!=0) layer_set_hidden(bitmap_layer_get_layer(refresh_layer),true); } } @@ -483,7 +485,7 @@ static void init(void) { bluetooth_connection_service_subscribe(handle_bluetooth); tick_timer_service_subscribe(MINUTE_UNIT, handle_minute_tick); if(flick) enable_flick(true); - timeout_timer = app_timer_register(timeout_length,timeout_callback, NULL); + //timeout_timer = app_timer_register(timeout_length,timeout_callback, NULL); } static void deinit(void) { diff --git a/httpdocs/.idea/workspace.xml b/httpdocs/.idea/workspace.xml index fba3dd3..5acb1d1 100644 --- a/httpdocs/.idea/workspace.xml +++ b/httpdocs/.idea/workspace.xml @@ -27,11 +27,11 @@ - + - - + + @@ -40,7 +40,7 @@ - + @@ -57,10 +57,10 @@ - + - + @@ -70,7 +70,7 @@ - + @@ -80,8 +80,28 @@ - - + + + + + + + + + + + + + + + + + + + + + + @@ -105,8 +125,11 @@ @@ -144,6 +167,7 @@ + @@ -236,20 +260,6 @@ - - - - - - - - - @@ -312,26 +321,26 @@ - - - - - - - - + - - + + + + + + + + + - + @@ -356,22 +365,6 @@ - - - - - - - - - - - - - - - - @@ -694,14 +687,6 @@ - - - - - - - - @@ -709,28 +694,12 @@ - + - - - - - - - - - - - - - - - - @@ -739,22 +708,62 @@ - + - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/httpdocs/config.src/.sass-cache/fbbfd24a85cf759959729bf58a2b088cc49edd70/main.scssc b/httpdocs/config.src/.sass-cache/fbbfd24a85cf759959729bf58a2b088cc49edd70/main.scssc new file mode 100644 index 0000000..06731ef Binary files /dev/null and b/httpdocs/config.src/.sass-cache/fbbfd24a85cf759959729bf58a2b088cc49edd70/main.scssc differ diff --git a/httpdocs/config.src/body.html b/httpdocs/config.src/body.html index 42b8b72..01168f6 100644 --- a/httpdocs/config.src/body.html +++ b/httpdocs/config.src/body.html @@ -22,7 +22,14 @@ SAVE

Updates