From 1c2ca29f3f9fa2e40cf05953a66e28cebc074c95 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 7 Jul 2022 14:20:37 +0200 Subject: [PATCH] Allow retry if download via app fails --- apps/agpsdata/app.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/agpsdata/app.js b/apps/agpsdata/app.js index 0877a174d..080efebc0 100644 --- a/apps/agpsdata/app.js +++ b/apps/agpsdata/app.js @@ -3,7 +3,7 @@ function display(text1, text2) { g.clear(); var img = require("Storage").read("agpsdata.img"); if (img) { - g.drawImage(img, g.getWidth() - 48, g.getHeight()-48-24); + g.drawImage(img, g.getWidth() - 48, g.getHeight() - 48 - 24); } g.setFont("Vector", 20); g.setFontAlign(0, 1); @@ -21,9 +21,16 @@ function display(text1, text2) { Bangle.loadWidgets(); Bangle.drawWidgets(); -display("Updating data..."); -require("agpsdata").pull(function() { - display("Success", "AGPS data updated."); -},function(error) { - display("Error:", error); -}); +function start() { + display("Updating data..."); + require("agpsdata") + .pull(function() { display("Success", "AGPS data updated."); }, + function(error) { + display("Error:" + error, "touch to retry"); + Bangle.on("touch", () => { + start(); + }); + }); +} + +start();