Skip to content
Merged
8 changes: 7 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
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:app}, false).catch(() => {});
});
}
function getAppDescription(app) {
Expand Down Expand Up @@ -948,9 +948,9 @@
if (file) entrypoint = JSON.stringify(file.name);
else showToast("No entrypoint found for app. Loading default clock.","warning");
// start the emulator and upload the whole app (and dependencies)
startCleanEmulator()

Check warning on line 951 in js/index.js

View workflow job for this annotation

GitHub Actions / test

'startCleanEmulator' is not defined
.then(() => uploadApp(app))

Check warning on line 952 in js/index.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 12 spaces but found 10
.then(() => Comms.write(`load(${entrypoint});\n`));

Check warning on line 953 in js/index.js

View workflow job for this annotation

GitHub Actions / test

Expected indentation of 12 spaces but found 10
} else { // fallback - open the Web IDE
if (!file) {
console.error("No entrypoint found for "+appid);
Expand Down Expand Up @@ -1045,6 +1045,12 @@
}

return startOperation({name:"App Upload"}, () => getInstalledApps().then(()=>{
if (app.requiredFw!==undefined){
if(device.version < app.requiredFw) {
Comment thread
RKBoss6 marked this conversation as resolved.
Outdated
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
16 changes: 15 additions & 1 deletion js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,20 @@ 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>
`:``}
</div>
</div>`);

if (buttons.githubIssue) {
const issueBtn = modal.querySelector("#githubIssue");
if (issueBtn) {
issueBtn.app = buttons.githubIssue;
}
}

document.body.append(modal);
modal.querySelector("a[href='#close']").addEventListener("click",event => {
event.preventDefault();
Expand All @@ -131,9 +140,14 @@ function showPrompt(title, text, buttons, shouldEscapeHtml) {
event.preventDefault();
let isYes = event.target.getAttribute("isyes")=="1";
if (isYes) resolve();
else if (event.target.app) {
Comment thread
RKBoss6 marked this conversation as resolved.
Outdated
console.log("User data:",event.target.app);
window.open(`https://github.com/espruino/BangleApps/issues/new?template=bangle-bug-report-custom-form.yaml&title=[${event.target.app.name.replace(" ", "%20")}] Describe%20the%20issue...`, '_blank');

}
else reject("User cancelled");
modal.remove();
});
})
});
});
}
Expand Down
Loading