Skip to content

Commit cf2cdcb

Browse files
committed
feat(cozy-device-helper): Add isFlagshipOfflineSupported() method
Since linagora/cozy-flagship-app#1209 the Flagship app can inject the `offline_available` attribute into WebViews metadata in order to tell the cozy-app when offline mode is supported The new `` method can now be used to check this attribute
1 parent 155cb57 commit cf2cdcb

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

packages/cozy-device-helper/src/flagship.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface FlagshipMetadata {
1616
biometry_type?: BiometryType
1717
immersive?: boolean
1818
navbarHeight?: number
19+
offline_available?: boolean
1920
platform?: Record<string, unknown>
2021
route?: FlagshipRoutes
2122
settings_PINEnabled?: boolean
@@ -40,3 +41,6 @@ export const getFlagshipMetadata = (): FlagshipMetadata =>
4041

4142
export const isFlagshipApp = (): boolean =>
4243
getGlobalWindow()?.cozy?.flagship !== undefined
44+
45+
export const isFlagshipOfflineSupported = (): boolean =>
46+
getGlobalWindow()?.cozy?.flagship?.offline_available

packages/cozy-device-helper/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ export { isCordova } from './cordova'
2121
export { nativeLinkOpen } from './link'
2222
export { openDeeplinkOrRedirect } from './deeplink'
2323

24-
export { isFlagshipApp, getFlagshipMetadata } from './flagship'
24+
export {
25+
isFlagshipApp,
26+
isFlagshipOfflineSupported,
27+
getFlagshipMetadata
28+
} from './flagship'

0 commit comments

Comments
 (0)