├── .editorconfig ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md └── workflows │ ├── nodejs.yml │ ├── npmpublish.yml │ └── rebase.yml ├── .gitignore ├── .prettierignore ├── .vscode └── settings.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── DEVELOPER.md ├── LICENSE ├── README.md ├── circle.yml ├── gulpfile.js ├── package-lock.json ├── package.json ├── prettier.config.js ├── scripts ├── build │ ├── helpers.ts │ ├── ngx.ts │ ├── remove-tslib-helpers.js │ ├── transformers │ │ ├── extract-injectables.ts │ │ ├── imports.ts │ │ ├── members.ts │ │ ├── methods.ts │ │ ├── plugin-class.ts │ │ └── properties.ts │ └── transpile.ts ├── docs-json │ ├── index.ts │ └── readme.md ├── docs │ ├── config.json │ ├── dgeni │ │ ├── configs │ │ │ ├── links.js │ │ │ ├── log.js │ │ │ ├── tag-defs.js │ │ │ ├── template-filters.js │ │ │ └── template-tags.js │ │ ├── dgeni-config.js │ │ ├── dgeni-readmes-config.js │ │ ├── filters │ │ │ ├── capital.js │ │ │ ├── code.js │ │ │ ├── dashify.js │ │ │ └── dump.js │ │ ├── processors │ │ │ ├── debug.js │ │ │ ├── hide-private-api.js │ │ │ ├── jekyll.js │ │ │ ├── mark-properties.js │ │ │ ├── npm-id.js │ │ │ ├── parse-optional.js │ │ │ ├── readmes.js │ │ │ └── remove-private-members.js │ │ ├── tag-defs │ │ │ └── tag-defs.js │ │ └── templates │ │ │ ├── common.template.html │ │ │ ├── native_menu.template.html │ │ │ └── readme.template.md │ ├── gulp-tasks.js │ ├── prepare.sh │ ├── update_docs.sh │ ├── update_readmes.sh │ └── utils.inc.sh ├── git │ ├── clone.sh │ └── config.sh ├── logger.ts ├── tasks │ ├── build-es5.ts │ ├── build-esm.ts │ ├── build-ngx.ts │ └── publish.ts ├── templates │ ├── wrap-min.tmpl │ └── wrap.tmpl └── tsconfig.json ├── src └── @ionic-native │ ├── core │ ├── bootstrap.ts │ ├── decorators │ │ ├── common.spec.ts │ │ ├── common.ts │ │ ├── cordova-function-override.ts │ │ ├── cordova-instance.ts │ │ ├── cordova-property.ts │ │ ├── cordova.ts │ │ ├── instance-property.ts │ │ └── interfaces.ts │ ├── index.ts │ ├── ionic-native-plugin.ts │ ├── ng1.ts │ └── util.ts │ └── plugins │ ├── abbyy-rtr │ └── index.ts │ ├── action-sheet │ └── index.ts │ ├── adjust │ └── index.ts │ ├── admob-free │ └── index.ts │ ├── admob-plus │ └── index.ts │ ├── admob-pro │ └── index.ts │ ├── admob │ └── index.ts │ ├── aes-256 │ └── index.ts │ ├── alipay │ └── index.ts │ ├── analytics-firebase │ └── index.ts │ ├── android-exoplayer │ └── index.ts │ ├── android-fingerprint-auth │ └── index.ts │ ├── android-full-screen │ └── index.ts │ ├── android-permissions │ └── index.ts │ ├── anyline │ └── index.ts │ ├── app-availability │ └── index.ts │ ├── app-center-analytics │ └── index.ts │ ├── app-center-crashes │ └── index.ts │ ├── app-center-push │ └── index.ts │ ├── app-launcher │ └── index.ts │ ├── app-minimize │ └── index.ts │ ├── app-preferences │ └── index.ts │ ├── app-rate │ └── index.ts │ ├── app-update │ └── index.ts │ ├── app-version │ └── index.ts │ ├── apple-pay │ └── index.ts │ ├── apple-wallet │ └── index.ts │ ├── appodeal │ └── index.ts │ ├── appsflyer │ └── index.ts │ ├── audio-management │ └── index.ts │ ├── autostart │ └── index.ts │ ├── background-fetch │ └── index.ts │ ├── background-geolocation │ └── index.ts │ ├── background-mode │ └── index.ts │ ├── backlight │ └── index.ts │ ├── badge │ └── index.ts │ ├── baidu-push │ └── index.ts │ ├── barcode-scanner │ └── index.ts │ ├── base64-to-gallery │ └── index.ts │ ├── base64 │ └── index.ts │ ├── battery-status │ └── index.ts │ ├── biocatch │ └── index.ts │ ├── biometric-wrapper │ └── index.ts │ ├── ble │ └── index.ts │ ├── blinkid │ └── index.ts │ ├── blinkup │ └── index.ts │ ├── bluetooth-le │ └── index.ts │ ├── bluetooth-serial │ └── index.ts │ ├── braintree │ └── index.ts │ ├── branch-io │ └── index.ts │ ├── brightness │ └── index.ts │ ├── broadcaster │ └── index.ts │ ├── browser-tab │ └── index.ts │ ├── calendar │ └── index.ts │ ├── call-directory │ └── index.ts │ ├── call-log │ └── index.ts │ ├── call-number │ └── index.ts │ ├── camera-preview │ └── index.ts │ ├── camera │ └── index.ts │ ├── card-io │ └── index.ts │ ├── chooser │ └── index.ts │ ├── class-kit │ └── index.ts │ ├── clevertap │ └── index.ts │ ├── clipboard │ └── index.ts │ ├── cloud-settings │ └── index.ts │ ├── clover-go │ └── index.ts │ ├── code-push │ └── index.ts │ ├── colored-browser-tabs │ └── index.ts │ ├── contacts │ └── index.ts │ ├── couchbase-lite │ └── index.ts │ ├── crop │ └── index.ts │ ├── date-picker │ └── index.ts │ ├── db-meter │ └── index.ts │ ├── deeplinks │ └── index.ts │ ├── device-accounts │ └── index.ts │ ├── device-feedback │ └── index.ts │ ├── device-motion │ └── index.ts │ ├── device-orientation │ └── index.ts │ ├── device │ └── index.ts │ ├── diagnostic │ └── index.ts │ ├── dialogs │ └── index.ts │ ├── dns │ └── index.ts │ ├── document-picker │ └── index.ts │ ├── document-scanner │ └── index.ts │ ├── document-viewer │ └── index.ts │ ├── downloader │ └── index.ts │ ├── email-composer │ └── index.ts │ ├── emm-app-config │ └── index.ts │ ├── estimote-beacons │ └── index.ts │ ├── extended-device-information │ └── index.ts │ ├── fabric │ └── index.ts │ ├── facebook │ └── index.ts │ ├── fcm │ └── index.ts │ ├── file-chooser │ └── index.ts │ ├── file-encryption │ └── index.ts │ ├── file-opener │ └── index.ts │ ├── file-path │ └── index.ts │ ├── file-picker │ └── index.ts │ ├── file-transfer │ └── index.ts │ ├── file │ └── index.ts │ ├── fingerprint-aio │ └── index.ts │ ├── firebase-analytics │ └── index.ts │ ├── firebase-authentication │ └── index.ts │ ├── firebase-config │ └── index.ts │ ├── firebase-crash │ └── index.ts │ ├── firebase-crashlytics │ └── index.ts │ ├── firebase-dynamic-links │ └── index.ts │ ├── firebase-messaging │ └── index.ts │ ├── firebase-vision │ └── index.ts │ ├── firebase-x │ └── index.ts │ ├── firebase │ └── index.ts │ ├── flashlight │ └── index.ts │ ├── flurry-analytics │ └── index.ts │ ├── foreground-service │ └── index.ts │ ├── ftp │ └── index.ts │ ├── full-screen-image │ └── index.ts │ ├── gao-de-location │ └── index.ts │ ├── ge-tui-sdk-plugin │ └── index.ts │ ├── geofence │ └── index.ts │ ├── geolocation │ └── index.ts │ ├── globalization │ └── index.ts │ ├── google-analytics │ └── index.ts │ ├── google-nearby │ └── index.ts │ ├── google-play-games-services │ └── index.ts │ ├── google-plus │ └── index.ts │ ├── gyroscope │ └── index.ts │ ├── hce │ └── index.ts │ ├── header-color │ └── index.ts │ ├── health-kit │ └── index.ts │ ├── health │ └── index.ts │ ├── hot-code-push │ └── index.ts │ ├── hotspot │ └── index.ts │ ├── http │ └── index.ts │ ├── httpd │ └── index.ts │ ├── hyper-track │ └── index.ts │ ├── iamport-cordova │ └── index.ts │ ├── ibeacon │ └── index.ts │ ├── image-picker │ └── index.ts │ ├── image-resizer │ └── index.ts │ ├── in-app-browser │ └── index.ts │ ├── in-app-purchase-2 │ └── index.ts │ ├── in-app-purchase │ └── index.ts │ ├── in-app-review │ └── index.ts │ ├── index-app-content │ └── index.ts │ ├── insomnia │ └── index.ts │ ├── instagram │ └── index.ts │ ├── intel-security │ └── index.ts │ ├── intercom │ └── index.ts │ ├── ionic-webview │ └── index.ts │ ├── ios-aswebauthenticationsession-api │ └── index.ts │ ├── is-debug │ └── index.ts │ ├── janalytics │ └── index.ts │ ├── jins-meme │ └── index.ts │ ├── jumio │ └── index.ts │ ├── keyboard │ └── index.ts │ ├── keychain-touch-id │ └── index.ts │ ├── keychain │ └── index.ts │ ├── kommunicate │ └── index.ts │ ├── last-cam │ └── index.ts │ ├── launch-navigator │ └── index.ts │ ├── launch-review │ └── index.ts │ ├── line-login │ └── index.ts │ ├── local-notifications │ └── index.ts │ ├── location-accuracy │ └── index.ts │ ├── lottie-splash-screen │ └── index.ts │ ├── luxand │ └── index.ts │ ├── magnetometer │ └── index.ts │ ├── market │ └── index.ts │ ├── media-capture │ └── index.ts │ ├── media │ └── index.ts │ ├── metrix │ └── index.ts │ ├── mixpanel │ └── index.ts │ ├── mlkit-translate │ └── index.ts │ ├── mobile-accessibility │ └── index.ts │ ├── mobile-messaging │ └── index.ts │ ├── ms-adal │ └── index.ts │ ├── music-controls │ └── index.ts │ ├── native-audio │ └── index.ts │ ├── native-geocoder │ └── index.ts │ ├── native-keyboard │ └── index.ts │ ├── native-page-transitions │ └── index.ts │ ├── native-ringtones │ └── index.ts │ ├── native-storage │ └── index.ts │ ├── native-view │ └── index.ts │ ├── navigation-bar │ └── index.ts │ ├── network-interface │ └── index.ts │ ├── network │ └── index.ts │ ├── nfc │ └── index.ts │ ├── ocr │ └── index.ts │ ├── onesignal │ └── index.ts │ ├── open-native-settings │ └── index.ts │ ├── openalpr │ └── index.ts │ ├── paypal │ └── index.ts │ ├── pdf-generator │ └── index.ts │ ├── pedometer │ └── index.ts │ ├── phonegap-local-notification │ └── index.ts │ ├── photo-library │ └── index.ts │ ├── photo-viewer │ └── index.ts │ ├── pin-check │ └── index.ts │ ├── pin-dialog │ └── index.ts │ ├── pinterest │ └── index.ts │ ├── power-management │ └── index.ts │ ├── preview-any-file │ └── index.ts │ ├── printer │ └── index.ts │ ├── pspdfkit-cordova │ └── index.ts │ ├── purchases │ └── index.ts │ ├── push │ └── index.ts │ ├── pushape-push │ └── index.ts │ ├── qqsdk │ └── index.ts │ ├── qr-scanner │ └── index.ts │ ├── quikkly │ └── index.ts │ ├── regula-document-reader │ └── index.ts │ ├── rollbar │ └── index.ts │ ├── safari-view-controller │ └── index.ts │ ├── screen-orientation │ └── index.ts │ ├── screenshot │ └── index.ts │ ├── secure-storage-echo │ └── index.ts │ ├── secure-storage │ └── index.ts │ ├── sensors │ └── index.ts │ ├── serial │ └── index.ts │ ├── service-discovery │ └── index.ts │ ├── shake │ └── index.ts │ ├── shop-checkout │ └── index.ts │ ├── sign-in-with-apple │ └── index.ts │ ├── sim │ └── index.ts │ ├── siri-shortcuts │ └── index.ts │ ├── smartlook │ └── index.ts │ ├── sms-retriever │ └── index.ts │ ├── sms │ └── index.ts │ ├── social-sharing │ └── index.ts │ ├── speech-recognition │ └── index.ts │ ├── speechkit │ └── index.ts │ ├── spinner-dialog │ └── index.ts │ ├── splash-screen │ └── index.ts │ ├── spotify-auth │ └── index.ts │ ├── sqlite-db-copy │ └── index.ts │ ├── sqlite-porter │ └── index.ts │ ├── sqlite │ └── index.ts │ ├── ssh-connect │ └── index.ts │ ├── star-prnt │ └── index.ts │ ├── status-bar │ └── index.ts │ ├── stepcounter │ └── index.ts │ ├── streaming-media │ └── index.ts │ ├── stripe │ └── index.ts │ ├── sum-up │ └── index.ts │ ├── taptic-engine │ └── index.ts │ ├── tealium-adidentifier │ └── index.ts │ ├── tealium-installreferrer │ └── index.ts │ ├── tealium │ └── index.ts │ ├── text-to-speech │ └── index.ts │ ├── theme-detection │ └── index.ts │ ├── themeable-browser │ └── index.ts │ ├── three-dee-touch │ └── index.ts │ ├── toast │ └── index.ts │ ├── touch-id │ └── index.ts │ ├── twitter-connect │ └── index.ts │ ├── uid │ └── index.ts │ ├── unique-device-id │ └── index.ts │ ├── unvired-cordova-sdk │ └── index.ts │ ├── uptime │ └── index.ts │ ├── urbanairship │ └── index.ts │ ├── usabilla-cordova-sdk │ └── index.ts │ ├── user-agent │ └── index.ts │ ├── vibes │ └── index.ts │ ├── vibration │ └── index.ts │ ├── video-capture-plus │ └── index.ts │ ├── video-editor │ └── index.ts │ ├── video-player │ └── index.ts │ ├── web-intent │ └── index.ts │ ├── web-server │ └── index.ts │ ├── web-socket-server │ └── index.ts │ ├── webengage │ └── index.ts │ ├── wechat │ └── index.ts │ ├── wheel-selector │ └── index.ts │ ├── wifi-wizard-2 │ └── index.ts │ ├── wonderpush │ └── index.ts │ ├── youtube-video-player │ └── index.ts │ ├── zbar │ └── index.ts │ ├── zeroconf │ └── index.ts │ ├── zip │ └── index.ts │ └── zoom │ └── index.ts ├── tsconfig.core.json ├── tsconfig.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | insert_final_newline = false 15 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Ionic Native 2 | 3 | ## Have an issue? 4 | #### There are no rules, but here are a few things to consider: 5 | ###### Before you submit an issue: 6 | * Do a quick search to see if there are similar issues 7 | * Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/api/platform/Platform/#ready). 8 | * **Check that you are using the latest version of** `ionic-native`, you can install the latest version by running `npm i --save @ionic-native/core@latest` 9 | 10 | ###### Still having problems? submit an issue with the following details: 11 | * Short description of the issue 12 | * Steps to reproduce 13 | * Stack trace (if available) 14 | 15 | 16 | ## Feature request? 17 | Have a plugin you'd like to see supported? Since Ionic Native is a thin wrapper around existing Cordova plugins, adding support for new plugins is as easy as creating a new wrapper for whatever plugin you'd like to add. 18 | 19 | Take a look at our [Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more info on adding new plugins. 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **I'm submitting a ...** (check one with "x") 2 | [ ] bug report 3 | [ ] feature request 4 | [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/ 5 | 6 | **Current behavior:** 7 | 8 | 9 | **Expected behavior:** 10 | 11 | 12 | **Steps to reproduce:** 13 | 14 | 15 | **Related code:** 16 | 17 | ``` 18 | insert any relevant code here 19 | ``` 20 | 21 | **Other information:** 22 | 23 | 24 | **Ionic info:** (run `ionic info` from a terminal/cmd prompt and paste output below): 25 | 26 | ``` 27 | insert the output from ionic info here 28 | ``` 29 | -------------------------------------------------------------------------------- /.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | name: Node CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | strategy: 11 | matrix: 12 | node-version: [12.x] 13 | 14 | steps: 15 | - uses: actions/checkout@v1 16 | - name: Use Node.js ${{ matrix.node-version }} 17 | uses: actions/setup-node@v1 18 | with: 19 | node-version: ${{ matrix.node-version }} 20 | - name: Cache ionic site 21 | id: ionic-site 22 | uses: actions/cache@v2 23 | with: 24 | path: ~/ionic-site/ 25 | key: ionic-site-${{ hashFiles('**/package-lock.json') }} 26 | - name: Setup git 27 | run: bash ./scripts/git/config.sh 28 | - name: Prepare ionic-site repo 29 | if: github.ref == 'refs/heads/master' 30 | run: bash ./scripts/docs/prepare.sh 31 | - name: Install dependencies 32 | run: npm ci 33 | - name: Lint 34 | run: npm run lint 35 | - name: Build 36 | run: npm run build 37 | - name: Test 38 | run: npm run test 39 | - name: Readmes 40 | run: npm run readmes 41 | - name: Deploy doc 42 | if: github.ref == 'refs/heads/master' 43 | run: bash ./scripts/docs/update_docs.sh 44 | env: 45 | GITHUB_PROJECT_REPONAME: ${{ github.repository }} 46 | GITHUB_SHA1: ${{ github.sha }} 47 | -------------------------------------------------------------------------------- /.github/workflows/npmpublish.yml: -------------------------------------------------------------------------------- 1 | name: Node.js Package 2 | 3 | on: 4 | release: 5 | types: [created] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v1 12 | - uses: actions/setup-node@v1 13 | with: 14 | node-version: 12 15 | - name: Install dependencies 16 | run: npm ci 17 | - name: Lint 18 | run: npm run lint 19 | - name: Build 20 | run: npm run build 21 | - name: Test 22 | run: npm run test 23 | - name: Readmes 24 | run: npm run readmes 25 | 26 | publish-npm: 27 | needs: build 28 | runs-on: ubuntu-latest 29 | steps: 30 | - uses: actions/checkout@v1 31 | - uses: actions/setup-node@v1 32 | with: 33 | node-version: 12 34 | registry-url: https://registry.npmjs.org/ 35 | - run: npm ci 36 | - run: npm run shipit 37 | env: 38 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 39 | -------------------------------------------------------------------------------- /.github/workflows/rebase.yml: -------------------------------------------------------------------------------- 1 | on: 2 | issue_comment: 3 | types: [created] 4 | name: Automatic Rebase 5 | jobs: 6 | rebase: 7 | name: Rebase 8 | if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@master 12 | with: 13 | fetch-depth: 0 14 | - name: Automatic Rebase 15 | uses: cirrus-actions/rebase@1.3 16 | env: 17 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | .idea 4 | .tmp 5 | aot/ 6 | scripts/ionic-native-bower 7 | scripts/docs-json/*.json 8 | dist/ 9 | src/@ionic-native/plugins/**/ngx 10 | *.d.ts 11 | injectable-classes.json 12 | 13 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | package.json 2 | node_modules 3 | .github 4 | .vscode 5 | dist 6 | CHANGELOG.md 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of the Ionic project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities. 4 | 5 | Communication through any of Ionic's channels (GitHub, Slack, Forum, IRC, mailing lists, Twitter, etc.) must be constructive and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 6 | 7 | We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to the Ionic project to do the same. 8 | 9 | If any member of the community violates this code of conduct, the maintainers of the Ionic project may take action, removing issues, comments, and PRs or blocking accounts as deemed appropriate. 10 | 11 | If you are subject to or witness unacceptable behavior, or have any other concerns, please email us at [hi@ionicframework.com](mailto:hi@ionicframework.com). 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015-present Drifty Co. 2 | http://drifty.com/ 3 | 4 | MIT License 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: ~/ionic-native/ 5 | docker: 6 | - image: node:12 7 | steps: 8 | - checkout 9 | - restore_cache: 10 | key: ionic-site-{{ checksum "package.json" }} 11 | - run: 12 | name: Prepare ionic-site repo 13 | command: | 14 | if [ "${CIRCLE_BRANCH}" == "master" ]; then 15 | ./scripts/docs/prepare.sh 16 | fi 17 | - save_cache: 18 | key: ionic-site-{{ checksum "package.json" }} 19 | paths: 20 | - ~/ionic-site/ 21 | - restore_cache: 22 | key: node_modules_{{ checksum "package.json" }} 23 | - run: 24 | name: Install node modules 25 | command: npm ci 26 | - save_cache: 27 | key: node_modules_{{ checksum "package.json" }} 28 | paths: 29 | - ~/ionic-native/node_modules/ 30 | - run: 31 | name: Run tslint 32 | command: npm run lint 33 | - run: bash ./scripts/git/config.sh 34 | - run: 35 | name: Build Ionic Native 36 | command: npm run build 37 | - run: 38 | name: Generate README files to ensure docs are valid 39 | command: npm run readmes 40 | - run: 41 | name: Run tests 42 | command: npm test 43 | - add_ssh_keys 44 | - deploy: 45 | name: Update docs 46 | command: | 47 | if [ "${CIRCLE_BRANCH}" == "master" ]; then 48 | ./scripts/docs/update_docs.sh 49 | else 50 | echo "We are on ${CIRCLE_BRANCH} branch, not going to update docs." 51 | fi 52 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const gulp = require('gulp'), 4 | minimist = require('minimist'), 5 | rename = require('gulp-rename'), 6 | tslint = require('gulp-tslint'), 7 | replace = require('gulp-replace'), 8 | _ = require('lodash'); 9 | 10 | const flagConfig = { 11 | string: ['port', 'version', 'ngVersion', 'animations'], 12 | boolean: ['dry-run'], 13 | alias: { p: 'port', v: 'version', a: 'ngVersion' }, 14 | default: { port: 8000 }, 15 | }, 16 | flags = minimist(process.argv.slice(2), flagConfig); 17 | 18 | /* Docs tasks */ 19 | require('./scripts/docs/gulp-tasks')(gulp, flags); 20 | 21 | gulp.task('lint', () => { 22 | return gulp 23 | .src('src/**/*.ts') 24 | .pipe( 25 | tslint({ 26 | formatter: 'verbose', 27 | configuration: 'tslint.json', 28 | }) 29 | ) 30 | .pipe(tslint.report()); 31 | }); 32 | 33 | gulp.task('plugin:create', () => { 34 | if (flags.n && flags.n !== '') { 35 | const src = flags.m ? './scripts/templates/wrap-min.tmpl' : './scripts/templates/wrap.tmpl', 36 | pluginName = flags.n, 37 | spaced = pluginName.replace(/(?!^)([A-Z])/g, ' $1'), 38 | kebabCase = _.kebabCase(pluginName); 39 | 40 | return gulp 41 | .src(src) 42 | .pipe(replace('{{ PluginName }}', pluginName)) 43 | .pipe(replace('{{ Plugin_Name }}', spaced)) 44 | .pipe(replace('{{ pluginName }}', _.lowerFirst(pluginName))) 45 | .pipe(replace('{{ plugin-name }}', kebabCase)) 46 | .pipe(rename('index.ts')) 47 | .pipe(gulp.dest('./src/@ionic-native/plugins/' + kebabCase)); 48 | } else { 49 | console.log('Usage is: gulp plugin:create -n PluginName'); 50 | } 51 | }); 52 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 120, 3 | tabWidth: 2, 4 | useTabs: false, 5 | semi: true, 6 | singleQuote: true, 7 | trailingComma: 'es5', 8 | bracketSpacing: true, 9 | jsxBracketSameLine: false, 10 | arrowParens: 'avoid', 11 | rangeStart: 0, 12 | rangeEnd: Infinity, 13 | requirePragma: false, 14 | insertPragma: false, 15 | proseWrap: 'preserve', 16 | }; 17 | -------------------------------------------------------------------------------- /scripts/build/remove-tslib-helpers.js: -------------------------------------------------------------------------------- 1 | // removes the __extends method that is added automatically by typescript 2 | module.exports = source => source.replace(/var\s__extends\s=\s\(this\s&&[\sa-z\._\(\)\|{}=:\[\]&,;?]+}\)\(\);/i, ''); 3 | -------------------------------------------------------------------------------- /scripts/build/transformers/extract-injectables.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs-extra'; 2 | import * as path from 'path'; 3 | import * as ts from 'typescript'; 4 | 5 | import { hasDecorator, ROOT } from '../helpers'; 6 | 7 | export interface InjectableClassEntry { 8 | file: string; 9 | className: string; 10 | dirName: string; 11 | } 12 | 13 | const injectableClasses: InjectableClassEntry[] = []; 14 | export const EMIT_PATH = path.resolve(ROOT, 'injectable-classes.json'); 15 | 16 | /** 17 | * This transformer extracts all the injectable classes 18 | * so we can use all the names later on when we compile 19 | * an es5 bundle. 20 | * 21 | * Every injectable class will end up in the 22 | * window['IonicNative'] object. 23 | */ 24 | export function extractInjectables() { 25 | return (ctx: ts.TransformationContext) => { 26 | return tsSourceFile => { 27 | if (tsSourceFile.fileName.indexOf('src/@ionic-native/plugins') > -1) { 28 | ts.visitEachChild( 29 | tsSourceFile, 30 | node => { 31 | if (node.kind !== ts.SyntaxKind.ClassDeclaration) { 32 | return node; 33 | } 34 | 35 | const isInjectable: boolean = hasDecorator('Injectable', node); 36 | if (isInjectable) { 37 | injectableClasses.push({ 38 | file: tsSourceFile.path, 39 | className: (node as ts.ClassDeclaration).name.text, 40 | dirName: tsSourceFile.path.split(/[\\\/]+/).reverse()[1], 41 | }); 42 | } 43 | }, 44 | ctx 45 | ); 46 | } 47 | 48 | return tsSourceFile; 49 | }; 50 | }; 51 | } 52 | 53 | export function emitInjectableClasses() { 54 | fs.writeJSONSync(EMIT_PATH, injectableClasses); 55 | } 56 | 57 | export function cleanEmittedData() { 58 | fs.unlinkSync(EMIT_PATH); 59 | } 60 | -------------------------------------------------------------------------------- /scripts/build/transformers/members.ts: -------------------------------------------------------------------------------- 1 | import * as ts from 'typescript'; 2 | import { transformMethod } from './methods'; 3 | import { transformProperty } from './properties'; 4 | 5 | export function transformMembers(cls: ts.ClassDeclaration) { 6 | const propertyIndices: number[] = []; 7 | 8 | const members = cls.members.map((member: any, index: number) => { 9 | // only process decorated members 10 | if (!member.decorators || !member.decorators.length) return member; 11 | 12 | switch (member.kind) { 13 | case ts.SyntaxKind.MethodDeclaration: 14 | return transformMethod(member); 15 | case ts.SyntaxKind.PropertyDeclaration: 16 | propertyIndices.push(index); 17 | return member; 18 | case ts.SyntaxKind.Constructor: 19 | return ts.createConstructor(undefined, undefined, member.parameters, member.body); 20 | default: 21 | return member; // in case anything gets here by accident... 22 | } 23 | }); 24 | 25 | propertyIndices.forEach((i: number) => { 26 | const [getter, setter] = transformProperty(members, i) as any; 27 | members.push(getter, setter); 28 | }); 29 | 30 | propertyIndices.reverse().forEach(i => members.splice(i, 1)); 31 | 32 | return members; 33 | } 34 | -------------------------------------------------------------------------------- /scripts/build/transformers/methods.ts: -------------------------------------------------------------------------------- 1 | import * as ts from 'typescript'; 2 | import { Logger } from '../../logger'; 3 | import { 4 | convertValueToLiteral, 5 | getDecorator, 6 | getDecoratorArgs, 7 | getDecoratorName, 8 | getMethodsForDecorator, 9 | } from '../helpers'; 10 | 11 | export function transformMethod(method: ts.MethodDeclaration) { 12 | if (!method) return; 13 | 14 | const decorator = getDecorator(method), 15 | decoratorName = getDecoratorName(decorator), 16 | decoratorArgs = getDecoratorArgs(decorator); 17 | 18 | try { 19 | return ts.createMethod( 20 | undefined, 21 | undefined, 22 | undefined, 23 | method.name, 24 | undefined, 25 | method.typeParameters, 26 | method.parameters, 27 | method.type, 28 | ts.createBlock([ts.createReturn(getMethodBlock(method, decoratorName, decoratorArgs))]) 29 | ); 30 | } catch (e) { 31 | Logger.error('Error transforming method: ' + (method.name as any).text); 32 | Logger.error(e.message); 33 | } 34 | } 35 | 36 | function getMethodBlock(method: ts.MethodDeclaration, decoratorName: string, decoratorArgs: any): ts.Expression { 37 | const decoratorMethod = getMethodsForDecorator(decoratorName)[0]; 38 | 39 | switch (decoratorName) { 40 | case 'CordovaCheck': 41 | case 'InstanceCheck': 42 | // TODO remove function wrapper 43 | return ts.createImmediatelyInvokedArrowFunction([ 44 | ts.createIf( 45 | ts.createBinary( 46 | ts.createCall(ts.createIdentifier(decoratorMethod), undefined, [ts.createThis()]), 47 | ts.SyntaxKind.EqualsEqualsEqualsToken, 48 | ts.createTrue() 49 | ), 50 | method.body 51 | ), 52 | ]); 53 | 54 | default: 55 | return ts.createCall(ts.createIdentifier(decoratorMethod), undefined, [ 56 | ts.createThis(), 57 | ts.createLiteral((method.name as any).text), 58 | convertValueToLiteral(decoratorArgs), 59 | ts.createIdentifier('arguments'), 60 | ]); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /scripts/build/transformers/plugin-class.ts: -------------------------------------------------------------------------------- 1 | import * as ts from 'typescript'; 2 | 3 | import { Logger } from '../../logger'; 4 | import { convertValueToLiteral, getDecorator, getDecoratorArgs, getDecoratorName } from '../helpers'; 5 | import { transformMembers } from './members'; 6 | 7 | function transformClass(cls: any, ngcBuild?: boolean) { 8 | Logger.profile('transformClass: ' + cls.name.text); 9 | 10 | const pluginStatics = []; 11 | const dec: any = getDecorator(cls); 12 | 13 | if (dec) { 14 | const pluginDecoratorArgs = getDecoratorArgs(dec); 15 | 16 | // add plugin decorator args as static properties of the plugin's class 17 | for (const prop in pluginDecoratorArgs) { 18 | pluginStatics.push( 19 | ts.createProperty( 20 | undefined, 21 | [ts.createToken(ts.SyntaxKind.StaticKeyword)], 22 | ts.createIdentifier(prop), 23 | undefined, 24 | undefined, 25 | convertValueToLiteral(pluginDecoratorArgs[prop]) 26 | ) 27 | ); 28 | } 29 | } 30 | 31 | cls = ts.createClassDeclaration( 32 | ngcBuild && cls.decorators && cls.decorators.length 33 | ? cls.decorators.filter(d => getDecoratorName(d) === 'Injectable') 34 | : undefined, // remove Plugin and Injectable decorators 35 | [ts.createToken(ts.SyntaxKind.ExportKeyword)], 36 | cls.name, 37 | cls.typeParameters, 38 | cls.heritageClauses, 39 | [...transformMembers(cls), ...pluginStatics] 40 | ); 41 | 42 | Logger.profile('transformClass: ' + cls.name.text); 43 | return cls; 44 | } 45 | 46 | function transformClasses(file: ts.SourceFile, ctx: ts.TransformationContext, ngcBuild?: boolean) { 47 | Logger.silly('Transforming file: ' + file.fileName); 48 | return ts.visitEachChild( 49 | file, 50 | node => { 51 | if ( 52 | node.kind !== ts.SyntaxKind.ClassDeclaration || 53 | (node.modifiers && node.modifiers.find(v => v.kind === ts.SyntaxKind.DeclareKeyword)) 54 | ) { 55 | return node; 56 | } 57 | return transformClass(node, ngcBuild); 58 | }, 59 | ctx 60 | ); 61 | } 62 | 63 | export function pluginClassTransformer(ngcBuild?: boolean): ts.TransformerFactory { 64 | return (ctx: ts.TransformationContext) => { 65 | return tsSourceFile => { 66 | if (tsSourceFile.fileName.indexOf('src/@ionic-native/plugins') > -1) 67 | return transformClasses(tsSourceFile, ctx, ngcBuild); 68 | return tsSourceFile; 69 | }; 70 | }; 71 | } 72 | -------------------------------------------------------------------------------- /scripts/build/transformers/properties.ts: -------------------------------------------------------------------------------- 1 | import * as ts from 'typescript'; 2 | 3 | import { getDecorator, getDecoratorName } from '../helpers'; 4 | 5 | export function transformProperty(members: any[], index: number) { 6 | const property = members[index] as ts.PropertyDeclaration, 7 | decorator = getDecorator(property), 8 | decoratorName = getDecoratorName(decorator); 9 | 10 | let type: 'cordova' | 'instance'; 11 | 12 | switch (decoratorName) { 13 | case 'CordovaProperty': 14 | type = 'cordova'; 15 | break; 16 | 17 | case 'InstanceProperty': 18 | type = 'instance'; 19 | break; 20 | 21 | default: 22 | return property; 23 | } 24 | 25 | const getter = ts.createGetAccessor( 26 | undefined, 27 | undefined, 28 | property.name, 29 | undefined, 30 | property.type, 31 | ts.createBlock([ 32 | ts.createReturn( 33 | ts.createCall(ts.createIdentifier(type + 'PropertyGet'), undefined, [ 34 | ts.createThis(), 35 | ts.createLiteral((property.name as any).text), 36 | ]) 37 | ), 38 | ]) 39 | ); 40 | 41 | const setter = ts.createSetAccessor( 42 | undefined, 43 | undefined, 44 | property.name, 45 | [ts.createParameter(undefined, undefined, undefined, 'value', undefined, property.type)], 46 | ts.createBlock([ 47 | ts.createStatement( 48 | ts.createCall(ts.createIdentifier(type + 'PropertySet'), undefined, [ 49 | ts.createThis(), 50 | ts.createLiteral((property.name as any).text), 51 | ts.createIdentifier('value'), 52 | ]) 53 | ), 54 | ]) 55 | ); 56 | 57 | return [getter, setter]; 58 | } 59 | -------------------------------------------------------------------------------- /scripts/build/transpile.ts: -------------------------------------------------------------------------------- 1 | import * as ts from 'typescript'; 2 | import { pluginClassTransformer } from './transformers/plugin-class'; 3 | import { importsTransformer } from './transformers/imports'; 4 | import { clone } from 'lodash'; 5 | import { emitInjectableClasses, extractInjectables } from './transformers/extract-injectables'; 6 | import { COMPILER_OPTIONS, PLUGIN_PATHS, TS_CONFIG } from './helpers'; 7 | 8 | let host: ts.CompilerHost; 9 | 10 | export function getCompilerHost() { 11 | if (!host) host = ts.createCompilerHost(TS_CONFIG); 12 | return host; 13 | } 14 | 15 | export function getProgram(declaration = false, pluginPaths: string[] = PLUGIN_PATHS) { 16 | const compilerOptions: ts.CompilerOptions = clone(COMPILER_OPTIONS); 17 | compilerOptions.declaration = declaration; 18 | compilerOptions.moduleResolution = ts.ModuleResolutionKind.NodeJs; 19 | compilerOptions.target = ts.ScriptTarget.ES5; 20 | compilerOptions.module = ts.ModuleKind.ES2015; 21 | compilerOptions.inlineSourceMap = true; 22 | compilerOptions.inlineSources = true; 23 | compilerOptions.lib = ['lib.dom.d.ts', 'lib.es5.d.ts', 'lib.es2015.d.ts', 'lib.es2016.d.ts', 'lib.es2017.d.ts']; 24 | 25 | return ts.createProgram(pluginPaths, compilerOptions, getCompilerHost()); 26 | } 27 | 28 | export function generateDeclarations(sourceFiles?: string[]) { 29 | return getProgram(true, sourceFiles).emit(undefined, getCompilerHost().writeFile, undefined, true); 30 | } 31 | 32 | export function transpile() { 33 | const emitResult = getProgram().emit(undefined, getCompilerHost().writeFile, undefined, false, { 34 | before: [extractInjectables(), importsTransformer(), pluginClassTransformer()], 35 | }); 36 | 37 | emitInjectableClasses(); 38 | 39 | return emitResult; 40 | } 41 | -------------------------------------------------------------------------------- /scripts/docs-json/readme.md: -------------------------------------------------------------------------------- 1 | # docs-json 2 | 3 | This script reads and generates [typedoc](https://github.com/TypeStrong/typedoc) data for each of the plugins in `src/@ionic-native/plugins`. That data is then formatted and output as `plugins.json` in this directory. 4 | -------------------------------------------------------------------------------- /scripts/docs/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "sitePath": "../ionic-site", 3 | "v2DocsDir": "docs/native", 4 | "docsDest": "../ionic-site/content/docs/native", 5 | "pluginDir": "dist/@ionic-native/plugins" 6 | } 7 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/configs/links.js: -------------------------------------------------------------------------------- 1 | module.exports = function (getLinkInfo) { 2 | getLinkInfo.useFirstAmbiguousLink = false; 3 | }; 4 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/configs/log.js: -------------------------------------------------------------------------------- 1 | module.exports = function (log) { 2 | log.level = 'error'; //'silly', 'debug', 'info', 'warn', 'error' 3 | }; 4 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/configs/tag-defs.js: -------------------------------------------------------------------------------- 1 | module.exports = function (parseTagsProcessor) { 2 | parseTagsProcessor.tagDefinitions = parseTagsProcessor.tagDefinitions.concat(require('../tag-defs/tag-defs')); 3 | }; 4 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/configs/template-filters.js: -------------------------------------------------------------------------------- 1 | module.exports = function (templateEngine) { 2 | // Nunjucks and Angular conflict in their template bindings so change the Nunjucks 3 | // Also conflict with Jekyll 4 | templateEngine.config.tags = { 5 | variableStart: '<$', 6 | variableEnd: '$>', 7 | blockStart: '<@', 8 | blockEnd: '@>', 9 | commentStart: '<#', 10 | commentEnd: '#>', 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/configs/template-tags.js: -------------------------------------------------------------------------------- 1 | module.exports = function (templateEngine) { 2 | // add custom filters to nunjucks 3 | templateEngine.filters.push( 4 | require('../filters/capital'), 5 | require('../filters/code'), 6 | require('../filters/dump'), 7 | require('../filters/dashify') 8 | ); 9 | }; 10 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/filters/capital.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = { 3 | name: 'capital', 4 | process: str => (str ? str.charAt(0).toUpperCase() + str.substring(1) : ''), 5 | }; 6 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/filters/code.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const encoder = new require('node-html-encoder').Encoder(); 3 | 4 | function code(str, inline, lang) { 5 | // Encode any HTML entities in the code string 6 | str = encoder.htmlEncode(str, true); 7 | 8 | // If a language is provided then attach a CSS class to the code element 9 | lang = lang ? ' class="lang-' + lang + '"' : ''; 10 | 11 | str = '' + str + ''; 12 | 13 | // If not inline then wrap the code element in a pre element 14 | if (!inline) { 15 | str = '
' + str + '
'; 16 | } 17 | 18 | return str; 19 | } 20 | 21 | module.exports = { 22 | name: 'code', 23 | process: (str, lang) => code(str, true, lang), 24 | }; 25 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/filters/dashify.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = { 3 | name: 'dashify', 4 | process: str => (str ? str.replace(/\s/g, '-') : ''), 5 | }; 6 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/filters/dump.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = { 3 | name: 'dump', 4 | process: obj => console.log(obj), 5 | }; 6 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/processors/debug.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function test() { 3 | return { 4 | name: 'debug', 5 | $runBefore: ['rendering-docs'], 6 | $process: function (docs) { 7 | docs.forEach(function (doc) { 8 | if (doc.name == 'Camera') { 9 | console.log(doc.tags); 10 | doc.tags.forEach(function (tag) { 11 | if (tag.tagName == 'classes') { 12 | } 13 | }); 14 | 15 | doc.moduleDoc.exports.forEach(function (d, i) { 16 | if (d.name === 'CameraOptions') { 17 | console.log('Name: ' + d.name); 18 | console.log('Type: ' + d.docType); 19 | console.log('First member: ', d.members[0]); 20 | } 21 | }); 22 | 23 | var exports = doc.exportSymbol.parent.exports; 24 | for (var p in exports) { 25 | if (p == 'CameraOptions') { 26 | var x = exports[p]; 27 | console.log(x.members.quality); 28 | } 29 | } 30 | doc.members.forEach(function (method) { 31 | if (method.name === 'getPicture') { 32 | console.log(method); 33 | } 34 | }); 35 | } 36 | }); 37 | }, 38 | }; 39 | }; 40 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/processors/hide-private-api.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function removePrivateApi() { 3 | return { 4 | name: 'remove-private-api', 5 | description: 'Prevent the private apis from being rendered', 6 | $runBefore: ['rendering-docs'], 7 | $process: docs => docs.filter(doc => !doc.private && (!doc.tags || !doc.tags.tagsByName.get('hidden'))), 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/processors/jekyll.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function jekyll(renderDocsProcessor) { 3 | return { 4 | name: 'jekyll', 5 | description: 'Create jekyll includes', 6 | $runAfter: ['paths-computed'], 7 | $runBefore: ['rendering-docs'], 8 | $process: docs => { 9 | // pretty up and sort the docs object for menu generation 10 | docs = docs.filter(doc => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page'); 11 | 12 | docs.push({ 13 | docType: 'class', 14 | URL: 'https://github.com/ionic-team/ionic-native-google-maps/blob/master/documents/README.md', 15 | name: 'Google Maps', 16 | }); 17 | 18 | docs.sort((a, b) => { 19 | const textA = a.name ? a.name.toUpperCase() : '', 20 | textB = b.name ? b.name.toUpperCase() : ''; 21 | 22 | return textA < textB ? -1 : textA > textB ? 1 : 0; 23 | }); 24 | 25 | docs.forEach(doc => { 26 | if (!doc.outputPath) { 27 | return; 28 | } 29 | 30 | doc.outputPath = doc.outputPath.toLowerCase().replace(/\s/g, '-'); 31 | doc.URL = doc.outputPath.replace('docs//', 'docs/').replace('/index.md', '').replace('content/', ''); 32 | // add trailing slash to plugin pages 33 | if (!doc.URL.endsWith('/') && !doc.URL.endsWith('.html')) { 34 | doc.URL = doc.URL + '/'; 35 | } 36 | 37 | doc.URL = '/' + doc.URL; 38 | }); 39 | 40 | const betaDocs = []; 41 | 42 | docs = docs.filter(doc => { 43 | if (doc.beta === true) { 44 | betaDocs.push(doc); 45 | return false; 46 | } 47 | return true; 48 | }); 49 | 50 | docs = docs.concat(betaDocs); 51 | 52 | // add side menu 53 | docs.push({ 54 | docType: 'nativeMenu', 55 | id: 'native_menu', 56 | template: 'native_menu.template.html', 57 | outputPath: 'content/_includes/fluid/native_menu.html', 58 | }); 59 | 60 | return docs; 61 | }, 62 | }; 63 | }; 64 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/processors/mark-properties.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function markProperties() { 3 | return { 4 | name: 'mark-properties', 5 | $runBefore: ['rendering-docs'], 6 | $process: docs => 7 | docs.map(doc => { 8 | for (let i in doc.members) { 9 | if (doc.members.hasOwnProperty(i) && typeof doc.members[i].parameters === 'undefined') { 10 | doc.members[i].isProperty = true; 11 | } 12 | } 13 | return doc; 14 | }), 15 | }; 16 | }; 17 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/processors/npm-id.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function npmId(renderDocsProcessor) { 3 | return { 4 | name: 'npm-id', 5 | $runAfter: ['paths-computed'], 6 | $runBefore: ['rendering-docs'], 7 | $process: docs => { 8 | // pretty up and sort the docs object for menu generation 9 | docs = docs.filter(function (doc) { 10 | return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page'; 11 | }); 12 | 13 | docs.forEach(doc => { 14 | doc.npmId = doc.id.match(/plugins\/(.*)\/index/)[1]; 15 | }); 16 | 17 | return docs; 18 | }, 19 | }; 20 | }; 21 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/processors/parse-optional.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function parseOptional() { 3 | return { 4 | $runBefore: ['rendering-docs'], 5 | $process: docs => { 6 | docs.forEach(doc => { 7 | if (doc.members && doc.members.length) { 8 | for (let i in doc.members) { 9 | if (doc.members[i].params && doc.members[i].params.length) { 10 | for (let ii in doc.members[i].params) { 11 | if (doc.members[i].params[ii].optional) { 12 | doc.members[i].params[ii].description += 'Optional'; 13 | } 14 | } 15 | } 16 | } 17 | } 18 | }); 19 | return docs; 20 | }, 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/processors/readmes.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function readmes(renderDocsProcessor) { 3 | return { 4 | name: 'readmes', 5 | description: 'Create jekyll includes', 6 | $runAfter: ['paths-computed'], 7 | $runBefore: ['rendering-docs'], 8 | $process: docs => { 9 | // pretty up and sort the docs object for menu generation 10 | docs = docs.filter(doc => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page'); 11 | 12 | docs.forEach(doc => { 13 | doc.outputPath = doc.outputPath.replace('src/@ionic-native/', ''); 14 | }); 15 | 16 | return docs; 17 | }, 18 | }; 19 | }; 20 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/processors/remove-private-members.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function removePrivateMembers() { 3 | return { 4 | name: 'remove-private-members', 5 | description: 'Remove member docs with @private tags', 6 | $runAfter: ['tags-parsed'], 7 | $runBefore: ['rendering-docs'], 8 | $process: docs => { 9 | docs.forEach(doc => { 10 | if (doc.members) { 11 | doc.members = doc.members.filter(member => !member.tags.tagsByName.get('hidden')); 12 | } 13 | 14 | if (doc.statics) { 15 | doc.statics = doc.statics.filter(staticMethod => !staticMethod.tags.tagsByName.get('hidden')); 16 | } 17 | }); 18 | 19 | return docs; 20 | }, 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/tag-defs/tag-defs.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = [ 3 | { name: 'advanced' }, 4 | { name: 'demo' }, 5 | { name: 'beta', transforms: (doc, tag, value) => typeof value !== 'undefined' }, // make the value true or undefined instead of '' or undefined 6 | { name: 'usage' }, 7 | { name: 'hidden' }, // hide from docs 8 | { name: 'classes' }, // related classes 9 | { name: 'interfaces' }, // related interfaces 10 | { name: 'paid', transforms: (doc, tag, value) => typeof value !== 'undefined' }, // paid plugin, set value to true 11 | ]; 12 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/templates/native_menu.template.html: -------------------------------------------------------------------------------- 1 |
  • 2 | Overview 3 |
  • 4 |
  • 5 | Browser Usage 6 |
  • 7 | <@- for doc in docs @><@ if doc.URL and doc.private != true @> 8 |
  • 9 | <$ doc.name $><@ if doc.paid == true @> <@ endif @><@ if doc.beta == true @> 11 | β<@ endif @> 13 |
  • 14 | <@ endif @><@ endfor @> 15 | -------------------------------------------------------------------------------- /scripts/docs/dgeni/templates/readme.template.md: -------------------------------------------------------------------------------- 1 | 2 | Improve this doc 3 | 4 | 5 | # <$ doc.name $> 6 | 7 | <@- if doc.beta == true @> 8 | 9 |

    10 | This plugin is still in beta stage and may not work as expected. Please 11 | submit any issues to the plugin repo. 13 |

    14 | <@ endif -@> 15 | 16 | <@ for prop in doc.decorators[0].argumentInfo @> 17 | 18 | ``` 19 | $ <@ if prop.install @><$ prop.install $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @> 20 | $ npm install @ionic-native/<$ doc.npmId $> 21 | ``` 22 | 23 | ## [Usage Documentation](https://ionicframework.com/docs/native/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/')|replace('index.ts','')|replace('src/@ionic-native/plugins/','') $>) 24 | 25 | Plugin Repo: [<$ prop.repo $>](<$ prop.repo $>) 26 | 27 | <$ doc.description $> 28 | 29 | <@- if prop.platforms @> 30 | 31 | ## Supported platforms 32 | 33 | <@ for platform in prop.platforms -@> 34 | 35 | - <$ platform $> 36 | <@ endfor @> 37 | 38 | <@ endif -@> 39 | 40 | <@ endfor @> 41 | -------------------------------------------------------------------------------- /scripts/docs/gulp-tasks.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const config = require('./config.json'), 3 | projectPackage = require('../../package.json'), 4 | path = require('path'), 5 | fs = require('fs-extra'), 6 | Dgeni = require('dgeni'); 7 | 8 | module.exports = gulp => { 9 | gulp.task('docs', () => { 10 | try { 11 | const ionicPackage = require('./dgeni/dgeni-config')(projectPackage.version), 12 | dgeni = new Dgeni([ionicPackage]); 13 | 14 | return dgeni.generate().then(docs => console.log(docs.length + ' docs generated')); 15 | } catch (err) { 16 | console.log(err.stack); 17 | } 18 | }); 19 | 20 | gulp.task('readmes', () => { 21 | fs.copySync( 22 | path.resolve(__dirname, '..', '..', 'README.md'), 23 | path.resolve(__dirname, '..', '..', config.pluginDir, 'core', 'README.md') 24 | ); 25 | 26 | try { 27 | const ionicPackage = require('./dgeni/dgeni-readmes-config')(projectPackage.version), 28 | dgeni = new Dgeni([ionicPackage]); 29 | return dgeni.generate().then(docs => console.log(docs.length + ' README files generated')); 30 | } catch (err) { 31 | console.log(err.stack); 32 | } 33 | }); 34 | }; 35 | -------------------------------------------------------------------------------- /scripts/docs/prepare.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "##### " 4 | echo "##### prepare.sh" 5 | echo "#####" 6 | 7 | 8 | function init { 9 | cd .. 10 | SITE_PATH=$(readJsonProp "config.json" "sitePath") 11 | cd .. 12 | export IONIC_DIR=$PWD 13 | SITE_DIR=$IONIC_DIR/$SITE_PATH 14 | } 15 | 16 | function run { 17 | 18 | if [ ! -d "$SITE_DIR" ]; then 19 | echo "checking out" 20 | cd ./scripts 21 | ./git/clone.sh --repository="ionic-site" \ 22 | --directory="$SITE_DIR" \ 23 | --branch="master" 24 | cd $SITE_DIR 25 | ls -al 26 | else 27 | echo "using existing" 28 | cd $SITE_DIR 29 | git reset --hard 30 | git pull origin master 31 | fi 32 | 33 | git rm -rf content/docs/native/*/ || true 34 | 35 | } 36 | 37 | source $(dirname $0)/utils.inc.sh 38 | -------------------------------------------------------------------------------- /scripts/docs/update_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "##### " 4 | echo "##### ci/update_docs.sh" 5 | echo "#####" 6 | 7 | 8 | function init { 9 | cd .. 10 | SITE_PATH=$(readJsonProp "config.json" "sitePath") 11 | cd .. 12 | export IONIC_DIR=$PWD 13 | SITE_DIR=$IONIC_DIR/$SITE_PATH 14 | } 15 | 16 | function run { 17 | 18 | VERSION=$(readJsonProp "package.json" "version") 19 | 20 | # process new docs 21 | ./node_modules/.bin/gulp docs 22 | 23 | # CD in to the site dir to commit updated docs 24 | cd $SITE_DIR 25 | 26 | # Add all files to git 27 | git add . 28 | 29 | # if no changes, don't commit 30 | CHANGED=$(git diff-index --name-only HEAD 2>/dev/null | wc -l) 31 | if [ $CHANGED -eq 0 ]; 32 | then 33 | echo "-- No changes detected for the following commit, docs not updated." 34 | echo "https://github.com/ionic-team/$GITHUB_PROJECT_REPONAME/commit/$GITHUB_SHA1" 35 | else 36 | git config --global user.email "hi@ionicframework.com" 37 | git config --global user.name "Ionitron" 38 | git commit -am "Automated build of native docs ionic-team/$GITHUB_PROJECT_REPONAME@$GITHUB_SHA1" 39 | # in case a different commit was pushed to ionic-site during doc/demo gen, 40 | # try to rebase around it before pushing 41 | git fetch 42 | git rebase 43 | 44 | git push origin master || : 45 | 46 | echo "-- Updated docs for $VERSION_NAME succesfully!" 47 | fi 48 | } 49 | 50 | source $(dirname $0)/utils.inc.sh 51 | -------------------------------------------------------------------------------- /scripts/docs/update_readmes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "##### " 4 | echo "##### ci/update_docs.sh" 5 | echo "#####" 6 | 7 | 8 | function init { 9 | cd ../.. 10 | } 11 | 12 | function run { 13 | # process new docs 14 | ./node_modules/.bin/gulp readmes 15 | 16 | # if no changes, don't commit 17 | CHANGED=$(git diff-index --name-only HEAD --) 18 | if [ -z "$CHANGED" ]; 19 | then 20 | echo "-- No changes detected for the following commit, docs not updated." 21 | echo "https://github.com/ionic-team/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1" 22 | else 23 | git config --global user.email "hi@ionicframework.com" 24 | git config --global user.name "Ionitron" 25 | git add -A 26 | git commit -am "Automated build of native readmes for ionic-team/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1" 27 | # in case a different commit was pushed to ionic-site during doc/demo gen, 28 | # try to rebase around it before pushing 29 | git fetch 30 | git rebase 31 | 32 | # git push origin master || : 33 | 34 | echo "-- Updated docs for $VERSION_NAME successfully!" 35 | fi 36 | } 37 | 38 | source $(dirname $0)/../utils.inc.sh 39 | -------------------------------------------------------------------------------- /scripts/git/clone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ARG_DEFS=( 4 | "--repository=(.*)" 5 | "--directory=(.*)" 6 | "[--depth=(.*)]" 7 | "[--branch=(.*)]" 8 | ) 9 | 10 | function run { 11 | rm -rf $DIRECTORY 12 | mkdir -p $DIRECTORY 13 | 14 | echo "-- Cloning $REPOSITORY#$BRANCH to $DIRECTORY..." 15 | 16 | ARGS="--branch=${BRANCH:-master} --depth=3" 17 | if [[ "$DEPTH" != "" ]]; then 18 | ARGS="$ARGS --depth=$DEPTH" 19 | fi 20 | 21 | git config --global user.email "hi@ionicframework.com" 22 | git config --global user.name "Ionitron" 23 | 24 | git clone git@github.com:ionic-team/$REPOSITORY.git $DIRECTORY $ARGS 25 | cd $DIRECTORY 26 | git fetch origin --tags 27 | cd ../ 28 | } 29 | 30 | source $(dirname $0)/../utils.inc.sh 31 | -------------------------------------------------------------------------------- /scripts/git/config.sh: -------------------------------------------------------------------------------- 1 | git config --global user.email "hi@ionicframework.com" 2 | git config --global user.name "Ionitron" 3 | -------------------------------------------------------------------------------- /scripts/logger.ts: -------------------------------------------------------------------------------- 1 | import { createLogger, format, transports } from 'winston'; 2 | 3 | const { combine, colorize, simple } = format; 4 | 5 | const LOG_LEVEL = 'verbose'; 6 | 7 | export const Logger = createLogger({ 8 | level: LOG_LEVEL, 9 | format: combine(colorize(), simple()), 10 | transports: [new transports.Console({ level: LOG_LEVEL })], 11 | }); 12 | -------------------------------------------------------------------------------- /scripts/tasks/build-esm.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs-extra'; 2 | import * as path from 'path'; 3 | 4 | import { PLUGIN_PATHS, ROOT } from '../build/helpers'; 5 | import { EMIT_PATH } from '../build/transformers/extract-injectables'; 6 | import { generateDeclarations, transpile } from '../build/transpile'; 7 | 8 | generateDeclarations(); 9 | transpile(); 10 | 11 | const outDirs = PLUGIN_PATHS.map(p => 12 | p.replace(path.join(ROOT, 'src'), path.join(ROOT, 'dist')).replace(/[\\/]index.ts/, '') 13 | ); 14 | const injectableClasses = fs.readJSONSync(EMIT_PATH); 15 | 16 | outDirs.forEach(dir => { 17 | const classes = injectableClasses.filter(entry => entry.dirName === dir.split(/[\\/]+/).pop()); 18 | 19 | let jsFile: string = fs.readFileSync(path.join(dir, 'index.js'), 'utf-8'), 20 | dtsFile: string = fs.readFileSync(path.join(dir, 'index.d.ts'), 'utf-8'); 21 | 22 | classes.forEach(entry => { 23 | dtsFile = dtsFile.replace(`class ${entry.className} `, 'class ' + entry.className + 'Original '); 24 | dtsFile += `\nexport declare const ${entry.className}: ${entry.className}Original;`; 25 | jsFile = jsFile.replace( 26 | new RegExp(`([\\s\\(])${entry.className}([\\s\\.;\\(,])`, 'g'), 27 | '$1' + entry.className + 'Original$2' 28 | ); 29 | jsFile = jsFile.replace( 30 | `export { ${entry.className}Original }`, 31 | `var ${entry.className} = new ${entry.className}Original();\nexport { ${entry.className} }` 32 | ); 33 | }); 34 | 35 | fs.writeFileSync(path.join(dir, 'index.js'), jsFile, 'utf-8'); 36 | fs.writeFileSync(path.join(dir, 'index.d.ts'), dtsFile, 'utf-8'); 37 | }); 38 | -------------------------------------------------------------------------------- /scripts/tasks/build-ngx.ts: -------------------------------------------------------------------------------- 1 | import { cleanupNgx, generateDeclarationFiles, modifyMetadata, transpileNgx, transpileNgxCore } from '../build/ngx'; 2 | 3 | transpileNgxCore(); 4 | transpileNgx(); 5 | generateDeclarationFiles(); 6 | modifyMetadata(); 7 | cleanupNgx(); 8 | -------------------------------------------------------------------------------- /scripts/templates/wrap-min.tmpl: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a template for new plugin wrappers 3 | * 4 | * TODO: 5 | * - Add/Change information below 6 | * - Document usage (importing, executing main functionality) 7 | * - Remove any imports that you are not using 8 | * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs and any other docs you added 9 | * - Remove this note 10 | * 11 | */ 12 | import { Injectable } from '@angular/core'; 13 | import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, IonicNativePlugin } from '@ionic-native/core'; 14 | import { Observable } from 'rxjs'; 15 | 16 | /** 17 | * @name {{ Plugin_Name }} 18 | * @description 19 | * This plugin does something 20 | * 21 | * @usage 22 | * ```typescript 23 | * import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}'; 24 | * 25 | * 26 | * constructor(private {{ pluginName }}: {{ PluginName }}) { } 27 | * 28 | * ... 29 | * 30 | * 31 | * this.{{ pluginName }}.functionName('Hello', 123) 32 | * .then((res: any) => console.log(res)) 33 | * .catch((error: any) => console.error(error)); 34 | * 35 | * ``` 36 | */ 37 | @Plugin({ 38 | pluginName: '{{ PluginName }}', 39 | plugin: '', // npm package name, example: cordova-plugin-camera 40 | pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation 41 | repo: '', // the github repository URL for the plugin 42 | install: '', // OPTIONAL install command, in case the plugin requires variables 43 | installVariables: [], // OPTIONAL the plugin requires variables 44 | platforms: [] // Array of platforms supported, example: ['Android', 'iOS'] 45 | }) 46 | @Injectable() 47 | export class {{ PluginName }} extends IonicNativePlugin { 48 | 49 | /** 50 | * This function does something 51 | * @param arg1 {string} Some param to configure something 52 | * @param arg2 {number} Another param to configure something 53 | * @return {Promise} Returns a promise that resolves when something happens 54 | */ 55 | @Cordova() 56 | functionName(arg1: string, arg2: number): Promise { 57 | return; // We add return; here to avoid any IDE / Compiler errors 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /scripts/templates/wrap.tmpl: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a template for new plugin wrappers 3 | * 4 | * TODO: 5 | * - Add/Change information below 6 | * - Document usage (importing, executing main functionality) 7 | * - Remove any imports that you are not using 8 | * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs and any other docs you added 9 | * - Remove this note 10 | * 11 | */ 12 | import { Injectable } from '@angular/core'; 13 | import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, IonicNativePlugin } from '@ionic-native/core'; 14 | import { Observable } from 'rxjs'; 15 | 16 | /** 17 | * @name {{ Plugin_Name }} 18 | * @description 19 | * This plugin does something 20 | * 21 | * @usage 22 | * ```typescript 23 | * import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}'; 24 | * 25 | * 26 | * constructor(private {{ pluginName }}: {{ PluginName }}) { } 27 | * 28 | * ... 29 | * 30 | * 31 | * this.{{ pluginName }}.functionName('Hello', 123) 32 | * .then((res: any) => console.log(res)) 33 | * .catch((error: any) => console.error(error)); 34 | * 35 | * ``` 36 | */ 37 | @Plugin({ 38 | pluginName: '{{ PluginName }}', 39 | plugin: '', // npm package name, example: cordova-plugin-camera 40 | pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation 41 | repo: '', // the github repository URL for the plugin 42 | install: '', // OPTIONAL install command, in case the plugin requires variables 43 | installVariables: [], // OPTIONAL the plugin requires variables 44 | platforms: [] // Array of platforms supported, example: ['Android', 'iOS'] 45 | }) 46 | @Injectable() 47 | export class {{ PluginName }} extends IonicNativePlugin { 48 | 49 | /** 50 | * This function does something 51 | * @param arg1 {string} Some param to configure something 52 | * @param arg2 {number} Another param to configure something 53 | * @return {Promise} Returns a promise that resolves when something happens 54 | */ 55 | @Cordova() 56 | functionName(arg1: string, arg2: number): Promise { 57 | return; // We add return; here to avoid any IDE / Compiler errors 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /scripts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "moduleResolution": "node", 6 | "noImplicitAny": false, 7 | "lib": ["es6"] 8 | }, 9 | "exclude": ["node_modules"] 10 | } 11 | -------------------------------------------------------------------------------- /src/@ionic-native/core/bootstrap.ts: -------------------------------------------------------------------------------- 1 | export function checkReady() { 2 | if (typeof process === 'undefined') { 3 | const win: any = typeof window !== 'undefined' ? window : {}; 4 | const DEVICE_READY_TIMEOUT = 5000; 5 | 6 | // To help developers using cordova, we listen for the device ready event and 7 | // log an error if it didn't fire in a reasonable amount of time. Generally, 8 | // when this happens, developers should remove and reinstall plugins, since 9 | // an inconsistent plugin is often the culprit. 10 | const before = Date.now(); 11 | 12 | let didFireReady = false; 13 | win.document.addEventListener('deviceready', () => { 14 | console.log(`Ionic Native: deviceready event fired after ${Date.now() - before} ms`); 15 | didFireReady = true; 16 | }); 17 | 18 | setTimeout(() => { 19 | if (!didFireReady && win.cordova) { 20 | console.warn( 21 | `Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.` 22 | ); 23 | } 24 | }, DEVICE_READY_TIMEOUT); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/@ionic-native/core/decorators/cordova-function-override.ts: -------------------------------------------------------------------------------- 1 | import { Observable, Observer } from 'rxjs'; 2 | 3 | import { checkAvailability, getPlugin } from './common'; 4 | 5 | function overrideFunction(pluginObj: any, methodName: string): Observable { 6 | return new Observable((observer: Observer) => { 7 | const availabilityCheck = checkAvailability(pluginObj, methodName); 8 | 9 | if (availabilityCheck === true) { 10 | const pluginInstance = getPlugin(pluginObj.constructor.getPluginRef()); 11 | pluginInstance[methodName] = observer.next.bind(observer); 12 | return () => (pluginInstance[methodName] = () => {}); 13 | } else { 14 | observer.error(availabilityCheck); 15 | observer.complete(); 16 | } 17 | }); 18 | } 19 | 20 | export function cordovaFunctionOverride(pluginObj: any, methodName: string, args: IArguments | any[] = []) { 21 | return overrideFunction(pluginObj, methodName); 22 | } 23 | -------------------------------------------------------------------------------- /src/@ionic-native/core/decorators/cordova-instance.ts: -------------------------------------------------------------------------------- 1 | import { wrapInstance } from './common'; 2 | import { CordovaOptions } from './interfaces'; 3 | 4 | export function cordovaInstance(pluginObj: any, methodName: string, config: CordovaOptions, args: IArguments | any[]) { 5 | args = Array.from(args); 6 | return wrapInstance(pluginObj, methodName, config).apply(this, args); 7 | } 8 | -------------------------------------------------------------------------------- /src/@ionic-native/core/decorators/cordova-property.ts: -------------------------------------------------------------------------------- 1 | import { checkAvailability, getPlugin } from './common'; 2 | 3 | export function cordovaPropertyGet(pluginObj: any, key: string) { 4 | if (checkAvailability(pluginObj, key) === true) { 5 | return getPlugin(pluginObj.constructor.getPluginRef())[key]; 6 | } 7 | return null; 8 | } 9 | 10 | export function cordovaPropertySet(pluginObj: any, key: string, value: any) { 11 | if (checkAvailability(pluginObj, key) === true) { 12 | getPlugin(pluginObj.constructor.getPluginRef())[key] = value; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/@ionic-native/core/decorators/cordova.ts: -------------------------------------------------------------------------------- 1 | import { wrap } from './common'; 2 | import { CordovaOptions } from './interfaces'; 3 | 4 | export function cordova(pluginObj: any, methodName: string, config: CordovaOptions, args: IArguments | any[]) { 5 | return wrap(pluginObj, methodName, config).apply(this, args); 6 | } 7 | -------------------------------------------------------------------------------- /src/@ionic-native/core/decorators/instance-property.ts: -------------------------------------------------------------------------------- 1 | export function instancePropertyGet(pluginObj: any, key: string) { 2 | if (pluginObj._objectInstance && pluginObj._objectInstance[key]) { 3 | return pluginObj._objectInstance[key]; 4 | } 5 | return null; 6 | } 7 | 8 | export function instancePropertySet(pluginObj: any, key: string, value: any) { 9 | if (pluginObj._objectInstance) { 10 | pluginObj._objectInstance[key] = value; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/@ionic-native/core/index.ts: -------------------------------------------------------------------------------- 1 | import { checkReady } from './bootstrap'; 2 | 3 | export { IonicNativePlugin } from './ionic-native-plugin'; 4 | 5 | // Decorators 6 | export { checkAvailability, instanceAvailability, wrap, getPromise } from './decorators/common'; 7 | export * from './decorators/cordova'; 8 | export * from './decorators/cordova-function-override'; 9 | export * from './decorators/cordova-instance'; 10 | export * from './decorators/cordova-property'; 11 | export * from './decorators/instance-property'; 12 | export * from './decorators/interfaces'; 13 | 14 | checkReady(); 15 | -------------------------------------------------------------------------------- /src/@ionic-native/core/ionic-native-plugin.ts: -------------------------------------------------------------------------------- 1 | import { checkAvailability } from './decorators/common'; 2 | import { get } from './util'; 3 | 4 | export class IonicNativePlugin { 5 | static pluginName = ''; 6 | static pluginRef = ''; 7 | static plugin = ''; 8 | static repo = ''; 9 | static platforms: string[] = []; 10 | static install = ''; 11 | 12 | /** 13 | * Returns a boolean that indicates whether the plugin is installed 14 | * @return {boolean} 15 | */ 16 | static installed(): boolean { 17 | const isAvailable = checkAvailability(this.pluginRef) === true; 18 | return isAvailable; 19 | } 20 | 21 | /** 22 | * Returns the original plugin object 23 | */ 24 | static getPlugin(): any { 25 | if (typeof window !== 'undefined') { 26 | return get(window, this.pluginRef); 27 | } 28 | return null; 29 | } 30 | 31 | /** 32 | * Returns the plugin's name 33 | */ 34 | static getPluginName(): string { 35 | const pluginName = this.pluginName; 36 | return pluginName; 37 | } 38 | 39 | /** 40 | * Returns the plugin's reference 41 | */ 42 | static getPluginRef(): string { 43 | const pluginRef = this.pluginRef; 44 | return pluginRef; 45 | } 46 | 47 | /** 48 | * Returns the plugin's install name 49 | */ 50 | static getPluginInstallName(): string { 51 | const plugin = this.plugin; 52 | return plugin; 53 | } 54 | 55 | /** 56 | * Returns the plugin's supported platforms 57 | */ 58 | static getSupportedPlatforms(): string[] { 59 | const platform = this.platforms; 60 | return platform; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/@ionic-native/core/ng1.ts: -------------------------------------------------------------------------------- 1 | declare const window: any; 2 | 3 | /** 4 | * Initialize the ionic.native Angular module if we're running in ng1. 5 | * This iterates through the list of registered plugins and dynamically 6 | * creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovaStatusBar. 7 | */ 8 | export function initAngular1(plugins: any) { 9 | if (typeof window !== 'undefined' && window.angular) { 10 | const ngModule = window.angular.module('ionic.native', []); 11 | 12 | for (const name in plugins) { 13 | const serviceName = '$cordova' + name; 14 | const cls = plugins[name]; 15 | 16 | ((serviceName, cls, name) => { 17 | ngModule.service(serviceName, [ 18 | () => { 19 | const funcs = window.angular.copy(cls); 20 | funcs.__proto__['name'] = name; 21 | return funcs; 22 | }, 23 | ]); 24 | })(serviceName, cls, name); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/@ionic-native/core/util.ts: -------------------------------------------------------------------------------- 1 | declare const window: any; 2 | 3 | /** 4 | * @private 5 | */ 6 | export function get(element: Element | Window, path: string) { 7 | const paths: string[] = path.split('.'); 8 | let obj: any = element; 9 | for (let i = 0; i < paths.length; i++) { 10 | if (!obj) { 11 | return null; 12 | } 13 | obj = obj[paths[i]]; 14 | } 15 | return obj; 16 | } 17 | 18 | /** 19 | * @private 20 | */ 21 | export function getPromise(callback: Function = () => {}): Promise { 22 | const tryNativePromise = () => { 23 | if (typeof Promise === 'function' || (typeof window !== 'undefined' && window.Promise)) { 24 | return new Promise((resolve, reject) => { 25 | callback(resolve, reject); 26 | }); 27 | } else { 28 | console.error( 29 | 'No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.' 30 | ); 31 | } 32 | }; 33 | 34 | return tryNativePromise(); 35 | } 36 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/alipay/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Alipay 6 | * @description 7 | * This plugin facilitates the usage of Alipay 支付宝 in an Ionic apps with the integrated AlipaySDK dated on 20180601. 8 | * 9 | * Requires Cordova plugin: `cordova-plugin-gubnoi-alipay`. For more info, please see https://github.com/jing-zhou/cordova-plugin-alipay . 10 | * 11 | * @usage 12 | * ```typescript 13 | * import { Alipay } from '@ionic-native/alipay/ngx'; 14 | * 15 | * constructor(private alipay: Alipay) { 16 | * 17 | * //alipayOrder is a string that has been generated and signed by the server side. 18 | * this.alipay.pay(alipayOrder, success, error) 19 | * .then(result => { 20 | * console.log(result); // Success 21 | * }) 22 | * .catch(error => { 23 | * console.log(error); // Failed 24 | * }); 25 | * 26 | * } 27 | * 28 | * ``` 29 | */ 30 | @Plugin({ 31 | pluginName: 'Alipay', 32 | plugin: 'cordova-plugin-gubnoi-alipay', 33 | pluginRef: 'cordova.plugins.alipay', 34 | repo: 'https://github.com/jing-zhou/cordova-plugin-alipay', 35 | install: 'ionic cordova plugin add cordova-plugin-gubnoi-alipay --variable APP_ID=your_app_id', 36 | installVariables: ['APP_ID'], 37 | platforms: ['Android', 'iOS'], 38 | }) 39 | @Injectable() 40 | export class Alipay extends IonicNativePlugin { 41 | /** 42 | * Open Alipay to perform App pay 43 | * @param {string} order alipay order string 44 | * @returns {Promise} Returns a Promise that resolves with the success return, or rejects with an error. 45 | */ 46 | @Cordova() 47 | pay(order: string, success?: (res?: any) => void, error?: (err?: any) => void): Promise { 48 | return; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/anyline/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface AnylineOptions { 5 | // Valid License Key 6 | licenseKey: string; 7 | 8 | // Scanning options 9 | config: any; 10 | } 11 | 12 | /** 13 | * @name Anyline 14 | * @description 15 | * Anyline provides an easy-to-use SDK for applications to enable Optical Character Recognition (OCR) on mobile devices. 16 | * 17 | * @usage 18 | * ```typescript 19 | * import { Anyline } from '@ionic-native/anyline/ngx'; 20 | * 21 | * 22 | * constructor(private anyline: Anyline) { } 23 | * 24 | * ... 25 | * 26 | * 27 | * this.anyline.scan(options) 28 | * .then((res: any) => console.log(res)) 29 | * .catch((error: any) => console.error(error)); 30 | * 31 | * ``` 32 | */ 33 | @Plugin({ 34 | pluginName: 'Anyline', 35 | plugin: 'io-anyline-cordova', 36 | pluginRef: 'Anyline', 37 | repo: 'https://github.com/Anyline/anyline-ocr-cordova-module', 38 | platforms: ['Android', 'iOS'], 39 | }) 40 | @Injectable() 41 | export class Anyline extends IonicNativePlugin { 42 | /** 43 | * Scan 44 | * @param options {AnylineOptions} Scanning options 45 | * @return {Promise} Returns a promise that resolves when Code is captured 46 | */ 47 | @Cordova() 48 | scan(options: AnylineOptions): Promise { 49 | return; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/app-availability/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name App Availability 6 | * @description 7 | * This plugin allows you to check if an app is installed on the user's device. It requires an URI Scheme (e.g. twitter://) on iOS or a Package Name (e.g com.twitter.android) on Android. 8 | * 9 | * Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability). 10 | * 11 | * @usage 12 | * ```typescript 13 | * import { AppAvailability } from '@ionic-native/app-availability/ngx'; 14 | * import { Platform } from 'ionic-angular'; 15 | * 16 | * constructor(private appAvailability: AppAvailability, private platform: Platform) { } 17 | * 18 | * ... 19 | * 20 | * let app; 21 | * 22 | * if (this.platform.is('ios')) { 23 | * app = 'twitter://'; 24 | * } else if (this.platform.is('android')) { 25 | * app = 'com.twitter.android'; 26 | * } 27 | * 28 | * this.appAvailability.check(app) 29 | * .then( 30 | * (yes: boolean) => console.log(app + ' is available'), 31 | * (no: boolean) => console.log(app + ' is NOT available') 32 | * ); 33 | * ``` 34 | */ 35 | @Plugin({ 36 | pluginName: 'AppAvailability', 37 | plugin: 'cordova-plugin-appavailability', 38 | pluginRef: 'appAvailability', 39 | repo: 'https://github.com/ohh2ahh/AppAvailability', 40 | platforms: ['Android', 'iOS'], 41 | }) 42 | @Injectable() 43 | export class AppAvailability extends IonicNativePlugin { 44 | /** 45 | * Checks if an app is available on device 46 | * @param {string} app Package name on android, or URI scheme on iOS 47 | * @returns {Promise} 48 | */ 49 | @Cordova() 50 | check(app: string): Promise { 51 | return; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/app-center-push/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | import { Observable } from 'rxjs'; 4 | 5 | /** 6 | * @name App Center Push 7 | * @description 8 | * 9 | * For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/push/cordova 10 | * 11 | * @usage 12 | * ```typescript 13 | * import { AppCenterPush } from '@ionic-native/app-center-push/ngx'; 14 | * 15 | * 16 | * constructor(private appCenterPush: AppCenterPush) { } 17 | * 18 | * ... 19 | * 20 | * this.appCenterPush.setEnabled(true).then(() => { 21 | * this.appCenterPush.addEventListener('My Event').subscribe(pushNotification => { 22 | * console.log('Recived push notification', pushNotification); 23 | * }); 24 | * }); 25 | * 26 | * ``` 27 | */ 28 | @Plugin({ 29 | pluginName: 'AppCenterPush', 30 | plugin: 'cordova-plugin-appcenter-push', 31 | pluginRef: 'AppCenter.Push', 32 | repo: 'https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-push', 33 | platforms: ['Android', 'iOS'], 34 | }) 35 | @Injectable() 36 | export class AppCenterPush extends IonicNativePlugin { 37 | /** 38 | * Subscribe to an event 39 | * @param {string} eventName Event name 40 | * @returns {Observable} 41 | */ 42 | @Cordova({ 43 | observable: true, 44 | clearFunction: 'removeEventListener', 45 | }) 46 | addEventListener(eventName: string): Observable { 47 | return; 48 | } 49 | /** 50 | * Check if App Center Push is enabled 51 | * @returns {Promise} 52 | */ 53 | @Cordova() 54 | isEnabled(): Promise { 55 | return; 56 | } 57 | 58 | /** 59 | * Enable or disable App Center Push at runtime 60 | * @param {boolean} shouldEnable Set value 61 | * @returns {Promise} 62 | */ 63 | @Cordova() 64 | setEnabled(shouldEnable: boolean): Promise { 65 | return; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/app-launcher/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface AppLauncherOptions { 5 | uri?: string; 6 | packageName?: string; 7 | } 8 | 9 | /** 10 | * @name App Launcher 11 | * @description 12 | * Simple Cordova plugin to see if other apps are installed and launch them. 13 | * 14 | * @usage 15 | * ```typescript 16 | * import { AppLauncher, AppLauncherOptions } from '@ionic-native/app-launcher/ngx'; 17 | * import { Platform } from '@ionic/angular'; 18 | * 19 | * constructor(private appLauncher: AppLauncher, private platform: Platform) { } 20 | * 21 | * ... 22 | * 23 | * const options: AppLauncherOptions = { 24 | * } 25 | * 26 | * if(this.platform.is('ios')) { 27 | * options.uri = 'fb://' 28 | * } else { 29 | * options.packageName = 'com.facebook.katana' 30 | * } 31 | * 32 | * this.appLauncher.canLaunch(options) 33 | * .then((canLaunch: boolean) => console.log('Facebook is available')) 34 | * .catch((error: any) => console.error('Facebook is not available')); 35 | * 36 | * ``` 37 | */ 38 | @Plugin({ 39 | pluginName: 'AppLauncher', 40 | plugin: 'cordova-plugin-app-launcher', 41 | pluginRef: 'window.plugins.launcher', 42 | repo: 'https://github.com/nchutchind/cordova-plugin-app-launcher', 43 | platforms: ['Android', 'iOS'], 44 | }) 45 | @Injectable() 46 | export class AppLauncher extends IonicNativePlugin { 47 | /** 48 | * Check if any apps are installed that can launch via a specified URI or Package Name. 49 | * @param options App Launcher options 50 | * @return {Promise} Returns a promise that resolves if the app is installed 51 | */ 52 | @Cordova() 53 | canLaunch(options: AppLauncherOptions): Promise { 54 | return; 55 | } 56 | 57 | /** 58 | * Launches the app via a specified URI or Package Name 59 | * @param options App Launcher options 60 | * @return {Promise} Returns a promise that resolves the launched app 61 | */ 62 | @Cordova() 63 | launch(options: AppLauncherOptions): Promise { 64 | return; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/app-minimize/index.ts: -------------------------------------------------------------------------------- 1 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 2 | import { Injectable } from '@angular/core'; 3 | 4 | /** 5 | * @name App Minimize 6 | * @description 7 | * AppMinimize is a plugin to minimize the application on android devices 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { Platfrom } from '@ionic/angular'; 12 | * import { AppMinimize } from '@ionic-native/app-minimize/ngx'; 13 | * 14 | * 15 | * constructor(private platform: Platform, private appMinimize: AppMinimize) { } 16 | * 17 | * ... 18 | * 19 | * this.platform.registerBackButtonAction(() => { 20 | * this.appMinimize.minimize(); 21 | * }); 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'AppMinimize', 27 | plugin: 'cordova-plugin-appminimize', 28 | pluginRef: 'plugins.appMinimize', 29 | repo: 'https://github.com/tomloprod/cordova-plugin-appminimize', 30 | platforms: ['Android'], 31 | }) 32 | @Injectable() 33 | export class AppMinimize extends IonicNativePlugin { 34 | /** 35 | * Minimizes the application 36 | * @return {Promise} 37 | */ 38 | @Cordova() 39 | minimize(): Promise { 40 | return; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/app-update/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface AppUpdateOptions { 5 | authType?: string; 6 | username?: string; 7 | password?: string; 8 | skipPromptDialog?: boolean; 9 | skipProgressDialog?: boolean; 10 | } 11 | 12 | /** 13 | * @name App Update 14 | * @description 15 | * This plugin does self-update for android 16 | * 17 | * @usage 18 | * 19 | * You should first host an XML file on your server with the following data in it: 20 | * ```xml 21 | * 22 | * 302048 23 | * APK Name 24 | * https://your-remote-api.com/YourApp.apk 25 | * 26 | * ``` 27 | * 28 | * Then use the following code: 29 | * 30 | * ```typescript 31 | * import { AppUpdate } from '@ionic-native/app-update/ngx'; 32 | * 33 | * constructor(private appUpdate: AppUpdate) { 34 | * 35 | * const updateUrl = 'https://your-remote-api.com/update.xml'; 36 | * this.appUpdate.checkAppUpdate(updateUrl).then(() => { console.log('Update available') }); 37 | * 38 | * } 39 | * ``` 40 | * 41 | * The plugin will compare the app version and update it automatically if the API has a newer version to install. 42 | * @interfaces 43 | * AppUpdateOptions 44 | */ 45 | @Plugin({ 46 | pluginName: 'AppUpdate', 47 | plugin: 'cordova-plugin-app-update', 48 | pluginRef: 'AppUpdate', 49 | repo: 'https://github.com/vaenow/cordova-plugin-app-update', 50 | platforms: ['Android'], 51 | }) 52 | @Injectable() 53 | export class AppUpdate extends IonicNativePlugin { 54 | /** 55 | * Check and update 56 | * @param {string} updateUrl update api url 57 | * @param {AppUpdateOptions} [options] options 58 | * @return {Promise} Returns a promise that resolves when something happens 59 | */ 60 | @Cordova({ 61 | callbackOrder: 'reverse', 62 | }) 63 | checkAppUpdate(updateUrl: string, options?: AppUpdateOptions): Promise { 64 | return; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/app-version/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name App Version 6 | * @premier app-version 7 | * @description 8 | * Reads the version of your app from the target build settings. 9 | * 10 | * Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version). 11 | * 12 | * @usage 13 | * ```typescript 14 | * import { AppVersion } from '@ionic-native/app-version/ngx'; 15 | * 16 | * constructor(private appVersion: AppVersion) { } 17 | * 18 | * ... 19 | * 20 | * 21 | * this.appVersion.getAppName(); 22 | * this.appVersion.getPackageName(); 23 | * this.appVersion.getVersionCode(); 24 | * this.appVersion.getVersionNumber(); 25 | * 26 | * ``` 27 | */ 28 | @Plugin({ 29 | pluginName: 'AppVersion', 30 | plugin: 'cordova-plugin-app-version', 31 | pluginRef: 'cordova.getAppVersion', 32 | repo: 'https://github.com/whiteoctober/cordova-plugin-app-version', 33 | platforms: ['Android', 'iOS', 'Windows'], 34 | }) 35 | @Injectable() 36 | export class AppVersion extends IonicNativePlugin { 37 | /** 38 | * Returns the name of the app, e.g.: "My Awesome App" 39 | * @returns {Promise} 40 | */ 41 | @Cordova() 42 | getAppName(): Promise { 43 | return; 44 | } 45 | 46 | /** 47 | * Returns the package name of the app, e.g.: "com.example.myawesomeapp" 48 | * @returns {Promise} 49 | */ 50 | @Cordova() 51 | getPackageName(): Promise { 52 | return; 53 | } 54 | 55 | /** 56 | * Returns the build identifier of the app. 57 | * In iOS a string with the build version like "1.6095" 58 | * In Android a number generated from the version string, like 10203 for version "1.2.3" 59 | * @returns {Promise} 60 | */ 61 | @Cordova() 62 | getVersionCode(): Promise { 63 | return; 64 | } 65 | 66 | /** 67 | * Returns the version of the app, e.g.: "1.2.3" 68 | * @returns {Promise} 69 | */ 70 | @Cordova() 71 | getVersionNumber(): Promise { 72 | return; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/autostart/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Autostart 6 | * @description 7 | * This plugin automatically starts your Android app after every boot or auto-update. 8 | * You can enable or disable the autostart function in your app. 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { Autostart } from '@ionic-native/autostart/ngx'; 13 | * 14 | * 15 | * constructor(private autostart: Autostart) { } 16 | * 17 | * ... 18 | * 19 | * this.autostart.enable(); 20 | * 21 | * this.autostart.disable(); 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'Autostart', 27 | plugin: 'cordova-plugin-autostart', 28 | pluginRef: 'cordova.plugins.autoStart', 29 | repo: 'https://github.com/ToniKorin/cordova-plugin-autostart', 30 | platforms: ['Android'], 31 | }) 32 | @Injectable() 33 | export class Autostart extends IonicNativePlugin { 34 | /** 35 | * Enable the automatic startup after the boot 36 | */ 37 | @Cordova({ sync: true }) 38 | enable(): void {} 39 | 40 | /** 41 | * Disable the automatic startup after the boot 42 | */ 43 | @Cordova({ sync: true }) 44 | disable(): void {} 45 | } 46 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/backlight/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @beta 6 | * @name Backlight 7 | * @description 8 | * This plugin adds turning on/off the device backlight. 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { Backlight } from '@ionic-native/backlight/ngx'; 13 | * 14 | * constructor(private backlight: Backlight) { } 15 | * 16 | * ... 17 | * 18 | * // Turn backlight on 19 | * this.backlight.on().then(() => console.log('backlight on')); 20 | * 21 | * // Turn backlight off 22 | * this.backlight.off().then(() => console.log('backlight off')); 23 | * 24 | * ``` 25 | */ 26 | @Plugin({ 27 | pluginName: 'Backlight', 28 | plugin: 'cordova-plugin-backlight', 29 | pluginRef: 'cordova.plugins.Backlight', 30 | repo: 'https://github.com/mebibou/cordova-plugin-backlight', 31 | platforms: ['Android'], 32 | }) 33 | @Injectable() 34 | export class Backlight extends IonicNativePlugin { 35 | /** 36 | * This function turns backlight on 37 | * @return {Promise} Returns a promise that resolves when the backlight is on 38 | */ 39 | @Cordova() 40 | on(): Promise { 41 | return; 42 | } 43 | 44 | /** 45 | * This function turns backlight off 46 | * @return {Promise} Returns a promise that resolves when the backlight is off 47 | */ 48 | @Cordova() 49 | off(): Promise { 50 | return; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/base64-to-gallery/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface Base64ToGalleryOptions { 5 | /** Saved file name prefix */ 6 | prefix: string; 7 | /** 8 | * On Android runs Media Scanner after file creation. 9 | * On iOS if true the file will be added to camera roll, otherwise will be saved to a library folder. 10 | */ 11 | mediaScanner: boolean; 12 | } 13 | 14 | /** 15 | * @name Base64 To Gallery 16 | * @description This plugin allows you to save base64 data as a png image into the device 17 | * @usage 18 | * ```typescript 19 | * import { Base64ToGallery } from '@ionic-native/base64-to-gallery/ngx'; 20 | * 21 | * constructor(private base64ToGallery: Base64ToGallery) { } 22 | * 23 | * 24 | * ... 25 | * 26 | * 27 | * this.base64ToGallery.base64ToGallery(base64Data, { prefix: '_img' }).then( 28 | * res => console.log('Saved image to gallery ', res), 29 | * err => console.log('Error saving image to gallery ', err) 30 | * ); 31 | * ``` 32 | * @interfaces 33 | * Base64ToGalleryOptions 34 | */ 35 | @Plugin({ 36 | pluginName: 'Base64ToGallery', 37 | plugin: 'cordova-base64-to-gallery', 38 | pluginRef: 'cordova', 39 | repo: 'https://github.com/Nexxa/cordova-base64-to-gallery', 40 | platforms: ['Android', 'iOS', 'Windows Phone 8'], 41 | }) 42 | @Injectable() 43 | export class Base64ToGallery extends IonicNativePlugin { 44 | /** 45 | * Converts a base64 string to an image file in the device gallery 46 | * @param {string} data The actual base64 string that you want to save 47 | * @param {any} [options] An object with properties 48 | * @returns {Promise} returns a promise that resolves when the image is saved. 49 | */ 50 | @Cordova({ 51 | successIndex: 2, 52 | errorIndex: 3, 53 | }) 54 | base64ToGallery(data: string, options?: Base64ToGalleryOptions): Promise { 55 | return; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/base64/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @beta 6 | * @name Base64 7 | * @description 8 | * This Plugin is used to encode base64 of any file, it uses js code for iOS, but in case of android it uses native code to handle android versions lower than v.3 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { Base64 } from '@ionic-native/base64/ngx'; 13 | * 14 | * constructor(private base64: Base64) { } 15 | * 16 | * ... 17 | * 18 | * let filePath: string = 'file:///...'; 19 | * this.base64.encodeFile(filePath).then((base64File: string) => { 20 | * console.log(base64File); 21 | * }, (err) => { 22 | * console.log(err); 23 | * }); 24 | * 25 | * ``` 26 | */ 27 | @Plugin({ 28 | pluginName: 'Base64', 29 | plugin: 'com-badrit-base64', 30 | pluginRef: 'plugins.Base64', 31 | repo: 'https://github.com/hazemhagrass/phonegap-base64', 32 | platforms: ['Android', 'iOS'], 33 | }) 34 | @Injectable() 35 | export class Base64 extends IonicNativePlugin { 36 | /** 37 | * This function encodes base64 of any file 38 | * @param {string} filePath Absolute file path 39 | * @return {Promise} Returns a promise that resolves when the file is successfully encoded 40 | */ 41 | @Cordova() 42 | encodeFile(filePath: string): Promise { 43 | return; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/biometric-wrapper/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name BiometricWrapper 6 | * @description 7 | * This plugin capture biometric(Iris and Fingerprint) and validate the user. 8 | * May be used in Banking domain 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { BiometricWrapper } from '@ionic-native/biometric-wrapper/ngx'; 13 | * 14 | * 15 | * constructor(private biometricWrapper: BiometricWrapper) { } 16 | * 17 | * ... 18 | * 19 | * 20 | * this.biometricWrapper.activateIris({'PID_XML': ''}) 21 | * .then((res: any) => ) 22 | * .catch((error: any) => ); 23 | * 24 | * ``` 25 | */ 26 | 27 | @Plugin({ 28 | pluginName: 'BiometricWrapper', 29 | plugin: 'cordova-plugin-biometric', 30 | pluginRef: 'cordova.plugins.BiometricWrapper', 31 | repo: '', 32 | install: '', 33 | installVariables: [], 34 | platforms: ['Android'], 35 | }) 36 | @Injectable() 37 | export class BiometricWrapper extends IonicNativePlugin { 38 | /** 39 | * This function activate iris activity 40 | * @return {Promise} Returns a promise that resolves when iris data captured 41 | */ 42 | @Cordova() 43 | activateIris(args: any): Promise { 44 | return; 45 | } 46 | 47 | /** 48 | * This function activate fingerprint activity 49 | * @return {Promise} Returns a promise that resolves when FP data captured 50 | */ 51 | @Cordova() 52 | activateFingerprint(args: any): Promise { 53 | return; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/brightness/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Brightness 6 | * @description 7 | * The Brightness plugin let you control the display brightness of your device. 8 | * 9 | * Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness). 10 | * 11 | * @usage 12 | * ```typescript 13 | * import { Brightness } from '@ionic-native/brightness/ngx'; 14 | * 15 | * constructor(private brightness: Brightness) { } 16 | * 17 | * ... 18 | * 19 | * let brightnessValue = 0.8; 20 | * this.brightness.setBrightness(brightnessValue); 21 | * ``` 22 | * 23 | */ 24 | @Plugin({ 25 | pluginName: 'Brightness', 26 | plugin: 'cordova-plugin-brightness', 27 | pluginRef: 'cordova.plugins.brightness', 28 | repo: 'https://github.com/mgcrea/cordova-plugin-brightness', 29 | platforms: ['Android', 'iOS'], 30 | }) 31 | @Injectable() 32 | export class Brightness extends IonicNativePlugin { 33 | /** 34 | * Sets the brightness of the display. 35 | * 36 | * @param {number} value Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness. 37 | * @returns {Promise} Returns a Promise that resolves if setting brightness was successful. 38 | */ 39 | @Cordova() 40 | setBrightness(value: number): Promise { 41 | return; 42 | } 43 | 44 | /** 45 | * Reads the current brightness of the device display. 46 | * 47 | * @returns {Promise} Returns a Promise that resolves with the 48 | * brightness value of the device display (floating number between 0 and 1). 49 | */ 50 | @Cordova() 51 | getBrightness(): Promise { 52 | return; 53 | } 54 | 55 | /** 56 | * Keeps the screen on. Prevents the device from setting the screen to sleep. 57 | * @param {boolean} value 58 | */ 59 | @Cordova() 60 | setKeepScreenOn(value: boolean): void {} 61 | } 62 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/browser-tab/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Browser Tab 6 | * @description 7 | * This plugin provides an interface to in-app browser tabs that exist on some mobile platforms, specifically [Custom Tabs](http://developer.android.com/tools/support-library/features.html#custom-tabs) on Android (including the [Chrome Custom Tabs](https://developer.chrome.com/multidevice/android/customtabs) implementation), and [SFSafariViewController](https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/) on iOS. 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { BrowserTab } from '@ionic-native/browser-tab/ngx'; 12 | * 13 | * constructor(private browserTab: BrowserTab) { 14 | * 15 | * browserTab.isAvailable() 16 | * .then(isAvailable => { 17 | * if (isAvailable) { 18 | * browserTab.openUrl('https://ionic.io'); 19 | * } else { 20 | * // open URL with InAppBrowser instead or SafariViewController 21 | * } 22 | * }); 23 | * } 24 | * 25 | * ``` 26 | */ 27 | @Plugin({ 28 | pluginName: 'BrowserTab', 29 | plugin: 'cordova-plugin-browsertab', 30 | pluginRef: 'cordova.plugins.browsertab', 31 | repo: 'https://github.com/google/cordova-plugin-browsertab', 32 | platforms: ['Android', 'iOS'], 33 | }) 34 | @Injectable() 35 | export class BrowserTab extends IonicNativePlugin { 36 | /** 37 | * Check if BrowserTab option is available 38 | * @return {Promise} Returns a promise that resolves when check is successful and returns true or false 39 | */ 40 | @Cordova() 41 | isAvailable(): Promise { 42 | return; 43 | } 44 | 45 | /** 46 | * Opens the provided URL using a browser tab 47 | * @param {string} url The URL you want to open 48 | * @return {Promise} Returns a promise that resolves when check open was successful 49 | */ 50 | @Cordova() 51 | openUrl(url: string): Promise { 52 | return; 53 | } 54 | 55 | /** 56 | * Closes browser tab 57 | * @return {Promise} Returns a promise that resolves when close was finished 58 | */ 59 | @Cordova() 60 | close(): Promise { 61 | return; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/call-log/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface CallLogObject { 5 | name: string; 6 | value: string | string[]; 7 | operator: '==' | '!=' | '>' | '>=' | '<' | '<=' | 'like'; 8 | } 9 | 10 | /** 11 | * @name Call Log 12 | * @description 13 | * This plugin access the call history on a device and that can be filtered 14 | * 15 | * @usage 16 | * ```typescript 17 | * import { CallLog } from '@ionic-native/call-log/ngx'; 18 | * 19 | * 20 | * constructor(private callLog: CallLog) { } 21 | * 22 | * ```` 23 | * @interfaces 24 | * CallLogObject 25 | * 26 | */ 27 | @Plugin({ 28 | pluginName: 'CallLog', 29 | plugin: 'cordova-plugin-calllog', 30 | pluginRef: 'plugins.callLog', 31 | repo: 'https://github.com/creacore-team/cordova-plugin-calllog', 32 | platforms: ['Android'], 33 | }) 34 | @Injectable() 35 | export class CallLog extends IonicNativePlugin { 36 | /** 37 | * This function return the call logs 38 | * @param {CallLogObject[]} filters array of object to filter the query 39 | * @return {Promise} 40 | */ 41 | @Cordova() 42 | getCallLog(filters: CallLogObject[]): Promise { 43 | return; 44 | } 45 | 46 | /** 47 | * Check permission 48 | * @returns {Promise} 49 | */ 50 | @Cordova({ 51 | platforms: ['Android'], 52 | }) 53 | hasReadPermission(): Promise { 54 | return; 55 | } 56 | 57 | /** 58 | * Request permission 59 | * @returns {Promise} 60 | */ 61 | @Cordova({ 62 | platforms: ['Android'], 63 | }) 64 | requestReadPermission(): Promise { 65 | return; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/call-number/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Call Number 6 | * @description 7 | * Call a number directly from your Cordova/Ionic application. 8 | * **NOTE**: The iOS Simulator (and maybe Android Simulators) do not provide access to the phone subsystem. 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { CallNumber } from '@ionic-native/call-number/ngx'; 13 | * 14 | * constructor(private callNumber: CallNumber) { } 15 | * 16 | * ... 17 | * 18 | * 19 | * this.callNumber.callNumber("18001010101", true) 20 | * .then(res => console.log('Launched dialer!', res)) 21 | * .catch(err => console.log('Error launching dialer', err)); 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'CallNumber', 27 | plugin: 'call-number', 28 | pluginRef: 'plugins.CallNumber', 29 | repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin', 30 | platforms: ['Android', 'iOS'], 31 | }) 32 | @Injectable() 33 | export class CallNumber extends IonicNativePlugin { 34 | /** 35 | * Calls a phone number 36 | * @param {string} numberToCall The phone number to call as a string 37 | * @param {boolean} bypassAppChooser Set to true to bypass the app chooser and go directly to dialer 38 | * @return {Promise} 39 | */ 40 | @Cordova({ 41 | callbackOrder: 'reverse', 42 | }) 43 | callNumber(numberToCall: string, bypassAppChooser: boolean): Promise { 44 | return; 45 | } 46 | 47 | /** 48 | * Check if call feature is available 49 | * @return {Promise} 50 | */ 51 | @Cordova() 52 | isCallSupported(): Promise { 53 | return; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/chooser/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface ChooserResult { 5 | data?: Uint8Array; 6 | dataURI?: string; 7 | mediaType: string; 8 | name: string; 9 | uri: string; 10 | } 11 | 12 | /** 13 | * @name Chooser 14 | * @description 15 | * File chooser plugin for Cordova. 16 | * 17 | * The following must be added to config.xml to prevent crashing when selecting large files on Android: 18 | * ```xml 19 | * 20 | * 24 | * 25 | * 26 | * 27 | * ``` 28 | * 29 | * @usage 30 | * ```typescript 31 | * import { Chooser } from '@ionic-native/chooser/ngx'; 32 | * 33 | * 34 | * constructor(private chooser: Chooser) { } 35 | * 36 | * ... 37 | * 38 | * 39 | * this.chooser.getFile() 40 | * .then(file => console.log(file ? file.name : 'canceled')) 41 | * .catch((error: any) => console.error(error)); 42 | * 43 | * ``` 44 | * 45 | * @interfaces 46 | * ChooserResult 47 | */ 48 | @Plugin({ 49 | pluginName: 'Chooser', 50 | plugin: 'cordova-plugin-chooser', 51 | pluginRef: 'chooser', 52 | repo: 'https://github.com/cyph/cordova-plugin-chooser', 53 | platforms: ['Android', 'iOS'], 54 | }) 55 | @Injectable() 56 | export class Chooser extends IonicNativePlugin { 57 | /** 58 | * Displays native prompt for user to select a file. 59 | * @param {string} [accept] Optional MIME type filter (e.g. 'image/gif,video/*'). 60 | * @return {Promise} Promise containing selected file's raw binary data, 61 | * base64-encoded data: URI, MIME type, display name, and original URI. 62 | */ 63 | @Cordova() 64 | getFile(accept?: string): Promise { 65 | return; 66 | } 67 | /** 68 | * Displays native prompt for user to select a file. 69 | * @param {string} [accept] Optional MIME type filter (e.g. 'image/gif,video/*'). 70 | * @returns {Promise} Promise containing selected file's MIME type, display name, and original URI. 71 | * If user cancels, promise will be resolved as undefined. 72 | * If error occurs, promise will be rejected. 73 | */ 74 | @Cordova() 75 | getFileMetadata(accept?: string): Promise { 76 | return; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/clipboard/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | /** 4 | * @name Clipboard 5 | * @premier clipboard 6 | * @description 7 | * Clipboard management plugin for Cordova that supports iOS, Android, and Windows Phone 8. 8 | * 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { Clipboard } from '@ionic-native/clipboard/ngx'; 13 | * 14 | * constructor(private clipboard: Clipboard) { } 15 | * 16 | * ... 17 | * 18 | * 19 | * this.clipboard.copy('Hello world'); 20 | * 21 | * this.clipboard.paste().then( 22 | * (resolve: string) => { 23 | * alert(resolve); 24 | * }, 25 | * (reject: string) => { 26 | * alert('Error: ' + reject); 27 | * } 28 | * ); 29 | * 30 | * this.clipboard.clear(); 31 | * ``` 32 | */ 33 | @Plugin({ 34 | pluginName: 'Clipboard', 35 | plugin: 'cordova-clipboard', 36 | pluginRef: 'cordova.plugins.clipboard', 37 | repo: 'https://github.com/ihadeed/cordova-clipboard', 38 | platforms: ['Android', 'iOS', 'Windows Phone 8'], 39 | }) 40 | @Injectable() 41 | export class Clipboard extends IonicNativePlugin { 42 | /** 43 | * Copies the given text 44 | * @param {string} text Text that gets copied on the system clipboard 45 | * @returns {Promise} Returns a promise after the text has been copied 46 | */ 47 | @Cordova() 48 | copy(text: string): Promise { 49 | return; 50 | } 51 | 52 | /** 53 | * Pastes the text stored in clipboard 54 | * @returns {Promise} Returns a promise after the text has been pasted 55 | */ 56 | @Cordova() 57 | paste(): Promise { 58 | return; 59 | } 60 | 61 | /** 62 | * Clear the text stored in clipboard 63 | * @returns {Promise} Returns a promise after the text has been cleaned 64 | */ 65 | @Cordova() 66 | clear(): Promise { 67 | return; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/colored-browser-tabs/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | import { Observable } from 'rxjs'; 4 | 5 | /** 6 | * @name Colored Browser Tabs 7 | * @description 8 | * This plugin opens Chrome Custom Tabs on Android or SafariViewController on iOS 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { ColoredBrowserTabs } from '@ionic-native/colored-browser-tabs/ngx'; 13 | * 14 | * 15 | * constructor(private browserTabs: ColoredBrowserTabs) { } 16 | * 17 | * ... 18 | * 19 | * 20 | * this.browserTabs.openTab('www.example.url', '#ffffff') 21 | * .subscribe() 22 | * 23 | * this.browserTabs.openTabWithAnimation('www.example.url', 'slide_x', '#ffffff') 24 | * .subscribe() 25 | * 26 | * ``` 27 | */ 28 | @Plugin({ 29 | pluginName: 'ColoredBrowserTabs', 30 | plugin: 'cordova-plugin-colored-browser-tabs', 31 | pluginRef: 'ColoredBrowserTabs', 32 | repo: 'https://github.com/TobyEb/cordova-plugin-colored-browser-tabs', 33 | platforms: ['Android', 'iOS'], 34 | }) 35 | @Injectable() 36 | export class ColoredBrowserTabs extends IonicNativePlugin { 37 | /** 38 | * Call this method to open the tab 39 | * @param url - the url you want to open 40 | * @param color - the color with which you want to define the toolbar color 41 | * @return {Observable} Returns a Observable that resolves when something happens 42 | */ 43 | @Cordova({ observable: true, successIndex: 2, errorIndex: 3 }) 44 | openTab(url: string, color?: string): Observable { 45 | return; 46 | } 47 | /** 48 | * Call this method to open the tab 49 | * @param url - the url you want to open 50 | * @param anim - the animation you want for enter and exit, you can choose between slide_x / slide_y and fade 51 | * only works in Android, iOS just shows the default animation 52 | * @param color - the color with which you want to define the toolbar color 53 | * @return {Observable} Returns a Observable that resolves when something happens 54 | */ 55 | @Cordova({ observable: true, successIndex: 3, errorIndex: 4 }) 56 | openTabWithAnimation(url: string, anim: string, color?: string): Observable { 57 | return; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/crop/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface CropOptions { 5 | quality?: number; 6 | targetHeight?: number; 7 | targetWidth?: number; 8 | } 9 | 10 | /** 11 | * @name Crop 12 | * @description Crops images 13 | * @usage 14 | * ```typescript 15 | * import { Crop } from '@ionic-native/crop/ngx'; 16 | * 17 | * constructor(private crop: Crop) { } 18 | * 19 | * ... 20 | * 21 | * this.crop.crop('path/to/image.jpg', {quality: 75}) 22 | * .then( 23 | * newImage => console.log('new image path is: ' + newImage), 24 | * error => console.error('Error cropping image', error) 25 | * ); 26 | * ``` 27 | * @interfaces 28 | * CropOptions 29 | */ 30 | @Plugin({ 31 | pluginName: 'Crop', 32 | plugin: 'cordova-plugin-crop', 33 | pluginRef: 'plugins', 34 | repo: 'https://github.com/jeduan/cordova-plugin-crop', 35 | platforms: ['Android', 'iOS'], 36 | }) 37 | @Injectable() 38 | export class Crop extends IonicNativePlugin { 39 | /** 40 | * Crops an image 41 | * @param {string} pathToImage 42 | * @param {CropOptions} [options] 43 | * @returns {Promise} Returns a promise that resolves with the new image path, or rejects if failed to crop. 44 | */ 45 | @Cordova({ 46 | callbackOrder: 'reverse', 47 | }) 48 | crop(pathToImage: string, options?: CropOptions): Promise { 49 | return; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/db-meter/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | import { Observable } from 'rxjs'; 4 | 5 | /** 6 | * @name DB Meter 7 | * @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone. 8 | * @usage 9 | * ```typescript 10 | * import { DBMeter } from '@ionic-native/db-meter/ngx'; 11 | * 12 | * constructor(private dbMeter: DBMeter) { } 13 | * 14 | * ... 15 | * 16 | * 17 | * // Start listening 18 | * let subscription = this.dbMeter.start().subscribe( 19 | * data => console.log(data) 20 | * ); 21 | * 22 | * // Check if we are listening 23 | * this.dbMeter.isListening().then( 24 | * isListening => console.log(isListening) 25 | * ); 26 | * 27 | * // Stop listening 28 | * subscription.unsubscribe(); 29 | * 30 | * // Delete DBMeter instance from memory 31 | * this.dbMeter.delete().then( 32 | * () => console.log('Deleted DB Meter instance'), 33 | * error => console.log('Error occurred while deleting DB Meter instance') 34 | * ); 35 | * ``` 36 | */ 37 | @Plugin({ 38 | pluginName: 'DBMeter', 39 | plugin: 'cordova-plugin-dbmeter', 40 | pluginRef: 'DBMeter', 41 | repo: 'https://github.com/akofman/cordova-plugin-dbmeter', 42 | platforms: ['Android', 'iOS'], 43 | }) 44 | @Injectable() 45 | export class DBMeter extends IonicNativePlugin { 46 | /** 47 | * Starts listening 48 | * @returns {Observable} Returns an observable. Subscribe to start listening. Unsubscribe to stop listening. 49 | */ 50 | @Cordova({ 51 | observable: true, 52 | clearFunction: 'stop', 53 | }) 54 | start(): Observable { 55 | return; 56 | } 57 | 58 | /** 59 | * Stops listening 60 | * @hidden 61 | */ 62 | @Cordova() 63 | stop(): Promise { 64 | return; 65 | } 66 | 67 | /** 68 | * Check if the DB Meter is listening 69 | * @returns {Promise} Returns a promise that resolves with a boolean that tells us whether the DB meter is listening 70 | */ 71 | @Cordova() 72 | isListening(): Promise { 73 | return; 74 | } 75 | 76 | /** 77 | * Delete the DB Meter instance 78 | * @returns {Promise} Returns a promise that will resolve if the instance has been deleted, and rejects if errors occur. 79 | */ 80 | @Cordova() 81 | delete(): Promise { 82 | return; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/device-feedback/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface DeviceFeedbackStatus { 5 | /** Haptic Feedback */ 6 | haptic: boolean; 7 | 8 | /** Acoustic Feedback */ 9 | acoustic: boolean; 10 | } 11 | 12 | /** 13 | * @name Device Feedback 14 | * @premier vibration 15 | * @description 16 | * 17 | * Plugin that lets you provide haptic or acoustic feedback on Android devices. 18 | * 19 | * @usage 20 | * ```typescript 21 | * import { DeviceFeedback } from '@ionic-native/device-feedback/ngx'; 22 | * 23 | * constructor(private deviceFeedback: DeviceFeedback) { } 24 | * 25 | * ... 26 | * 27 | * 28 | * this.deviceFeedback.acoustic(); 29 | * 30 | * this.deviceFeedback.haptic(0); 31 | * 32 | * this.deviceFeedback.isFeedbackEnabled().then(feedback => { 33 | * console.log(feedback); 34 | * // { 35 | * // acoustic: true, 36 | * // haptic: true 37 | * // } 38 | * }); 39 | * 40 | * ``` 41 | * @innterfaces 42 | * DeviceFeedbackEnabled 43 | */ 44 | @Plugin({ 45 | pluginName: 'DeviceFeedback', 46 | plugin: 'cordova-plugin-velda-devicefeedback', 47 | pluginRef: 'plugins.deviceFeedback', 48 | repo: 'https://github.com/VVelda/device-feedback', 49 | platforms: ['Android'], 50 | }) 51 | @Injectable() 52 | export class DeviceFeedback extends IonicNativePlugin { 53 | /** 54 | * Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do. 55 | */ 56 | @Cordova({ sync: true }) 57 | acoustic(): void {} 58 | 59 | /** 60 | * Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do. 61 | * @param {number} type Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap. 62 | */ 63 | @Cordova({ sync: true }) 64 | haptic(type: number): void {} 65 | 66 | /** 67 | * Check if haptic and acoustic feedback is enabled by user settings. 68 | * @returns {Promise} 69 | */ 70 | @Cordova() 71 | isFeedbackEnabled(): Promise { 72 | return; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/device/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | declare const window: any; 5 | 6 | /** 7 | * @name Device 8 | * @premier device 9 | * @description 10 | * Access information about the underlying device and platform. 11 | * 12 | * @usage 13 | * ```typescript 14 | * import { Device } from '@ionic-native/device/ngx'; 15 | * 16 | * constructor(private device: Device) { } 17 | * 18 | * ... 19 | * 20 | * console.log('Device UUID is: ' + this.device.uuid); 21 | * ``` 22 | */ 23 | @Plugin({ 24 | pluginName: 'Device', 25 | plugin: 'cordova-plugin-device', 26 | pluginRef: 'device', 27 | repo: 'https://github.com/apache/cordova-plugin-device', 28 | platforms: ['Android', 'Browser', 'iOS', 'macOS', 'Windows'], 29 | }) 30 | @Injectable() 31 | export class Device extends IonicNativePlugin { 32 | /** Get the version of Cordova running on the device. */ 33 | @CordovaProperty() 34 | cordova: string; 35 | 36 | /** 37 | * The device.model returns the name of the device's model or product. The value is set 38 | * by the device manufacturer and may be different across versions of the same product. 39 | */ 40 | @CordovaProperty() 41 | model: string; 42 | 43 | /** Get the device's operating system name. */ 44 | @CordovaProperty() 45 | platform: string; 46 | 47 | /** Get the device's Universally Unique Identifier (UUID). */ 48 | @CordovaProperty() 49 | uuid: string; 50 | 51 | /** Get the operating system version. */ 52 | @CordovaProperty() 53 | version: string; 54 | 55 | /** Get the device's manufacturer. */ 56 | @CordovaProperty() 57 | manufacturer: string; 58 | 59 | /** Whether the device is running on a simulator. */ 60 | @CordovaProperty() 61 | isVirtual: boolean; 62 | 63 | /** Get the device hardware serial number. */ 64 | @CordovaProperty() 65 | serial: string; 66 | } 67 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/dns/index.ts: -------------------------------------------------------------------------------- 1 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 2 | import { Injectable } from '@angular/core'; 3 | 4 | /** 5 | * @name DNS 6 | * @description A plugin for Apache Cordova that enables applications to manually resolve hostnames into an underlying network address. This is mostly useful for determining whether there is a problem with the device's DNS server configuration. 7 | * 8 | * @usage 9 | * ```typescript 10 | * import { DNS } from '@ionic-native/dns/ngx'; 11 | * 12 | * 13 | * constructor(private dns: DNS) { } 14 | * 15 | * ... 16 | * this.dns.resolve(hostname) 17 | * .then( 18 | * address => console.log('Resolved ' + hostname + ' to ' + address), 19 | * error => console.log('Failed to resolve ' + hostname + ': ' + error) 20 | * ); 21 | * 22 | * ``` 23 | */ 24 | @Plugin({ 25 | pluginName: 'DNS', 26 | plugin: 'cordova-plugin-dns', 27 | pluginRef: 'cordova.plugins.dns', 28 | repo: 'https://bitbucket.org/zegeba/cordova-plugin-dns', 29 | platforms: ['Android'], 30 | }) 31 | @Injectable() 32 | export class DNS extends IonicNativePlugin { 33 | /** 34 | * Resolve hostnames into an underlying network address. 35 | * @param hostname 36 | * @returns {Promise} Returns a promise that resolves with the resolution. 37 | */ 38 | @Cordova() 39 | resolve(hostname: string): Promise { 40 | return; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/document-picker/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name iOS DocumentPicker 6 | * @description 7 | * 8 | * Opens the file picker on iOS for the user to select a file, returns a file URI. 9 | * Allows the user to upload files from iCloud 10 | * 11 | * @usage 12 | * ```typescript 13 | * import { DocumentPicker } from '@ionic-native/document-picker/ngx'; 14 | * 15 | * constructor(private docPicker: DocumentPicker) { } 16 | * 17 | * ... 18 | * 19 | * this.docPicker.getFile('all') 20 | * .then(uri => console.log(uri)) 21 | * .catch(e => console.log(e)); 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'IOSDocumentPicker', 27 | plugin: 'cordova-plugin-documentpicker.DocumentPicker', 28 | pluginRef: 'DocumentPicker', 29 | repo: 'https://github.com/iampossible/Cordova-DocPicker', 30 | platforms: ['iOS'], 31 | }) 32 | @Injectable() 33 | export class DocumentPicker extends IonicNativePlugin { 34 | /** 35 | * Open a file 36 | * @param {string} [option] files between 'image', 'pdf' or 'all' 37 | * @returns {Promise} 38 | */ 39 | @Cordova() 40 | getFile(option?: string): Promise { 41 | return; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/emm-app-config/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | import { Observable } from 'rxjs'; 4 | 5 | /** 6 | * @name Emm App Config 7 | * @description 8 | * This plugin provides information on EMM application configuration 9 | * 10 | * Requires the Cordova plugin: `cordova-plugin-emm-app-config`. For more info, please see the [Cordova EMM App Config Plugin Docs](https://github.com/oracle/cordova-plugin-emm-app-config). 11 | * 12 | * 13 | * @usage 14 | * ```typescript 15 | * import { EmmAppConfig } from '@ionic-native/emm-app-config/ngx'; 16 | * 17 | * 18 | * constructor(private readonly emmAppConfig: EmmAppConfig) { } 19 | * 20 | * ... 21 | * 22 | * // Get all the values of the emm app configuration 23 | * const values = this.emmAppConfig.getValue(); 24 | * 25 | * // Get specific value of the emm app configuration 26 | * const value = this.emmAppConfig.getValue('serverUrl'); 27 | * 28 | * // Get an event every time the emm app config changes 29 | * this.emmAppConfig.registerChangedListener() 30 | * .subscribe(() => console.log('App config changes')); 31 | * 32 | * ``` 33 | */ 34 | @Plugin({ 35 | platforms: ['Android', 'iOS'], 36 | plugin: 'cordova-plugin-emm-app-config', 37 | pluginName: 'EmmAppConfig', 38 | pluginRef: 'cordova.plugins.EmmAppConfig', 39 | repo: 'https://github.com/oracle/cordova-plugin-emm-app-config', 40 | }) 41 | @Injectable() 42 | export class EmmAppConfig extends IonicNativePlugin { 43 | /** 44 | * Get value from the Emm application configuration. 45 | * @param configKey {string} Key of the value to get, or null to get all the values as an object. 46 | * @return {any} Returns configuration on an object 47 | */ 48 | @Cordova({ sync: true }) getValue(configKey?: string): any { 49 | return; 50 | } 51 | 52 | /** 53 | * Register a listener that will be invoked when the application configuration is changed. 54 | * @return {void} 55 | */ 56 | @Cordova({ observable: true }) registerChangedListener(): Observable { 57 | return; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/extended-device-information/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Extended Device Information 6 | * @description 7 | * Retrieves additional device information from the Device Hardware 8 | * - memory 9 | * - cpumhz 10 | * - totalstorage 11 | * - freestorage 12 | * 13 | * @usage 14 | * ```typescript 15 | * import { ExtendedDeviceInformation } from '@ionic-native/extended-device-information/ngx'; 16 | * 17 | * 18 | * constructor(private extendedDeviceInformation: ExtendedDeviceInformation) { } 19 | * 20 | * ... 21 | * 22 | * console.log('The Memory is: ' + this.extendedDeviceInformation.memory); 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'ExtendedDeviceInformation', 27 | plugin: 'cordova-plugin-extended-device-information', 28 | pluginRef: 'extended-device-information', 29 | repo: 'https://github.com/danielehrhardt/cordova-plugin-extended-device-information', 30 | platforms: ['Android'], 31 | }) 32 | @Injectable() 33 | export class ExtendedDeviceInformation extends IonicNativePlugin { 34 | /** 35 | * Get the device's memory size 36 | */ 37 | @CordovaProperty() 38 | memory: number; 39 | 40 | /** 41 | * Get the device's CPU mhz 42 | */ 43 | @CordovaProperty() 44 | cpumhz: string; 45 | 46 | /** 47 | * Get the total storage 48 | */ 49 | @CordovaProperty() 50 | totalstorage: string; 51 | 52 | /** 53 | * Get the total storage 54 | */ 55 | @CordovaProperty() 56 | freestorage: number; 57 | } 58 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/file-chooser/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface FileChooserOptions { 5 | /** 6 | * comma seperated mime types to filter files. 7 | */ 8 | mime: string; 9 | } 10 | 11 | /** 12 | * @name File Chooser 13 | * @description 14 | * 15 | * Opens the file picker on Android for the user to select a file, returns a file URI. 16 | * 17 | * @usage 18 | * ```typescript 19 | * import { FileChooser } from '@ionic-native/file-chooser/ngx'; 20 | * 21 | * constructor(private fileChooser: FileChooser) { } 22 | * 23 | * ... 24 | * 25 | * this.fileChooser.open() 26 | * .then(uri => console.log(uri)) 27 | * .catch(e => console.log(e)); 28 | * 29 | * ``` 30 | * @interfaces 31 | * FileChooserOptions 32 | */ 33 | @Plugin({ 34 | pluginName: 'FileChooser', 35 | plugin: 'cordova-plugin-filechooser', 36 | pluginRef: 'fileChooser', 37 | repo: 'https://github.com/ihadeed/cordova-filechooser', 38 | platforms: ['Android'], 39 | }) 40 | @Injectable() 41 | export class FileChooser extends IonicNativePlugin { 42 | /** 43 | * Open a file 44 | * @param {FileChooserOptions} [options] Optional parameter, defaults to ''. Filters the file selection list according to mime types 45 | * @returns {Promise} 46 | */ 47 | @Cordova() 48 | open(options?: FileChooserOptions): Promise { 49 | return; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/file-encryption/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name File Encryption 6 | * @description 7 | * Simple file encryption for Cordova. 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { FileEncryption } from '@ionic-native/file-encryption/ngx'; 12 | * 13 | * 14 | * constructor(private fileEncryption: FileEncryption) { } 15 | * 16 | * ... 17 | * 18 | * this.fileEncryption.decrypt('assets/json/topSecret.json', 'secretKey'); 19 | * 20 | * this.fileEncryption.encrypt('assets/json/topSecret.json', 'secretKey'); 21 | * 22 | * ``` 23 | */ 24 | @Plugin({ 25 | pluginName: 'FileEncryption', 26 | plugin: 'cordova-safe', 27 | pluginRef: 'cordova.plugins.disusered', 28 | repo: 'https://github.com/disusered/cordova-safe', 29 | platforms: ['Android', 'iOS'], 30 | }) 31 | @Injectable() 32 | export class FileEncryption extends IonicNativePlugin { 33 | /** 34 | * Encrypt a file 35 | * @param {string} file A string representing a local URI 36 | * @param {string} key A key for the crypto operations 37 | * @return {Promise} Returns a promise that resolves when something happens 38 | */ 39 | @Cordova() 40 | encrypt(file: string, key: string): Promise { 41 | return; 42 | } 43 | 44 | /** 45 | * Decrypt a file 46 | * @param {string} file A string representing a local URI 47 | * @param {string} key A key for the crypto operations 48 | * @return {Promise} Returns a promise that resolves when something happens 49 | */ 50 | @Cordova() 51 | decrypt(file: string, key: string): Promise { 52 | return; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/file-path/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | declare const window: any; 5 | 6 | /** 7 | * @name File Path 8 | * @premier filesystem 9 | * @description 10 | * 11 | * This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the aFileChooser library. 12 | * 13 | * @usage 14 | * ```typescript 15 | * import { FilePath } from '@ionic-native/file-path/ngx'; 16 | * 17 | * constructor(private filePath: FilePath) { } 18 | * 19 | * ... 20 | * 21 | * this.filePath.resolveNativePath(path) 22 | * .then(filePath => console.log(filePath)) 23 | * .catch(err => console.log(err)); 24 | * 25 | * ``` 26 | */ 27 | @Plugin({ 28 | pluginName: 'FilePath', 29 | plugin: 'cordova-plugin-filepath', 30 | pluginRef: 'window.FilePath', 31 | repo: 'https://github.com/hiddentao/cordova-plugin-filepath', 32 | platforms: ['Android'], 33 | }) 34 | @Injectable() 35 | export class FilePath extends IonicNativePlugin { 36 | /** 37 | * Resolve native path for given content URL/path. 38 | * @param {string} path Content URL/path. 39 | * @returns {Promise} 40 | */ 41 | @Cordova() 42 | resolveNativePath(path: string): Promise { 43 | return; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/file-picker/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface IOSFilePickerPosition { 5 | x: number; 6 | y: number; 7 | width: number; 8 | height: number; 9 | } 10 | 11 | /** 12 | * @name iOS File Picker 13 | * @description 14 | * 15 | * Opens the file picker on iOS for the user to select a file, returns a file URI. 16 | * 17 | * @usage 18 | * ```typescript 19 | * import { IOSFilePicker } from '@ionic-native/file-picker/ngx'; 20 | * 21 | * constructor(private filePicker: IOSFilePicker) { } 22 | * 23 | * ... 24 | * 25 | * this.filePicker.pickFile() 26 | * .then(uri => console.log(uri)) 27 | * .catch(err => console.log('Error', err)); 28 | * 29 | * ``` 30 | * @interfaces 31 | * IOSFilePickerPosition 32 | */ 33 | @Plugin({ 34 | pluginName: 'iOS File Picker', 35 | plugin: 'cordova-plugin-filepicker', 36 | pluginRef: 'FilePicker', 37 | repo: 'https://github.com/jcesarmobile/FilePicker-Phonegap-iOS-Plugin', 38 | platforms: ['iOS'], 39 | }) 40 | @Injectable() 41 | export class IOSFilePicker extends IonicNativePlugin { 42 | /** 43 | * Open a file 44 | * @params {string | string[]} [utis] 45 | * @params {IOSFilePickerPosition} [position] Set the position of the rectangle where the file picker should show up. 46 | * @returns {Promise} 47 | */ 48 | @Cordova({ 49 | callbackOrder: 'reverse', 50 | }) 51 | pickFile(utis?: string | string[], position?: IOSFilePickerPosition): Promise { 52 | return; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/firebase-crash/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name FirebaseCrash 6 | * @description 7 | * This plugin brings crash reporting from Google Firebase to your Cordova project! Android and iOS supported. 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { FirebaseCrash } from '@ionic-native/firebase-crash'; 12 | * 13 | * constructor(private firebaseCrash: FirebaseCrash) { } 14 | * 15 | * ... 16 | * 17 | * this.firebaseCrash.setUserId('123456789'); 18 | * this.firebaseCrash.log('message'); 19 | * this.firebaseCrash.logError('non fatal exception'); 20 | * 21 | * ``` 22 | */ 23 | @Plugin({ 24 | pluginName: 'FirebaseCrash', 25 | plugin: 'cordova-plugin-firebase-crash', 26 | pluginRef: 'cordova.plugins.firebase.crashlytics', 27 | repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-crash', 28 | platforms: ['Android', 'iOS'], 29 | }) 30 | @Injectable() 31 | export class FirebaseCrash extends IonicNativePlugin { 32 | /** 33 | * Add logging that will be sent with your crash data in case of app crash. 34 | * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#add_custom_logs 35 | * @param {string} message 36 | * @return {Promise} 37 | */ 38 | @Cordova({ sync: true }) 39 | log(message: string): Promise { 40 | return; 41 | } 42 | 43 | /** 44 | * Log non-fatal exceptions in addition to automatically reported app crashes. 45 | * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#log_non-fatal_exceptions 46 | * @param {string} message 47 | * @return {Promise} 48 | */ 49 | @Cordova({ sync: true }) 50 | logError(message: string): Promise { 51 | return; 52 | } 53 | 54 | /** 55 | * Sets the user identifier property for crashlytics reporting. 56 | * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#set_user_ids 57 | * @param {string} userId value to set the userId 58 | * @returns {Promise} 59 | */ 60 | @Cordova({ sync: true }) 61 | setUserId(userId: string): Promise { 62 | return; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/flashlight/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Flashlight 6 | * @description This plugin allows you to switch the flashlight / torch of the device on and off. 7 | * 8 | * Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin). 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { Flashlight } from '@ionic-native/flashlight/ngx'; 13 | * 14 | * constructor(private flashlight: Flashlight) { } 15 | * 16 | * ... 17 | * 18 | * this.flashlight.switchOn(); 19 | * 20 | * ``` 21 | */ 22 | @Plugin({ 23 | pluginName: 'Flashlight', 24 | plugin: 'cordova-plugin-flashlight', 25 | pluginRef: 'window.plugins.flashlight', 26 | repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin', 27 | platforms: ['Android', 'iOS', 'Windows Phone 8'], 28 | }) 29 | @Injectable() 30 | export class Flashlight extends IonicNativePlugin { 31 | /** 32 | * Checks if the flashlight is available 33 | * @returns {Promise} Returns a promise that resolves with a boolean stating if the flashlight is available. 34 | */ 35 | @Cordova() 36 | available(): Promise { 37 | return; 38 | } 39 | 40 | /** 41 | * Switches the flashlight on 42 | * @returns {Promise} 43 | */ 44 | @Cordova() 45 | switchOn(): Promise { 46 | return; 47 | } 48 | 49 | /** 50 | * Switches the flashlight off 51 | * @returns {Promise} 52 | */ 53 | @Cordova() 54 | switchOff(): Promise { 55 | return; 56 | } 57 | 58 | /** 59 | * Toggles the flashlight 60 | * @returns {Promise} 61 | */ 62 | @Cordova() 63 | toggle(): Promise { 64 | return; 65 | } 66 | 67 | /** 68 | * Checks if the flashlight is turned on. 69 | * @returns {boolean} 70 | */ 71 | @Cordova({ 72 | sync: true, 73 | }) 74 | isSwitchedOn(): boolean { 75 | return; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/full-screen-image/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Full Screen Image 6 | * @description 7 | * This plugin does something 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { FullScreenImage } from '@ionic-native/full-screen-image'; 12 | * 13 | * 14 | * constructor(private fullScreenImage: FullScreenImage) { } 15 | * 16 | * ... 17 | * 18 | * this.fullScreenImage.showImageURL('/assets/...') 19 | * .then((data: any) => console.log(res)) 20 | * .catch((error: any) => console.error(error)); 21 | * 22 | * ... 23 | * 24 | * this.fullScreenImage.showImageBase64('iVBORw0KGgoAAAANSUhEUgAAA...') 25 | * .then((data: any) => console.log(res)) 26 | * .catch((error: any) => console.error(error)); 27 | * 28 | * ``` 29 | */ 30 | @Plugin({ 31 | pluginName: 'FullScreenImage', 32 | plugin: 'es.keensoft.fullscreenimage', 33 | pluginRef: 'FullScreenImage', 34 | repo: 'https://github.com/keensoft/FullScreenImage-Cordova-Plugin', 35 | platforms: ['Android', 'iOS'], 36 | }) 37 | @Injectable() 38 | export class FullScreenImage extends IonicNativePlugin { 39 | /** 40 | * Opens an image from a URL or path 41 | * @param url {string} url or image path 42 | * @return {Promise} 43 | */ 44 | @Cordova({ sync: true }) 45 | showImageURL(url: string): Promise { 46 | return; 47 | } 48 | 49 | /** 50 | * Opens an image from a base64 string 51 | * @param base64String {string} base64 string 52 | * @param name? {string} image name 53 | * @param type? {string} image extension 54 | * @return {Promise} 55 | */ 56 | @Cordova({ sync: true }) 57 | showImageBase64(base64String: string, name?: string, type?: string): Promise { 58 | return; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/ge-tui-sdk-plugin/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Ge Tui Sdk Plugin 6 | * @description 7 | * This plugin does something 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { GeTuiSdkPlugin } from '@ionic-native/ge-tui-sdk-plugin'; 12 | * 13 | * 14 | * constructor(private geTuiSdkPlugin: GeTuiSdkPlugin) { } 15 | * 16 | * this.geTuiSdkPlugin.callback_init((res) => { console.log(res)}); 17 | * .then((res: any) => console.log(res)) 18 | * .catch((error: any) => console.error(error)); 19 | * this.geTuiSdkPlugin.initialize(); 20 | * .then((res: any) => console.log(res)) 21 | * .catch((error: any) => console.error(error)); 22 | * this.geTuiSdkPlugin.getClientId(); 23 | * .then((res: any) => console.log(res)) 24 | * .catch((error: any) => console.error(error)); 25 | * this.geTuiSdkPlugin.getVersion(); 26 | * .then((res: any) => console.log(res)) 27 | * .catch((error: any) => console.error(error)); 28 | * 29 | * ``` 30 | */ 31 | @Plugin({ 32 | pluginName: 'GeTuiSdkPlugin', 33 | plugin: 'cordova-plugin-getuisdk', 34 | pluginRef: 'GeTuiSdkPlugin', 35 | repo: 'git@github.com:GetuiLaboratory/cordova-plugin-getuisdk.git', 36 | install: 37 | 'cordova plugin add cordova-plugin-getuisdk --variable PUSH_APPID=your appid --variable PUSH_APPKEY=your appkey --variable PUSH_APPSECRET=your appsecret', 38 | installVariables: ['PUSH_APPID', 'PUSH_APPKEY', 'PUSH_APPSECRET'], 39 | platforms: ['Android', 'iOS'], 40 | }) 41 | @Injectable() 42 | export class GeTuiSdkPlugin extends IonicNativePlugin { 43 | @Cordova() 44 | callback_init(callback: Function): Promise { 45 | return; 46 | } 47 | 48 | @Cordova({ 49 | sync: true, 50 | }) 51 | initialize() { 52 | return; 53 | } 54 | 55 | @Cordova() 56 | getClientId(): Promise { 57 | return; 58 | } 59 | 60 | @Cordova() 61 | getVersion(): Promise { 62 | return; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/google-nearby/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | import { Observable } from 'rxjs'; 4 | 5 | /** 6 | * @name Google Nearby 7 | * @description 8 | * This plugin adds support for the Google Nearby Messages API. 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { GoogleNearby } from '@ionic-native/google-nearby/ngx'; 13 | * 14 | * 15 | * constructor(private googleNearby: GoogleNearby) { } 16 | * 17 | * this.googleNearby.publish('Hello') 18 | * .then((res: any) => console.log(res)) 19 | * .catch((error: any) => console.error(error)); 20 | * 21 | * this.googleNearby.subscribe() 22 | * .then((res: any) => console.log(res)) 23 | * .catch((error: any) => console.error(error)); 24 | * ``` 25 | */ 26 | @Plugin({ 27 | pluginName: 'GoogleNearby', 28 | plugin: 'cordova-plugin-google-nearby', 29 | pluginRef: 'window.nearby', 30 | repo: 'https://github.com/hahahannes/cordova-plugin-google-nearby', 31 | install: 'ionic cordova plugin add cordova-plugin-google-nearby --variable API_KEY="123456789"', 32 | installVariables: ['API_KEY'], 33 | platforms: ['Android'], 34 | }) 35 | @Injectable() 36 | export class GoogleNearby extends IonicNativePlugin { 37 | /** 38 | * Publish a message 39 | * @param message {string} Message to publish 40 | * @return {Promise} Returns a promise that resolves when the message got published 41 | */ 42 | @Cordova() 43 | publish(message: string): Promise { 44 | return; 45 | } 46 | 47 | /** 48 | * Subscribe to receive messages 49 | * @return {Observable} Returns an observable that emits received messages 50 | */ 51 | @Cordova({ 52 | observable: true, 53 | clearFunction: 'unsubscribe', 54 | }) 55 | subscribe(): Observable { 56 | return; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/hce/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name hce 6 | * @description 7 | * HCE Cordova Wrapper 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { hce } from '@ionic-native/hce/ngx'; 12 | * 13 | * 14 | * constructor(private hce: hce) { } 15 | * 16 | * ... 17 | * 18 | * function onCommand(command){ 19 | * var commandAsBytes = new Uint8Array(command); 20 | * var commandAsString = hce.util.byteArrayToHexString(commandAsBytes); 21 | * 22 | * // do something with the command 23 | * 24 | * // send the response 25 | * hce.sendReponse(commandResponse); 26 | * } 27 | * this.hce.registerCommandCallback().then(onCommand); 28 | * 29 | * ``` 30 | */ 31 | @Plugin({ 32 | pluginName: 'hce', 33 | plugin: 'cordova-plugin-hce', 34 | pluginRef: 'hce', 35 | repo: 'https://github.com/don/cordova-plugin-hce', 36 | install: '', 37 | installVariables: ['AID_FILTER'], 38 | platforms: ['Android'], 39 | }) 40 | @Injectable() 41 | export class HCE extends IonicNativePlugin { 42 | /** 43 | * Registers command receiver. 44 | * @param onCommand {HCECommandEvent} The event handler. 45 | * @param fail {Function} Error event handler. 46 | * 47 | */ 48 | @Cordova() 49 | registerCommandCallback(onCommand: HCECommandEvent, fail?: Function): void { 50 | return; // We add return; here to avoid any IDE / Compiler errors 51 | } 52 | /** 53 | * Registers Deactivated receiver. 54 | * @param ok {HCEDeactivatedEvent} Success event handler. 55 | * @param fail {Function} Error event handler. 56 | * 57 | */ 58 | @Cordova() 59 | registerDeactivatedCallback(ok: HCEDeactivatedEvent, fail?: Function): void { 60 | return; // We add return; here to avoid any IDE / Compiler errors 61 | } 62 | 63 | /** 64 | * Sends response APDU. 65 | * @param response {Uint8Array} Response 66 | * @param success {string} Success Callback. 67 | * @param success {string} Failure Callback. 68 | * 69 | */ 70 | @Cordova() 71 | sendResponse(response: Uint8Array, success?: Function, failure?: Function): void { 72 | return; // We add return; here to avoid any IDE / Compiler errors 73 | } 74 | } 75 | 76 | export type HCECommandEvent = (command: Uint8Array) => void; 77 | export type HCEDeactivatedEvent = (command: number) => void; 78 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/header-color/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Header Color 6 | * @description 7 | * Cordova plugin to change color of header in Android Multitask View 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { HeaderColor } from '@ionic-native/header-color/ngx'; 12 | * 13 | * constructor(private headerColor: HeaderColor) { } 14 | * 15 | * ... 16 | * 17 | * this.headerColor.tint('#becb29'); 18 | * ``` 19 | */ 20 | @Plugin({ 21 | pluginName: 'HeaderColor', 22 | plugin: 'cordova-plugin-headercolor', 23 | pluginRef: 'plugins.headerColor', 24 | repo: 'https://github.com/tomloprod/cordova-plugin-headercolor', 25 | platforms: ['Android'], 26 | }) 27 | @Injectable() 28 | export class HeaderColor extends IonicNativePlugin { 29 | /** 30 | * Set a color to the task header 31 | * @param color {string} The hex value of the color 32 | * @returns {Promise} 33 | */ 34 | @Cordova({ 35 | callbackStyle: 'object', 36 | successName: 'success', 37 | errorName: 'failure', 38 | }) 39 | tint(color: string): Promise { 40 | return; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/image-resizer/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface ImageResizerOptions { 5 | /** 6 | * The URI for the image on the device to get scaled 7 | */ 8 | uri: string; 9 | 10 | /** 11 | * The name of the folder the image should be put 12 | * (Android only) 13 | */ 14 | folderName?: string; 15 | 16 | /** 17 | * A custom name for the file. Default name is a timestamp. You have to set this value on iOS 18 | */ 19 | fileName?: string; 20 | 21 | /** 22 | * 23 | * Quality given as Number for the quality of the new image 24 | * (Android and iOS only) 25 | */ 26 | quality?: number; 27 | 28 | /** 29 | * The width of the new image 30 | */ 31 | width: number; 32 | 33 | /** 34 | * The height of the new image 35 | */ 36 | height: number; 37 | 38 | /** 39 | * Whether or not to return a base64 encoded image string instead of the path to the resized image. 40 | * iOS only 41 | */ 42 | base64?: boolean; 43 | } 44 | 45 | /** 46 | * @name Image Resizer 47 | * @description 48 | * Cordova Plugin For Image Resize 49 | * 50 | * @usage 51 | * ```typescript 52 | * import { ImageResizer, ImageResizerOptions } from '@ionic-native/image-resizer/ngx'; 53 | * 54 | * constructor(private imageResizer: ImageResizer) { } 55 | * 56 | * ... 57 | * 58 | * let options = { 59 | * uri: uri, 60 | * folderName: 'Protonet', 61 | * quality: 90, 62 | * width: 1280, 63 | * height: 1280 64 | * } as ImageResizerOptions; 65 | * 66 | * this.imageResizer 67 | * .resize(options) 68 | * .then((filePath: string) => console.log('FilePath', filePath)) 69 | * .catch(e => console.log(e)); 70 | * 71 | * ``` 72 | * @interfaces 73 | * ImageResizerOptions 74 | */ 75 | @Plugin({ 76 | pluginName: 'ImageResizer', 77 | plugin: 'info.protonet.imageresizer', 78 | pluginRef: 'ImageResizer', 79 | repo: 'https://github.com/JoschkaSchulz/cordova-plugin-image-resizer', 80 | platforms: ['Android', 'iOS', 'Windows'], 81 | }) 82 | @Injectable() 83 | export class ImageResizer extends IonicNativePlugin { 84 | /** 85 | * @returns {Promise} 86 | */ 87 | @Cordova() 88 | resize(options: ImageResizerOptions): Promise { 89 | return; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/in-app-review/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | /* tslint:disable */ 4 | /** 5 | * @name In App Review 6 | * @description 7 | * This plugin does use the iOS class SKStore​Review​Controller to open the inApp review popup available since iOS 10.3 8 | * 9 | * This functionality only works on iOS devices 10 | * 11 | * 12 | * @usage 13 | * ```typescript 14 | * import { InAppReview } from '@ionic-native/in-app-review/ngx'; 15 | * 16 | * 17 | * constructor(private inAppReview: InAppReview) { } 18 | * 19 | * ... 20 | * 21 | * 22 | * this.inAppReview.requestReview() 23 | * .then((res: any) => console.log(res)) 24 | * .catch((error: any) => console.error(error)); 25 | * 26 | * ``` 27 | */ 28 | /* tslint:enable */ 29 | @Plugin({ 30 | pluginName: 'InAppReview', 31 | plugin: 'com.omarben.inappreview', 32 | pluginRef: 'inappreview', 33 | repo: 'https://github.com/omaxlive/com.omarben.inappreview', 34 | platforms: ['iOS'], 35 | }) 36 | @Injectable() 37 | export class InAppReview extends IonicNativePlugin { 38 | /** 39 | * Open the inApp review popup 40 | * @return {Promise} Returns a promise that resolves when something happens 41 | */ 42 | @Cordova() 43 | requestReview(): Promise { 44 | return; // We add return; here to avoid any IDE / Compiler errors 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/insomnia/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Insomnia 6 | * @description 7 | * Prevent the screen of the mobile device from falling asleep. 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { Insomnia } from '@ionic-native/insomnia/ngx'; 12 | * 13 | * constructor(private insomnia: Insomnia) { } 14 | * 15 | * ... 16 | * 17 | * this.insomnia.keepAwake() 18 | * .then( 19 | * () => console.log('success'), 20 | * () => console.log('error') 21 | * ); 22 | * 23 | * this.insomnia.allowSleepAgain() 24 | * .then( 25 | * () => console.log('success'), 26 | * () => console.log('error') 27 | * ); 28 | * ``` 29 | * 30 | */ 31 | @Plugin({ 32 | pluginName: 'Insomnia', 33 | plugin: 'cordova-plugin-insomnia', 34 | pluginRef: 'plugins.insomnia', 35 | repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin', 36 | platforms: ['Android', 'Browser', 'Firefox OS', 'iOS', 'Windows', 'Windows Phone 8'], 37 | }) 38 | @Injectable() 39 | export class Insomnia extends IonicNativePlugin { 40 | /** 41 | * Keeps awake the application 42 | * @returns {Promise} 43 | */ 44 | @Cordova() 45 | keepAwake(): Promise { 46 | return; 47 | } 48 | 49 | /** 50 | * Allows the application to sleep again 51 | * @returns {Promise} 52 | */ 53 | @Cordova() 54 | allowSleepAgain(): Promise { 55 | return; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/instagram/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Instagram 6 | * @description Share a photo with the instagram app 7 | * 8 | * @usage 9 | * ```typescript 10 | * import { Instagram } from '@ionic-native/instagram/ngx'; 11 | * 12 | * constructor(private instagram: Instagram) { } 13 | * 14 | * ... 15 | * 16 | * this.instagram.share('data:image/png;uhduhf3hfif33', 'Caption') 17 | * .then(() => console.log('Shared!')) 18 | * .catch((error: any) => console.error(error)); 19 | * 20 | * ``` 21 | */ 22 | @Plugin({ 23 | pluginName: 'Instagram', 24 | plugin: 'cordova-instagram-plugin', 25 | pluginRef: 'Instagram', 26 | repo: 'https://github.com/vstirbu/InstagramPlugin', 27 | platforms: ['Android', 'iOS'], 28 | }) 29 | @Injectable() 30 | export class Instagram extends IonicNativePlugin { 31 | /** 32 | * Detect if the Instagram application is installed on the device. 33 | * 34 | * @returns {Promise} Returns a promise that returns a boolean value if installed, or the app version on android 35 | */ 36 | @Cordova({ 37 | callbackStyle: 'node', 38 | }) 39 | isInstalled(): Promise { 40 | return; 41 | } 42 | 43 | /** 44 | * Share an image on Instagram 45 | * Note: Instagram app stopped accepting pre-filled captions on both iOS and Android. As a work-around, the caption is copied to the clipboard. You have to inform your users to paste the caption. 46 | * 47 | * @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share 48 | * @param caption The caption of the image 49 | * @returns {Promise} Returns a promise that resolves if the image was shared 50 | */ 51 | @Cordova({ 52 | callbackStyle: 'node', 53 | }) 54 | share(canvasIdOrDataUrl: string, caption?: string): Promise { 55 | return; 56 | } 57 | 58 | /** 59 | * Share a library asset or video 60 | * @param assetLocalIdentifier A local fileURI 61 | * @returns {Promise} Returns a promise that resolves if the image was shared 62 | */ 63 | @Cordova({ 64 | callbackOrder: 'reverse', 65 | }) 66 | shareAsset(assetLocalIdentifier: string): Promise { 67 | return; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/ionic-webview/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Ionic Webview 6 | * @capacitorincompatible true 7 | * @description 8 | * Access Web View utilities. 9 | * 10 | * Requires the Cordova plugin: `cordova-plugin-ionic-webview` > 2.0. For more info, please see the [Ionic Web View](https://github.com/ionic-team/cordova-plugin-ionic-webview) repository. 11 | * 12 | * @usage 13 | * ```typescript 14 | * import { WebView } from '@ionic-native/ionic-webview/ngx'; 15 | * 16 | * 17 | * constructor(private webview: WebView) { } 18 | * 19 | * ... 20 | * 21 | * img = this.webview.convertFileSrc('file:///Users/dan/camera-image-12345.png') 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'WebView', 27 | plugin: 'cordova-plugin-ionic-webview', 28 | pluginRef: 'window.Ionic.WebView', 29 | repo: 'https://github.com/ionic-team/cordova-plugin-ionic-webview', 30 | platforms: ['Android', 'iOS'], 31 | install: 'ionic cordova plugin add cordova-plugin-ionic-webview', 32 | }) 33 | @Injectable() 34 | export class WebView extends IonicNativePlugin { 35 | /** 36 | * Convert a `file://` URL to a URL that is compatible with the local web server in the Web View plugin. 37 | */ 38 | @CordovaProperty() 39 | convertFileSrc: (url: string) => string; 40 | } 41 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/ios-aswebauthenticationsession-api/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name ios-aswebauthenticationsession-api 6 | * @description 7 | * Plugin for iOS 12 ASWebAuthenticationSession API 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { IosASWebauthenticationSession } from '@ionic-native/ios-aswebauthenticationsession-api/ngx'; 12 | * 13 | * 14 | * constructor(private IosASWebauthenticationSession: ios-aswebauthenticationsession-api) { } 15 | * 16 | * ... 17 | * 18 | * 19 | * this.IosASWebauthenticationSession.start(callbackUrl, authorizeURL) 20 | * .then((redirectUrl: string) => console.log(redirectUrl)) 21 | * .catch((error: any) => console.error(error)); 22 | * 23 | * ``` 24 | */ 25 | 26 | @Plugin({ 27 | pluginName: 'IosASWebauthenticationSession', 28 | plugin: 'cordova-plugin-ios-aswebauthenticationsession-api', 29 | pluginRef: 'plugins.ASWebAuthSession', 30 | repo: 31 | 'https://github.com/jwelker110/cordova-plugin-ios-aswebauthenticationsession-api', 32 | platforms: ['iOS'], 33 | }) 34 | @Injectable() 35 | export class IosASWebauthenticationSession extends IonicNativePlugin { 36 | /** 37 | * This function start an authentication flow in ASWebauthenticationSession 38 | * @param callbackUrl {string} Callback URL of your App 39 | * @param authorizeURL {number} Authorization URL 40 | * @return {Promise} Returns a promise that resolves a string containing the redirect URL after finishing ASWebauthenticationSession 41 | */ 42 | @Cordova() 43 | start( 44 | callbackUrl: string, 45 | authorizeURL: string 46 | ): Promise { 47 | return; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/is-debug/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Is Debug 6 | * @description 7 | * Detect if the app is running in debug mode or not. 8 | * Debug mode is when the app is built and installed locally via xcode / eclipse / the cordova cli etc, compared to release mode when the app was downloaded from the app / play store via an end user. 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { IsDebug } from '@ionic-native/is-debug/ngx'; 13 | * 14 | * constructor(private isDebug: IsDebug) { } 15 | * 16 | * ... 17 | * 18 | * this.isDebug.getIsDebug() 19 | * .then(isDebug => console.log('Is debug:', isDebug)) 20 | * .catch(err => console.error(err)); 21 | * 22 | * ``` 23 | */ 24 | @Plugin({ 25 | pluginName: 'IsDebug', 26 | plugin: 'cordova-plugin-is-debug', 27 | pluginRef: 'cordova.plugins.IsDebug', 28 | repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug', 29 | platforms: ['Android', 'iOS'], 30 | }) 31 | @Injectable() 32 | export class IsDebug extends IonicNativePlugin { 33 | /** 34 | * Determine if an app was installed via xcode / eclipse / the ionic CLI etc 35 | * @returns {Promise} Returns a promise that resolves with true if the app was installed via xcode / eclipse / the ionic CLI etc. It will resolve to false if the app was downloaded from the app / play store by the end user. 36 | */ 37 | @Cordova() 38 | getIsDebug(): Promise { 39 | return; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/janalytics/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name jAnalytics 6 | * @description 7 | * This plugin does something 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { JAnalytics } from '@ionic-native/JAnalytics/ngx'; 12 | * 13 | * 14 | * constructor(private jAnalytics: JAnalytics) { } 15 | * 16 | * ... 17 | * 18 | * 19 | * this.jAnalytics.functionName('Hello', 123) 20 | * .then((res: any) => console.log(res)) 21 | * .catch((error: any) => console.error(error)); 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'JAnalytics', 27 | plugin: 'cordova-plugin-janalytics', 28 | pluginRef: 'JAnalytics', 29 | repo: 'https://github.com/jpush/cordova-plugin-janalytics', 30 | install: 'ionic cordova plugin add cordova-plugin-janalytics --variable APP_KEY=YOUR_APP_KEY', 31 | installVariables: ['APP_KEY'], 32 | platforms: ['Android', 'iOS'], 33 | }) 34 | @Injectable() 35 | export class JAnalytics extends IonicNativePlugin { 36 | /** 37 | * This function does something 38 | * @return {Promise} Returns a promise that resolves when something happens 39 | */ 40 | @Cordova() 41 | init(): Promise { 42 | return; 43 | } 44 | 45 | @Cordova() 46 | initCrashHandler(): Promise { 47 | return; 48 | } 49 | 50 | @Cordova() 51 | stopCrashHandler(): Promise { 52 | return; 53 | } 54 | 55 | @Cordova() 56 | onPageStart(params: any): Promise { 57 | return; 58 | } 59 | 60 | @Cordova() 61 | onPageEnd(params: any): Promise { 62 | return; 63 | } 64 | 65 | @Cordova() 66 | addCountEvent(params: any): Promise { 67 | return; 68 | } 69 | 70 | @Cordova() 71 | addCalculateEvent(params: any): Promise { 72 | return; 73 | } 74 | 75 | @Cordova() 76 | addLoginEvent(params: any): Promise { 77 | return; 78 | } 79 | 80 | @Cordova() 81 | addRegisterEvent(params: any): Promise { 82 | return; 83 | } 84 | 85 | @Cordova() 86 | addBrowseEvent(params: any): Promise { 87 | return; 88 | } 89 | 90 | @Cordova() 91 | addPurchaseEvent(params: any): Promise { 92 | return; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/lottie-splash-screen/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Lottie Splash Screen 6 | * @description 7 | * Cordova plugin to show bodymovin/Lottie animations as the splash screen with Airbnb's Lottie wrapper 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { LottieSplashScreen } from '@ionic-native/lottie-splash-screen/ngx'; 12 | * 13 | * 14 | * constructor(private lottieSplashScreen: LottieSplashScreen) { } 15 | * 16 | * ... 17 | * 18 | * 19 | * this.lottieSplashScreen.show('www/lottie/animation.json', false, 1024, 768) 20 | * .then((res: any) => console.log(res)) 21 | * .catch((error: any) => console.error(error)); 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'LottieSplashScreen', 27 | plugin: 'cordova-plugin-lottie-splashscreen', 28 | pluginRef: 'lottie.splashscreen', 29 | repo: 'https://github.com/timbru31/cordova-plugin-lottie-splashscreen', 30 | install: '', 31 | installVariables: [], 32 | platforms: ['Android', 'iOS'], 33 | }) 34 | @Injectable() 35 | export class LottieSplashScreen extends IonicNativePlugin { 36 | /** 37 | * This function shows a Lottie splash screen. If no arguments are given, it defaults to the config.xml values, however you can pass (new) options here to change the behavior on runtime. (For easier reading the TypeScript notation is used) 38 | * @param location {string} Location of the Lottie JSON file that should be loaded. 39 | * @param remote {number} Toggles Lottie's remote mode which allows files to be downloaded/displayed from URLs. Example: 40 | * @param width {number} Width of the container that's rendering the Lottie animation 41 | * @param height {number} Height of the container that's rendering the Lottie animation 42 | */ 43 | @Cordova({ 44 | sync: true, 45 | }) 46 | show(location?: string, remote?: boolean, width?: number, height?: number): void {} 47 | 48 | /** 49 | * This methods hides the current active Lottie splashscreen and destroys the views. 50 | */ 51 | @Cordova({ sync: true }) 52 | hide(): void {} 53 | } 54 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/market/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | /** 4 | * @name Market 5 | * @description 6 | * Opens an app's page in the market place (Google Play, App Store) 7 | * 8 | * @usage 9 | * ```typescript 10 | * import { Market } from '@ionic-native/market/ngx'; 11 | * 12 | * constructor(private market: Market) { } 13 | * 14 | * ... 15 | * 16 | * this.market.open('your.package.name'); 17 | * 18 | * ``` 19 | */ 20 | @Plugin({ 21 | pluginName: 'Market', 22 | plugin: 'cordova-plugin-market', 23 | pluginRef: 'cordova.plugins.market', 24 | repo: 'https://github.com/xmartlabs/cordova-plugin-market', 25 | platforms: ['Android', 'iOS'], 26 | }) 27 | @Injectable() 28 | export class Market extends IonicNativePlugin { 29 | /** 30 | * Opens an app in Google Play / App Store 31 | * @param appId {string} Package name 32 | * @return {Promise} 33 | */ 34 | @Cordova({ 35 | callbackStyle: 'object', 36 | successName: 'success', 37 | errorName: 'failure', 38 | }) 39 | open(appId: string): Promise { 40 | return; 41 | } 42 | 43 | /** 44 | * Search apps by keyword 45 | * @param keyword {string} Keyword 46 | * @return {Promise} 47 | */ 48 | @Cordova({ 49 | callbackStyle: 'object', 50 | successName: 'success', 51 | errorName: 'failure', 52 | platforms: ['Android'], 53 | }) 54 | search(keyword: string): Promise { 55 | return; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/native-ringtones/index.ts: -------------------------------------------------------------------------------- 1 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 2 | import { Injectable } from '@angular/core'; 3 | 4 | /** 5 | * @beta 6 | * @name Native Ringtones 7 | * @description 8 | * The plugin helps get the native ringtones list on Android or IOS devices. 9 | * And you can also use this plugin to play or stop the native ringtones and custom ringtones(added in the www folder). 10 | * 11 | * @usage 12 | * ``` 13 | * import { NativeRingtones } from '@ionic-native/native-ringtones/ngx'; 14 | * 15 | * 16 | * constructor(private ringtones: NativeRingtones) { } 17 | * 18 | * ... 19 | * this.ringtones.getRingtone().then((ringtones) => { console.log(ringtones); }); 20 | * 21 | * this.ringtones.playRingtone('assets/ringtones/sound_1.caf'); 22 | * 23 | * this.ringtones.stopRingtone('assets/ringtones/sound_1.caf'); 24 | * 25 | * ``` 26 | */ 27 | @Plugin({ 28 | pluginName: 'native-ringtones', 29 | plugin: 'cordova-plugin-native-ringtones', 30 | pluginRef: 'cordova.plugins.NativeRingtones', 31 | repo: 'https://github.com/TongZhangzt/cordova-plugin-native-ringtones', 32 | platforms: ['Android', 'iOS'], 33 | }) 34 | @Injectable() 35 | export class NativeRingtones extends IonicNativePlugin { 36 | /** 37 | * Get the ringtone list of the device 38 | * @return {Promise} Returns a promise that resolves when ringtones found successfully 39 | */ 40 | @Cordova() 41 | getRingtone(): Promise { 42 | return; 43 | } 44 | 45 | /** 46 | * This function starts playing the ringtone 47 | * @param {string} ringtoneUri The path to the ringtone file 48 | * @return {Promise} Returns a promise 49 | */ 50 | @Cordova() 51 | playRingtone(ringtoneUri: string): Promise { 52 | return; 53 | } 54 | 55 | /** 56 | * This function stops playing the ringtone 57 | * @param {string} ringtoneUri The path to the ringtone file 58 | * @return {Promise} Returns a promise 59 | */ 60 | @Cordova() 61 | stopRingtone(ringtoneUri: string): Promise { 62 | return; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/navigation-bar/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @beta 6 | * @name Navigation Bar 7 | * @description 8 | * The NavigationBar plugin allows you to hide and auto hide the android navigation bar. 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { NavigationBar } from '@ionic-native/navigation-bar/ngx'; 13 | * 14 | * constructor(private navigationBar: NavigationBar) { } 15 | * 16 | * ... 17 | * 18 | * let autoHide: boolean = true; 19 | * this.navigationBar.setUp(autoHide); 20 | * ``` 21 | */ 22 | @Plugin({ 23 | pluginName: 'NavigationBar', 24 | plugin: 'cordova-plugin-navigationbar', 25 | pluginRef: 'navigationbar', 26 | repo: 'https://github.com/cranberrygame/cordova-plugin-navigationbar', 27 | platforms: ['Android'], 28 | }) 29 | @Injectable() 30 | export class NavigationBar extends IonicNativePlugin { 31 | /** 32 | * hide automatically (or not) the navigation bar. 33 | * @param autohide {boolean} 34 | * @return {Promise} 35 | */ 36 | @Cordova({ 37 | callbackStyle: 'object', 38 | successName: 'success', 39 | errorName: 'failure', 40 | }) 41 | setUp(autohide?: boolean): Promise { 42 | return; 43 | } 44 | 45 | /** 46 | * Hide the navigation bar. 47 | * @return {Promise} 48 | */ 49 | @Cordova({ 50 | callbackStyle: 'object', 51 | successName: 'success', 52 | errorName: 'failure', 53 | }) 54 | hideNavigationBar(): Promise { 55 | return; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/openalpr/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface OpenALPROptions { 5 | /** Country used for scanning the license plate */ 6 | country?: string; 7 | 8 | /** Amount of results returned */ 9 | amount?: number; 10 | } 11 | 12 | export interface OpenALPRResult { 13 | /** LicensePlate */ 14 | number: string; 15 | /** Probability */ 16 | confidence: number; 17 | } 18 | 19 | /** 20 | * @name OpenALPR 21 | * @description 22 | * This Cordova plugin adds support for the OpenALPR (Automatic License Plate Recognition) library, which provides support for retrieving the license plate from a picture. 23 | * 24 | * @usage 25 | * ```typescript 26 | * import { OpenALPR, OpenALPROptions, OpenALPRResult } from '@ionic-native/openalpr/ngx'; 27 | * 28 | * 29 | * constructor(private openALPR: OpenALPR) { } 30 | * 31 | * const scanOptions: OpenALPROptions = { 32 | * country: this.openALPR.Country.EU, 33 | * amount: 3 34 | * } 35 | * 36 | * // To get imageData, you can use the @ionic-native/camera module for example. It works with DestinationType.FILE_URI and DATA_URL 37 | * 38 | * this.openALPR.scan(imageData, scanOptions) 39 | * .then((res: [OpenALPRResult]) => console.log(res)) 40 | * .catch((error: Error) => console.error(error)); 41 | * 42 | * ``` 43 | */ 44 | @Plugin({ 45 | pluginName: 'OpenALPR', 46 | plugin: 'cordova-plugin-openalpr', 47 | pluginRef: 'cordova.plugins.OpenALPR', 48 | repo: 'https://github.com/iMicknl/cordova-plugin-openalpr', 49 | platforms: ['Android', 'iOS'], 50 | }) 51 | @Injectable() 52 | export class OpenALPR extends IonicNativePlugin { 53 | Country = { 54 | AU: 'au', 55 | BR: 'br', 56 | BR2: 'br2', 57 | EU: 'eu', 58 | IN: 'in', 59 | KR2: 'kr2', 60 | US: 'us', 61 | VN2: 'vn2', 62 | }; 63 | 64 | /** 65 | * This function does something 66 | * @param imageData {any} Base64 encoding of the image data or the image file URI 67 | * @param options {OpenALPROptions} Options to pass to the OpenALPR scanner 68 | * @return {Promise} Returns a promise that resolves when something happens 69 | */ 70 | @Cordova() 71 | scan(imageData: any, options?: OpenALPROptions): Promise { 72 | return; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/photo-viewer/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface PhotoViewerOptions { 5 | /** 6 | * Set to false to disable the share button (Android only). Default: true 7 | */ 8 | share?: boolean; 9 | /** 10 | * Add HTTP headers to the request. Useful for authenticated pages. 11 | * The value is a string in a JSON format. Default: '' 12 | */ 13 | headers?: string; 14 | /** 15 | * Option for close button visibility when share false [ONLY FOR iOS] 16 | */ 17 | closeButton?: boolean; 18 | /** 19 | * If you need to copy image to reference before show then set it true [ONLY FOR iOS] 20 | */ 21 | copyToReference?: boolean; 22 | /** 23 | * Enable or Disable Picasso Options ( Only Android ): fit, centerInside, centerCrop. 24 | */ 25 | piccasoOptions?: { 26 | fit?: boolean; 27 | centerInside?: boolean; 28 | centerCrop?: boolean; 29 | }; 30 | } 31 | 32 | /** 33 | * @name Photo Viewer 34 | * @description This plugin can display your image in full screen with the ability to pan, zoom, and share the image. 35 | * @usage 36 | * ```typescript 37 | * import { PhotoViewer } from '@ionic-native/photo-viewer/ngx'; 38 | * 39 | * constructor(private photoViewer: PhotoViewer) { } 40 | * 41 | * ... 42 | * 43 | * this.photoViewer.show('https://mysite.com/path/to/image.jpg'); 44 | * 45 | * this.photoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false}); 46 | * 47 | * this.photoViewer.show('https://mysecuresite.com/path/to/image.jpg', 'My image title', {share: false, headers: '{username:foo,password:bar}'}); 48 | * ``` 49 | */ 50 | @Plugin({ 51 | pluginName: 'PhotoViewer', 52 | plugin: 'com-sarriaroman-photoviewer', 53 | pluginRef: 'PhotoViewer', 54 | repo: 'https://github.com/sarriaroman/photoviewer', 55 | platforms: ['Android', 'iOS'], 56 | }) 57 | @Injectable() 58 | export class PhotoViewer extends IonicNativePlugin { 59 | /** 60 | * Shows an image in full screen 61 | * @param url {string} URL or path to image 62 | * @param title {string} 63 | * @param options {PhotoViewerOptions} 64 | */ 65 | @Cordova({ sync: true }) 66 | show(url: string, title?: string, options?: PhotoViewerOptions): void {} 67 | } 68 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/pin-check/index.ts: -------------------------------------------------------------------------------- 1 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 2 | import { Injectable } from '@angular/core'; 3 | 4 | /** 5 | * @name Pin Check 6 | * @description 7 | * This plugin is for use with Apache Cordova and allows your application to check whether pin/keyguard or passcode is setup on iOS and Android phones. 8 | * 9 | * Requires Cordova plugin: cordova-plugin-pincheck. For more info, please see the [PinCheck plugin docs](https://github.com/ohh2ahh/AppAvailability). 10 | * 11 | * @usage 12 | * ```typescript 13 | * import { PinCheck } from '@ionic-native/pin-check/ngx'; 14 | * import { Platform } from 'ionic-angular'; 15 | * 16 | * constructor(private pinCheck: PinCheck, private platform: Platform) { } 17 | * 18 | * ... 19 | * 20 | * this.pinCheck.isPinSetup() 21 | * .then( 22 | * (success: string) => console.log("pin is setup.");, 23 | * (error: string) => console.log("pin not setup."); 24 | * ); 25 | * ``` 26 | */ 27 | @Plugin({ 28 | pluginName: 'PinCheck', 29 | plugin: 'cordova-plugin-pincheck', 30 | pluginRef: 'cordova.plugins.PinCheck', 31 | repo: 'https://github.com/shangyilim/cordova-plugin-pincheck', 32 | platforms: ['Android', 'iOS'], 33 | }) 34 | @Injectable() 35 | export class PinCheck extends IonicNativePlugin { 36 | /** 37 | * check whether pin/keyguard or passcode is setup 38 | * @returns {Promise} 39 | */ 40 | @Cordova() 41 | isPinSetup(): Promise { 42 | return; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/pin-dialog/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Pin Dialog 6 | * @description 7 | * PhoneGap numeric password dialog plugin for Android and iOS. 8 | * 9 | * Requires Cordova plugin: `cordova-plugin-pin-dialog`. For more info, please see the [Pin Dialog plugin docs](https://github.com/Paldom/PinDialog). 10 | * 11 | * 12 | * 13 | * @usage 14 | * ```typescript 15 | * import { PinDialog } from '@ionic-native/pin-dialog/ngx'; 16 | * 17 | * 18 | * constructor(private pinDialog: PinDialog) { } 19 | * 20 | * ... 21 | * 22 | * this.pinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel']) 23 | * .then( 24 | * (result: any) => { 25 | * if (result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1); 26 | * else if(result.buttonIndex == 2) console.log('User cancelled'); 27 | * } 28 | * ); 29 | * ``` 30 | */ 31 | @Plugin({ 32 | pluginName: 'PinDialog', 33 | plugin: 'cordova-plugin-pin-dialog', 34 | pluginRef: 'plugins.pinDialog', 35 | repo: 'https://github.com/Paldom/PinDialog', 36 | platforms: ['Android', 'iOS'], 37 | }) 38 | @Injectable() 39 | export class PinDialog extends IonicNativePlugin { 40 | /** 41 | * Show pin dialog 42 | * @param {string} message Message to show the user 43 | * @param {string} title Title of the dialog 44 | * @param {string[]} buttons Buttons to show 45 | * @returns {Promise<{ buttonIndex: number, input1: string }>} 46 | */ 47 | @Cordova({ 48 | successIndex: 1, 49 | errorIndex: 4, // no error callback 50 | }) 51 | prompt(message: string, title: string, buttons: string[]): Promise<{ buttonIndex: number; input1: string }> { 52 | return; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/power-management/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | /** 4 | * @name Power Management 5 | * @description 6 | * The PowerManagement plugin offers access to the devices power-management functionality. 7 | * It should be used for applications which keep running for a long time without any user interaction. 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { PowerManagement } from '@ionic-native/power-management/ngx'; 12 | * 13 | * constructor(private powerManagement: PowerManagement) { } 14 | * 15 | * ... 16 | * 17 | * this.powerManagement.acquire() 18 | * .then(onSuccess) 19 | * .catch(onError); 20 | * 21 | * ``` 22 | */ 23 | @Plugin({ 24 | pluginName: 'PowerManagement', 25 | plugin: 'cordova-plugin-powermanagement-orig', 26 | pluginRef: 'powerManagement', 27 | repo: 'https://github.com/Viras-/cordova-plugin-powermanagement', 28 | platforms: ['Android', 'iOS', 'Windows', 'Windows Phone'], 29 | }) 30 | @Injectable() 31 | export class PowerManagement extends IonicNativePlugin { 32 | /** 33 | * Acquire a wakelock by calling this. 34 | * @returns {Promise} 35 | */ 36 | @Cordova() 37 | acquire(): Promise { 38 | return; 39 | } 40 | 41 | /** 42 | * This acquires a partial wakelock, allowing the screen to be dimmed. 43 | * @returns {Promise} 44 | */ 45 | @Cordova() 46 | dim(): Promise { 47 | return; 48 | } 49 | 50 | /** 51 | * Release the wakelock. It's important to do this when you're finished with the wakelock, to avoid unnecessary battery drain. 52 | * @returns {Promise} 53 | */ 54 | @Cordova() 55 | release(): Promise { 56 | return; 57 | } 58 | 59 | /** 60 | * By default, the plugin will automatically release a wakelock when your app is paused (e.g. when the screen is turned off, or the user switches to another app). 61 | * It will reacquire the wakelock upon app resume. If you would prefer to disable this behaviour, you can use this function. 62 | * @param set {boolean} 63 | * @returns {Promise} 64 | */ 65 | @Cordova() 66 | setReleaseOnPause(set: boolean): Promise { 67 | return; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/preview-any-file/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; 3 | /** 4 | * @name PreviewAnyFile 5 | * @description 6 | * Whatever the file is PDF document, Word document, Excel, office document,zip archive file, image, text, html or anything else, you can perform a preview by this cordova Plugin to preview any file in native mode by providing the local or external URL. 7 | * 8 | * Requires Cordova plugin: `cordova-plugin-preview-any-file`. For more info, please see the [previewAnyFile plugin docs](https://github.com/mostafa-mansour1/previewAnyFile). 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { PreviewAnyFile } from '@ionic-native/preview-any-file/ngx'; 13 | * 14 | * 15 | * constructor(private previewAnyFile: PreviewAnyFile) { } 16 | * 17 | * ... 18 | * 19 | * 20 | * this.previewAnyFile.preview('file://filepath.ext') 21 | * .then((res: any) => console.log(res)) 22 | * .catch((error: any) => console.error(error)); 23 | * 24 | * ``` 25 | */ 26 | @Plugin({ 27 | pluginName: 'PreviewAnyFile', 28 | plugin: 'cordova-plugin-preview-any-file', // npm package name, example: cordova-plugin-camera 29 | pluginRef: 'PreviewAnyFile', // the variable reference to call the plugin, example: navigator.geolocation 30 | repo: 'https://github.com/mostafa-mansour1/previewAnyFile', // the github repository URL for the plugin 31 | install: '', // OPTIONAL install command, in case the plugin requires variables 32 | installVariables: [], // OPTIONAL the plugin requires variables 33 | platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] 34 | }) 35 | @Injectable() 36 | export class PreviewAnyFile extends IonicNativePlugin { 37 | /** 38 | * this function return SUCCESS in success callback if the file successfully opened, if the content is base64 you have to write it into file by cordova-plugin-file 39 | * @param url {string} full absolute URL for the file, if the path is content:// you need to resolve the native url, if the path is https:// it may not work in android 40 | * @return {Promise} Returns a promise that resolves if the file opened reject if not; 41 | */ 42 | @Cordova() 43 | preview(url: string): Promise { 44 | return; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/quikkly/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name QuikklyPlugin 6 | * @description ionic wrapper for cordova-plugin-quikkly 7 | * Use the quikkly scanner in your ionic app 8 | */ 9 | @Plugin({ 10 | pluginName: 'QuikklyPlugin', 11 | plugin: 'cordova-plugin-quikkly', 12 | pluginRef: 'cordova.plugins.quikkly', 13 | repo: 'https://github.com/quikkly/cordova-plugin-quikkly.git', 14 | platforms: ['Android', 'iOS'], 15 | }) 16 | @Injectable() 17 | export class QuikklyPlugin extends IonicNativePlugin { 18 | @Cordova() 19 | openScanner(): Promise { 20 | return; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/regula-document-reader/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @paid 6 | * @beta 7 | * @name Regula Document Reader 8 | * @description 9 | * Plugin for reading and validation of identification documents. 10 | * 11 | * @usage 12 | * ```typescript 13 | * import { RegulaDocumentReader } from '@ionic-native/regula-document-reader/ngx'; 14 | * 15 | * let license; // read regula.license file 16 | * RegulaDocumentReader.initReader(license); // initialize reader 17 | * RegulaDocumentReader.scanDocument().then((result) => { 18 | * // read result 19 | * }) 20 | * ``` 21 | */ 22 | @Plugin({ 23 | pluginName: 'Regula Document Reader', 24 | plugin: 'cordova-plugin-documentreader', 25 | pluginRef: 'DocumentReader', 26 | repo: 'https://github.com/regulaforensics/cordova-plugin-documentreader.git', 27 | platforms: ['iOS', 'Android'], 28 | install: 'ionic plugin add cordova-plugin-documentreader --variable CAMERA_USAGE_DESCRIPTION="To take photo"', 29 | }) 30 | @Injectable() 31 | export class RegulaDocumentReader extends IonicNativePlugin { 32 | /** 33 | * Initialize the scanner 34 | * @param license {any} License data 35 | */ 36 | @Cordova() 37 | initReader(license: any): void {} 38 | 39 | /** 40 | * Run the scanner 41 | * @return {Promise} Returns a promise that resolves when results was got, and fails when not 42 | */ 43 | @Cordova() 44 | scanDocument(): Promise { 45 | return; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/rollbar/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @beta 6 | * @name Rollbar 7 | * @description 8 | * This plugin adds [Rollbar](https://rollbar.com/) App monitoring to your application 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { Rollbar } from '@ionic-native/rollbar/ngx'; 13 | * 14 | * constructor(private rollbar: Rollbar) { } 15 | * 16 | * ... 17 | * 18 | * this.rollbar.init(); 19 | * 20 | * ``` 21 | */ 22 | @Plugin({ 23 | pluginName: 'Rollbar', 24 | plugin: 'resgrid-cordova-plugins-rollbar', 25 | pluginRef: 'cordova.plugins.Rollbar', 26 | repo: 'https://github.com/Resgrid/cordova-plugins-rollbar', 27 | install: 28 | 'ionic cordova plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN="YOUR_ROLLBAR_ACCEESS_TOKEN" --variable ROLLBAR_ENVIRONMENT="ROLLBAR_ENVIRONMENT"', 29 | installVariables: ['ROLLBAR_ACCESS_TOKEN', 'ROLLBAR_ENVIRONMENT'], 30 | platforms: ['Android', 'iOS'], 31 | }) 32 | @Injectable() 33 | export class Rollbar extends IonicNativePlugin { 34 | /** 35 | * This function initializes the monitoring of your application 36 | * @return {Promise} Returns a promise that resolves when the plugin successfully initializes 37 | */ 38 | @Cordova() 39 | init(): Promise { 40 | return; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/sensors/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export const enum TYPE_SENSOR { 5 | PROXIMITY = 'PROXIMITY', 6 | ACCELEROMETER = 'ACCELEROMETER', 7 | GRAVITY = 'GRAVITY', 8 | GYROSCOPE = 'GYROSCOPE', 9 | GYROSCOPE_UNCALIBRATED = 'GYROSCOPE_UNCALIBRATED', 10 | LINEAR_ACCELERATION = 'LINEAR_ACCELERATION', 11 | ROTATION_VECTOR = 'ROTATION_VECTOR', 12 | STEP_COUNTER = 'STEP_COUNTER', 13 | GAME_ROTATION_VECTOR = 'GAME_ROTATION_VECTOR', 14 | GEOMAGNETIC_ROTATION_VECTOR = 'GEOMAGNETIC_ROTATION_VECTOR', 15 | MAGNETIC_FIELD = 'MAGNETIC_FIELD', 16 | MAGNETIC_FIELD_UNCALIBRATED = 'MAGNETIC_FIELD_UNCALIBRATED', 17 | ORIENTATION = 'ORIENTATION', 18 | AMBIENT_TEMPERATURE = 'AMBIENT_TEMPERATURE', 19 | LIGHT = 'LIGHT', 20 | PRESSURE = 'PRESSURE', 21 | RELATIVE_HUMIDITY = 'RELATIVE_HUMIDITY', 22 | TEMPERATURE = 'TEMPERATURE', 23 | } 24 | 25 | /** 26 | * @name Sensors 27 | * @description 28 | * This plugin enables sensors on Android devices 29 | * 30 | * @usage 31 | * ```typescript 32 | * import { Sensors, TYPE_SENSOR } from '@ionic-native/sensors/ngx'; 33 | * 34 | * 35 | * constructor(private sensors: Sensors) { } 36 | * 37 | * ... 38 | * 39 | * 40 | * this.sensors.enableSensor(TYPE_SENSOR.LIGHT); 41 | * 42 | * ``` 43 | */ 44 | @Plugin({ 45 | pluginName: 'Sensors', 46 | plugin: 'https://github.com/fabiorogeriosj/cordova-plugin-sensors.git', 47 | pluginRef: 'sensors', 48 | repo: 'https://github.com/fabiorogeriosj/cordova-plugin-sensors.git', 49 | platforms: ['Android'], 50 | }) 51 | @Injectable() 52 | export class Sensors extends IonicNativePlugin { 53 | /** 54 | * This function enables the sensor 55 | * @param {string} TYPE_SENSOR Specify the sensor to enable 56 | * @return {Promise} Returns a promise that resolves when something happens 57 | */ 58 | @Cordova() 59 | enableSensor(TYPE_SENSOR: string): Promise { 60 | return; 61 | } 62 | 63 | /** 64 | * This function disables the sensor 65 | * @return {Promise} Returns a promise that resolves when something happens 66 | */ 67 | @Cordova() 68 | disableSensor(): Promise { 69 | return; 70 | } 71 | 72 | /** 73 | * This function calls the success callback 74 | * @return {Promise} Returns sensor state 75 | */ 76 | @Cordova() 77 | getState(): Promise { 78 | return; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/service-discovery/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name ServiceDiscovery 6 | * @description 7 | * Simple plugin to get any SSDP / UPnP / DLNA service on a local network 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { ServiceDiscovery } from '@ionic-native/service-discovery'; 12 | * 13 | * 14 | * constructor(private serviceDiscovery: ServiceDiscovery) { } 15 | * 16 | * ... 17 | * 18 | * 19 | * this.serviceDiscovery.getNetworkServices('ssdp:all') 20 | * .then(devices => console.log(devices)) 21 | * .catch(error => console.error(error)); 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'ServiceDiscovery', 27 | plugin: 'cordova-plugin-discovery', 28 | pluginRef: 'serviceDiscovery', 29 | repo: 'https://github.com/scottdermott/cordova-plugin-discovery', 30 | platforms: ['Android', 'iOS'], 31 | }) 32 | @Injectable() 33 | export class ServiceDiscovery extends IonicNativePlugin { 34 | /** 35 | * Finds and returns metadata about devices discovered on the network via SSDP / UPnP / DLNA 36 | * @param service {string} The service name to discover 37 | * @return {Promise} Returns a promise that resolves when something happens 38 | */ 39 | @Cordova() 40 | getNetworkServices(service: string): Promise { 41 | return; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/shake/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | import { Observable } from 'rxjs'; 4 | /** 5 | * @name Shake 6 | * @description Handles shake gesture 7 | * @usage 8 | * ```typescript 9 | * import { Shake } from '@ionic-native/shake/ngx'; 10 | * 11 | * constructor(private shake: Shake) { } 12 | * 13 | * ... 14 | * 15 | * const watch = this.shake.startWatch(60).subscribe(() => { 16 | * // do something 17 | * }); 18 | * 19 | * watch.unsubscribe(); 20 | * ``` 21 | */ 22 | @Plugin({ 23 | pluginName: 'Shake', 24 | plugin: 'cordova-plugin-shake', 25 | pluginRef: 'shake', 26 | repo: 'https://github.com/leecrossley/cordova-plugin-shake', 27 | platforms: ['iOS'], 28 | }) 29 | @Injectable() 30 | export class Shake extends IonicNativePlugin { 31 | /** 32 | * Watch for shake gesture 33 | * @param sensitivity {number} Optional sensitivity parameter. Defaults to 40 34 | * @returns {Observable} 35 | */ 36 | @Cordova({ 37 | observable: true, 38 | clearFunction: 'stopWatch', 39 | successIndex: 0, 40 | errorIndex: 2, 41 | }) 42 | startWatch(sensitivity?: number): Observable { 43 | return; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/shop-checkout/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name ShopCheckout 6 | * @description 7 | * This is a plugin that allows your Ionic app to use ShopChecout for Android. 8 | * Follow the offical documentation to setup this plugin correctly: https://developer.shoptopup.com/docs/shoptopup-for-cordovaphonegap 9 | * 10 | * @usage 11 | * ```typescript 12 | * import { ShopCheckout } from '@ionic-native/shop-checkout/ngx'; 13 | * 14 | * 15 | * constructor(private shopCheckout: ShopCheckout) { } 16 | * 17 | * ... 18 | * 19 | * this.shopCheckout.registerAgent(); 20 | * ... 21 | * this.shopCheckout.openProducts(); 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'ShopCheckout', 27 | plugin: 'cordova-plugin-shop-checkout', 28 | pluginRef: 'shopCheckout', 29 | repo: 'https://github.com/tradedepot/cordova-shop-checkout', 30 | platforms: ['Android'], 31 | }) 32 | @Injectable() 33 | export class ShopCheckout extends IonicNativePlugin { 34 | /** 35 | * Register an agent 36 | * @param options {any} Options 37 | * @return {Promise} Returns a promise 38 | */ 39 | @Cordova() 40 | registerAgent(options: any): Promise { 41 | return; 42 | } 43 | 44 | /** 45 | * Open products view 46 | * @param options {any} Options 47 | * @return {Promise} Returns a promise 48 | */ 49 | @Cordova() 50 | openProducts(options: any): Promise { 51 | return; 52 | } 53 | 54 | /** 55 | * Open trannsactions view 56 | * @param options {any} Options 57 | * @return {Promise} Returns a promise 58 | */ 59 | @Cordova() 60 | openTransactions(options: any): Promise { 61 | return; 62 | } 63 | 64 | /** 65 | * @return {Promise} Returns a promise 66 | */ 67 | @Cordova() 68 | logout(options: any): Promise { 69 | return; 70 | } 71 | 72 | /** 73 | * @return {Promise} Returns a promise 74 | */ 75 | @Cordova() 76 | isInitialized(): Promise { 77 | return; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/sim/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Sim 6 | * @description 7 | * Gets info from the Sim card like the carrier name, mcc, mnc and country code and other system dependent info. 8 | * 9 | * Requires Cordova plugin: `cordova-plugin-sim`. For more info, please see the [Cordova Sim docs](https://github.com/pbakondy/cordova-plugin-sim). 10 | * 11 | * @usage 12 | * ```typescript 13 | * import { Sim } from '@ionic-native/sim/ngx'; 14 | * 15 | * 16 | * constructor(private sim: Sim) { } 17 | * 18 | * ... 19 | * 20 | * this.sim.getSimInfo().then( 21 | * (info) => console.log('Sim info: ', info), 22 | * (err) => console.log('Unable to get sim info: ', err) 23 | * ); 24 | * 25 | * this.sim.hasReadPermission().then( 26 | * (info) => console.log('Has permission: ', info) 27 | * ); 28 | * 29 | * this.sim.requestReadPermission().then( 30 | * () => console.log('Permission granted'), 31 | * () => console.log('Permission denied') 32 | * ); 33 | * ``` 34 | */ 35 | @Plugin({ 36 | pluginName: 'Sim', 37 | plugin: 'cordova-plugin-sim', 38 | pluginRef: 'plugins.sim', 39 | repo: 'https://github.com/pbakondy/cordova-plugin-sim', 40 | platforms: ['Android', 'iOS', 'Windows', 'Windows Phone'], 41 | }) 42 | @Injectable() 43 | export class Sim extends IonicNativePlugin { 44 | /** 45 | * Returns info from the SIM card. 46 | * @returns {Promise} 47 | */ 48 | @Cordova() 49 | getSimInfo(): Promise { 50 | return; 51 | } 52 | 53 | /** 54 | * Check permission 55 | * @returns {Promise} 56 | */ 57 | @Cordova({ 58 | platforms: ['Android'], 59 | }) 60 | hasReadPermission(): Promise { 61 | return; 62 | } 63 | 64 | /** 65 | * Request permission 66 | * @returns {Promise} 67 | */ 68 | @Cordova({ 69 | platforms: ['Android'], 70 | }) 71 | requestReadPermission(): Promise { 72 | return; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/sms-retriever/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Sms Retriever 6 | * @description 7 | * This plugin retrives the SMS which arrive without requiring READ permissions. 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { SmsRetriever } from '@ionic-native/sms-retriever'; 12 | * 13 | * 14 | * constructor(private smsRetriever: SmsRetriever) { } 15 | * 16 | * ... 17 | * 18 | * 19 | * this.smsRetriever.getAppHash() 20 | * .then((res: any) => console.log(res)) 21 | * .catch((error: any) => console.error(error)); 22 | * this.smsRetriever.startWatching() 23 | * .then((res: any) => console.log(res)) 24 | * .catch((error: any) => console.error(error)); 25 | * 26 | * ``` 27 | */ 28 | @Plugin({ 29 | pluginName: 'SmsRetriever', 30 | plugin: 'cordova-plugin-sms-retriever-manager', 31 | pluginRef: 'cordova.plugins.smsRetriever', 32 | repo: 'https://github.com/hanatharesh2712/ionic-native-sms-retriever-plugin-master', 33 | install: 'ionic cordova plugin add cordova-plugin-sms-retriever-manager --variable PLAY_SERVICES_VERSION="15.0.1"', 34 | installVariables: ['PLAY_SERVICES_VERSION'], 35 | platforms: ['Android'], 36 | }) 37 | @Injectable() 38 | export class SmsRetriever extends IonicNativePlugin { 39 | /** 40 | * This function start wathching message arrive event and retrive message text. 41 | * @return {Promise} Returns a promise that resolves when retrives SMS text or TIMEOUT after 5 min. 42 | */ 43 | @Cordova() 44 | startWatching(): Promise { 45 | return; 46 | } 47 | 48 | /** 49 | * This function is to get hash string of APP. 50 | * @return {Promise} Returns a promise that resolves when successfully generate hash of APP. 51 | */ 52 | @Cordova() 53 | getAppHash(): Promise { 54 | return; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/sms/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * Options for sending an SMS 6 | */ 7 | export interface SmsOptions { 8 | /** 9 | * Set to true to replace \n by a new line. Default: false 10 | */ 11 | replaceLineBreaks?: boolean; 12 | 13 | android?: SmsOptionsAndroid; 14 | } 15 | 16 | export interface SmsOptionsAndroid { 17 | /** 18 | * Set to "INTENT" to send SMS with the native android SMS messaging. Leaving it empty will send the SMS without opening any app. 19 | */ 20 | intent?: string; 21 | } 22 | 23 | /** 24 | * @name SMS 25 | * @description 26 | * 27 | * Requires Cordova plugin: cordova-sms-plugin. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin). 28 | * 29 | * @usage 30 | * ```typescript 31 | * import { SMS } from '@ionic-native/sms/ngx'; 32 | * 33 | * constructor(private sms: SMS) { } 34 | * 35 | * 36 | * ... 37 | * 38 | * 39 | * // Send a text message using default options 40 | * this.sms.send('416123456', 'Hello world!'); 41 | * ``` 42 | * @interfaces 43 | * SmsOptions 44 | * SmsOptionsAndroid 45 | */ 46 | @Plugin({ 47 | pluginName: 'SMS', 48 | plugin: 'cordova-sms-plugin', 49 | pluginRef: 'sms', 50 | repo: 'https://github.com/cordova-sms/cordova-sms-plugin', 51 | platforms: ['Android', 'iOS', 'Windows', 'Windows Phone 8'], 52 | }) 53 | @Injectable() 54 | export class SMS extends IonicNativePlugin { 55 | /** 56 | * Sends sms to a number 57 | * @param phoneNumber {string|string[]} Phone number 58 | * @param message {string} Message 59 | * @param options {SmsOptions} Options 60 | * @returns {Promise} Resolves promise when the SMS has been sent 61 | */ 62 | @Cordova({ 63 | successIndex: 3, 64 | errorIndex: 4, 65 | }) 66 | send(phoneNumber: string | string[], message: string, options?: SmsOptions): Promise { 67 | return; 68 | } 69 | 70 | /** 71 | * This function lets you know if the app has permission to send SMS 72 | * @return {Promise} returns a promise that resolves with a boolean that indicates if we have permission 73 | */ 74 | @Cordova({ 75 | platforms: ['Android'], 76 | }) 77 | hasPermission(): Promise { 78 | return; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/speechkit/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name SpeechKit 6 | * @description 7 | * Implementation of Nuance SpeechKit SDK on Ionic 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { SpeechKit } from '@ionic-native/speechkit/ngx'; 12 | * 13 | * constructor(private speechkit: SpeechKit) { } 14 | * 15 | * 16 | * // find voice names that match language from: https://developer.nuance.com/public/index.php?task=supportedLanguages 17 | * this.speechkit.tts('Text to be read out loud', 'ENG-GBR', 'Serena').then( 18 | * (msg) => { console.log(msg); }, 19 | * (err) => { console.log(err); } 20 | * ); 21 | * ``` 22 | */ 23 | @Plugin({ 24 | pluginName: 'SpeechKit', 25 | plugin: 'cordova-plugin-nuance-speechkit', 26 | pluginRef: 'plugins.speechkit', 27 | repo: 'https://github.com/Shmarkus/cordova-plugin-nuance-speechkit', 28 | platforms: ['Android', 'iOS'], 29 | }) 30 | @Injectable() 31 | export class SpeechKit extends IonicNativePlugin { 32 | /** 33 | * Speak text out loud in given language 34 | * @returns {Promise} 35 | */ 36 | @Cordova() 37 | tts(text: string, language: string, voice: string): Promise { 38 | return; 39 | } 40 | 41 | /** 42 | * Try to recognize what the user said 43 | * @returns {Promise} 44 | */ 45 | @Cordova({ 46 | platforms: ['Android'], 47 | }) 48 | asr(language: string): Promise { 49 | return; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/spinner-dialog/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface SpinnerDialogIOSOptions { 5 | /** 6 | * Opacity of the overlay, between 0 (transparent) and 1 (opaque). Default: 0.35 7 | */ 8 | overlayOpacity?: number; 9 | 10 | /** 11 | * Red component of the text color, between 0 and 1. Default: 1 12 | */ 13 | textColorRed?: number; 14 | 15 | /** 16 | * Green component of the text color, between 0 and 1. Default: 1 17 | */ 18 | textColorGreen?: number; 19 | 20 | /** 21 | * Blue component of the text color, between 0 and 1. Default: 1 22 | */ 23 | textColorBlue?: number; 24 | } 25 | 26 | /** 27 | * @name Spinner Dialog 28 | * @description 29 | * Cordova plugin for showing a native spinner based on Paldom/SpinnerDialog. 30 | * 31 | * Requires Cordova plugin: `cordova-plugin-native-spinner`. For more info, please see the [Spinner Dialog plugin docs](https://github.com/greybax/cordova-plugin-native-spinner). 32 | * 33 | * @usage 34 | * ```typescript 35 | * import { SpinnerDialog } from '@ionic-native/spinner-dialog/ngx'; 36 | * 37 | * constructor(private spinnerDialog: SpinnerDialog) { } 38 | * 39 | * ... 40 | * 41 | * this.spinnerDialog.show(); 42 | * 43 | * this.spinnerDialog.hide(); 44 | * ``` 45 | * @interfaces 46 | * SpinnerDialogIOSOptions 47 | */ 48 | @Plugin({ 49 | pluginName: 'SpinnerDialog', 50 | plugin: 'cordova-plugin-native-spinner', 51 | pluginRef: 'SpinnerDialog', 52 | repo: 'https://github.com/greybax/cordova-plugin-native-spinner', 53 | platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows'], 54 | }) 55 | @Injectable() 56 | export class SpinnerDialog extends IonicNativePlugin { 57 | /** 58 | * Shows the spinner dialog 59 | * @param title {string} Spinner title (shows on Android only) 60 | * @param message {string} Spinner message 61 | * @param cancelCallback {boolean|function} Set to true to set spinner not cancelable. Or provide a function to call when the user cancels the spinner. 62 | * @param iOSOptions {object} Options for iOS only 63 | */ 64 | @Cordova({ 65 | sync: true, 66 | }) 67 | show(title?: string, message?: string, cancelCallback?: any, iOSOptions?: SpinnerDialogIOSOptions): void {} 68 | 69 | /** 70 | * Hides the spinner dialog if visible 71 | */ 72 | @Cordova({ 73 | sync: true, 74 | }) 75 | hide(): void {} 76 | } 77 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/splash-screen/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Splash Screen 6 | * @premier splashscreen 7 | * @capacitorincompatible true 8 | * @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded. 9 | * @usage 10 | * ```typescript 11 | * import { SplashScreen } from '@ionic-native/splash-screen/ngx'; 12 | * 13 | * constructor(private splashScreen: SplashScreen) { } 14 | * 15 | * ... 16 | * 17 | * this.splashScreen.show(); 18 | * 19 | * this.splashScreen.hide(); 20 | * ``` 21 | */ 22 | @Plugin({ 23 | pluginName: 'SplashScreen', 24 | plugin: 'cordova-plugin-splashscreen', 25 | pluginRef: 'navigator.splashscreen', 26 | repo: 'https://github.com/apache/cordova-plugin-splashscreen', 27 | platforms: ['Amazon Fire OS', 'Android', 'iOS', 'Windows'], 28 | }) 29 | @Injectable() 30 | export class SplashScreen extends IonicNativePlugin { 31 | /** 32 | * Shows the splashscreen 33 | */ 34 | @Cordova({ 35 | sync: true, 36 | }) 37 | show(): void {} 38 | 39 | /** 40 | * Hides the splashscreen 41 | */ 42 | @Cordova({ 43 | sync: true, 44 | }) 45 | hide(): void {} 46 | } 47 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/ssh-connect/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name SSH Connect 6 | * @description 7 | * Cordova plugin to make connections and execute commands through SSH 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { SSHConnect } from '@ionic-native/ssh-connect/ngx'; 12 | * 13 | * 14 | * constructor(private sshConnect: SSHConnect) { } 15 | * 16 | * ... 17 | * 18 | * 19 | * this.sshConnect.connect('user', 'password', 'host', port) 20 | * .then(resp => console.log(resp)) 21 | * .catch(error => console.error(error)); 22 | * 23 | * this.sshConnect.executeCommand('command') 24 | * .then(resp => console.log(resp)) 25 | * .catch(error => console.error(error)); 26 | * 27 | * this.sshConnect.disconnect() 28 | * .then(resp => console.log(resp)) 29 | * .catch(error => console.error(error)); 30 | * 31 | * ``` 32 | */ 33 | @Plugin({ 34 | pluginName: 'SSHConnect', 35 | plugin: 'cordova-plugin-ssh-connect', 36 | pluginRef: 'cordova.plugins.sshConnect', 37 | repo: 'https://github.com/JosePerez27/cordova-plugin-ssh-connect', 38 | platforms: ['Android'], 39 | }) 40 | @Injectable() 41 | export class SSHConnect extends IonicNativePlugin { 42 | /** 43 | * Establish a remote ssh connection 44 | * @param {user} user The remote host user 45 | * @param {password} password The remote host password 46 | * @param {host} host The remote device to connect 47 | * @param {port} port The SSH port for connection (usually port 22) 48 | * @return {Promise} Returns an promise that resolves with the success of the connection 49 | */ 50 | @Cordova() 51 | connect(user: string, password: string, host: string, port: number): Promise { 52 | return; 53 | } 54 | 55 | /** 56 | * Execute a command on the remote host connected by ssh 57 | * @param {command} command The command to execute 58 | * @return {Promise} Returns an promise that resolves with the printed text on the remote console 59 | */ 60 | @Cordova() 61 | executeCommand(command: string): Promise { 62 | return; 63 | } 64 | 65 | /** 66 | * Disconnect the SSH session 67 | * @return {Promise} Returns an promise that resolves with the success of the disconnection 68 | */ 69 | @Cordova() 70 | disconnect(): Promise { 71 | return; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/tealium-adidentifier/index.ts: -------------------------------------------------------------------------------- 1 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 2 | import { Injectable } from '@angular/core'; 3 | 4 | /** 5 | * @paid 6 | * @name TealiumAdIdentifier 7 | * @description 8 | * This module depends on the [Tealium Cordova Plugin](https://github.com/tealium/cordova-plugin). Without it, this module will not do anything. 9 | * Makes the IDFA and Google Ad Identifier available in the Tealium data layer. 10 | * 11 | * @usage 12 | * ``` 13 | * import { TealiumAdIdentifier } from '@ionic-native/tealium-adidentifier/ngx'; 14 | * 15 | * 16 | * constructor(private adIdentifier: TealiumAdIdentifier) { } 17 | * 18 | * ... 19 | * 20 | * 21 | * this.adIdentifier.setPersistent("main"); 22 | * this.adIdentifier.setVolatile("main"); 23 | * 24 | * ``` 25 | */ 26 | 27 | @Plugin({ 28 | pluginName: 'TealiumAdIdentifier', 29 | plugin: 'tealium-cordova-adidentifier', // npm package name, example: cordova-plugin-camera 30 | pluginRef: 'window.tealiumAdIdentifier', // the variable reference to call the plugin, example: navigator.geolocation 31 | repo: 'https://github.com/Tealium/cordova-plugin', // the github repository URL for the plugin 32 | platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] 33 | install: '', // OPTIONAL install command, in case the plugin requires variables 34 | }) 35 | @Injectable() 36 | export class TealiumAdIdentifier extends IonicNativePlugin { 37 | /** 38 | * This function stores the ad identifier information as persistent data 39 | * @param instanceName {string} Your arbitrary Tealium instance name provided at init time 40 | * @return {Promise} Returns a promise that resolves when something happens 41 | */ 42 | @Cordova() 43 | setPersistent(instanceName: string): Promise { 44 | return; 45 | } 46 | 47 | /** 48 | * This function stores the ad identifier information as volatile data 49 | * @param instanceName {string} Your arbitrary Tealium instance name provided at init time 50 | * @return {Promise} Returns a promise that resolves when something happens 51 | */ 52 | @Cordova() 53 | setVolatile(instanceName: string): Promise { 54 | return; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/tealium-installreferrer/index.ts: -------------------------------------------------------------------------------- 1 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 2 | import { Injectable } from '@angular/core'; 3 | 4 | /** 5 | * @paid 6 | * @name TealiumInstallReferrer 7 | * @description 8 | * This module depends on the [Tealium Cordova Plugin](https://github.com/tealium/cordova-plugin). Without it, this module will not do anything. 9 | * Implements a Broadcast Receiver for the INSTALL_REFERRER intent. 10 | * 11 | * @usage 12 | * ``` 13 | * import { TealiumInstallReferrer } from '@ionic-native/tealium-installreferrer/ngx'; 14 | * 15 | * 16 | * constructor(private installReferrer: TealiumInstallReferrer) { } 17 | * 18 | * 19 | * this.installReferrer.setPersistent("main"); 20 | * this.installReferrer.setVolatile("main"); 21 | * 22 | * 23 | * 24 | * ``` 25 | */ 26 | 27 | @Plugin({ 28 | pluginName: 'TealiumInstallReferrer', 29 | plugin: 'tealium-cordova-installreferrer', // npm package name, example: cordova-plugin-camera 30 | pluginRef: 'window.tealiumInstallReferrer', // the variable reference to call the plugin, example: navigator.geolocation 31 | repo: 'https://github.com/Tealium/cordova-plugin', // the github repository URL for the plugin 32 | platforms: ['Android'], // Array of platforms supported, example: ['Android', 'iOS'] 33 | install: '', // OPTIONAL install command, in case the plugin requires variables 34 | }) 35 | @Injectable() 36 | export class TealiumInstallReferrer extends IonicNativePlugin { 37 | /** 38 | * This function stores the install referrer information as persistent data 39 | * @param instanceName {string} Your arbitrary Tealium instance name provided at init time 40 | * @return {Promise} Returns a promise that resolves when something happens 41 | */ 42 | @Cordova() 43 | setPersistent(instanceName: string): Promise { 44 | return; 45 | } 46 | 47 | /** 48 | * This function stores the install referrer information as volatile data 49 | * @param instanceName {string} Your arbitrary Tealium instance name provided at init time 50 | * @return {Promise} Returns a promise that resolves when something happens 51 | */ 52 | @Cordova() 53 | setVolatile(instanceName: string): Promise { 54 | return; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/text-to-speech/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface TTSOptions { 5 | /** text to speak */ 6 | text: string; 7 | /** a string like 'en-US', 'zh-CN', etc */ 8 | locale?: string; 9 | /** speed rate, 0 ~ 1 */ 10 | rate?: number; 11 | } 12 | 13 | /** 14 | * @name Text To Speech 15 | * @description 16 | * Text to Speech plugin 17 | * 18 | * @usage 19 | * ```typescript 20 | * import { TextToSpeech } from '@ionic-native/text-to-speech/ngx'; 21 | * 22 | * constructor(private tts: TextToSpeech) { } 23 | * 24 | * ... 25 | * 26 | * this.tts.speak('Hello World') 27 | * .then(() => console.log('Success')) 28 | * .catch((reason: any) => console.log(reason)); 29 | * 30 | * ``` 31 | * @interfaces 32 | * TTSOptions 33 | */ 34 | @Plugin({ 35 | pluginName: 'Text To Speech', 36 | plugin: 'cordova-plugin-tts', 37 | pluginRef: 'TTS', 38 | repo: 'https://github.com/vilic/cordova-plugin-tts', 39 | platforms: ['Android', 'iOS', 'Windows Phone 8'], 40 | }) 41 | @Injectable() 42 | export class TextToSpeech extends IonicNativePlugin { 43 | /** 44 | * This function speaks 45 | * @param textOrOptions {string | TTSOptions} Text to speak or TTSOptions 46 | * @return {Promise} Returns a promise that resolves when the speaking finishes 47 | */ 48 | @Cordova({ 49 | successIndex: 1, 50 | errorIndex: 2, 51 | }) 52 | speak(textOrOptions: string | TTSOptions): Promise { 53 | return; 54 | } 55 | 56 | /** 57 | * Stop any current TTS playback 58 | * @return {Promise} 59 | */ 60 | @Cordova() 61 | stop(): Promise { 62 | return; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/theme-detection/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; 3 | 4 | export interface ThemeDetectionResponse { 5 | // Boolean value about the status of the request 6 | value: boolean; 7 | 8 | // Message for readable usage 9 | message: string; 10 | } 11 | 12 | /** 13 | * @beta 14 | * @name Theme Detection 15 | * @description 16 | * Cordova plugin to detect whether dark mode is enabled or not 17 | * 18 | * @usage 19 | * ```typescript 20 | * import { ThemeDetection } from '@ionic-native/theme-detection'; 21 | * 22 | * 23 | * constructor(private themeDetection: ThemeDetection) { } 24 | * 25 | * ... 26 | * 27 | * this.themeDetection.isAvailable() 28 | * .then((res: ThemeDetectionResponse) => { 29 | * if(res.value) { 30 | * this.themeDetection.isDarkModeEnabled().then((res: ThemeDetectionResponse) => { 31 | * console.log(res); 32 | * }) 33 | * .catch((error: any) => console.error(error)); 34 | * } 35 | * }) 36 | * .catch((error: any) => console.error(error)); 37 | * 38 | * ``` 39 | */ 40 | @Plugin({ 41 | pluginName: 'ThemeDetection', 42 | plugin: 'cordova-plugin-theme-detection', 43 | pluginRef: 'cordova.plugins.ThemeDetection', 44 | repo: 'https://github.com/mariusbackes/cordova-plugin-theme-detection', 45 | install: 'cordova plugin add cordova-plugin-theme-detection', 46 | installVariables: [], 47 | platforms: ['iOS', 'Android'], 48 | }) 49 | @Injectable() 50 | export class ThemeDetection extends IonicNativePlugin { 51 | /** 52 | * 53 | * @return {Promise} 54 | * Returns a promise with an object that has a boolean property which gives information if the detection is available or not 55 | */ 56 | @Cordova() 57 | isAvailable(): Promise { 58 | return; 59 | } 60 | 61 | /** 62 | * 63 | * @return {Promise} 64 | * Returns a promise with an object that has a boolean property which gives information if dark mode is enabled or not 65 | */ 66 | @Cordova() 67 | isDarkModeEnabled(): Promise { 68 | return; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/uid/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CordovaProperty, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Uid 6 | * @description 7 | * Get unique identifiers: UUID, IMEI, IMSI, ICCID and MAC. 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { Uid } from '@ionic-native/uid/ngx'; 12 | * import { AndroidPermissions } from '@ionic-native/android-permissions/ngx'; 13 | * 14 | * constructor(private uid: Uid, private androidPermissions: AndroidPermissions) { } 15 | * 16 | * 17 | * async getImei() { 18 | * const { hasPermission } = await this.androidPermissions.checkPermission( 19 | * this.androidPermissions.PERMISSION.READ_PHONE_STATE 20 | * ); 21 | * 22 | * if (!hasPermission) { 23 | * const result = await this.androidPermissions.requestPermission( 24 | * this.androidPermissions.PERMISSION.READ_PHONE_STATE 25 | * ); 26 | * 27 | * if (!result.hasPermission) { 28 | * throw new Error('Permissions required'); 29 | * } 30 | * 31 | * // ok, a user gave us permission, we can get him identifiers after restart app 32 | * return; 33 | * } 34 | * 35 | * return this.uid.IMEI 36 | * } 37 | * ``` 38 | */ 39 | @Plugin({ 40 | pluginName: 'Uid', 41 | plugin: 'cordova-plugin-uid', 42 | pluginRef: 'cordova.plugins.uid', 43 | repo: 'https://github.com/lionelhe/cordova-plugin-uid', 44 | platforms: ['Android'], 45 | }) 46 | @Injectable() 47 | export class Uid extends IonicNativePlugin { 48 | /** Get the device Universally Unique Identifier (UUID). */ 49 | @CordovaProperty() 50 | UUID: string; 51 | 52 | /** Get the device International Mobile Station Equipment Identity (IMEI). */ 53 | @CordovaProperty() 54 | IMEI: string; 55 | 56 | /** Get the device International mobile Subscriber Identity (IMSI). */ 57 | @CordovaProperty() 58 | IMSI: string; 59 | 60 | /** Get the sim Integrated Circuit Card Identifier (ICCID). */ 61 | @CordovaProperty() 62 | ICCID: string; 63 | 64 | /** Get the Media Access Control address (MAC). */ 65 | @CordovaProperty() 66 | MAC: string; 67 | } 68 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/unique-device-id/index.ts: -------------------------------------------------------------------------------- 1 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 2 | import { Injectable } from '@angular/core'; 3 | 4 | /** 5 | * @name Unique Device ID 6 | * @description 7 | * This plugin produces a unique, cross-install, app-specific device id. 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { UniqueDeviceID } from '@ionic-native/unique-device-id/ngx'; 12 | * 13 | * constructor(private uniqueDeviceID: UniqueDeviceID) { } 14 | * 15 | * ... 16 | * 17 | * this.uniqueDeviceID.get() 18 | * .then((uuid: any) => console.log(uuid)) 19 | * .catch((error: any) => console.log(error)); 20 | * 21 | * ``` 22 | */ 23 | @Plugin({ 24 | pluginName: 'UniqueDeviceID', 25 | plugin: 'cordova-plugin-uniquedeviceid', 26 | pluginRef: 'window.plugins.uniqueDeviceID', 27 | repo: 'https://github.com/Paldom/UniqueDeviceID', 28 | platforms: ['Android', 'iOS', 'Windows Phone 8'], 29 | }) 30 | @Injectable() 31 | export class UniqueDeviceID extends IonicNativePlugin { 32 | /** 33 | * Gets a unique, cross-install, app-specific device id. 34 | * @return {Promise} Returns a promise that resolves when something happens 35 | */ 36 | @Cordova() 37 | get(): Promise { 38 | return; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/uptime/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Uptime 6 | * @description 7 | * This plugin provides the time spent in milliseconds since boot (uptime). 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { Uptime } from '@ionic-native/uptime/ngx'; 12 | * 13 | * constructor(private uptime: Uptime) { } 14 | * 15 | * ... 16 | * 17 | * this.uptime.getUptime(includeDeepSleep) 18 | * .then(uptime => console.log(uptime)) 19 | * .catch(error => console.log(error)); 20 | * 21 | * ``` 22 | */ 23 | @Plugin({ 24 | pluginName: 'Uptime', 25 | plugin: 'cordova-plugin-uptime', 26 | pluginRef: 'Uptime', 27 | repo: 'https://github.com/s1lviu/cordova-plugin-uptime', 28 | platforms: ['Android', 'iOS'], 29 | }) 30 | @Injectable() 31 | export class Uptime extends IonicNativePlugin { 32 | /** 33 | * This function return system uptime 34 | * @param {boolean} includeDeepSleep Set to true to include system deep sleep 35 | * @return {Promise} Returns a promise that return the uptime in milliseconds 36 | */ 37 | @Cordova() 38 | getUptime(includeDeepSleep: boolean): Promise { 39 | return; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/user-agent/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name User Agent 6 | * @description 7 | * The UserAgent plugin provides functions to set the HTTP user-agent header. For more info about User-Agents, please [see the HTTP User-Agent docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent). 8 | * 9 | * Requires Cordova plugin: `cordova-useragent`. For more info, please see the [User-Agent plugin docs](https://github.com/LouisT/cordova-useragent). 10 | * 11 | * @usage 12 | * ```typescript 13 | * import { UserAgent } from '@ionic-native/user-agent/ngx'; 14 | * 15 | * 16 | * constructor(private userAgent: UserAgent) { } 17 | * 18 | * ... 19 | * 20 | * 21 | * this.userAgent.set('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36') 22 | * .then((res: any) => console.log(res)) 23 | * .catch((error: any) => console.error(error)); 24 | * 25 | * * this.userAgent.get() 26 | * .then((res: any) => console.log(res)) 27 | * .catch((error: any) => console.error(error)); 28 | * 29 | * * this.userAgent.reset() 30 | * .then((res: any) => console.log(res)) 31 | * .catch((error: any) => console.error(error)); 32 | * 33 | * ``` 34 | */ 35 | @Plugin({ 36 | pluginName: 'UserAgent', 37 | plugin: 'cordova-plugin-useragent', 38 | pluginRef: 'UserAgent', 39 | repo: 'https://github.com/danielsogl/cordova-plugin-useragent', 40 | platforms: ['Android', 'iOS'], 41 | }) 42 | @Injectable() 43 | export class UserAgent extends IonicNativePlugin { 44 | /** 45 | * Changes the current user-agent to the one sent by argument. 46 | * @param userAgent {string} User-Agent 47 | * @return {Promise} Returns a promise that resolves when the user-agent changes 48 | */ 49 | @Cordova() 50 | set(userAgent: string): Promise { 51 | return; 52 | } 53 | 54 | /** 55 | * Returns the current user-agent string. 56 | * @return {Promise} Returns a promise that resolves when the user-agent is returned 57 | */ 58 | @Cordova() 59 | get(): Promise { 60 | return; 61 | } 62 | 63 | /** 64 | * Sets the user-agent back to default 65 | * @return {Promise} Returns a promise that resolves when the user-agent resets 66 | */ 67 | @Cordova() 68 | reset(): Promise { 69 | return; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/vibration/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Vibration 6 | * @premier vibration 7 | * @description Vibrates the device 8 | * @usage 9 | * ```typescript 10 | * import { Vibration } from '@ionic-native/vibration/ngx'; 11 | * 12 | * constructor(private vibration: Vibration) { } 13 | * 14 | * ... 15 | * 16 | * // Vibrate the device for a second 17 | * // Duration is ignored on iOS. 18 | * this.vibration.vibrate(1000); 19 | * 20 | * // Vibrate 2 seconds 21 | * // Pause for 1 second 22 | * // Vibrate for 2 seconds 23 | * // Patterns work on Android and Windows only 24 | * this.vibration.vibrate([2000,1000,2000]); 25 | * 26 | * // Stop any current vibrations immediately 27 | * // Works on Android and Windows only 28 | * this.vibration.vibrate(0); 29 | * ``` 30 | */ 31 | @Plugin({ 32 | pluginName: 'Vibration', 33 | plugin: 'cordova-plugin-vibration', 34 | pluginRef: 'navigator', 35 | repo: 'https://github.com/apache/cordova-plugin-vibration', 36 | platforms: ['Android', 'iOS', 'Windows'], 37 | }) 38 | @Injectable() 39 | export class Vibration extends IonicNativePlugin { 40 | /** 41 | * Vibrates the device for given amount of time. 42 | * @param time {number|number[]} Milliseconds to vibrate the device. If passed an array of numbers, it will define a vibration pattern. Pass 0 to stop any vibration immediately. 43 | */ 44 | @Cordova({ 45 | sync: true, 46 | }) 47 | vibrate(time: number | number[]) {} 48 | } 49 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/video-player/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * Options for the video playback using the `play` function. 6 | */ 7 | export interface VideoOptions { 8 | /** 9 | * Set the initial volume of the video playback, where 0.0 is 0% volume and 1.0 is 100%. 10 | * For example: for a volume of 30% set the value to 0.3. 11 | */ 12 | volume?: number; 13 | /** 14 | * There are two options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING. 15 | * These strings are the only ones which can be passed as option. 16 | */ 17 | scalingMode?: number; 18 | } 19 | 20 | /** 21 | * @name Video Player 22 | * @description 23 | * A Cordova plugin that simply allows you to immediately play a video in fullscreen mode. 24 | * 25 | * Requires Cordova plugin: `com.moust.cordova.videoplayer`. For more info, please see the [VideoPlayer plugin docs](https://github.com/moust/cordova-plugin-videoplayer). 26 | * 27 | * @usage 28 | * ```typescript 29 | * import { VideoPlayer } from '@ionic-native/video-player/ngx'; 30 | * 31 | * constructor(private videoPlayer: VideoPlayer) { } 32 | * 33 | * ... 34 | * 35 | * // Playing a video. 36 | * this.videoPlayer.play('file:///android_asset/www/movie.mp4').then(() => { 37 | * console.log('video completed'); 38 | * }).catch(err => { 39 | * console.log(err); 40 | * }); 41 | * 42 | * ``` 43 | * @interfaces 44 | * VideoOptions 45 | */ 46 | @Plugin({ 47 | pluginName: 'VideoPlayer', 48 | plugin: 'https://github.com/moust/cordova-plugin-videoplayer.git', 49 | pluginRef: 'VideoPlayer', 50 | repo: 'https://github.com/moust/cordova-plugin-videoplayer', 51 | platforms: ['Android'], 52 | }) 53 | @Injectable() 54 | export class VideoPlayer extends IonicNativePlugin { 55 | /** 56 | * Plays the video from the passed url. 57 | * @param fileUrl {string} File url to the video. 58 | * @param options {VideoOptions?} Optional video playback settings. See options above. 59 | * @returns {Promise} Resolves promise when the video was played successfully. 60 | */ 61 | @Cordova() 62 | play(fileUrl: string, options?: VideoOptions): Promise { 63 | return; 64 | } 65 | 66 | /** 67 | * Stops the video playback immediatly. 68 | */ 69 | @Cordova({ sync: true }) 70 | close(): void {} 71 | } 72 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/youtube-video-player/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | /** 4 | * @name Youtube Video Player 5 | * @description 6 | * Plays YouTube videos in Native YouTube App 7 | * 8 | * @usage 9 | * For Android 5.0+ you will need to add the following to config.xml 10 | * ```xml 11 | * 12 | * ``` 13 | * For more information: https://developers.google.com/youtube/v3/getting-started 14 | * 15 | * 16 | * ```typescript 17 | * import { YoutubeVideoPlayer } from '@ionic-native/youtube-video-player/ngx'; 18 | * 19 | * constructor(private youtube: YoutubeVideoPlayer) { } 20 | * 21 | * ... 22 | * 23 | * 24 | * this.youtube.openVideo('myvideoid'); 25 | * 26 | * ``` 27 | */ 28 | @Plugin({ 29 | pluginName: 'YoutubeVideoPlayer', 30 | plugin: 'cordova-plugin-youtube-video-player', 31 | pluginRef: 'YoutubeVideoPlayer', 32 | repo: 'https://github.com/ihadeed/CordovaYoutubeVideoPlayer', 33 | platforms: ['Android', 'iOS'], 34 | }) 35 | @Injectable() 36 | export class YoutubeVideoPlayer extends IonicNativePlugin { 37 | /** 38 | * Plays a YouTube video 39 | * @param videoId {string} Video ID 40 | */ 41 | @Cordova({ sync: true }) 42 | openVideo(videoId: string): void {} 43 | } 44 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/zbar/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | export interface ZBarOptions { 5 | /** 6 | * A string representing the title text (Android only). 7 | * Default: "Scan QR Code" 8 | */ 9 | text_title?: string; 10 | 11 | /** 12 | * A string representing the instruction text (Android only). 13 | * Default: "Please point your camera at the QR code." 14 | */ 15 | text_instructions?: string; 16 | 17 | /** 18 | * A string defining the active camera when opening the scanner. 19 | * Possible values: "front", "back" 20 | * Default: "back" 21 | */ 22 | camera?: string; 23 | 24 | /** 25 | * A string defining the state of the flash. 26 | * Possible values: "on", "off", "auto" 27 | * Default: "auto" 28 | */ 29 | flash?: string; 30 | 31 | /** 32 | * A boolean to show or hide a line in the center of the scanner. 33 | * Default: true 34 | */ 35 | drawSight?: boolean; 36 | } 37 | 38 | /** 39 | * @name ZBar 40 | * @description 41 | * The ZBar Scanner Plugin allows you to scan 2d barcodes. 42 | * 43 | * Requires Cordova plugin: `cordova-plugin-cszbar`. For more info, please see the [zBar plugin docs](https://github.com/tjwoon/csZBar). 44 | * 45 | * @usage 46 | * ```typescript 47 | * import { ZBar, ZBarOptions } from '@ionic-native/zbar/ngx'; 48 | * 49 | * constructor(private zbar: ZBar) { } 50 | * 51 | * ... 52 | * 53 | * let options: ZBarOptions = { 54 | * flash: 'off', 55 | * drawSight: false 56 | * } 57 | * 58 | * this.zbar.scan(options) 59 | * .then(result => { 60 | * console.log(result); // Scanned code 61 | * }) 62 | * .catch(error => { 63 | * console.log(error); // Error message 64 | * }); 65 | * 66 | * ``` 67 | * 68 | * @interfaces 69 | * ZBarOptions 70 | */ 71 | @Plugin({ 72 | pluginName: 'ZBar', 73 | plugin: 'cordova-plugin-cszbar', 74 | pluginRef: 'cloudSky.zBar', 75 | repo: 'https://github.com/tjwoon/csZBar', 76 | platforms: ['Android', 'iOS'], 77 | }) 78 | @Injectable() 79 | export class ZBar extends IonicNativePlugin { 80 | /** 81 | * Open the scanner 82 | * @param options { ZBarOptions } Scan options 83 | * @returns {Promise} Returns a Promise that resolves with the scanned string, or rejects with an error. 84 | */ 85 | @Cordova() 86 | scan(options: ZBarOptions): Promise { 87 | return; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/@ionic-native/plugins/zip/index.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; 3 | 4 | /** 5 | * @name Zip 6 | * @description 7 | * A Cordova plugin to unzip files in Android and iOS. 8 | * 9 | * @usage 10 | * ```typescript 11 | * import { Zip } from '@ionic-native/zip/ngx'; 12 | * 13 | * constructor(private zip: Zip) { } 14 | * 15 | * ... 16 | * 17 | * this.zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%')) 18 | * .then((result) => { 19 | * if(result === 0) console.log('SUCCESS'); 20 | * if(result === -1) console.log('FAILED'); 21 | * }); 22 | * 23 | * ``` 24 | */ 25 | @Plugin({ 26 | pluginName: 'Zip', 27 | plugin: 'cordova-plugin-zip', 28 | pluginRef: 'zip', 29 | repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip', 30 | platforms: ['Android', 'iOS'], 31 | }) 32 | @Injectable() 33 | export class Zip extends IonicNativePlugin { 34 | /** 35 | * Extracts files from a ZIP archive 36 | * @param sourceZip {string} Source ZIP file 37 | * @param destUrl {string} Destination folder 38 | * @param onProgress {Function} optional callback to be called on progress update 39 | * @returns {Promise} returns a promise that resolves with a number. 0 is success, -1 is error 40 | */ 41 | @Cordova({ 42 | successIndex: 2, 43 | errorIndex: 4, 44 | }) 45 | unzip(sourceZip: string, destUrl: string, onProgress?: Function): Promise { 46 | return; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tsconfig.core.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "declaration": true, 5 | "stripInternal": true, 6 | "experimentalDecorators": true, 7 | "emitDecoratorMetadata": true, 8 | "noImplicitAny": true, 9 | "module": "es2015", 10 | "moduleResolution": "node", 11 | "outDir": "./dist", 12 | "rootDir": "src", 13 | "target": "es5", 14 | "skipLibCheck": true, 15 | "lib": ["es2017", "dom"], 16 | "inlineSources": true, 17 | "sourceMap": true 18 | }, 19 | "include": ["src/@ionic-native/core/**/*.ts"], 20 | "exclude": ["node_modules", "src/@ionic-native/core/**/*.spec.ts"] 21 | } 22 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "declaration": true, 5 | "stripInternal": true, 6 | "experimentalDecorators": true, 7 | "emitDecoratorMetadata": true, 8 | "noImplicitAny": true, 9 | "module": "es2015", 10 | "moduleResolution": "node", 11 | "paths": { 12 | "@ionic-native/core": ["./dist/@ionic-native/core"] 13 | }, 14 | "outDir": "./dist", 15 | "rootDir": "src", 16 | "target": "es5", 17 | "skipLibCheck": true, 18 | "lib": ["es2017", "dom"], 19 | "inlineSources": true, 20 | "inlineSourceMap": true 21 | }, 22 | "include": ["src/@ionic-native/plugins/**/*.ts"], 23 | "angularCompilerOptions": { 24 | "genDir": "aot" 25 | }, 26 | "plugins": [{ "name": "typescript-tslint-plugin" }] 27 | } 28 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint-ionic-rules", "tslint-config-prettier"], 3 | "rules": { 4 | "no-empty": false, 5 | "no-import-side-effect": false, 6 | "no-redundant-jsdoc": false, 7 | "ban-types": false, 8 | "no-shadowed-variable": false, 9 | "no-constant-condition": false, 10 | "no-extra-boolean-cast": false, 11 | "adjacent-overload-signatures": false, 12 | "ter-no-proto": false, 13 | "callable-types": false, 14 | "ordered-imports": false, 15 | "prefer-conditional-expression": false, 16 | "max-classes-per-file": true 17 | } 18 | } 19 | --------------------------------------------------------------------------------