iOS: the icon's count follows the page's (#421)
Reported: the unread count on the icon only changed when the app was
opened. Two reasons:
- Items read in the page never reached it, since only the player's own
mark-read refreshed the badge.
- The background refresh that should bring new items runs when iOS
chooses, which for this app has been rarely.
The page now sends All Subscriptions' count ({t:"unread", n}) each time
its list is drawn with a new one, so reading, and new items arriving
over the event stream while the app is open, set it at once. While an
episode plays the app is awake with the screen locked, so the player's
tick also re-checks every quarter of an hour.
With the app closed and nothing playing, the count still waits on iOS's
refresh. Push (#433) is what makes that exact.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -108,6 +108,7 @@ function renderFeeds(){
|
||||
for(const img of $$<HTMLImageElement>('img',list)){ const k=img.outerHTML; if(!drawn.has(k)) drawn.set(k,[]); drawn.get(k)!.push(img); }
|
||||
list.innerHTML='';
|
||||
const unreadAll=unreadInAll();
|
||||
hostBadge(unreadAll);
|
||||
const places=document.createElement('div');
|
||||
places.className='places';
|
||||
for(const [id,v] of Object.entries(VIEWS)){
|
||||
|
||||
@@ -25,6 +25,15 @@ const ipxHost: ((m: any) => void) | null = (() => {
|
||||
|
||||
if (ipxHost) installNativePlayback();
|
||||
|
||||
/// All Subscriptions' unread count, for the app's icon (#421), each time the list is drawn with a
|
||||
/// new one: items read in the page and new ones arriving set it at once, where the app's own fetch
|
||||
/// waited for the app to come forward again.
|
||||
let badgeSent=-1;
|
||||
function hostBadge(n: number){
|
||||
// As haptic: the list can be drawn before this file has declared what it uses.
|
||||
try{ if(n!==badgeSent){ badgeSent=n; ipxHost?.({t:'unread', n}); } }catch{}
|
||||
}
|
||||
|
||||
/// A press felt as well as seen, in the app (#430): the phone's haptics, which a page cannot reach.
|
||||
/// `tap` for play, pause and the like, `done` for something finished (marked read), `warn` for an
|
||||
/// error. An app without them ignores the message; a browser has no host to send it to.
|
||||
|
||||
Reference in New Issue
Block a user