Skip to content

Commit

Permalink
feat: Remove cordova related methods
Browse files Browse the repository at this point in the history
When updating, if you find a method below, it is probably dead code
that you can remove. :
- hasDevicePlugin,
- hasInAppBrowserPlugin,
- hasSafariPlugin,
- hasNetworkInformationPlugin
- checkApp
- startApp
- nativeLinkOpen
- openDeeplinkOrRedirect
- getDeviceName

When updating, if you find a method below, keep what is relevant,
i.e. what is related to `isWebApp()` or `!isMobileApp()` or
`!isCordova()` :
- isCordova
- getPlatform
- isIOSApp
- isAndroidApp
- isMobileApp
- isWebApp
  • Loading branch information
zatteo committed Jan 13, 2025
1 parent f41540e commit 7c57ad4
Show file tree
Hide file tree
Showing 16 changed files with 9 additions and 647 deletions.
31 changes: 4 additions & 27 deletions packages/cozy-device-helper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,14 @@
### Platforms

```
import { getPlatform, isWebApp, isMobileApp, isIOSApp, isAndroidApp, isFlagshipApp } from 'cozy-device-helper'
import { isFlagshipApp, isMobile, isAndroid, isIOS } from 'cozy-device-helper'
```

To know the platform:

- `isFlagshipApp()`: return `boolean` if inside the flagship app.
- `getPlatform()`: return `ios`, `android` or `web`
- `isWebApp()`: return `boolean`
- `isMobileApp()`: return `boolean`. True if its a cordova App. False for others.
- `isIOSApp()`: return `boolean`. True if its a cordova App on iOS.
- `isAndroidApp()`: return `boolean`. True if its a cordova App on Android.
- `isFlagshipOfflineSupported()`: return `boolean` if offline supported by the flagship app.
- `getFlagshipMetadata()`: return `object` corresponding to flagship metadata.
- `isAndroid()`: return `boolean` (check if the user is on an android smartphone (native & browser))
- `isOS()`: return `boolean` (check if the user is on an iOS smartphone (native & browser))
- `isIOS()`: return `boolean` (check if the user is on an iOS smartphone (native & browser))
- `isMobile()`: return `boolean` (check if the user is on an android or iOS smartphone (native & browser))

### Device Name

```
import { getDeviceName } from 'cozy-device-helper'
```

To know device name `getDeviceName()`.

### Cordova Plugins

```
import { hasDevicePlugin, hasInAppBrowserPlugin, hasSafariPlugin, checkApp, startApp } from 'cozy-device-helper'
```

- `hasDevicePlugin`: return `boolean`
- `hasInAppBrowserPlugin`: return `boolean`
- `hasSafariPlugin`: return a promise which resolve by a `boolean`
- `checkApp`: return a `promise` that resolves with informations about the application (if installed) or false (if not installed)
- `startApp`: Start an Application. Return a `promise` - False if the application was not able to be started
14 changes: 2 additions & 12 deletions packages/cozy-device-helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,26 @@
"bugs": {
"url": "https://github.com/cozy/cozy-libs/issues"
},
"dependencies": {
"lodash": "^4.17.19"
},
"devDependencies": {
"@babel/cli": "7.16.8",
"@babel/core": "7.16.12",
"@types/react-native": "0.67.7",
"babel-jest": "26.6.3",
"babel-preset-cozy-app": "^2.8.1",
"jest": "26.6.3"
"babel-preset-cozy-app": "^2.8.1"
},
"files": [
"dist"
],
"homepage": "https://github.com/cozy/cozy-libs/blob/master/packages/cozy-device-helper/README.md",
"jest": {
"testURL": "http://localhost"
},
"license": "MIT",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/cozy/cozy-libs.git"
},
"scripts": {
"build": "yarn clean && yarn types && babel --extensions .ts,.tsx --ignore '**/*.spec.tsx','**/*.spec.ts' ./src -d ./dist",
"build": "yarn clean && yarn types && babel --extensions .ts,.tsx ./src -d ./dist",
"clean": "rm -rf ./dist",
"prepublishOnly": "yarn run build",
"start": "yarn build --watch",
"test": "jest src/**",
"types": "tsc -p tsconfig-build.json"
},
"types": "dist/index.d.ts"
Expand Down
28 changes: 0 additions & 28 deletions packages/cozy-device-helper/src/apps.spec.ts

This file was deleted.

136 changes: 0 additions & 136 deletions packages/cozy-device-helper/src/apps.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/cozy-device-helper/src/cordova.ts

This file was deleted.

126 changes: 0 additions & 126 deletions packages/cozy-device-helper/src/deeplink.ts

This file was deleted.

Loading

0 comments on commit 7c57ad4

Please sign in to comment.