owmweather - Show notice if not textinput is installed

master
Martin Boonk 2022-07-02 16:10:42 +02:00
parent c8fc3046d4
commit 8a14255c5f
2 changed files with 11 additions and 4 deletions

View File

@ -6,6 +6,7 @@ This updates [Weather](https://banglejs.com/apps/#weather) with data from the Op
Just install and configure the app. This needs an internet-enabled Gadgetbridge version.
Install [My Location](https://banglejs.com/apps/#mylocation) to change the location for the weather requests.
Install one of the text input libraries to modify the API key in the settings
## Creator

View File

@ -40,17 +40,23 @@
"Force refresh": Bangle.pullOwmWeather
};
if (require("textinput")){
mainmenu["API key"] = function (){
mainmenu["API key"] = function (){
if (require("textinput")){
require("textinput").input({text:settings.apikey}).then(result => {
if (result != "") {
print("Result is", result);
settings.apikey = result;
writeSettings("apikey",result);
}
E.showMenu(buildMainMenu());
});
};
}
} else {
E.showPrompt("Install a text input lib"),then(()=>{
E.showMenu(buildMainMenu());
});
}
};
return mainmenu;
}