Skip to content

Commit

Permalink
Support minimal-ui display mode
Browse files Browse the repository at this point in the history
Adds minimal-ui parsing support from web-manifest instead of
returnign standalone.
  • Loading branch information
ukaratkevich committed Jan 20, 2025
1 parent 9429036 commit f14af5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/lib/TwaManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const SHORT_NAME_MAX_SIZE = 12;
const MIN_NOTIFICATION_ICON_SIZE = 48;

// Supported display modes for TWA
const DISPLAY_MODE_VALUES = ['standalone', 'fullscreen', 'fullscreen-sticky'];
const DISPLAY_MODE_VALUES = ['standalone', 'minimal-ui', 'fullscreen', 'fullscreen-sticky'];
export type DisplayMode = typeof DISPLAY_MODE_VALUES[number];
export const DisplayModes: DisplayMode[] = [...DISPLAY_MODE_VALUES];

Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/spec/lib/TwaManifestSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ describe('TwaManifest', () => {

it('Replaces unsupported display modes with `standalone`', () => {
const manifestUrl = new URL('https://pwa-directory.com/manifest.json');
expect(TwaManifest.fromWebManifestJson(manifestUrl, {display: 'minimal-ui'}).display)
.toBe('standalone');
expect(TwaManifest.fromWebManifestJson(manifestUrl, {display: 'browser'}).display)
.toBe('standalone');
});
Expand Down Expand Up @@ -333,11 +331,11 @@ describe('TwaManifest', () => {
it('Returns display mode if it is supported', () => {
expect(asDisplayMode('standalone')).toBe('standalone');
expect(asDisplayMode('fullscreen')).toBe('fullscreen');
expect(asDisplayMode('minimal-ui')).toBe('minimal-ui');
});

it('Returns null for unsupported display modes', () => {
expect(asDisplayMode('browser')).toBeNull();
expect(asDisplayMode('minimal-ui')).toBeNull();
expect(asDisplayMode('bogus')).toBeNull();
expect(asDisplayMode('')).toBeNull();
});
Expand Down

0 comments on commit f14af5a

Please sign in to comment.