Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add offline related methods to cozy-intent and to cozy-device-helper #2562

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/cozy-device-helper/src/flagship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface FlagshipMetadata {
biometry_type?: BiometryType
immersive?: boolean
navbarHeight?: number
offline_available?: boolean
platform?: Record<string, unknown>
route?: FlagshipRoutes
settings_PINEnabled?: boolean
Expand All @@ -40,3 +41,6 @@ export const getFlagshipMetadata = (): FlagshipMetadata =>

export const isFlagshipApp = (): boolean =>
getGlobalWindow()?.cozy?.flagship !== undefined

export const isFlagshipOfflineSupported = (): boolean =>
getGlobalWindow()?.cozy?.flagship?.offline_available
6 changes: 5 additions & 1 deletion packages/cozy-device-helper/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ export { isCordova } from './cordova'
export { nativeLinkOpen } from './link'
export { openDeeplinkOrRedirect } from './deeplink'

export { isFlagshipApp, getFlagshipMetadata } from './flagship'
export {
isFlagshipApp,
isFlagshipOfflineSupported,
getFlagshipMetadata
} from './flagship'
2 changes: 2 additions & 0 deletions packages/cozy-intent/src/api/models/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ interface _NativeMethodsRegister {
ocr: (base64: string) => unknown
openAppOSSettings: () => Promise<null>
isAvailable: (featureName: string) => Promise<boolean>
flagshipLinkRequest: (operation: unknown) => Promise<unknown>
downloadFile: (file: unknown) => Promise<unknown>
}

export type NativeMethodsRegister = _NativeMethodsRegister & PostMeDefault
Expand Down