From 727176c09fb6dd5fc6087256ba8f83928f038066 Mon Sep 17 00:00:00 2001 From: Toni <toni88x@gmail.com> Date: Tue, 18 Oct 2022 13:55:11 +0100 Subject: [PATCH 1/2] Add missing properties to ManifestOptions interface According to https://developer.mozilla.org/en-US/docs/Web/Manifest/protocol_handlers --- src/parts/manifest/types.ts | 62 +++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/src/parts/manifest/types.ts b/src/parts/manifest/types.ts index b6de837..54b1876 100644 --- a/src/parts/manifest/types.ts +++ b/src/parts/manifest/types.ts @@ -1,18 +1,76 @@ +export type ManifestDisplay = 'fullscreen' | 'standalone' | 'minimal-ui' | 'browser' + +export type ManifestDisplayOverride = ManifestDisplay | 'window-controls-overlay' + +export type ManifestOrientation = 'any' | 'natural' | 'landscape' | 'landscape-primary' | 'landscape-secondary' | 'portrait' | 'portrait-primary' | 'portrait-secondary' + +export type ManifestPlatform = 'chrome_web_store' | 'play' | 'itunes' | 'webapp' | 'windows' | 'f-droid' | 'amazon' + export interface ManifestIcon { src: string type: string sizes: string - purpose: 'any' | 'maskable' + purpose: 'any' | 'maskable' | 'monochrome' +} + +export interface ManifestScreenshot { + src: string + type: string + sizes: string +} + +export interface ManifestShortcut { + name: string + short_name: string + url: string + icons: ManifestIcon[] +} + +export interface ManifestRelatedApplication { + id: string + platform: ManifestPlatform + url: string +} + +export interface ManifestShareTarget { + action: string + method?: 'GET' | 'POST' + enctype?: string + params: { + title?: string + text?: string + url?: string + files?: { + name: string + accept: string + } + } +} + +export interface ManifestProtocolHandler { + protocol: string + url: string } export interface ManifestOptions { + id: string, name: string short_name: string description: string lang: string + scope: string start_url: string - display: string + display: ManifestDisplay + display_override: ManifestDislplayOverlay[] + orientation: ManifestOrientation background_color: string theme_color: string + categories: string[] icons: ManifestIcon[] + screenshots: ManifestScreenshot[] + shortcuts: ManifestShortcut[] + related_applications: ManifestRelatedApplication[] + prefer_related_applications: boolean + share_target: ManifestShareTarget + protocol_handlers: ManifestProtocolHandler[] } From 8a28767ec3f1344cb8997b289db9472518b5a106 Mon Sep 17 00:00:00 2001 From: Toni <toni88x@gmail.com> Date: Tue, 18 Oct 2022 14:00:37 +0100 Subject: [PATCH 2/2] Make new ManifestOptions optional All added ones are optional now --- src/parts/manifest/types.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/parts/manifest/types.ts b/src/parts/manifest/types.ts index 54b1876..d01d378 100644 --- a/src/parts/manifest/types.ts +++ b/src/parts/manifest/types.ts @@ -53,24 +53,24 @@ export interface ManifestProtocolHandler { } export interface ManifestOptions { - id: string, + id?: string, name: string short_name: string description: string lang: string - scope: string + scope?: string start_url: string display: ManifestDisplay - display_override: ManifestDislplayOverlay[] - orientation: ManifestOrientation + display_override?: ManifestDislplayOverlay[] + orientation?: ManifestOrientation background_color: string theme_color: string - categories: string[] + categories?: string[] icons: ManifestIcon[] - screenshots: ManifestScreenshot[] - shortcuts: ManifestShortcut[] - related_applications: ManifestRelatedApplication[] - prefer_related_applications: boolean - share_target: ManifestShareTarget - protocol_handlers: ManifestProtocolHandler[] + screenshots?: ManifestScreenshot[] + shortcuts?: ManifestShortcut[] + related_applications?: ManifestRelatedApplication[] + prefer_related_applications?: boolean + share_target?: ManifestShareTarget + protocol_handlers?: ManifestProtocolHandler[] }