Skip to content
Merged
16 changes: 15 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,15 @@ function showAppInfo(appid, installedVersion) {
const infoPart = infoTxt.length>0 ? marked(infoTxt.join("<br>")) : "";
const changelogPart = changelogText ? changelogText.replace(/\n/g, "<br/>") : "";
const changeLogHeading = changelogPart ? "<hr><strong>ChangeLog:</strong><br>" : "";
showPrompt(app.name + " App Information", infoPart + changeLogHeading + changelogPart, {ok: true,}, false).catch(() => {});
showPrompt(app.name + " App Information", infoPart + changeLogHeading + changelogPart, {ok: true, githubIssue: true}, false).catch(() => {}).then((c)=>{
if(c=="githubIssue"){
const encodedTitle = encodeURIComponent(`[${app.name}] Describe the issue...`);
const authorText = app.author ? encodeURIComponent(`@${app.author}`):"";
window.open(`https://github.com/espruino/BangleApps/issues/new?template=bangle-bug-report-custom-form.yaml&title=${encodedTitle}&fwversion=${device.version?device.version:""}&author=${authorText}`,'_blank');
}
}

);
});
}
function getAppDescription(app) {
Expand Down Expand Up @@ -1045,6 +1053,12 @@ function uploadApp(app, options) {
}

return startOperation({name:"App Upload"}, () => getInstalledApps().then(()=>{
if (app.requiredFw!==undefined){
if(Utils.versionLess(device.version,app.requiredFw)) {
showToast(`App "${app.name}" requires firmware version ${app.requiredFw} or higher. You have version ${device.version}. To install this app, please update your firmware.`,"warning");
return;
}
}
if (device.appsInstalled.some(i => i.id === app.id)) {
return updateApp(app, {noNewOperation:true /*in 'App Upload'*/});
}
Expand Down
2 changes: 2 additions & 0 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function showPrompt(title, text, buttons, shouldEscapeHtml) {
${buttons.yes?'<button class="btn btn-primary" isyes="1">Yes</button>':''}
${buttons.no?'<button class="btn" isyes="0">No</button>':''}
${buttons.ok?'<button class="btn" isyes="1">Ok</button>':''}
${buttons.githubIssue?`<button class="btn" id="githubIssue">Report Issue</button>`:''}
${buttons.footer?`<span style="float:left">${buttons.footer}<span>`:""}
</div>
`:``}
Expand All @@ -131,6 +132,7 @@ function showPrompt(title, text, buttons, shouldEscapeHtml) {
event.preventDefault();
let isYes = event.target.getAttribute("isyes")=="1";
if (isYes) resolve();
else if (event.target.id=="githubIssue") resolve("githubIssue");
else reject("User cancelled");
modal.remove();
});
Expand Down
Loading