diff --git a/app/engine.js b/app/engine.js index 0e2f2cf..b23fa2b 100644 --- a/app/engine.js +++ b/app/engine.js @@ -2983,14 +2983,26 @@ async function downloadUpdate() { try { const r = await window.engineHost.updateDownload(updFound.asset.url, updFound.asset.name); if (!r.ok) { $('updProgress').textContent = r.error || 'Download failed.'; btn.disabled = false; return; } - $('updProgress').textContent = 'Saved to Downloads.'; - /* Say what is left to do. Nothing installs itself here on purpose — see - the note on the main-process side. */ - $('updWhat').textContent = 'Downloaded ' + updFound.tag + ' (' + fmtMB(r.bytes) + '). ' + - 'Quit Church Translate, open the disk image, and drag the app over the one in ' + - 'Applications. Your settings, models and voices are untouched.'; - log('update ' + updFound.tag + ' downloaded to ' + r.path, 'ok'); - try { await window.engineHost.updateReveal(r.path); } catch (_) {} + $('updProgress').textContent = 'Downloaded. Installing\u2026'; + log('update ' + updFound.tag + ' downloaded to ' + r.path, 'ok'); + + /* + * Straight into the install. The app quits, a helper swaps the bundle and + * reopens it — so from here the window closing IS the update working, and + * saying so before it happens stops that looking like a crash. + */ + $('updWhat').textContent = 'Installing ' + updFound.tag + '. Church Translate will close and ' + + 'reopen by itself in a few seconds. Your settings, models and voices are untouched.'; + const ins = await window.engineHost.updateInstall(r.path); + if (!ins || !ins.ok) { + /* Still useful: the file is downloaded, so fall back to the manual route + rather than leaving them with nothing. */ + $('updProgress').textContent = (ins && ins.error) || 'Could not install.'; + $('updWhat').textContent = 'Downloaded, but it could not install itself. Quit Church ' + + 'Translate, open the disk image in Downloads, and drag the app over the one in Applications.'; + try { await window.engineHost.updateReveal(r.path); } catch (_) {} + btn.disabled = false; + } } catch (e) { $('updProgress').textContent = 'Download failed: ' + e.message; btn.disabled = false; diff --git a/app/index.html b/app/index.html index 8266e8a..50625c0 100644 --- a/app/index.html +++ b/app/index.html @@ -391,7 +391,7 @@