feat(desktop 0.1.5): show version + Check for updates in Settings (#12)
- Settings now shows 'Biz Connect for Desktop · Version x.y.z' with a Check for updates button (desktop only, feature-detected). - preload exposes checkForUpdates(); main.js adds the check-updates IPC (returns available/current/dev/error) and, when a build finishes downloading, shows a Restart now / Later dialog instead of only the silent on-next-launch install. - desktop version bumped 0.1.4 -> 0.1.5. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+16
-1
@@ -809,7 +809,7 @@
|
||||
<body>
|
||||
<script src="/icons.js?v=4"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@twemoji/api@15.1.0/dist/twemoji.min.js" crossorigin="anonymous"></script>
|
||||
<script>window.__BUILD='2026-07-07-batch50';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);
|
||||
<script>window.__BUILD='2026-07-07-batch51';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);
|
||||
// Render modern (Twemoji) emojis in place of the OS's flat ones. No-op if the CDN didn't load
|
||||
// (emojis stay as plain Unicode). (#5)
|
||||
function twemojify(el){ try{ if(el && window.twemoji) window.twemoji.parse(el, { folder:'svg', ext:'.svg' }); }catch(_){} }</script>
|
||||
@@ -986,10 +986,25 @@ function openSettings(){
|
||||
+sw('setGroup','Group message notifications', notifOn('group'))
|
||||
+sw('setDm','Direct message notifications', notifOn('dm'))
|
||||
+'<label class="gi-setting"><span>Notifications <span class="perm-state '+perm+'">'+permLabel+'</span><div style="font-size:.72rem;color:var(--muted);font-weight:400;margin-top:.15rem">Pop up messages & calls even when this tab isn’t open</div></span>'+(granted?'':'<button class="btn sm" id="setPerm">'+(perm==='denied'?'Allow':'Enable')+'</button>')+'</label>'
|
||||
+(window.bizConnectNative?('<label class="gi-setting"><span>Biz Connect for Desktop<div style="font-size:.72rem;color:var(--muted);font-weight:400;margin-top:.15rem" id="setVer">Version '+pEsc(window.bizConnectNative.version||'—')+'</div></span><button class="btn sm" id="setUpd">Check for updates</button></label>'):'')
|
||||
+'<div class="hint" style="margin-top:.4rem">These preferences are saved on this device.</div></div>';
|
||||
document.body.appendChild(ov);
|
||||
ov.onclick=e=>{ if(e.target===ov) ov.remove(); };
|
||||
ov.querySelector('#setClose').onclick=()=>ov.remove();
|
||||
const updBtn=ov.querySelector('#setUpd'); // #12: desktop version + manual update check
|
||||
if(updBtn) updBtn.onclick=async()=>{
|
||||
const ver=ov.querySelector('#setVer'); updBtn.disabled=true; updBtn.textContent='Checking…';
|
||||
let done=false;
|
||||
try{
|
||||
const r=(window.bizConnectNative&&window.bizConnectNative.checkForUpdates)?await window.bizConnectNative.checkForUpdates():{status:'unsupported'};
|
||||
if(r.status==='available'){ updBtn.textContent='Update '+(r.version||'')+' found'; if(ver) ver.textContent='Downloading '+(r.version||'')+'… you’ll be asked to restart when ready.'; done=true; }
|
||||
else if(r.status==='current'){ updBtn.textContent='Up to date ✓'; }
|
||||
else if(r.status==='dev'){ updBtn.textContent='Dev build'; }
|
||||
else if(r.status==='unsupported'){ updBtn.textContent='Update on newer app'; }
|
||||
else { updBtn.textContent='Check failed'; }
|
||||
}catch(_){ updBtn.textContent='Check failed'; }
|
||||
setTimeout(()=>{ if(!done){ updBtn.disabled=false; updBtn.textContent='Check for updates'; } }, 3500);
|
||||
};
|
||||
const setPref=(k,v)=>{ try{ localStorage.setItem('notif_'+k, v?'on':'off'); }catch(_){} };
|
||||
ov.querySelector('#setGroup').onchange=e=>setPref('group', e.target.checked);
|
||||
ov.querySelector('#setDm').onchange=e=>setPref('dm', e.target.checked);
|
||||
|
||||
Reference in New Issue
Block a user