@glassly/engine 0.3.5-dev.720 → 0.3.5-dev.728

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -256,6 +256,7 @@ function projectApps(previousState: AppStatusState, localApps: ClientApp[]): Cli
256
256
  // across both passes.
257
257
  foregrounded: app.packageName === previousState.foregroundedPackage,
258
258
  paused: app.local && app.running && isMiniappsPaused(),
259
+ widgetOnly: !!app.local && app.running && miniappWidgetMode.isWidgetOnly(app.packageName),
259
260
  }
260
261
  const prev = previousByPackage.get(app.packageName)
261
262
  return prev && shallowEqualApp(prev, next) ? prev : next
@@ -362,6 +363,11 @@ export const useAppStatusStore = create<AppStatusState>((set, get) => ({
362
363
  return false
363
364
  }
364
365
 
366
+ // An app running only for its widget is promoted before the host hook:
367
+ // the hook may foreground it, and setForeground sends a widget-only app
368
+ // back here.
369
+ if (app.widgetOnly) miniappWidgetMode.setWidgetOnly(packageName, false)
370
+
365
371
  // Host navigation / open-animation seam. Runs on EVERY accepted open —
366
372
  // including re-opening an already-running app — so the animation always
367
373
  // plays (BuiltInMiniappCatalog.navigateForApp: overlay apps setForeground
@@ -374,13 +380,12 @@ export const useAppStatusStore = create<AppStatusState>((set, get) => ({
374
380
 
375
381
  // If the tapped app is already running, this is a re-open: the nav/foreground
376
382
  // above already drove the animation, and there's nothing to spawn. Short-
377
- // circuit before the spawn pipeline. An app running only for its widget
378
- // is promoted instead: it keeps its context and takes the foreground.
383
+ // circuit before the spawn pipeline. A promoted app keeps its context but
384
+ // still takes the foreground below.
379
385
  if (app.running && !app.widgetOnly) {
380
386
  saveLastOpenTime(packageName)
381
387
  return true
382
388
  }
383
- if (app.widgetOnly) miniappWidgetMode.setWidgetOnly(packageName, false)
384
389
 
385
390
  // Only-one rules: one standard app in the foreground, one dashboard
386
391
  // drawing the overlay. Starting another stops the one running. Widget-only
@@ -495,13 +500,10 @@ export const useAppStatusStore = create<AppStatusState>((set, get) => ({
495
500
  apps: s.apps.map((a) => ({...a, foregrounded: a.packageName === packageName})),
496
501
  }))
497
502
 
498
- // Ensure the JSContext exists. start() is idempotent for an
499
- // already-running app and enforces the foreground-only-one rule for
500
- // standard apps. Fire-and-forget after the flag flip so it doesn't block
501
- // paint.
502
- // if (!app.running) {
503
- // get().start(app)
504
- // }
503
+ // The wearer is in this app now: one running only for its widget becomes
504
+ // a normal run. start() promotes it, stops the standard peer and keeps the
505
+ // context. Fire-and-forget after the flag flip so it doesn't block paint.
506
+ if (app.running && app.widgetOnly) void get().start(app, {skipNavigation: true})
505
507
  },
506
508
 
507
509
  clearForeground: () => {