ReviewOS

also looking at this

craft-native/craft

fix(ios): let native screens choose interface appearance

#398
Closed glennmichael123 wants to merge codex/issue-389-appearance into main
8 files +218 -5

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

packages/typescript/src/__tests__/bridge-integration.test.tsmodified+8-0
Changes to packages/typescript/src/__tests__/bridge-integration.test.ts
@@ -34,6 +34,8 @@ describe('Bridge Type Definitions', () => {
3434 version: '1.0.0',
3535 platform: 'macos',
3636 }),
37 setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {},
38 getAppearance: async () => 'light',
3739 },
3840 }
3941
@@ -85,6 +87,8 @@ describe('Bridge Type Definitions', () => {
8587 version: '1.0.0',
8688 platform: 'macos',
8789 }),
90 setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {},
91 getAppearance: async () => 'light',
8892 }
8993
9094 expect(typeof mockApp.hideDockIcon).toBe('function')
@@ -286,6 +290,8 @@ describe('Bridge API Method Signatures', () => {
286290 version: '1.0.0',
287291 platform: 'macos',
288292 }),
293 setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {},
294 getAppearance: async () => 'light',
289295 }
290296
291297 const info = await mockApp.getInfo()
@@ -327,6 +333,8 @@ describe('Window Global Type Augmentation', () => {
327333 version: '1.0.0',
328334 platform: 'macos',
329335 }),
336 setAppearance: async (_appearance: 'light' | 'dark' | 'system') => {},
337 getAppearance: async () => 'light',
330338 },
331339 } as CraftBridgeAPI,
332340 }
packages/typescript/src/api/app.tsmodified+2-2
Changes to packages/typescript/src/api/app.ts
@@ -629,14 +629,14 @@ class AppManager {
629629 // ==========================================================================
630630
631631 /**
632 * Set app appearance (macOS)
632 * Set the app appearance on native hosts.
633633 */
634634 async setAppearance(appearance: 'light' | 'dark' | 'system'): Promise<void> {
635635 await this._call('setAppearance', { appearance })
636636 }
637637
638638 /**
639 * Get current appearance
639 * Get the current effective Light/Dark appearance.
640640 */
641641 async getAppearance(): Promise<'light' | 'dark'> {
642642 return this._call('getAppearance')
packages/typescript/src/types.tsmodified+6-0
Changes to packages/typescript/src/types.ts
@@ -759,6 +759,12 @@ export interface CraftAppAPI {
759759 * Get application information
760760 */
761761 getInfo(): Promise<AppInfo>
762
763 /** Pin every native surface to Light, Dark, or the system setting. */
764 setAppearance(appearance: 'light' | 'dark' | 'system'): Promise<void>
765
766 /** Read the app's effective Light/Dark appearance. */
767 getAppearance(): Promise<'light' | 'dark'>
762768}
763769
764770/**