From 45779126aaeed392c93bb357a054fb0fba6b3ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E5=A4=A7=E5=BE=B7?= Date: Tue, 23 Apr 2024 00:27:25 +0800 Subject: [PATCH] =?UTF-8?q?init:=20=E5=AE=8C=E6=88=90=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=8F=90=E7=A4=BA=E5=8C=85=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DEVELOPER.md | 119 +- README.md | 23 +- gulpfile.js | 2 +- scripts/build/helpers.ts | 2 +- .../build/transformers/extract-injectables.ts | 2 +- scripts/build/transformers/plugin-class.ts | 2 +- scripts/docs/config.json | 2 +- scripts/docs/dgeni/dgeni-config.js | 2 +- scripts/docs/dgeni/dgeni-readmes-config.js | 2 +- .../docs/dgeni/templates/readme.template.md | 2 +- scripts/tasks/publish.ts | 8 +- .../plugins/abbyy-rtr/index.ts | 342 -- .../plugins/action-sheet/index.ts | 138 - .../plugins/adjust/index.ts | 818 ----- .../plugins/admob-plus/index.ts | 101 - .../plugins/admob-pro/index.ts | 347 -- .../plugins/admob/index.ts | 588 ---- .../plugins/advanced-image-picker/index.ts | 166 - .../plugins/aes-256/index.ts | 107 - .../plugins/all-in-one-sdk/index.ts | 94 - .../plugins/analytics-firebase/index.ts | 259 -- .../plugins/android-exoplayer/index.ts | 304 -- .../plugins/android-full-screen/index.ts | 162 - .../plugins/android-notch/index.ts | 100 - .../plugins/android-permissions/index.ts | 249 -- .../plugins/anyline/index.ts | 51 - .../plugins/app-availability/index.ts | 53 - .../plugins/app-center-analytics/index.ts | 79 - .../plugins/app-center-crashes/index.ts | 118 - .../plugins/app-center-low-memory/index.ts | 41 - .../plugins/app-center-push/index.ts | 69 - .../plugins/app-center-shared/index.ts | 63 - .../plugins/app-preferences/index.ts | 159 - .../plugins/app-rate/index.ts | 295 -- .../plugins/app-review/index.ts | 55 - .../plugins/app-version/index.ts | 77 - .../plugins/apple-wallet/index.ts | 230 -- .../plugins/applovin/index.ts | 340 -- .../plugins/approov-advanced-http/index.ts | 773 ----- .../plugins/appsflyer/index.ts | 212 -- .../plugins/background-fetch/index.ts | 113 - .../plugins/background-geolocation/index.ts | 913 ----- .../plugins/background-mode/index.ts | 283 -- .../plugins/background-upload/index.ts | 111 - .../plugins/badge/index.ts | 117 - .../plugins/barcode-scanner/index.ts | 154 - .../plugins/battery-status/index.ts | 89 - .../plugins/biocatch/index.ts | 107 - .../plugins/biometric-wrapper/index.ts | 58 - .../plugins/ble/index.ts | 675 ---- .../plugins/blinkid/index.ts | 2949 ----------------- .../bluetooth-classic-serial-port/index.ts | 358 -- .../plugins/bluetooth-le/index.ts | 1175 ------- .../plugins/bluetooth-serial/index.ts | 292 -- .../plugins/branch-io/index.ts | 261 -- .../plugins/brightness/index.ts | 62 - .../plugins/broadcaster/index.ts | 79 - .../plugins/browser-tab/index.ts | 63 - .../plugins/build-info/index.ts | 329 -- .../plugins/calendar/index.ts | 493 --- .../plugins/call-directory/index.ts | 123 - .../plugins/call-number/index.ts | 56 - .../plugins/camera-preview/index.ts | 551 --- .../plugins/camera/index.ts | 268 -- .../plugins/checkout/index.ts | 223 -- .../plugins/chooser-simple-file/index.ts | 64 - .../plugins/chooser/index.ts | 81 - .../plugins/clevertap/index.ts | 1048 ------ .../plugins/clipboard/index.ts | 70 - .../plugins/cloud-settings/index.ts | 94 - .../plugins/code-push/index.ts | 553 ---- .../plugins/crop-plugin-privacy/index.ts | 57 - .../plugins/custom-uisdk/index.ts | 315 -- .../plugins/deeplinks/index.ts | 137 - .../plugins/device-accounts/index.ts | 105 - .../plugins/device-motion/index.ts | 108 - .../plugins/device-orientation/index.ts | 116 - .../plugins/device/index.ts | 73 - .../plugins/dfu-update/index.ts | 66 - .../plugins/diagnostic/index.ts | 1100 ------ .../plugins/dialogs/index.ts | 112 - .../plugins/dns/index.ts | 42 - .../plugins/document-picker/index.ts | 43 - .../plugins/document-scanner/index.ts | 92 - .../plugins/document-viewer/index.ts | 116 - .../dynamsoft-barcode-scanner/index.ts | 209 -- .../plugins/email-composer/index.ts | 258 -- .../plugins/fabric/index.ts | 441 --- .../plugins/facebook/index.ts | 479 --- .../plugins/fbsdk/index.ts | 484 --- .../plugins/fcm/index.ts | 245 -- .../plugins/ffmpeg/index.ts | 74 - .../plugins/file-chooser/index.ts | 47 - .../plugins/file-md5/index.ts | 43 - .../plugins/file-opener/index.ts | 96 - .../plugins/file-path/index.ts | 45 - .../plugins/file-transfer/index.ts | 281 -- .../plugins/file/index.ts | 1539 --------- .../plugins/fingerprint-aio/index.ts | 266 -- .../plugins/firebase-analytics/index.ts | 123 - .../plugins/firebase-authentication/index.ts | 214 -- .../plugins/firebase-config/index.ts | 108 - .../plugins/firebase-crash/index.ts | 66 - .../plugins/firebase-crashlytics/index.ts | 182 - .../plugins/firebase-dynamic-links/index.ts | 165 - .../plugins/firebase-messaging/index.ts | 189 -- .../plugins/firebase-vision/index.ts | 291 -- .../plugins/firebase-x/index.ts | 1004 ------ .../plugins/firebase/index.ts | 377 --- .../plugins/flashlight/index.ts | 81 - .../plugins/foreground-service/index.ts | 91 - .../plugins/ftp/index.ts | 154 - .../plugins/gao-de-location/index.ts | 353 -- .../plugins/gcdwebserver/index.ts | 69 - .../plugins/ge-tui-sdk-plugin/index.ts | 63 - .../plugins/geolocation/index.ts | 206 -- .../plugins/globalization/index.ts | 231 -- .../plugins/google-analytics/index.ts | 309 -- .../plugins/google-nearby/index.ts | 59 - .../plugins/google-plus/index.ts | 86 - .../plugins/header-color/index.ts | 42 - .../plugins/health-kit/index.ts | 323 -- .../plugins/health/index.ts | 359 -- .../plugins/http/index.ts | 678 ---- .../plugins/hyper-track/index.ts | 380 --- .../plugins/iamport-cordova/index.ts | 113 - .../plugins/ibeacon/index.ts | 760 ----- .../plugins/image-picker/index.ts | 134 - .../plugins/image-resizer/index.ts | 89 - .../plugins/imap/index.ts | 620 ---- .../plugins/in-app-browser/index.ts | 317 -- .../plugins/in-app-purchase-2/index.ts | 931 ------ .../plugins/in-app-review/index.ts | 45 - .../plugins/in-app-update/index.ts | 92 - .../plugins/insomnia/index.ts | 57 - .../plugins/instagram/index.ts | 69 - .../plugins/intercom/index.ts | 259 -- .../plugins/ionic-webview/index.ts | 39 - .../index.ts | 45 - .../plugins/is-debug/index.ts | 41 - .../plugins/keyboard/index.ts | 203 -- .../plugins/keychain/index.ts | 102 - .../plugins/kommunicate/index.ts | 188 -- .../plugins/launch-navigator/index.ts | 450 --- .../plugins/launch-review/index.ts | 77 - .../plugins/lets-cooee/index.ts | 89 - .../plugins/line-login/index.ts | 154 - .../plugins/local-backup/index.ts | 53 - .../plugins/local-notifications/index.ts | 861 ----- .../plugins/location-accuracy/index.ts | 148 - .../plugins/lottie-splash-screen/index.ts | 53 - .../plugins/magnetometer/index.ts | 87 - .../plugins/market/index.ts | 57 - .../plugins/media-capture/index.ts | 247 -- .../plugins/media/index.ts | 357 -- .../plugins/metrix/index.ts | 235 -- .../plugins/mixpanel/index.ts | 269 -- .../plugins/mlkit-translate/index.ts | 116 - .../plugins/mobile-accessibility/index.ts | 258 -- .../plugins/mobile-messaging/index.ts | 589 ---- .../plugins/multiple-document-picker/index.ts | 47 - .../plugins/music-controls/index.ts | 223 -- .../plugins/native-audio/index.ts | 127 - .../plugins/native-geocoder/index.ts | 153 - .../plugins/native-keyboard/index.ts | 246 -- .../plugins/native-page-transitions/index.ts | 146 - .../plugins/native-storage/index.ts | 104 - .../plugins/native-view/index.ts | 148 - .../plugins/network-interface/index.ts | 69 - .../plugins/network/index.ts | 144 - .../plugins/newrelic/index.ts | 319 -- .../plugins/nfc/index.ts | 589 ---- .../plugins/ocr/index.ts | 166 - .../plugins/onesignal/index.ts | 907 ----- .../plugins/open-native-settings/index.ts | 112 - .../plugins/openalpr/index.ts | 74 - .../plugins/paytabs/index.ts | 486 --- .../plugins/pdf-generator/index.ts | 88 - .../plugins/photo-library/index.ts | 307 -- .../plugins/photo-viewer/index.ts | 68 - .../plugins/play-install-referrer/index.ts | 17 - .../plugins/pollfish/index.ts | 172 - .../plugins/power-management/index.ts | 68 - .../plugins/power-optimization/index.ts | 101 - .../plugins/preview-any-file/index.ts | 119 - .../plugins/printer/index.ts | 217 -- .../plugins/pspdfkit-cordova/index.ts | 636 ---- .../plugins/purchases/index.ts | 1181 ------- .../plugins/push/index.ts | 501 --- .../plugins/pushape-push/index.ts | 474 --- .../plugins/safari-view-controller/index.ts | 134 - .../plugins/screen-orientation/index.ts | 109 - .../plugins/secure-storage-echo/index.ts | 186 -- .../plugins/secure-storage/index.ts | 161 - .../plugins/service-discovery/index.ts | 43 - .../plugins/shake/index.ts | 46 - .../plugins/sign-in-with-apple/index.ts | 176 - .../plugins/smartlook/index.ts | 610 ---- .../plugins/sms-retriever/index.ts | 57 - .../plugins/sms/index.ts | 81 - .../plugins/social-sharing/index.ts | 327 -- .../plugins/speech-recognition/index.ts | 171 - .../plugins/spinner-dialog/index.ts | 76 - .../plugins/splash-screen/index.ts | 46 - .../plugins/spotify-auth/index.ts | 138 - .../plugins/sqlite-db-copy/index.ts | 131 - .../plugins/sqlite-porter/index.ts | 125 - .../plugins/sqlite/index.ts | 233 -- .../plugins/star-prnt/index.ts | 977 ------ .../plugins/status-bar/index.ts | 125 - .../plugins/streaming-media/index.ts | 118 - .../plugins/stripe/index.ts | 222 -- .../plugins/sum-up/index.ts | 240 -- .../system-alert-window-permission/index.ts | 68 - .../plugins/taptic-engine/index.ts | 99 - .../plugins/tealium-adidentifier/index.ts | 57 - .../plugins/tealium-installreferrer/index.ts | 57 - .../plugins/tealium/index.ts | 372 --- .../plugins/text-to-speech-advanced/index.ts | 91 - .../plugins/theme-detection/index.ts | 69 - .../plugins/three-dee-touch/index.ts | 193 -- .../plugins/toast/index.ts | 198 -- .../plugins/touch-id/index.ts | 109 - .../plugins/unique-device-id/index.ts | 42 - .../plugins/unvired-cordova-sdk/index.ts | 1675 ---------- .../plugins/uptime/index.ts | 41 - .../plugins/urbanairship/index.ts | 1184 ------- .../plugins/usabilla-cordova-sdk/index.ts | 177 - .../plugins/vibes/index.ts | 212 -- .../plugins/vibration/index.ts | 49 - .../plugins/video-editor/index.ts | 213 -- .../plugins/video-player/index.ts | 71 - .../plugins/web-intent/index.ts | 304 -- .../plugins/web-server/index.ts | 110 - .../plugins/web-socket-server/index.ts | 214 -- .../plugins/webengage/index.ts | 210 -- .../plugins/webim/index.ts | 297 -- .../plugins/wechat/index.ts | 200 -- .../plugins/wheel-selector/index.ts | 204 -- .../plugins/wifi-wizard-2/index.ts | 915 ----- .../plugins/wonderpush/index.ts | 736 ---- .../plugins/youtube-video-player/index.ts | 43 - .../plugins/zbar/index.ts | 88 - .../plugins/zeroconf/index.ts | 166 - .../plugins/zip/index.ts | 43 - .../plugins/zoom/index.ts | 202 -- .../shuto/app-minimize/index.ts | 55 + .../shuto/j-push/index.ts | 230 ++ .../shuto/sangforvpn/index.ts | 147 + .../shuto/zebra-printer/index.ts | 85 + .../{plugins/shuto-zip => shuto/zip}/index.ts | 4 +- 251 files changed, 615 insertions(+), 60920 deletions(-) delete mode 100644 src/@awesome-cordova-plugins/plugins/abbyy-rtr/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/action-sheet/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/adjust/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/admob-plus/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/admob-pro/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/admob/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/advanced-image-picker/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/aes-256/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/all-in-one-sdk/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/analytics-firebase/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/android-exoplayer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/android-full-screen/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/android-notch/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/android-permissions/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/anyline/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-availability/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-center-analytics/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-center-crashes/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-center-low-memory/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-center-push/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-center-shared/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-preferences/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-rate/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-review/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/app-version/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/apple-wallet/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/applovin/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/approov-advanced-http/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/appsflyer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/background-fetch/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/background-geolocation/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/background-mode/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/background-upload/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/badge/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/barcode-scanner/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/battery-status/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/biocatch/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/biometric-wrapper/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/ble/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/blinkid/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/bluetooth-classic-serial-port/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/bluetooth-le/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/bluetooth-serial/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/branch-io/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/brightness/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/broadcaster/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/browser-tab/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/build-info/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/calendar/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/call-directory/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/call-number/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/camera-preview/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/camera/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/checkout/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/chooser-simple-file/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/chooser/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/clevertap/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/clipboard/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/cloud-settings/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/code-push/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/crop-plugin-privacy/index.ts delete mode 100755 src/@awesome-cordova-plugins/plugins/custom-uisdk/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/deeplinks/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/device-accounts/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/device-motion/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/device-orientation/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/device/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/dfu-update/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/diagnostic/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/dialogs/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/dns/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/document-picker/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/document-scanner/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/document-viewer/index.ts delete mode 100755 src/@awesome-cordova-plugins/plugins/dynamsoft-barcode-scanner/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/email-composer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/fabric/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/facebook/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/fbsdk/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/fcm/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/ffmpeg/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/file-chooser/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/file-md5/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/file-opener/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/file-path/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/file-transfer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/file/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/fingerprint-aio/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase-analytics/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase-authentication/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase-config/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase-crash/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase-crashlytics/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase-dynamic-links/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase-messaging/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase-vision/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase-x/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/firebase/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/flashlight/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/foreground-service/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/ftp/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/gao-de-location/index.ts delete mode 100755 src/@awesome-cordova-plugins/plugins/gcdwebserver/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/ge-tui-sdk-plugin/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/geolocation/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/globalization/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/google-analytics/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/google-nearby/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/google-plus/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/header-color/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/health-kit/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/health/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/http/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/hyper-track/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/iamport-cordova/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/ibeacon/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/image-picker/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/image-resizer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/imap/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/in-app-browser/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/in-app-purchase-2/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/in-app-review/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/in-app-update/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/insomnia/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/instagram/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/intercom/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/ionic-webview/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/ios-aswebauthenticationsession-api/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/is-debug/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/keyboard/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/keychain/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/kommunicate/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/launch-navigator/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/launch-review/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/lets-cooee/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/line-login/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/local-backup/index.ts delete mode 100755 src/@awesome-cordova-plugins/plugins/local-notifications/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/location-accuracy/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/lottie-splash-screen/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/magnetometer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/market/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/media-capture/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/media/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/metrix/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/mixpanel/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/mlkit-translate/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/mobile-accessibility/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/mobile-messaging/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/multiple-document-picker/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/music-controls/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/native-audio/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/native-geocoder/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/native-keyboard/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/native-page-transitions/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/native-storage/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/native-view/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/network-interface/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/network/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/newrelic/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/nfc/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/ocr/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/onesignal/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/open-native-settings/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/openalpr/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/paytabs/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/pdf-generator/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/photo-library/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/photo-viewer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/play-install-referrer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/pollfish/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/power-management/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/power-optimization/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/preview-any-file/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/printer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/pspdfkit-cordova/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/purchases/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/push/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/pushape-push/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/safari-view-controller/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/screen-orientation/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/secure-storage-echo/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/secure-storage/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/service-discovery/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/shake/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/sign-in-with-apple/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/smartlook/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/sms-retriever/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/sms/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/social-sharing/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/speech-recognition/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/spinner-dialog/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/splash-screen/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/spotify-auth/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/sqlite-db-copy/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/sqlite-porter/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/sqlite/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/star-prnt/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/status-bar/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/streaming-media/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/stripe/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/sum-up/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/system-alert-window-permission/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/taptic-engine/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/tealium-adidentifier/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/tealium-installreferrer/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/tealium/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/text-to-speech-advanced/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/theme-detection/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/three-dee-touch/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/toast/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/touch-id/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/unique-device-id/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/uptime/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/urbanairship/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/usabilla-cordova-sdk/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/vibes/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/vibration/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/video-editor/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/video-player/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/web-intent/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/web-server/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/web-socket-server/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/webengage/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/webim/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/wechat/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/wheel-selector/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/wifi-wizard-2/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/wonderpush/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/youtube-video-player/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/zbar/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/zeroconf/index.ts delete mode 100644 src/@awesome-cordova-plugins/plugins/zip/index.ts delete mode 100755 src/@awesome-cordova-plugins/plugins/zoom/index.ts create mode 100644 src/@awesome-cordova-plugins/shuto/app-minimize/index.ts create mode 100644 src/@awesome-cordova-plugins/shuto/j-push/index.ts create mode 100644 src/@awesome-cordova-plugins/shuto/sangforvpn/index.ts create mode 100644 src/@awesome-cordova-plugins/shuto/zebra-printer/index.ts rename src/@awesome-cordova-plugins/{plugins/shuto-zip => shuto/zip}/index.ts (95%) diff --git a/DEVELOPER.md b/DEVELOPER.md index 725a6b38..1bc986e6 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -6,50 +6,44 @@ This is a short guide on creating new plugin wrappers for Ionic Native. First, let's start by creating a new plugin wrapper from template. -``` -// Call this command, and replace PluginName with the name of the plugin you wish to add -// Make sure to capitalize the first letter, or use CamelCase if necessary. + // Call this command, and replace PluginName with the name of the plugin you wish to add + // Make sure to capitalize the first letter, or use CamelCase if necessary. -gulp plugin:create -n PluginName + gulp plugin:create -n PluginName -// add -m flag to get a minimal template to start with -gulp plugin:create -m -n PluginName -``` + // add -m flag to get a minimal template to start with + gulp plugin:create -m -n PluginName Running the command above will create a new directory `src/@ionic-native/plugins/plugin-name/` with a single file in there: `index.ts`. This file is where all the plugin definitions should be. Let's take a look at the existing plugin wrapper for Geolocation to see what goes into an Ionic Native plugin (comments have been removed for clarity): -``` -@Plugin({ - plugin: 'cordova-plugin-geolocation', - pluginRef: 'navigator.geolocation' -}) -@Injectable() -export class Geolocation { + @Plugin({ + plugin: 'cordova-plugin-geolocation', + pluginRef: 'navigator.geolocation' + }) + @Injectable() + export class Geolocation { - @Cordova() - getCurrentPosition(options?: GeolocationOptions): Promise { return; } + @Cordova() + getCurrentPosition(options?: GeolocationOptions): Promise { return; } - @Cordova({ - callbackOrder: 'reverse', - observable: true, - clearFunction: 'clearWatch' - }) - watchPosition(options?: GeolocationOptions): Observable { return; } -} -``` + @Cordova({ + callbackOrder: 'reverse', + observable: true, + clearFunction: 'clearWatch' + }) + watchPosition(options?: GeolocationOptions): Observable { return; } + } ### The Plugin Class First and foremost, we want to create a class representing our plugin, in this case Geolocation. -``` -@Injectable() -class Geolocation { + @Injectable() + class Geolocation { -} -``` + } #### Class Metadata @@ -57,16 +51,14 @@ Next, we need to specify some information about this plugin. Ionic Native is wri For example, the `@Plugin` decorator adds information about the plugin to our Geolocation class: -``` -@Plugin({ - plugin: 'cordova-plugin-geolocation', - pluginRef: 'navigator.geolocation' -}) -@Injectable() -export class Geolocation { + @Plugin({ + plugin: 'cordova-plugin-geolocation', + pluginRef: 'navigator.geolocation' + }) + @Injectable() + export class Geolocation { -} -``` + } Here, `plugin` is the name of the plugin package on npm and used when calling `cordova plugin add`. @@ -78,10 +70,8 @@ Now all that's left is to add the plugin methods, in this case `getCurrentPositi Let's take a look at `getCurrentPosition` first. -``` - @Cordova() - getCurrentPosition(options?: GeolocationOptions): Promise { return } -``` + @Cordova() + getCurrentPosition(options?: GeolocationOptions): Promise { return } It's just a stub. The `return` is only there to keep the TypeScript type-checker from complaining since we indicate that `getCurrentPosition` returns a `Promise`. @@ -89,14 +79,12 @@ By default, the `@Cordova` decorator wraps the plugin callbacks in a Promise tha Next, let's look at the `watchPosition` method. -``` - @Cordova({ - callbackOrder: 'reverse', - observable: true, - clearFunction: 'clearWatch' - }) - watchPosition(options?: GeolocationOptions): Observable { return } -``` + @Cordova({ + callbackOrder: 'reverse', + observable: true, + clearFunction: 'clearWatch' + }) + watchPosition(options?: GeolocationOptions): Observable { return } The `@Cordova` decorator has a few more options now. @@ -129,12 +117,19 @@ We have very precise rules over how our git commit messages can be formatted. Th Must be one of the following: - **fix**: A bug fix + - **feat**: A new feature + - **docs**: Documentation only changes + - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) + - **refactor**: A code change that neither fixes a bug nor adds a feature + - **perf**: A code change that improves performance + - **test**: Adding missing tests + - **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation #### Scope @@ -146,8 +141,11 @@ The scope could be anything specifying place of the commit change. For example, The subject contains succinct description of the change: - use the imperative, present tense: "change" not "changed" nor "changes" + - do not capitalize first letter + - do not place a period (.) at the end + - entire length of the commit message must not go over 50 characters ### Ionic Native Decorators @@ -157,10 +155,15 @@ The subject contains succinct description of the change: A decorator to wrap the main plugin class, and any other classes that will use `@Cordova` or `@CordovaProperty` decorators. This decorator accepts the following configuration: - _pluginName_: Plugin name, this should match the class name + - _plugin_: The plugin's NPM package, or Github URL if NPM is not available. + - _pluginRef_: The plugin object reference. Example: 'cordova.file'. + - _repo_: The plugin's Github Repository URL + - _install_: (optional) Install command. This is used in case a plugin has a custom install command (takes variables). + - _platforms_: An array of strings indicating the supported platforms. #### Cordova @@ -168,20 +171,35 @@ A decorator to wrap the main plugin class, and any other classes that will use ` Checks if the plugin and the method are available before executing. By default, the decorator will wrap the callbacks of the function and return a Promise. This decorator takes the following configuration options: - **observable**: set to true to return an Observable + - **methodName**: an optional name of the cordova plugins method name (if different from wrappers method name) + - **clearFunction**: an optional name of a method to clear the observable we returned + - **clearWithArgs**: This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used in the initial function. + - **sync**: set to true if the method should return the value as-is without wrapping with Observable/Promise + - **callbackOrder**: set to `reverse` if the success and error callbacks are the first two arguements of the method + - **callbackStyle**: set to `node` if the plugin has one callback with a node style (e.g: `function(err, result){}`), or set to `object` if the callbacks are part of an object + - **successName**: Success function property name. This must be set if callbackStyle is set to object. + - **errorName**: Error function property name. This must be set if callbackStyle is set to object. + - **successIndex**: Set a custom index for the success callback function. This doesn't work if callbackOrder or callbackStyle are set. + - **errorIndex**: Set a custom index for the error callback function. This doesn't work if callbackOrder or callbackStyle are set. + - **eventObservable**: set to true to return an observable that wraps an event listener + - **event**: Event name, this must be set if eventObservable is set to true + - **element**: Element to attach the event listener to, this is optional, defaults to `window` + - **otherPromise**: Set to true if the wrapped method returns a promise + - **platforms**: array of strings indicating supported platforms. Specify this if the supported platforms doesn't match the plugin's supported platforms. Example: @@ -210,6 +228,7 @@ someProperty: string; Checks if the plugin exists before performing a custom written method. By default, the method will return a promise that will reject with an error if the plugin is not available. This wrapper accepts two optional configurations: - **observable**: set to true to return an empty Observable if the plugin isn't available + - **sync**: set to true to return nothing if the plugin isn't available Example: diff --git a/README.md b/README.md index e9bdf619..0ecc5ea5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ You also need to install the Awesome Cordova Plugins package for each plugin you ## Documentation -For the full Awesome Cordova Plugins documentation, please visit [https://ionicframework.com/docs/native/](https://ionicframework.com/docs/native/). +For the full Awesome Cordova Plugins documentation, please visit . ### Basic Usage @@ -144,10 +144,13 @@ document.addEventListener('deviceready', () => { Awesome Cordova Plugins generates an AngularJS module in runtime and prepares a service for each plugin. To use the plugins in your AngularJS app: -1. Download the latest bundle from the [Github releases](https://github.com/danielsogl/awesome-cordova-plugins/releases) page. -2. Include it in `index.html` before your app's code. -3. Inject `ionic.native` module in your app. -4. Inject any plugin you would like to use with a `$cordova` prefix. +1. Download the latest bundle from the [Github releases](https://github.com/danielsogl/awesome-cordova-plugins/releases) page. + +2. Include it in `index.html` before your app's code. + +3. Inject `ionic.native` module in your app. + +4. Inject any plugin you would like to use with a `$cordova` prefix. ```js angular.module('myApp', ['ionic.native']).controller('MyPageController', function ($cordovaCamera) { @@ -166,9 +169,11 @@ angular.module('myApp', ['ionic.native']).controller('MyPageController', functio To use Awesome Cordova Plugins in any other setup: -1. Download the latest bundle from the [Github releases](https://github.com/danielsogl/awesome-cordova-plugins/releases) page. -2. Include it in `index.html` before your app's code. -3. Access any plugin using the global `IonicNative` variable. +1. Download the latest bundle from the [Github releases](https://github.com/danielsogl/awesome-cordova-plugins/releases) page. + +2. Include it in `index.html` before your app's code. + +3. Access any plugin using the global `IonicNative` variable. ```js document.addEventListener('deviceready', function () { @@ -256,7 +261,7 @@ Spent way too long diagnosing an issue only to realize a plugin wasn't firing or ## Plugin Missing? -Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/danielsogl/awesome-cordova-plugins/blob/master/DEVELOPER.md) for more on how to contribute. :heart: +Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/danielsogl/awesome-cordova-plugins/blob/master/DEVELOPER.md) for more on how to contribute. ❤️ # Credits diff --git a/gulpfile.js b/gulpfile.js index 573e4a22..3c524db5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -31,7 +31,7 @@ gulp.task('plugin:create', () => { .pipe(replace('{{ pluginName }}', _.lowerFirst(pluginName))) .pipe(replace('{{ plugin-name }}', kebabCase)) .pipe(rename('index.ts')) - .pipe(gulp.dest('./src/@awesome-cordova-plugins/plugins/' + kebabCase)); + .pipe(gulp.dest('./src/@awesome-cordova-plugins/shuto/' + kebabCase)); } else { console.log('Usage is: gulp plugin:create -n PluginName'); } diff --git a/scripts/build/helpers.ts b/scripts/build/helpers.ts index a4364a9e..53cf54f8 100644 --- a/scripts/build/helpers.ts +++ b/scripts/build/helpers.ts @@ -18,7 +18,7 @@ export const ROOT = resolve(__dirname, '../../'); // tslint:disable-next-line:no-var-requires export const TS_CONFIG = clone(require(resolve(ROOT, 'tsconfig.json'))); export const COMPILER_OPTIONS = TS_CONFIG.compilerOptions; -export const PLUGINS_ROOT = join(ROOT, 'src/@awesome-cordova-plugins/plugins/'); +export const PLUGINS_ROOT = join(ROOT, 'src/@awesome-cordova-plugins/shuto/'); export const PLUGIN_PATHS = readdirSync(PLUGINS_ROOT).map((d) => join(PLUGINS_ROOT, d, 'index.ts')); export function getDecorator(node: Node, index = 0): Decorator { diff --git a/scripts/build/transformers/extract-injectables.ts b/scripts/build/transformers/extract-injectables.ts index e15c4a0c..d94d7f1c 100644 --- a/scripts/build/transformers/extract-injectables.ts +++ b/scripts/build/transformers/extract-injectables.ts @@ -24,7 +24,7 @@ export const EMIT_PATH = resolve(ROOT, 'injectable-classes.json'); export function extractInjectables() { return (ctx: TransformationContext) => { return (tsSourceFile) => { - if (tsSourceFile.fileName.indexOf('src/@awesome-cordova-plugins/plugins') > -1) { + if (tsSourceFile.fileName.indexOf('src/@awesome-cordova-plugins/shuto') > -1) { visitEachChild( tsSourceFile, (node) => { diff --git a/scripts/build/transformers/plugin-class.ts b/scripts/build/transformers/plugin-class.ts index 8ba4cc10..4c541762 100644 --- a/scripts/build/transformers/plugin-class.ts +++ b/scripts/build/transformers/plugin-class.ts @@ -71,7 +71,7 @@ function transformClasses(file: SourceFile, ctx: TransformationContext, ngcBuild export function pluginClassTransformer(ngcBuild?: boolean): TransformerFactory { return (ctx: TransformationContext) => { return (tsSourceFile) => { - if (tsSourceFile.fileName.indexOf('src/@awesome-cordova-plugins/plugins') > -1) { + if (tsSourceFile.fileName.indexOf('src/@awesome-cordova-plugins/shuto') > -1) { return transformClasses(tsSourceFile, ctx, ngcBuild); } return tsSourceFile; diff --git a/scripts/docs/config.json b/scripts/docs/config.json index 4949e63a..ff046a1a 100644 --- a/scripts/docs/config.json +++ b/scripts/docs/config.json @@ -1,4 +1,4 @@ { "v2DocsDir": "docs/native", - "pluginDir": "dist/@awesome-cordova-plugins/plugins" + "pluginDir": "dist/@awesome-cordova-plugins/shuto" } diff --git a/scripts/docs/dgeni/dgeni-config.js b/scripts/docs/dgeni/dgeni-config.js index 93803617..b93e5f25 100644 --- a/scripts/docs/dgeni/dgeni-config.js +++ b/scripts/docs/dgeni/dgeni-config.js @@ -52,7 +52,7 @@ module.exports = (currentVersion) => { readFilesProcessor.basePath = path.resolve(__dirname, '../../..'); readTypeScriptModules.basePath = path.resolve(__dirname, '../../..'); - readTypeScriptModules.sourceFiles = ['./src/@awesome-cordova-plugins/plugins/**/*.ts']; + readTypeScriptModules.sourceFiles = ['./src/@awesome-cordova-plugins/shuto/**/*.ts']; }) // Configure file writing diff --git a/scripts/docs/dgeni/dgeni-readmes-config.js b/scripts/docs/dgeni/dgeni-readmes-config.js index 69fdad9e..9e2645d5 100644 --- a/scripts/docs/dgeni/dgeni-readmes-config.js +++ b/scripts/docs/dgeni/dgeni-readmes-config.js @@ -51,7 +51,7 @@ module.exports = (currentVersion) => { readFilesProcessor.basePath = path.resolve(__dirname, '../../..'); readTypeScriptModules.basePath = path.resolve(path.resolve(__dirname, '../../..')); - readTypeScriptModules.sourceFiles = ['./src/@awesome-cordova-plugins/plugins/**/*.ts']; + readTypeScriptModules.sourceFiles = ['./src/@awesome-cordova-plugins/shuto/**/*.ts']; }) // Configure file writing diff --git a/scripts/docs/dgeni/templates/readme.template.md b/scripts/docs/dgeni/templates/readme.template.md index 06b1fa45..b0494517 100644 --- a/scripts/docs/dgeni/templates/readme.template.md +++ b/scripts/docs/dgeni/templates/readme.template.md @@ -16,7 +16,7 @@ $ <@ if prop.install @><$ prop.install $><@ else @>ionic cordova plugin add <$ p $ npm install @awesome-cordova-plugins/<$ doc.npmId|replace('plugins/','') $> ``` -## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/')|replace('index.ts','')|replace('src/@awesome-cordova-plugins/plugins/','') $>) +## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/shuto/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/')|replace('index.ts','')|replace('src/@awesome-cordova-plugins/plugins/','') $>) Plugin Repo: [<$ prop.repo $>](<$ prop.repo $>) diff --git a/scripts/tasks/publish.ts b/scripts/tasks/publish.ts index eb3fb6ed..01e83167 100644 --- a/scripts/tasks/publish.ts +++ b/scripts/tasks/publish.ts @@ -40,7 +40,7 @@ const PLUGIN_PEER_DEPENDENCIES = { function getPackageJsonContent(name: string, peerDependencies = {}, dependencies = {}) { return merge(PACKAGE_JSON_BASE, { - name: '@awesome-cordova-plugins/' + name, + name: (name == 'core' ? '@awesome-cordova-plugins/' : '@shuto/') + name, dependencies, peerDependencies, version: VERSION, @@ -50,7 +50,9 @@ function getPackageJsonContent(name: string, peerDependencies = {}, dependencies function writePackageJson(data: any, dir: string) { const filePath = resolve(dir, 'package.json'); writeJSONSync(filePath, data); - PACKAGES.push(dir); + if (!data.name.startsWith('@awesome-cordova-plugins/')) { + PACKAGES.push(dir); + } } function writeNGXPackageJson(data: any, dir: string) { const filePath = resolve(dir, 'package.json'); @@ -67,7 +69,7 @@ function prepare() { PLUGIN_PATHS.forEach((pluginPath: string) => { const pluginName = pluginPath.split(/[\/\\]+/).slice(-2)[0]; const packageJsonContents = getPackageJsonContent(pluginName, PLUGIN_PEER_DEPENDENCIES); - const dir = resolve(DIST, 'plugins', pluginName); + const dir = resolve(DIST, 'shuto', pluginName); const ngxDir = join(dir, 'ngx'); writePackageJson(packageJsonContents, dir); writeNGXPackageJson(packageJsonContents, ngxDir); diff --git a/src/@awesome-cordova-plugins/plugins/abbyy-rtr/index.ts b/src/@awesome-cordova-plugins/plugins/abbyy-rtr/index.ts deleted file mode 100644 index 6cb815cb..00000000 --- a/src/@awesome-cordova-plugins/plugins/abbyy-rtr/index.ts +++ /dev/null @@ -1,342 +0,0 @@ -import { Injectable } from '@angular/core'; -import { CordovaCheck, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -declare const AbbyyRtrSdk: any; - -/** - * JSON object that you can pass as the options argument to change text - * capture settings. All keys are optional. Omitting a key means that a - * default setting will be used. - */ -export interface TextCaptureOptions { - /** - * The name of the license file. This file must be located in the - * www/rtr_assets/ directory in your project. - */ - licenseFileName?: string; - - /** - * Recognition languages which can be selected by the user, - * for example: ["English", "French", "German"]. Empty array - * disables language selection. - */ - selectableRecognitionLanguages?: string[]; - - /** - * Recognition language selected by default. - */ - recognitionLanguages?: string[]; - - /** - * Width and height of the recognition area, separated by a - * whitespace — for example: "0.8 0.3". The area of interest is - * centered in the preview frame, its width and height are - * relative to the preview frame size and should be in the [0.0, 1.0] range. - */ - areaOfInterest?: string; - - /** - * Whether to stop the plugin as soon as the result status is - * "Stable" (see Result status). When enabled (true), the - * recognition process can be stopped automatically. When - * disabled (false), recognition can be stopped only manually - * by user. - */ - stopWhenStable?: boolean; - - /** - * Show (true) or hide (false) the flashlight button in the text - * capture dialog. - */ - isFlashlightVisible?: boolean; - - /** - * Show (true) or hide (false) the stop button in the text - * capture dialog. When the user taps stop, RTR SDK returns - * the latest recognition result. - */ - isStopButtonVisible?: boolean; - - /** - * Specify the orientation, possible values 'landscape' or 'portrait'. - */ - orientation?: string; -} - -/** - * JSON object that represents text recognition results. - * The callback you implement should parse this object and show results to user. - */ -export interface TextCaptureResult { - /** - * An array of objects representing recognized lines of text. - * These objects have the following keys: - * · text (string): the recognized text. - * · quadrangle (string): vertex coordinates of the bounding quadrangle, - * a string of 8 integers separated with whitespaces ("x1 y1 ... x4 y4"), - * goes clockwise starting from the bottom left. - * · rect (string): position and size of the bounding rectangle, - * a string of 4 integers separated with whitespaces ("x y width height"). - */ - textLines: { text: string; quadrangle: string; rect?: string }[]; - - /** - * Additional information. This object has the following keys: - * · stabilityStatus (string): result stability status. - * See Result status for details. - * · userAction (string): the user's action which stopped the plugin, - * if any. Can be "Manually Stopped" if the stop button has been used, - * and "Canceled" if the user canceled processing. If the plugin has - * stopped automatically, the userAction key is not present in resultInfo. - * · frameSize (string): full size of the preview frame, a string - * with 2 integers separated with a whitespace ("720 1280"). - * · recognitionLanguages (string array): languages used for recognition, - * the array contains language identifiers (["English", "French", "German"]). - */ - resultInfo: { - stabilityStatus: string; - userAction: string; - frameSize: string; - recognitionLanguages: string[]; - }; - - /** - * Error details. This key is present only if an error occurs. - * The value is an object which has a single key: - * · description (string): human-readable error description. - */ - error?: { - description: string; - }; -} - -/** - * JSON object that you can pass as the options argument to change data - * capture settings. All keys are optional. Omitting a key means that a default - * setting will be used, except the profile and customDataCaptureScenario - * keys: you must specify either one of them, but not both at the same time. - */ -export interface DataCaptureOptions { - /** - * The predefined data capture profile to use, for example: "MRZ". - * Note: For the list of supported documents, see Specifications — Data - * Capture Profiles in the ABBYY Real-Time Recognition SDK 1 Developer's Guide. - */ - profile?: string; - - /** - * Custom data capture settings. This object has the following keys: - * · name (string): the name of your custom data capture scenario, required. - * · description (string): a more detailed description. This key is optional; - * if not given, it will be assigned the same value as name. - * · recognitionLanguages (string array): recognition languages to use. - * Default is ["English"]. - * · fields (object array): describes data fields to capture. Each object - * in this array has a single regEx key; its value is a string containing - * the regular expression that should be matched when capturing a field. - */ - customDataCaptureScenario?: { - name: string; - description: string; - recognitionLanguages: string[]; - fields: { regEx: string }[]; - }; - - /** - * The name of the license file. This file must be located in the - * www/rtr_assets/ directory in your project. - */ - licenseFileName?: string; - - /** - * Width and height of the recognition area, separated by a - * whitespace — for example: "0.8 0.3". The area of interest is - * centered in the preview frame, its width and height are - * relative to the preview frame size and should be in the [0.0, 1.0] range. - */ - areaOfInterest?: string; - - /** - * Whether to stop the plugin as soon as the result status is - * "Stable" (see Result status). When enabled (true), the - * recognition process can be stopped automatically. When - * disabled (false), recognition can be stopped only manually - * by user. - */ - stopWhenStable?: boolean; - - /** - * Show (true) or hide (false) the flashlight button in the text - * capture dialog. - */ - isFlashlightVisible?: boolean; - - /** - * Show (true) or hide (false) the stop button in the text - * capture dialog. When the user taps stop, RTR SDK returns - * the latest recognition result. - */ - isStopButtonVisible?: boolean; - - /** - * Specify the orientation, possible values 'landscape' or 'portrait'. - */ - orientation?: string; -} - -/** - * JSON object that represents data recognition results. The callback you - * implement should parse this object and show results to user. - */ -export interface DataCaptureResult { - /** - * The data scheme which was applied during data capture. - * The value is an object which has two keys: - * · id (string): the internal scheme identifier. - * · name (string): the scheme name. - * If you had defined a custom data capture scenario in options, both the - * id and name will be the same as the scenario name you specified. If - * you selected a predefined profile, the id and name are specified by the - * profile. If an error occurs during processing, the dataScheme key is not - * present in the result. - */ - dataScheme?: { - id: string; - name: string; - }; - - /** - * Recognized data fields. Each object in the array represents a separate - * data field. The data field objects have the following keys: - * · id (string): the internal identifier of the field. - * · name (string): the field name. - * Similarly to dataScheme, in custom scenarios both id and name are the same - * as the scenario name you specified (currently custom scenarios allow - * only 1 recognized field). - * · text (string): full text of the field. - * · quadrangle (string): vertex coordinates of the bounding quadrangle, a - * string of 8 integers separated with whitespaces ("x1 y1 ... x4 y4"), - * goes clockwise starting from the bottom left. - * · components (object array): an array of objects representing field - * components, that is, the text fragments found on the image, which - * constitute the field. - * In the components array each element is an object with the following keys: - * · text (string): text of this fragment. - * · quadrangle (string): vertex coordinates of the bounding quadrangle of - * this fragment, similar to the field's quadrangle. - * · rect (string): position and size of the bounding rectangle, a string - * of 4 integers separated with whitespaces ("x y width height"). - */ - dataFields: { - id: string; - name: string; - text: string; - quadrangle: string; - components: { - text: string; - quadrangle: string; - rect: string; - }; - }; - - /** - * Additional information. This object has the following keys: - * · stabilityStatus (string): result stability status. - * See Result status for details. - * · userAction (string): the user's action which stopped the plugin, - * if any. Can be "Manually Stopped" if the stop button has been used, - * and "Canceled" if the user canceled processing. If the plugin has - * stopped automatically, the userAction key is not present in resultInfo. - * · frameSize (string): full size of the preview frame, a string - * with 2 integers separated with a whitespace ("720 1280"). - */ - resultInfo: { - stabilityStatus: string; - userAction: string; - frameSize: string; - }; - - /** - * Error details. This key is present only if an error occurs. - * The value is an object which has a single key: - * · description (string): human-readable error description. - */ - error?: { - description: string; - }; -} - -/** - * @name ABBYY Real-Time Recognition - * @description - * This plugin allows to use the Text Capture and Data Capture features of - * ABBYY Real-Time Recognition SDK (RTR SDK) in apps. - * @usage - * ```typescript - * import { AbbyyRTR } from '@awesome-cordova-plugins/abbyy-rtr/ngx'; - * - * - * constructor(private abbyyRTR: AbbyyRTR) { } - * - * ... - * - * - * this.abbyyRTR.startTextCapture(options) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * - * this.abbyyRTR.startDataCapture(options) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'AbbyyRTR', - plugin: 'cordova-plugin-abbyy-rtr-sdk', - pluginRef: 'AbbyyRtrSdk', - repo: 'https://github.com/abbyysdk/RTR-SDK.Cordova', - install: 'ionic cordova plugin add cordova-plugin-abbyy-rtr-sdk', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class AbbyyRTR extends AwesomeCordovaNativePlugin { - /** - * Opens a modal dialog with controls for the Text Capture scenario. - * - * @param {TextCaptureOptions} options - * @returns {Promise} - */ - @CordovaCheck() - startTextCapture(options: TextCaptureOptions): Promise { - return new Promise((resolve, reject) => { - AbbyyRtrSdk.startTextCapture((result: DataCaptureResult) => { - if (result.error) { - reject(result); - } else { - resolve(result); - } - }, options); - }); - } - - /** - * Opens a modal dialog with controls for the Data Capture scenario. - * - * @param {DataCaptureOptions} options - * @returns {Promise} - */ - @CordovaCheck() - startDataCapture(options: DataCaptureOptions): Promise { - return new Promise((resolve, reject) => { - AbbyyRtrSdk.startDataCapture((result: DataCaptureResult) => { - if (result.error) { - reject(result); - } else { - resolve(result); - } - }, options); - }); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/action-sheet/index.ts b/src/@awesome-cordova-plugins/plugins/action-sheet/index.ts deleted file mode 100644 index 0e958c2b..00000000 --- a/src/@awesome-cordova-plugins/plugins/action-sheet/index.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface ActionSheetOptions { - /** - * The labels for the buttons. Uses the index x - */ - buttonLabels: string[]; - - /** - * The title for the actionsheet - */ - title?: string; - - /** - * The subtitle for the actionsheet (IOS only) - */ - subtitle?: string; - - /** - * Theme to be used on Android - */ - androidTheme?: 1 | 2 | 3 | 4 | 5; - - /** - * Enable a cancel on Android - */ - androidEnableCancelButton?: boolean; - - /** - * Enable a cancel on Windows Phone - */ - winphoneEnableCancelButton?: boolean; - - /** - * Add a cancel button with text - */ - addCancelButtonWithLabel?: string; - - /** - * Add a destructive button with text - */ - addDestructiveButtonWithLabel?: string; - - /** - * On an iPad, set the X,Y position - */ - position?: [number, number]; - - /** - * Choose if destructive button will be the last - */ - destructiveButtonLast?: boolean; -} - -/** - * @name Action Sheet - * @description - * The ActionSheet plugin shows a native list of options the user can choose from. - * - * Requires Cordova plugin: `cordova-plugin-actionsheet`. For more info, please see the [ActionSheet plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet). - * @usage - * ```typescript - * import { ActionSheet, ActionSheetOptions } from '@awesome-cordova-plugins/action-sheet/ngx'; - * - * constructor(private actionSheet: ActionSheet) { } - * - * ... - * - * - * let buttonLabels = ['Share via Facebook', 'Share via Twitter']; - * - * const options: ActionSheetOptions = { - * title: 'What do you want with this image?', - * subtitle: 'Choose an action', - * buttonLabels: buttonLabels, - * addCancelButtonWithLabel: 'Cancel', - * addDestructiveButtonWithLabel: 'Delete', - * androidTheme: this.actionSheet.ANDROID_THEMES.THEME_HOLO_DARK, - * destructiveButtonLast: true - * } - * - * this.actionSheet.show(options).then((buttonIndex: number) => { - * console.log('Button pressed: ' + buttonIndex); - * }); - * ``` - * @interfaces - * ActionSheetOptions - */ -@Plugin({ - pluginName: 'ActionSheet', - plugin: 'cordova-plugin-actionsheet', - pluginRef: 'plugins.actionsheet', - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-actionsheet', - platforms: ['Android', 'Browser', 'iOS', 'Windows', 'Windows Phone 8'], -}) -@Injectable() -export class ActionSheet extends AwesomeCordovaNativePlugin { - /** - * Convenience property to select an Android theme value - */ - ANDROID_THEMES: { - THEME_TRADITIONAL: number; - THEME_HOLO_DARK: number; - THEME_HOLO_LIGHT: number; - THEME_DEVICE_DEFAULT_DARK: number; - THEME_DEVICE_DEFAULT_LIGHT: number; - } = { - THEME_TRADITIONAL: 1, - THEME_HOLO_DARK: 2, - THEME_HOLO_LIGHT: 3, - THEME_DEVICE_DEFAULT_DARK: 4, - THEME_DEVICE_DEFAULT_LIGHT: 5, - }; - - /** - * Show a native ActionSheet component. See below for options. - * - * @param {ActionSheetOptions} [options] Options See table below - * @returns {Promise} Returns a Promise that resolves with the index of the - * button pressed (1 based, so 1, 2, 3, etc.) - */ - @Cordova() - show(options?: ActionSheetOptions): Promise { - return; - } - - /** - * Programmatically hide the native ActionSheet - * - * @param {ActionSheetOptions} [options] Options See table below - * @returns {Promise} Returns a Promise that resolves when the actionsheet is closed - */ - @Cordova() - hide(options?: ActionSheetOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/adjust/index.ts b/src/@awesome-cordova-plugins/plugins/adjust/index.ts deleted file mode 100644 index a10f2bb4..00000000 --- a/src/@awesome-cordova-plugins/plugins/adjust/index.ts +++ /dev/null @@ -1,818 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export class AdjustEvent { - private eventToken: string; - private revenue: number; - private currency: string; - private transactionId: string; - private callbackId: string; - private callbackParameters: string[] = []; - private partnerParameters: string[] = []; - - constructor(eventToken: string) { - this.eventToken = eventToken; - } - - setRevenue(revenue: number, currency: string): void { - this.revenue = revenue; - this.currency = currency; - } - - addCallbackParameter(key: string, value: string): void { - this.callbackParameters.push(key); - this.callbackParameters.push(value); - } - - addPartnerParameter(key: string, value: string): void { - this.partnerParameters.push(key); - this.partnerParameters.push(value); - } - - setTransactionId(transactionId: string) { - this.transactionId = transactionId; - } - - setCallbackId(callbackId: string) { - this.callbackId = callbackId; - } -} - -export class AdjustConfig { - private appToken: string; - private environment: AdjustEnvironment; - private sdkPrefix: string; - private delayStart = 0.0; - private logLevel: AdjustLogLevel = null; - private defaultTracker: string = null; - private urlStrategy: AdjustUrlStrategy = null; - private externalDeviceId: string = null; - private sendInBackground: boolean = null; - private shouldLaunchDeeplink: boolean = null; - private eventBufferingEnabled: boolean = null; - private userAgent: string = null; - private isDeviceKnown: boolean = null; - private needsCost: boolean = null; - private secretId: number = null; - private info1: number = null; - private info2: number = null; - private info3: number = null; - private info4: number = null; - private processName: string = null; // Android only - private preinstallTrackingEnabled: boolean = null; // Android only - private preinstallFilePath: string = null; // Android only - private oaidReadingEnabled: boolean = null; // Android only - private allowiAdInfoReading: boolean = null; // iOS only - private allowIdfaReading: boolean = null; // iOS only - private allowAdServicesInfoReading: boolean = null; // iOS only - private coppaCompliantEnabled: boolean = null; - private playStoreKidsAppEnabled: boolean = null; // Android only - private linkMeEnabled: boolean = null; // iOS only - - private attributionCallback: (attribution: AdjustAttribution) => void = null; - private eventTrackingSucceededCallback: (event: AdjustEventSuccess) => void = null; - private eventTrackingFailedCallback: (event: AdjustEventFailure) => void = null; - private sessionTrackingSucceededCallback: (session: AdjustSessionSuccess) => void = null; - private sessionTrackingFailedCallback: (session: AdjustSessionFailure) => void = null; - private deferredDeeplinkCallback: (uri: string) => void = null; - private conversionValueUpdatedCallback: (conversionValue: number) => void = null; - - constructor(appToken: string, environment: AdjustEnvironment) { - this.appToken = appToken; - this.environment = environment; - } - - setAppSecret(secretId: number, info1: number, info2: number, info3: number, info4: number): void { - this.secretId = secretId; - this.info1 = info1; - this.info2 = info2; - this.info3 = info3; - this.info4 = info4; - } - - setDelayStart(delayStart: number) { - this.delayStart = delayStart; - } - - setLogLevel(logLevel: AdjustLogLevel) { - this.logLevel = logLevel; - } - - setDefaultTracker(defaultTracker: string) { - this.defaultTracker = defaultTracker; - } - - setExternalDeviceId(externalDeviceId: string) { - this.externalDeviceId = externalDeviceId; - } - - setUrlStrategy(urlStrategy: AdjustUrlStrategy) { - this.urlStrategy = urlStrategy; - } - - setSendInBackground(sendInBackground: boolean) { - this.sendInBackground = sendInBackground; - } - - setShouldLaunchDeeplink(shouldLaunchDeeplink: boolean) { - this.shouldLaunchDeeplink = shouldLaunchDeeplink; - } - - setEventBufferingEnabled(eventBufferingEnabled: boolean) { - this.eventBufferingEnabled = eventBufferingEnabled; - } - - setCoppaCompliantEnabled(coppaCompliantEnabled: boolean) { - this.coppaCompliantEnabled = coppaCompliantEnabled; - } - - setPlayStoreKidsAppEnabled(playStoreKidsAppEnabled: boolean) { - this.playStoreKidsAppEnabled = playStoreKidsAppEnabled; - } - - setUserAgent(userAgent: string) { - this.userAgent = userAgent; - } - - setDeviceKnown(isDeviceKnown: boolean) { - this.isDeviceKnown = isDeviceKnown; - } - - setNeedsCost(needsCost: boolean) { - this.needsCost = needsCost; - } - - setProcessName(processName: string) { - this.processName = processName; - } - - setPreinstallTrackingEnabled(preinstallTrackingEnabled: boolean) { - this.preinstallTrackingEnabled = preinstallTrackingEnabled; - } - - setPreinstallFilePath(preinstallFilePath: string) { - this.preinstallFilePath = preinstallFilePath; - } - - setOaidReadingEnabled(enableOaidReading: boolean) { - this.oaidReadingEnabled = enableOaidReading; - } - - setAllowiAdInfoReading(allowiAdInfoReading: boolean) { - this.allowiAdInfoReading = allowiAdInfoReading; - } - - setAllowIdfaReading(allowIdfaReading: boolean) { - this.allowIdfaReading = allowIdfaReading; - } - - setAllowAdServicesInfoReading(allowAdServicesInfoReading: boolean) { - this.allowAdServicesInfoReading = allowAdServicesInfoReading; - } - - setLinkMeEnabled(linkMeEnabled: boolean) { - this.linkMeEnabled = linkMeEnabled; - } - - setAttributionCallbackListener(attributionCallback: (attribution: AdjustAttribution) => void) { - this.attributionCallback = attributionCallback; - } - - setEventTrackingSucceededCallbackListener(eventTrackingSucceededCallback: (event: AdjustEventSuccess) => void) { - this.eventTrackingSucceededCallback = eventTrackingSucceededCallback; - } - - setEventTrackingFailedCallbackListener(eventTrackingFailedCallback: (event: AdjustEventFailure) => void) { - this.eventTrackingFailedCallback = eventTrackingFailedCallback; - } - - setSessionTrackingSucceededCallbackListener( - sessionTrackingSucceededCallback: (session: AdjustSessionSuccess) => void - ) { - this.sessionTrackingSucceededCallback = sessionTrackingSucceededCallback; - } - - setSessionTrackingFailedCallbackListener(sessionTrackingFailedCallback: (session: AdjustSessionFailure) => void) { - this.sessionTrackingFailedCallback = sessionTrackingFailedCallback; - } - - setDeferredDeeplinkCallbackListener(deferredDeeplinkCallback: (uri: string) => void) { - this.deferredDeeplinkCallback = deferredDeeplinkCallback; - } - - setConversionValueUpdatedCallbackListener(conversionValueUpdatedCallback: (conversionValue: number) => void) { - this.conversionValueUpdatedCallback = conversionValueUpdatedCallback; - } - - private getAttributionCallback() { - return this.attributionCallback; - } - - private getEventTrackingSucceededCallback() { - return this.eventTrackingSucceededCallback; - } - - private getEventTrackingFailedCallback() { - return this.eventTrackingFailedCallback; - } - - private getSessionTrackingSucceededCallback() { - return this.sessionTrackingSucceededCallback; - } - - private getSessionTrackingFailedCallback() { - return this.sessionTrackingFailedCallback; - } - - private getDeferredDeeplinkCallback() { - return this.deferredDeeplinkCallback; - } - - private getConversionValueUpdatedCallback() { - return this.conversionValueUpdatedCallback; - } - - private hasAttributionListener() { - return this.attributionCallback !== null; - } - - private hasEventTrackingSucceededListener() { - return this.eventTrackingSucceededCallback !== null; - } - - private hasEventTrackingFailedListener() { - return this.eventTrackingFailedCallback !== null; - } - - private hasSessionTrackingSucceededListener() { - return this.sessionTrackingSucceededCallback !== null; - } - - private hasSessionTrackingFailedListener() { - return this.sessionTrackingFailedCallback !== null; - } - - private hasDeferredDeeplinkCallbackListener() { - return this.deferredDeeplinkCallback !== null; - } - - private hasConversionValueUpdatedCallbackListener() { - return this.conversionValueUpdatedCallback !== null; - } -} - -export class AdjustAppStoreSubscription { - private price: string; - private currency: string; - private transactionId: string; - private receipt: string; - private transactionDate: string; - private salesRegion: string; - private callbackParameters: string[] = []; - private partnerParameters: string[] = []; - - constructor(price: string, currency: string, transactionId: string, receipt: string) { - this.price = price; - this.currency = currency; - this.transactionId = transactionId; - this.receipt = receipt; - } - - setTransactionDate(transactionDate: string): void { - this.transactionDate = transactionDate; - } - - setSalesRegion(salesRegion: string): void { - this.salesRegion = salesRegion; - } - - addCallbackParameter(key: string, value: string): void { - this.callbackParameters.push(key); - this.callbackParameters.push(value); - } - - addPartnerParameter(key: string, value: string): void { - this.partnerParameters.push(key); - this.partnerParameters.push(value); - } -} - -export class AdjustPlayStoreSubscription { - private price: string; - private currency: string; - private sku: string; - private orderId: string; - private signature: string; - private purchaseToken: string; - private purchaseTime: string; - private callbackParameters: string[] = []; - private partnerParameters: string[] = []; - - constructor(price: string, currency: string, sku: string, orderId: string, signature: string, purchaseToken: string) { - this.price = price; - this.currency = currency; - this.sku = sku; - this.orderId = orderId; - this.signature = signature; - this.purchaseToken = purchaseToken; - } - - setPurchaseTime(purchaseTime: string): void { - this.purchaseTime = purchaseTime; - } - - addCallbackParameter(key: string, value: string): void { - this.callbackParameters.push(key); - this.callbackParameters.push(value); - } - - addPartnerParameter(key: string, value: string): void { - this.partnerParameters.push(key); - this.partnerParameters.push(value); - } -} - -export class AdjustThirdPartySharing { - private isEnabled: boolean; - private granularOptions: string[] = []; - private partnerSharingSettings: any[] = []; - - constructor(isEnabled: boolean) { - this.isEnabled = isEnabled; - } - - addGranularOption(partnerName: string, key: string, value: string): void { - this.granularOptions.push(partnerName); - this.granularOptions.push(key); - this.granularOptions.push(value); - } - - addPartnerSharingSetting(partnerName: string, key: string, value: boolean): void { - this.partnerSharingSettings.push(partnerName); - this.partnerSharingSettings.push(key); - this.partnerSharingSettings.push(value); - } -} - -export class AdjustAdRevenue { - private source: string; - private revenue: number; - private currency: string; - private adImpressionsCount: number; - private adRevenueNetwork: string; - private adRevenueUnit: string; - private adRevenuePlacement: string; - private callbackParameters: string[] = []; - private partnerParameters: string[] = []; - - constructor(source: string) { - this.source = source; - } - - setRevenue(revenue: number, currency: string): void { - this.revenue = revenue; - this.currency = currency; - } - - addCallbackParameter(key: string, value: string): void { - this.callbackParameters.push(key); - this.callbackParameters.push(value); - } - - addPartnerParameter(key: string, value: string): void { - this.partnerParameters.push(key); - this.partnerParameters.push(value); - } - - setAdImpressionsCount(adImpressionsCount: number) { - this.adImpressionsCount = adImpressionsCount; - } - - setAdRevenueNetwork(adRevenueNetwork: string) { - this.adRevenueNetwork = adRevenueNetwork; - } - - setAdRevenueUnit(adRevenueUnit: string) { - this.adRevenueUnit = adRevenueUnit; - } - - setAdRevenuePlacement(adRevenuePlacement: string) { - this.adRevenuePlacement = adRevenuePlacement; - } -} - -export interface AdjustAttribution { - trackerToken: string; - trackerName: string; - network: string; - campaign: string; - adgroup: string; - creative: string; - clickLabel: string; - adid: string; - costType: string; - costAmount: string; - costCurrency: string; - fbInstallReferrer: string; // Android only -} - -export interface AdjustSessionSuccess { - message: string; - timestamp: string; - adid: string; - jsonResponse: string; -} - -export interface AdjustSessionFailure { - message: string; - timestamp: string; - adid: string; - willRetry: boolean; - jsonResponse: string; -} - -export interface AdjustEventSuccess { - message: string; - timestamp: string; - adid: string; - eventToken: string; - callbackId: string; - jsonResponse: string; -} - -export interface AdjustEventFailure { - message: string; - timestamp: string; - adid: string; - eventToken: string; - willRetry: boolean; - callbackId: string; - jsonResponse: string; -} - -export enum AdjustEnvironment { - Sandbox = 'sandbox', - Production = 'production', -} - -export enum AdjustLogLevel { - Verbose = 'VERBOSE', - Debug = 'DEBUG', - Info = 'INFO', - Warn = 'WARN', - Error = 'ERROR', - Assert = 'ASSERT', - Suppress = 'SUPPRESS', -} - -export enum AdjustUrlStrategy { - India = 'india', - China = 'china', - DataResidencyEU = 'data-residency-eu', - DataResidencyTR = 'data-residency-tr', - DataResidencyUS = 'data-residency-us', -} - -export enum AdjustAdRevenueSource { - AdRevenueSourceAppLovinMAX = 'applovin_max_sdk', - AdRevenueSourceMopub = 'mopub', - AdRevenueSourceAdMob = 'admob_sdk', - AdRevenueSourceIronSource = 'ironsource_sdk', - AdRevenueSourceAdMost = "admost_sdk", - AdRevenueSourceUnity = "unity_sdk", - AdRevenueSourceHeliumChartboost = "helium_chartboost_sdk", - AdRevenueSourcePublisher = "publisher_sdk", -} - -/** - * @name Adjust - * @description - * This is the Ionic Cordova SDK of Adjust™. You can read more about Adjust™ at adjust.com. - * - * Requires Cordova plugin: `com.adjust.sdk`. For more info, please see the [Adjust Cordova SDK](https://github.com/adjust/cordova_sdk) - * - * @usage - * ```typescript - * import { Adjust, AdjustConfig, AdjustEnvironment } from '@awesome-cordova-plugins/adjust/ngx'; - * - * constructor(private adjust: Adjust) { } - * - * ... - * - * const config = new AdjustConfig('APP-TOKEN-HERE', AdjustEnvironment.Sandbox); - * config.logLevel = AdjustLogLevel.Verbose; - * // Set other config properties. - * adjust.create(config); - * - * ``` - * @interfaces - * AdjustAttribution - * AdjustSessionSuccess - * AdjustSessionFailure - * AdjustEventSuccess - * AdjustEventFailure - * @classes - * AdjustEvent - * AdjustConfig - * AdjustAppStoreSubscription - * AdjustPlayStoreSubscription - * AdjustThirdPartySharing - * AdjustAdReenue - * @enums - * AdjustEnvironment - * AdjustLogLevel - * AdjustUrlStrategy - * AdjustAdRevenueSource - */ -@Plugin({ - pluginName: 'Adjust', - plugin: 'com.adjust.sdk', - pluginRef: 'Adjust', - repo: 'https://github.com/adjust/cordova_sdk', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Adjust extends AwesomeCordovaNativePlugin { - - /** - * This method initializes Adjust SDK - * - * @param {AdjustConig} config Adjust config object used as starting options - */ - @Cordova({ sync: true }) - create(config: AdjustConfig): void {} - - /** - * This method tracks an event - * - * @param {AdjustEvent} event Adjust event object to be tracked - */ - @Cordova({ sync: true }) - trackEvent(event: AdjustEvent): void {} - - /** - * This method tracks App Store subscription - * - * @param {AdjustAppStoreSubscription} subscription Adjust App Store subscription object to be tracked - */ - @Cordova({ sync: true }) - trackAppStoreSubscription(subscription: AdjustAppStoreSubscription): void {} - - /** - * This method tracks Play Store subscription - * - * @param {AdjustPlayStoreSubscription} subscription Adjust Play Store subscription object to be tracked - */ - @Cordova({ sync: true }) - trackPlayStoreSubscription(subscription: AdjustPlayStoreSubscription): void {} - - /** - * This method tracks third party sharing choice - * - * @param {AdjustThirdPartySharing} thirdPartySharing Adjust third party sharing object to be tracked - */ - @Cordova({ sync: true }) - trackThirdPartySharing(thirdPartySharing: AdjustThirdPartySharing): void {} - - /** - * This method tracks ad revenue data - * - * @param {AdjustAdRevenueSource} source Ad revenue source - * @param {string} payload Ad revenue JSON string payload - */ - trackAdRevenue(source: AdjustAdRevenueSource, payload: string): void; - - /** - * This method tracks ad revenue data - * - * @param {AdjustAdRevenue} adRevenue Adjust ad revenue object - */ - trackAdRevenue(adRevenue: AdjustAdRevenue): void; - - // And typescript hides this, so the client will be able call only methods above - @Cordova({ sync: true }) - trackAdRevenue(sourceOrAdRevenue: any, payload?: any): void {} - - /** - * This method tracks measurement consent choice - * - * @param {boolean} measurementConsent set measurement consent to true or false - */ - @Cordova({ sync: true }) - trackMeasurementConsent(measurementConsent: boolean): void {} - - /** - * This method sets offline mode on or off - * - * @param {boolean} enabled set to true for offline mode on - */ - @Cordova({ sync: true }) - setOfflineMode(enabled: boolean): void {} - - /** - * By making this call, the Adjust SDK will try to find if there is any new attribution info inside of the deep link and if any, it will be sent to the Adjust backend. - * - * @param {string} url URL of the deeplink - */ - @Cordova({ sync: true }) - appWillOpenUrl(url: string): void {} - - /** - * You can disable/enable the Adjust SDK from tracking by invoking this method - * - * @param {boolean} enabled set to false to disable SDK - */ - @Cordova({ sync: true }) - setEnabled(enabled: boolean): void {} - - /** - * To send us the push notification token, add the following call to Adjust whenever you get your token in the app or when it gets updated. - * Push tokens are used for Audience Builder and client callbacks, and they are required for the upcoming uninstall tracking feature. - * - * @param {string} pushToken push token value - */ - @Cordova({ sync: true }) - setPushToken(pushToken: string): void {} - - /** - * Check if the Adjust SDK is currently enabled by calling this function - * - * @returns {Promise} - */ - @Cordova() - isEnabled(): Promise { - return; - } - - /** - * In accordance with article 17 of the EU's General Data Protection Regulation (GDPR), you can notify Adjust when a user has exercised their right to be forgotten. - * Calling the following method will instruct the Adjust SDK to communicate the user's choice to be forgotten to the Adjust backend - */ - @Cordova({ sync: true }) - gdprForgetMe(): void {} - - /** - * You can now notify Adjust when a user has exercised their right to stop sharing their data with partners for marketing purposes, but has allowed it to be shared for statistics purposes. - * Calling the following method will instruct the Adjust SDK to communicate the user's choice to disable data sharing to the Adjust backend - */ - @Cordova({ sync: true }) - disableThirdPartySharing(): void {} - - /** - * Function used to get Google AdId - * - * @returns {Promise} Returns a promise with google AdId value - */ - @Cordova() - getGoogleAdId(): Promise { - return; - } - - /** - * If you need to obtain the Amazon Advertising ID, you can make a call to this function. - * - * @returns {Promise} Returns a promise with anazib adv. ID - */ - @Cordova() - getAmazonAdId(): Promise { - return; - } - - /** - * To obtain the IDFA, call this function - * - * @returns {Promise} Returns a promise with IDFA string value - */ - @Cordova() - getIdfa(): Promise { - return; - } - - /** - * For every device with your app installed on it, the Adjust backend generates a unique Adjust device identifier (adid). - * In order to obtain this identifier, call this function - * - * @returns {Promise} Returns a promise with adid value - */ - @Cordova() - getAdid(): Promise { - return; - } - - /** - * Instruct to Adjust SDK to check current state of att_status - */ - @Cordova({ sync: true }) - checkForNewAttStatus(): void {} - - /** - * If you want to access information about a user's current attribution whenever you need it, you can make a call to this function - * - * @returns {Promise} Returns a promise with AdjustAttribution object - */ - @Cordova() - getAttribution(): Promise { - return; - } - - /** - * Get the information about version of the SDK used - * - * @returns {Promise} Returns a promise with sdk version information - */ - @Cordova() - getSdkVersion(): Promise { - return; - } - - /** - * Method used to add session callback parameters - * - * @param key key - * @param value value - */ - @Cordova({ sync: true }) - addSessionCallbackParameter(key: string, value: string): void {} - - /** - * Remove a specific session callback parameter by passing the desiring key to this method - * - * @param key key - */ - @Cordova({ sync: true }) - removeSessionCallbackParameter(key: string): void {} - - /** - * If all keys and values from the session callback parameters have to be removed, call this method - */ - @Cordova({ sync: true }) - resetSessionCallbackParameters(): void {} - - /** - * Method used to add session partner parameters - * - * @param key key - * @param value value - */ - @Cordova({ sync: true }) - addSessionPartnerParameter(key: string, value: string): void {} - - /** - * Remove a specific session partner parameter by passing the desiring key to this method - * - * @param key key - */ - @Cordova({ sync: true }) - removeSessionPartnerParameter(key: string): void {} - - /** - * If all keys and values from the session partner parameters have to be removed, call this method - */ - @Cordova({ sync: true }) - resetSessionPartnerParameters(): void {} - - /** - * This method call will make the Adjust SDK send the initial install session and any events created, if they were not sent after delay start was set and it's delay expired. - */ - @Cordova({ sync: true }) - sendFirstPackages(): void {} - - /** - * Request Adjust SDK to show pop up dialog for asking user's consent to be tracked. - * In order to do this, call this function - * - * @returns {Promise} Returns a promise with user's consent value - */ - @Cordova() - requestTrackingAuthorizationWithCompletionHandler(): Promise { - return; - } - - /** - * You can update SKAdNetwork conversion value with calling this method - * - * @param {number} conversionValue conversion value for the user - */ - @Cordova({ sync: true }) - updateConversionValue(conversionValue: number): void {} - - /** - * To obtain the app tracking authorization status in iOS, call this function - * - * @returns {Promise} Returns a promise with app tracking authorization status - */ - @Cordova() - getAppTrackingAuthorizationStatus(): Promise { - return; - } - - /** - * To obtain the last deep link which has opened your iOS app, call this function - * - * @returns {Promise} Returns a promise with iOS deep link string value - */ - @Cordova() - getLastDeeplink(): Promise { - return; - } -} \ No newline at end of file diff --git a/src/@awesome-cordova-plugins/plugins/admob-plus/index.ts b/src/@awesome-cordova-plugins/plugins/admob-plus/index.ts deleted file mode 100644 index 86be2a28..00000000 --- a/src/@awesome-cordova-plugins/plugins/admob-plus/index.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable, fromEvent } from 'rxjs'; - -export type AdUnitIDOption = - | string - | { - android: string; - ios: string; - }; - -/** - * @name AdMob Plus - * @description - * AdMob Plus is the successor of cordova-plugin-admob-free, which provides a cleaner API and build with modern tools. - */ -@Plugin({ - plugin: 'cordova-admob-plus', - pluginName: 'AdMob', - pluginRef: 'admob.banner', - repo: 'https://github.com/admob-plus/admob-plus', - platforms: ['Android', 'iOS'], -}) -export class Banner { - @Cordova({ otherPromise: true }) - hide(): Promise { - return Promise.resolve(); - } - - @Cordova({ otherPromise: true }) - show(opts: { id?: AdUnitIDOption }): Promise { - return Promise.resolve(); - } -} - -@Plugin({ - plugin: 'cordova-admob-plus', - pluginName: 'AdMob', - pluginRef: 'admob.interstitial', -}) -export class Interstitial { - @Cordova({ otherPromise: true }) - load(opts: { id?: AdUnitIDOption }): Promise { - return Promise.resolve(); - } - - @Cordova({ otherPromise: true }) - show(): Promise { - return Promise.resolve(); - } -} - -@Plugin({ - plugin: 'cordova-admob-plus', - pluginName: 'AdMob', - pluginRef: 'admob.rewardVideo', -}) -export class RewardVideo { - @Cordova({ otherPromise: true }) - load(opts: { id?: AdUnitIDOption }): Promise { - return Promise.resolve(); - } - - @Cordova({ otherPromise: true }) - show(): Promise { - return Promise.resolve(); - } -} - -@Plugin({ - platforms: ['Android', 'iOS'], - plugin: 'cordova-admob-plus', - pluginName: 'AdMob', - pluginRef: 'admob', - repo: 'https://github.com/admob-plus/admob-plus', -}) -@Injectable() -export class AdMob extends AwesomeCordovaNativePlugin { - banner = new Banner(); - interstitial = new Interstitial(); - rewardVideo = new RewardVideo(); - - @Cordova({ otherPromise: true }) - setAppMuted(value: boolean): Promise { - return Promise.resolve(); - } - - @Cordova({ otherPromise: true }) - setAppVolume(value: number): Promise { - return Promise.resolve(); - } - - @Cordova({ sync: true }) - setDevMode(value: boolean): void { - return undefined; - } - - on(event: string): Observable { - return fromEvent(document, event); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/admob-pro/index.ts b/src/@awesome-cordova-plugins/plugins/admob-pro/index.ts deleted file mode 100644 index 6d1baae4..00000000 --- a/src/@awesome-cordova-plugins/plugins/admob-pro/index.ts +++ /dev/null @@ -1,347 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export type AdSize = - | 'SMART_BANNER' - | 'BANNER' - | 'MEDIUM_RECTANGLE' - | 'FULL_BANNER' - | 'LEADERBOARD' - | 'SKYSCRAPER' - | 'CUSTOM'; - -export interface AdMobOptions { - /** - * Banner ad ID - */ - adId?: string; - - /** - * Banner Ad Size, defaults to `SMART_BANNER`. IT can be: `SMART_BANNER`, `BANNER`, `MEDIUM_RECTANGLE`, `FULL_BANNER`, `LEADERBOARD`, `SKYSCRAPER`, or `CUSTOM` - */ - adSize?: AdSize; - - /** - * Banner width, valid when `adSize` is set to `CUSTOM` - */ - width?: number; - - /** - * Banner height, valid when `adSize` is set to `CUSTOM` - */ - height?: number; - - /** - * Allow banner to overlap webview, or else it will push webview up or down to avoid overlap. Defaults to false. - */ - overlap?: boolean; - - /** - * Position of banner ad. Defaults to `TOP_CENTER`. You can use the `AdMobPro.AD_POSITION` property to select other values. - */ - position?: number; - - /** - * X in pixels. Valid when `position` is set to `POS_XY` - */ - x?: number; - - /** - * Y in pixels. Valid when `position` is set to `POS_XY` - */ - y?: number; - - /** - * Set to true to receive test ad for testing purposes - */ - isTesting?: boolean; - - /** - * Auto show interstitial ad when loaded. Set to false if hope to control the show timing with prepareInterstitial/showInterstitial - */ - autoShow?: boolean; - - /** - * Re-create the banner on web view orientation change (not screen orientation), or else just move the banner. Default:true. - */ - orientationRenew?: boolean; - - /** - * Set extra color style for Ad - */ - adExtras?: AdExtras; - - /** - * License key for the plugin - */ - license?: any; - - /** - * Set offset - */ - offsetTopBar?: boolean; -} - -export interface AdExtras { - color_bg: string; - - color_bg_top: string; - - color_border: string; - - color_link: string; - - color_text: string; - - color_url: string; -} - -/** - * @paid - * @name AdMob Pro - * @capacitorincompatible true - * @description - * Plugin for Google Ads, including AdMob / DFP (DoubleClick for publisher) and mediations to other Ad networks. - * - * IMPORTANT NOTICE: this plugin takes a percentage out of your earnings if you profit more than $1,000. Read more about this on the plugin's repo. For a completely free alternative, see [AdMobPro Free](../admob-free). - * @usage - * ```typescript - * import { AdMobPro } from '@awesome-cordova-plugins/admob-pro/ngx'; - * import { Platform } from '@ionic/angular'; - * - * constructor(private admob: AdMobPro, private platform: Platform ) { } - * - * ionViewDidLoad() { - * this.admob.onAdDismiss() - * .subscribe(() => { console.log('User dismissed ad'); }); - * } - * - * onClick() { - * let adId; - * if(this.platform.is('android')) { - * adId = 'YOUR_ADID_ANDROID'; - * } else if (this.platform.is('ios')) { - * adId = 'YOUR_ADID_IOS'; - * } - * this.admob.prepareInterstitial({adId: adId}) - * .then(() => { this.admob.showInterstitial(); }); - * } - * - * ``` - * @interfaces - * AdMobOptions - * AdExtras - */ -@Plugin({ - pluginName: 'AdMob Pro', - plugin: 'cordova-plugin-admobpro', - pluginRef: 'AdMob', - repo: 'https://github.com/floatinghotpot/cordova-admob-pro', - platforms: ['Android', 'iOS', 'Windows Phone 8'], -}) -@Injectable() -export class AdMobPro extends AwesomeCordovaNativePlugin { - AD_POSITION: { - NO_CHANGE: number; - TOP_LEFT: number; - TOP_CENTER: number; - TOP_RIGHT: number; - LEFT: number; - CENTER: number; - RIGHT: number; - BOTTOM_LEFT: number; - BOTTOM_CENTER: number; - BOTTOM_RIGHT: number; - POS_XY: number; - } = { - NO_CHANGE: 0, - TOP_LEFT: 1, - TOP_CENTER: 2, - TOP_RIGHT: 3, - LEFT: 4, - CENTER: 5, - RIGHT: 6, - BOTTOM_LEFT: 7, - BOTTOM_CENTER: 8, - BOTTOM_RIGHT: 9, - POS_XY: 10, - }; - - /** - * Create a banner - * - * @param {string | AdMobOptions} adIdOrOptions Ad ID or Options - * @returns {Promise} Returns a Promise that resolves when the banner is created - */ - @Cordova() - createBanner(adIdOrOptions: string | AdMobOptions): Promise { - return; - } - - /** - * Destroy the banner, remove it from screen. - */ - @Cordova({ - sync: true, - }) - removeBanner(): void {} - - /** - * Show banner at position - * - * @param {number} position Position. Use `AdMobPro.AD_POSITION` to set values. - */ - @Cordova({ - sync: true, - }) - showBanner(position: number): void {} - - /** - * Show banner at custom position - * - * @param {number} x Offset from screen left. - * @param {number} y Offset from screen top. - */ - @Cordova({ - sync: true, - }) - showBannerAtXY(x: number, y: number): void {} - - /** - * Hide the banner, remove it from screen, but can show it later - */ - @Cordova({ - sync: true, - }) - hideBanner(): void {} - - /** - * Prepare interstitial banner - * - * @param {string | AdMobOptions} adIdOrOptions Ad ID or Options - * @returns {Promise} Returns a Promise that resolves when interstitial is prepared - */ - @Cordova() - prepareInterstitial(adIdOrOptions: string | AdMobOptions): Promise { - return; - } - - /** - * Show interstitial ad when it's ready - */ - @Cordova({ - sync: true, - }) - showInterstitial(): void {} - - /** - * Prepare a reward video ad - * - * @param {string | AdMobOptions} adIdOrOptions Ad ID or Options - * @returns {Promise} Returns a Promise that resolves when the ad is prepared - */ - @Cordova() - prepareRewardVideoAd(adIdOrOptions: string | AdMobOptions): Promise { - return; - } - - /** - * Show a reward video ad - */ - @Cordova({ - sync: true, - }) - showRewardVideoAd(): void {} - - /** - * Sets the values for configuration and targeting - * - * @param {AdMobOptions} options Options - * @returns {Promise} Returns a Promise that resolves when the options have been set - */ - @Cordova() - setOptions(options: AdMobOptions): Promise { - return; - } - - /** - * Get user ad settings - * - * @returns {Promise} Returns a promise that resolves with the ad settings - */ - @Cordova() - getAdSettings(): Promise { - return; - } - - /** - * Triggered when failed to receive Ad - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'onAdFailLoad', - element: 'document', - }) - onAdFailLoad(): Observable { - return; - } - - /** - * Triggered when Ad received - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'onAdLoaded', - element: 'document', - }) - onAdLoaded(): Observable { - return; - } - - /** - * Triggered when Ad will be showed on screen - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'onAdPresent', - element: 'document', - }) - onAdPresent(): Observable { - return; - } - - /** - * Triggered when user click the Ad, and will jump out of your App - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'onAdLeaveApp', - element: 'document', - }) - onAdLeaveApp(): Observable { - return; - } - - /** - * Triggered when dismiss the Ad and back to your App - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'onAdDismiss', - element: 'document', - }) - onAdDismiss(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/admob/index.ts b/src/@awesome-cordova-plugins/plugins/admob/index.ts deleted file mode 100644 index 8ff984ec..00000000 --- a/src/@awesome-cordova-plugins/plugins/admob/index.ts +++ /dev/null @@ -1,588 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface AdmobBaseOptions { - /** - * (Optional) Your interstitial id code from your AdMob account. Defaults to bannerAdId - */ - interstitialAdId?: string; - - /** - * (Optional) Indicates whether to put banner ads at top when set to true or at bottom when set to false. Defaults to false - */ - bannerAtTop?: boolean; - - /** - * (Optional) Set to true to receive test ads (do not test with real ads as your account may be banned). Defaults to false - */ - isTesting?: boolean; - - /** - * (Optional) Auto show banner ads when available (onAdLoaded event is called). Defaults to true - */ - autoShowBanner?: boolean; - - /** - * (Optional) Auto show interstitial ads when available (onAdLoaded event is called). Defaults to true - */ - autoShowInterstitial?: boolean; -} -export interface AdmobOptions extends AdmobBaseOptions { - /** - * Your banner id code from your AdMob account (https://support.google.com/admob/answer/7356431?hl=en) - */ - bannerAdId: string; - - /** - * Deprecated. Now is only used in web. It will be used as a bannerAdId only in case it is undefined. - */ - publisherId?: string; - - /** - * (Optional) Your tappx id for iOS apps. If Admob is configured, it is also used to backfill your lost inventory (when there are no Admob ads available) - */ - tappxIdiOS?: string; - - /** - * (Optional) Your tappx id for Android apps. Admob is configured, it is also used to backfill your lost inventory when there are no Admob ads available - */ - tappxIdAndroid?: string; - - /** - * AdMob rewarded id (https://support.google.com/admob/answer/7356431?hl=en) - */ - rewardedAdId?: string; - - /** - * (Optional) Auto show rewarded ads when available (onAdLoaded event is called). Defaults to true - */ - autoShowRewarded?: boolean; - - /** - * (Optional) If any of tappxId is present, it tells the percentage of traffic diverted to tappx. Defaults to 0.5 (50% of the traffic will be requested to Tappx) - */ - tappxShare?: number; - - /** - * (Optional) Indicates the size of banner ads - */ - adSize?: string; - - /** - * (Optional) Allow banner overlap webview. Default false - */ - overlap?: boolean; - - /** - * (Optional) Set to true to avoid ios7 status bar overlap. Default false - */ - offsetStatusBar?: boolean; - - /** - * (Options) A JSON object with additional {key: value} pairs - */ - adExtras?: any; -} - -export interface AdmobWebOptions extends AdmobBaseOptions { - /** - * (Required) AdSense Publisher ID (https://support.google.com/adsense/answer/105516) - */ - publisherId: string; - - /** - * (Required) Your ad slot code from your AdSense account. Only for browser platform https://support.google.com/adsense/answer/105516 - */ - adSlot: string; - - /** - * (Optional) Indicates if show a close button on interstitial browser ads. Only for browser platform - */ - interstitialShowCloseButton?: boolean; - - /** - * (Optional) Indicates the number of seconds that the interstitial ad waits before show the close button. Only for browser platform - */ - secondsToShowCloseButton?: number; - - /** - * (Optional) Indicates the number of seconds that the interstitial ad waits before close the ad. Only for browser platform - */ - secondsToCloseInterstitial?: number; -} - -export interface AdMobEvent { - /** - * (Optional) AdMob supported type as seen in AD_TYPE - */ - adType?: string; - - /** - * (Optional) AdMob error code - */ - error?: number; - - /** - * (Optional) AdMob error reason - */ - reason?: string; -} - -/** - * @name AdMob - * @description - * Most complete Admob plugin with support for [Tappx](http://www.tappx.com/?h=dec334d63287772de859bdb4e977fce6) ads. - * Monetize your apps and games with AdMob ads, using latest Google AdMob SDK. With this plugin you can show AdMob ads easily! - * - * Supports:** - * - Banner ads (top and bottom) - * - Interstitial ads - * - Rewarded ads - * - [Tappx](http://www.tappx.com/?h=dec334d63287772de859bdb4e977fce6) ads - * @usage - * Note:** No ads will be served on apps with package name `io.ionic.starter`. This is the default package name for new `ionic` apps. Make sure to rename the package name so ads can be displayed. - * ```typescript - * import { Admob, AdmobOptions } from '@awesome-cordova-plugins/admob'; - * - * - * constructor(private admob: Admob) { - * // Admob options config - * const admobOptions: AdmobOptions = { - * bannerAdId: 'XXX-XXXX-XXXX', - * interstitialAdId: 'XXX-XXXX-XXXX', - * rewardedAdId: 'XXX-XXXX-XXXX', - * isTesting: true, - * autoShowBanner: false, - * autoShowInterstitial: false, - * autoShowRewarded: false, - * adSize: this.admob.AD_SIZE.BANNER - * }; - * - * // Set admob options - * this.admob.setOptions(admobOptions) - * .then(() => console.log('Admob options have been successfully set')) - * .catch(err => console.error('Error setting admob options:', err)); - * } - * - * - * - * // (Optionally) Load banner ad, in order to have it ready to show - * this.admob.createBannerView() - * .then(() => console.log('Banner ad loaded')) - * .catch(err => console.error('Error loading banner ad:', err)); - * - * - * // Show banner ad (createBannerView must be called before and onAdLoaded() event raised) - * this.admob.onAdLoaded().subscribe((ad) => { - * if (ad.adType === this.admob.AD_TYPE.BANNER) { - * this.admob.showBannerAd() - * .then(() => console.log('Banner ad shown')) - * .catch(err => console.error('Error showing banner ad:', err)); - * } - * }); - * - * - * // Hide banner ad, but do not destroy it, so it can be shown later on - * // See destroyBannerView in order to hide and destroy banner ad - * this.admob.showBannerAd(false) - * .then(() => console.log('Banner ad hidden')) - * .catch(err => console.error('Error hiding banner ad:', err)); - * - * - * - * // Request an interstitial ad, in order to be shown later on - * // It is possible to autoshow it via options parameter, see docs - * this.admob.requestInterstitialAd() - * .then(() => console.log('Interstitial ad loaded')) - * .catch(err => console.error('Error loading interstitial ad:', err)); - * - * - * // Show an interstitial ad (requestInterstitialAd must be called before) - * this.admob.onAdLoaded().subscribe((ad) => { - * if (ad.adType === this.admob.AD_TYPE.INTERSTITIAL) { - * this.admob.showInterstitialAd() - * .then(() => console.log('Interstitial ad shown')) - * .catch(err => console.error('Error showing interstitial ad:', err)); - * } - * }); - * - * - * // Request a rewarded ad - * this.admob.requestRewardedAd() - * .then(() => console.log('Rewarded ad loaded')) - * .catch(err => console.error('Error loading rewarded ad:', err)); - * - * - * // Show rewarded ad (requestRewardedAd must be called before) - * this.admob.onAdLoaded().subscribe((ad) => { - * if (ad.adType === this.admob.AD_TYPE.REWARDED) { - * this.admob.showRewardedAd() - * .then(() => console.log('Rewarded ad shown')) - * .catch(err => console.error('Error showing rewarded ad:', err)); - * } - * }); - * - * - * // Hide and destroy banner or interstitial ad - * this.admob.destroyBannerView() - * .then(() => console.log('Banner or interstitial ad destroyed')) - * .catch(err => console.error('Error destroying banner or interstitial ad:', err)); - * - * - * - * // On Ad loaded event - * this.admob.onAdLoaded().subscribe((ad) => { - * if (ad.adType === this.admob.AD_TYPE.BANNER) { - * console.log('Banner ad is loaded'); - * this.admob.showBannerAd(); - * } else if (ad.adType === this.admob.AD_TYPE.INTERSTITIAL) { - * console.log('Interstitial ad is loaded'); - * this.admob.showInterstitialAd(); - * } else if (ad.adType === this.admob.AD_TYPE.REWARDED) { - * console.log('Rewarded ad is loaded'); - * this.admob.showRewardedAd(); - * } - * }); - * - * - * - * // On ad failed to load - * this.admob.onAdFailedToLoad().subscribe(err => console.log('Error loading ad:', err)); - * - * - * - * // On interstitial ad opened - * this.admob.onAdOpened().subscribe(() => console.log('Interstitial ad opened')); - * - * - * - * // On interstitial ad closed - * this.admob.onAdClosed().subscribe(() => console.log('Interstitial ad closed')); - * - * - * - * // On ad clicked and left application - * this.admob.onAdLeftApplication().subscribe(() => console.log('Ad lefted application')); - * - * - * - * // On user ad rewarded - * this.admob.onRewardedAd().subscribe(() => console.log('The user has been rewarded')); - * - * - * - * // On rewarded ad video started - * this.admob.onRewardedAdVideoStarted().subscribe(() => console.log('Rewarded ad vieo started')); - * - * - * - * // On rewarded ad video completed - * this.admob.onRewardedAdVideoCompleted().subscribe(() => console.log('Rewarded ad video completed')); - * - * ``` - */ -@Plugin({ - pluginName: 'AdMob', - plugin: 'cordova-admob', - pluginRef: 'admob', - repo: 'https://github.com/appfeel/admob-google-cordova', - platforms: ['Android', 'iOS', 'Browser'], -}) -@Injectable() -export class Admob extends AwesomeCordovaNativePlugin { - /** - * This enum represents AdMob's supported ad sizes. - * Use one of these constants as adSize option when calling createBannerView - * - * @readonly - */ - @CordovaProperty() - readonly AD_SIZE: { - BANNER: string; - IAB_MRECT: string; - IAB_BANNER: string; - IAB_LEADERBOARD: string; - SMART_BANNER: string; - }; - - /** - * This enum represents AdMob's supported ad types - * - * @readonly - */ - @CordovaProperty() - readonly AD_TYPE: { - BANNER: string; - INTERSTITIAL: string; - REWARDED: string; - }; - - /** - * Set the options to start displaying ads. - * Although it is not required to call this method, as options can be specified in other methods, it is highly recommended - * - * @param options {AdmobOptions} Some param to configure something - * @returns {Promise} Returns a promise that resolves when the options are set - */ - @Cordova() - setOptions(options: AdmobOptions | AdmobWebOptions): Promise { - return; - } - - /** - * Creates a new banner ad view. Call this method in order to be able to start showing banners - * - * @param options {AdmobOptions} (Optional) Setup options - * @returns {Promise} Returns a promise that resolves when the banner view is created - */ - @Cordova() - createBannerView(options?: AdmobOptions | AdmobWebOptions): Promise { - return; - } - - /** - * Show banner ads. You must call createBannerView first, otherwise it will result in failure callback and no ads will be shown - * - * @param show {boolean} (Optional) Indicates whether to show or hide banner ads. Defaults to `true` - * @returns {Promise} Returns a promise that resolves when the banner shown or hidden - */ - @Cordova() - showBannerAd(show?: boolean): Promise { - return; - } - - /** - * Hide and destroy banner view. Call this method when you want to destroy banner view. - * It is not necessary to call this method when the app closed, as it will be automatically called by the plugin - */ - @Cordova() - destroyBannerView() {} - - /** - * Request an interstitial ad - * If `options.autoShowInterstitial` is set to `true` (default), the ad will automatically be displayed. - * Otherwise you need to subscribe to `onAdLoaded()` event and call `showInterstitialAd()` after it will be raised specifying that an interstitial ad is available. - * If you already called `requestInterstitialAd()` but the interstitial has never been shown, the successive calls to `requestInterstitialAd()` will result in the ad being inmediately available (the one that was obtained on the first call) - * - * @param options {AdmobOptions} (Optional) Setup options - * @returns {Promise} Returns a promise that resolves when the interstitial ad is loaded - */ - @Cordova() - requestInterstitialAd(options?: AdmobOptions | AdmobWebOptions): Promise { - return; - } - - /** - * Show an interstitial ad. Call it after `requestInterstitialAd()` and `onAdLoaded()` event raised. - * - * @returns {Promise} Returns a promise that resolves when the interstitial ad is shown - */ - @Cordova() - showInterstitialAd(): Promise { - return; - } - - /** - * Request an rewarded ad - * If `options.autoShowRewarded` is set to `true` (default), the ad will automatically be displayed. - * Otherwise you need to subscribe to `onAdLoaded()` enent and call `showRewardedAd()` after it will be raised specifying that a rewarded ad is available. - * If you already called `requestRewardedAd()` but the rewarded has never been shown, the successive calls to `requestRewardedAd()` will result in the ad being inmediately available (the one that was obtained on the first call) - * - * @param options {AdmobOptions} (Optional) Setup options - * @returns {Promise} Returns a promise that resolves when the rewarded ad is loaded - */ - @Cordova() - requestRewardedAd(options?: AdmobOptions | AdmobWebOptions): Promise { - return; - } - - /** - * Show a rewarded ad - * - * @returns {Promise} Returns a promise that resolves when the rewarded ad is shown - */ - @Cordova() - showRewardedAd(): Promise { - return; - } - - /** - * Called when an ad is received. - * - * WARNING*: only **ionic^4**. Older versions of ionic, use: - * - * ```js - * document.addEventListener(window.admob.events.onAdLoaded, () => { }); - * ``` - * - * Please refer to the documentation on https://admob-ionic.com/Events. - * - * @returns {Observable} Returns an observable when an ad is received - */ - @Cordova({ - eventObservable: true, - event: 'appfeel.cordova.admob.onAdLoaded', - element: document, - }) - onAdLoaded(): Observable { - return; - } - - /** - * Called when an ad request failed. - * - * WARNING*: only **ionic^4**. Older versions of ionic, use: - * - * ```js - * document.addEventListener(window.admob.events.onAdFailedToLoad, () => { }); - * ``` - * - * Please refer to the documentation on https://admob-ionic.com/Events. - * - * @returns {Observable} Returns an observable when an ad request is failed - */ - @Cordova({ - eventObservable: true, - event: 'appfeel.cordova.admob.onAdFailedToLoad', - element: document, - }) - onAdFailedToLoad(): Observable { - return; - } - - /** - * Called when an ad opens an overlay that covers the screen. - * Please note that onPause cordova event is raised when an interstitial is shown. - * - * WARNING*: only **ionic^4**. Older versions of ionic, use: - * - * ```js - * document.addEventListener(window.admob.events.onAdOpened, () => { }); - * ``` - * - * Please refer to the documentation on https://admob-ionic.com/Events. - * - * @returns {Observable} Returns an observable when an ad is opened - */ - @Cordova({ - eventObservable: true, - event: 'appfeel.cordova.admob.onAdOpened', - element: document, - }) - onAdOpened(): Observable { - return; - } - - /** - * Called when the user is about to return to the application after clicking on an ad. - * Please note that onResume cordova event is raised when an interstitial is closed. - * - * WARNING*: only **ionic^4**. Older versions of ionic, use: - * - * ```js - * document.addEventListener(window.admob.events.onAdClosed, () => { }); - * ``` - * - * Please refer to the documentation on https://admob-ionic.com/Events. - * - * @returns {Observable} Returns an observable when an ad is closed - */ - @Cordova({ - eventObservable: true, - event: 'appfeel.cordova.admob.onAdClosed', - element: document, - }) - onAdClosed(): Observable { - return; - } - - /** - * Called when the user leaves the application after clicking an ad (e.g., to go to the browser) - * - * @returns {Observable} Returns an observable when an ad leaves the application. - * - * WARNING*: only **ionic^4**. Older versions of ionic, use: - * - * ```js - * document.addEventListener(window.admob.events.onAdLeftApplication, () => { }); - * ``` - * - * Please refer to the documentation on https://admob-ionic.com/Events. - * @returns {Observable} Returns an observable when application is left due to an ad click - */ - @Cordova({ - eventObservable: true, - event: 'appfeel.cordova.admob.onAdLeftApplication', - element: document, - }) - onAdLeftApplication(): Observable { - return; - } - - /** - * Called when the user has been rewarded by an ad. - * - * WARNING*: only **ionic^4**. Older versions of ionic, use: - * - * ```js - * document.addEventListener(window.admob.events.onRewardedAd, () => { }); - * ``` - * - * Please refer to the documentation on https://admob-ionic.com/Events. - * - * @returns {Observable} Returns an observable when the user rewards an ad - */ - @Cordova({ - eventObservable: true, - event: 'appfeel.cordova.admob.onRewardedAd', - element: document, - }) - onRewardedAd(): Observable { - return; - } - - /** - * Called when the video of a rewarded ad started. - * - * WARNING*: only **ionic^4**. Older versions of ionic, use: - * - * ```js - * document.addEventListener(window.admob.events.onRewardedAdVideoStarted, () => { }); - * ``` - * - * Please refer to the documentation on https://admob-ionic.com/Events. - * - * @returns {Observable} Returns an observable when the video is started - */ - @Cordova({ - eventObservable: true, - event: 'appfeel.cordova.admob.onRewardedAdVideoStarted', - element: document, - }) - onRewardedAdVideoStarted(): Observable { - return; - } - - /** - * Called when the video of a rewarded ad has completed. - * - * WARNING*: only **ionic^4**. Older versions of ionic, use: - * - * ```js - * document.addEventListener(window.admob.events.onRewardedAdVideoCompleted, () => { }); - * ``` - * - * Please refer to the documentation on https://admob-ionic.com/Events. - * - * @returns {Observable} Returns an observable when the video is completed - */ - @Cordova({ - eventObservable: true, - event: 'appfeel.cordova.admob.onRewardedAdVideoCompleted', - element: document, - }) - onRewardedAdVideoCompleted(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/advanced-image-picker/index.ts b/src/@awesome-cordova-plugins/plugins/advanced-image-picker/index.ts deleted file mode 100644 index 8862cc18..00000000 --- a/src/@awesome-cordova-plugins/plugins/advanced-image-picker/index.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -interface PresentOptions { - /** - * Which Media Types are allowed to be selected - * default: "IMAGE" - */ - mediaType?: 'IMAGE' | 'VIDEO' | 'ALL'; - /** - * Show possibility to take via Camera - * default: true - */ - showCameraTile?: boolean; - /** - * On which Screen the Picker should be started (iOS only) - * default: "LIBRARY" - */ - startOnScreen?: 'LIBRARY' | 'IMAGE' | 'VIDEO'; - /** - * Date format of the Scroll Indicator (Android only) - * default: "YYYY.MM" - */ - scrollIndicatorDateFormat?: string; - /** - * Show Title (Android only) - * default: true - */ - showTitle?: boolean; - /** - * Customize the Title (Android only) - * default: "Select Image" - */ - title?: string; - /** - * Show the zoomIndicator at the Images (Android only) - * default: true - */ - zoomIndicator?: boolean; - /** - * Min Count of files to be selected - * default: 0 (android), 1 (iOS) - */ - min?: number; - /** - * Message to be shown if min Count not reached (Android only) - * default: "You need to select a minimum of ... pictures")" - */ - minCountMessage?: string; - /** - * Max Count of files can selected - * default: 0 (android), 1 (iOS) - */ - max?: number; - /** - * Message to be shown if max Count is reached - * default: "You can select a maximum of ... pictures" - */ - maxCountMessage?: string; - /** - * Change Done Button Text - */ - buttonText?: string; - /** - * Show Library as Dropdown (Android only) - * default: false - */ - asDropdown?: boolean; - /** - * Return the Result as base64 - * default: false - */ - asBase64?: boolean; - /** - * Return the Image as JPEG - * default: false - */ - asJpeg?: boolean; - /** - * Video Compression Option (iOS only) - * available options: https://github.com/Yummypets/YPImagePicker/blob/23158e138bd649b40762bf2e4aa4beb0d463a121/Source/Configuration/YPImagePickerConfiguration.swift#L226-L240 - * default: AVAssetExportPresetHighestQuality - */ - videoCompression?: string; -} - -interface Result { - type: 'image' | 'video'; - isBase64: boolean; - src: string; -} - -export enum ErrorCodes { - UnsupportedAction = 1, - WrongJsonObject = 2, - PickerCanceled = 3, - UnknownError = 10, -} - -/** - * Used for every Plugin Error Callback - */ -interface AdvancedImagePickerError { - /** - * One of the AdvancedImagePickerErrorCodes - */ - code: ErrorCodes; - - /** - * If available some more info (mostly exception message) - */ - message: string; -} - -/** - * @name AdvancedImagePicker - * @description - * This Cordova Plugin is for a better (multiple) ImagePicker with more options. - * - * @usage - * ```typescript - * import { AdvancedImagePicker } from '@awesome-cordova-plugins/advanced-image-picker/npx'; - * - * - * constructor(private advancedImagePicker: AdvancedImagePicker) { } - * - * ... - * - * - * this.advancedImagePicker.present{ - * // config here - * }) - * .then((res: Result[]) => console.log(res)) - * .catch((error: AdvancedImagePickerError) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'AdvancedImagePicker', - plugin: 'cordova-plugin-advanced-imagepicker', - pluginRef: 'AdvancedImagePicker', - repo: 'https://github.com/EinfachHans/cordova-plugin-advanced-imagepicker', - install: 'ionic cordova plugin add cordova-plugin-advanced-imagepicker', - installVariables: ['ANDROID_IMAGE_PICKER_VERSION'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class AdvancedImagePicker extends AwesomeCordovaNativePlugin { - /** - * Present the ImagePicker - * @param options {PresentOptions} https://github.com/EinfachHans/cordova-plugin-advanced-imagepicker/tree/master#parameters - * @return {Promise} - */ - @Cordova() - present(options: PresentOptions): Promise { - return; - } - - /** - * Cleans all temp stored Files that was created by this Plugin (iOS only) - */ - @Cordova({ platforms: ['iOS'] }) - cleanup(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/aes-256/index.ts b/src/@awesome-cordova-plugins/plugins/aes-256/index.ts deleted file mode 100644 index 7f662227..00000000 --- a/src/@awesome-cordova-plugins/plugins/aes-256/index.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name AES256 - * @description - * This cordova ionic plugin allows you to perform AES 256 encryption and decryption on the plain text. - * It's a cross-platform plugin which supports both Android and iOS. - * The encryption and decryption are performed on the device native layer so that the performance is much faster. - * @usage - * ```typescript - * import { AES256 } from '@awesome-cordova-plugins/aes-256/ngx'; - * - * private secureKey: string; - * private secureIV: string; - * - * constructor(private aes256: AES256) { - * this.generateSecureKeyAndIV(); // To generate the random secureKey and secureIV - * } - * - * ... - * - * async generateSecureKeyAndIV() { - * this.secureKey = await this.aes256.generateSecureKey('random password 12345'); // Returns a 32 bytes string - * this.secureIV = await this.aes256.generateSecureIV('random password 12345'); // Returns a 16 bytes string - * } - * - * this.aes256.encrypt(this.secureKey, this.secureIV, 'testdata') - * .then(res => console.log('Encrypted Data: ',res)) - * .catch((error: any) => console.error(error)); - * - * this.aes256.decrypt(this.secureKey, this.secureIV, 'encryptedData') - * .then(res => console.log('Decrypted Data : ',res)) - * .catch((error: any) => console.error(error)); - * - * - * this.aes256.generateSecureKey('random password 12345') - * .then(res => console.log('Secure Key : ',res)) - * .catch((error: any) => console.error(error)); - * - * - * this.aes256.generateSecureIV('random password 12345') - * .then(res => console.log('Secure IV : ',res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'AES256', - plugin: 'cordova-plugin-aes256-encryption', - pluginRef: 'cordova.plugins.AES256', - repo: 'https://github.com/Ideas2IT/cordova-aes256', - platforms: ['Android', 'iOS'], - install: 'ionic cordova plugin add cordova-plugin-aes256-encryption', -}) -@Injectable() -export class AES256 extends AwesomeCordovaNativePlugin { - /** - * This function used to perform the aes256 encryption - * - * @param {string} secureKey A 32 bytes string, which will used as input key for AES256 encryption. - * @param {string} secureIV A 16 bytes string, which will used as initial vector for AES256 encryption. - * @param {string} data A string which will be encrypted - * @returns {Promise} Returns a promise that resolves when encryption happens. The success response will returns encrypted data. - */ - @Cordova() - encrypt(secureKey: string, secureIV: string, data: string): Promise { - return; - } - - /** - * This function used to perform the aes256 decryption - * - * @param {string} secureKey A 32 bytes string, which will used as input key for AES256 decryption. - * @param {string} secureIV A 16 bytes string, which will used as initial vector for AES256 decryption. - * @param {string} data An AES256 encrypted data which will be decrypted. - * @returns {Promise} Returns a promise that resolves when decryption happens. The success response will returns decrypted data. - */ - @Cordova() - decrypt(secureKey: string, secureIV: string, data: string): Promise { - return; - } - - /** - * This function used to generate a secure key based on an password. Perfect if you want to delegate the key generation for encryption to the plugin. - * Make sure to save the return value of this function somewhere so your encrypted data can be decrypted in the future. - * - * @param {string} password A random string, which will be used as input for a PBKDF2 function - * @returns {Promise} Returns a promise that resolves when key is generated. - */ - @Cordova() - generateSecureKey(password: string): Promise { - return; - } - - /** - * This function used to generate a secure IV based on an password. Perfect if you want to delegate the IV generation for encryption to the plugin. - * Make sure to save the return value of this function somewhere so your encrypted data can be decrypted in the future. - * - * @param {string} password A random string, which will be used as input for a PBKDF2 function - * @returns {Promise} Returns a promise that resolves when IV is generated. - */ - @Cordova() - generateSecureIV(password: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/all-in-one-sdk/index.ts b/src/@awesome-cordova-plugins/plugins/all-in-one-sdk/index.ts deleted file mode 100644 index f64cd77c..00000000 --- a/src/@awesome-cordova-plugins/plugins/all-in-one-sdk/index.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Plugin, - Cordova, - CordovaProperty, - CordovaInstance, - InstanceProperty, - AwesomeCordovaNativePlugin, -} from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name AllInOneSDK - * @description - * Paytm All-in-One SDK plugin for Cordova/Ionic Applications - * Paytm All-in-One SDK provides a swift, secure and seamless payment experience to your users by invoking the Paytm app (if installed on your user’s smartphone) to complete payment for your order. - * Paytm All-in-One SDK enables payment acceptance via Paytm wallet, Paytm Payments Bank, saved Debit/Credit cards, Net Banking, BHIM UPI and EMI as available in your customer’s Paytm account. If Paytm app is not installed on a customer's device, the transaction will be processed via web view within the All-in-One SDK. - * For more information about Paytm All-in-One SDK, please visit https://developer.paytm.com/docs/all-in-one-sdk/hybrid-apps/cordova/ - * @usage - * ```typescript - * import { AllInOneSDK } from '@awesome-cordova-plugins/all-in-one-sdk/ngx'; - * - * - * constructor(private allInOneSDK: AllInOneSDK) { } - * - * ... - * - * For below parameters see [documentation](https://developer.paytm.com/docs/all-in-one-sdk/hybrid-apps/cordova/) - * let paymentIntent = { mid : merchantID, orderId: orderId, txnToken: transactionToken, amount: amount, isStaging: isStaging, callbackUrl:callBackURL, restrictAppInvoke:restrictAppInvoke } - * - * this.allInOneSDK.startTransaction(paymentIntent) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - * - * For iOS: - * After adding the plugin, open the iOS project, you can find the same at /platforms/ios. - * In case merchant don’t have callback URL, Add an entry into Info.plist LSApplicationQueriesSchemes(Array) Item 0 (String)-> paytm - * Add a URL Scheme “paytm”+”MID” - */ -@Plugin({ - pluginName: 'AllInOneSDK', - plugin: 'cordova-paytm-allinonesdk', - pluginRef: 'AllInOneSDK', - repo: 'https://github.com/paytm/paytm-allinonesdk-ionic-cordova.git', - platforms: ['Android', 'iOS'], -}) -export class AllInOneSDK extends AwesomeCordovaNativePlugin { - /** - * This function checks if Paytm Application is available on the device. - * If Paytm exists then it invokes Paytm Application with the parameters sent and creates an order. - * If the Paytm Application is not available the transaction is continued on a webView within All-in-One SDK. - * - * @param options {PaymentIntentModel} These parameters are required and will be used to create an order. - * @returns {Promise} Returns a promise that resolves when a transaction completes(both failed and successful). - */ - @Cordova() - startTransaction(options: PaymentIntentModel | PaymentAssistIntentModel): Promise { - return; - } -} - -/** - * The response that will be recieved when any transaction is completed - */ -export interface PaytmResponse { - message: string; - response: string; // A stringified response of a hashmap returned from All-in-One SDK -} - -/** - * For below parameters see [documentation](https://developer.paytm.com/docs/all-in-one-sdk/hybrid-apps/cordova/) - */ -export interface PaymentIntentModel { - mid: string; // Merchant ID - orderId: string; // Order ID - txnToken: string; // Transaction Token - amount: string; // Amount - isStaging: boolean; // Environment - callbackUrl: string; // Callback URL - restrictAppInvoke: boolean; // To enable or disable the paytm app invocation -} - -export interface PaymentAssistIntentModel { - mid: string; // Merchant ID - orderId: string; // Order ID - txnToken: string; // Transaction Token - amount: string; // Amount - isStaging: boolean; // Environment - callbackUrl: string; // Callback URL - restrictAppInvoke: boolean; // To enable or disable the paytm app invocation - enableAssist: boolean; // To enable or disable the Assist (Otp auto read) -} diff --git a/src/@awesome-cordova-plugins/plugins/analytics-firebase/index.ts b/src/@awesome-cordova-plugins/plugins/analytics-firebase/index.ts deleted file mode 100644 index 9671fd40..00000000 --- a/src/@awesome-cordova-plugins/plugins/analytics-firebase/index.ts +++ /dev/null @@ -1,259 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Analytics Firebase - * @description - * Google Analytics Firebase plugin for Ionic Native apps. - * @usage - * ```typescript - * import { AnalyticsFirebase } from '@awesome-cordova-plugins/analytics-firebase'; - * - * - * constructor(private analyticsFirebase: AnalyticsFirebase) { } - * - * // Track an event with default events and params - * const eventParams = {}; - * eventParams[this.analyticsFirebase.DEFAULT_PARAMS.LEVEL] = 29; - * this.analyticsFirebase.logEvent(this.analyticsFirebase.DEFAULT_EVENTS.LEVEL_UP, eventParams) - * .then(() => console.log('Event successfully tracked')) - * .catch(err => console.log('Error tracking event:', err)); - * - * // Track an event with custom events and params - * const eventParams = {}; - * eventParams['my-prop'] = 29; - * this.analyticsFirebase.logEvent('my-event', eventParams) - * .then(() => console.log('Event successfully tracked')) - * .catch(err => console.log('Error tracking event:', err)); - * - * - * // Reset analytics data - * this.analyticsFirebase.resetAnalyticsData() - * .then(() => console.log('Analytics data have been reset')) - * .catch(err => console.log('Error resetting analytics data:', err)); - * - * - * // Track a screen view - * this.analyticsFirebase.setCurrentScreen('Home') - * .then(() => console.log('View successfully tracked')) - * .catch(err => console.log('Error tracking view:', err)); - * - * - * // Set user id - * this.analyticsFirebase.setUserId('USER-ID') - * .then(() => console.log('User id successfully set')) - * .catch(err => console.log('Error setting user id:', err)); - * - * - * // Set user property from default properties - * this.analyticsFirebase.setUserProperty('KEY', 'VALUE') - * .then(() => console.log('User property successfully set')) - * .catch(err => console.log('Error setting user property:', err)); - * - * ``` - */ -@Plugin({ - pluginName: 'AnalyticsFirebase', - plugin: 'cordova-plugin-analytics', - pluginRef: 'analytics', - repo: 'https://github.com/appfeel/analytics-google', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class AnalyticsFirebase extends AwesomeCordovaNativePlugin { - /** - * This enum represents AnalyticsFirebase default events. - * Use one of these default events or a custom event - * - * @readonly - */ - @CordovaProperty() - readonly DEFAULT_EVENTS: { - ADD_PAYMENT_INFO: string; - ADD_TO_CART: string; - ADD_TO_WISHLIST: string; - APP_OPEN: string; - BEGIN_CHECKOUT: string; - CAMPAIGN_DETAILS: string; - CHECKOUT_PROGRESS: string; - EARN_VIRTUAL_CURRENCY: string; - ECOMMERCE_PURCHASE: string; - GENERATE_LEAD: string; - JOIN_GROUP: string; - LEVEL_END: string; - LEVEL_START: string; - LEVEL_UP: string; - LOGIN: string; - POST_SCORE: string; - PRESENT_OFFER: string; - PURCHASE_REFUND: string; - REMOVE_FROM_CART: string; - SEARCH: string; - SELECT_CONTENT: string; - SET_CHECKOUT_OPTION: string; - SHARE: string; - SIGN_UP: string; - SPEND_VIRTUAL_CURRENCY: string; - TUTORIAL_BEGIN: string; - TUTORIAL_COMPLETE: string; - UNLOCK_ACHIEVEMENT: string; - VIEW_ITEM: string; - VIEW_ITEM_LIST: string; - VIEW_SEARCH_RESULTS: string; - }; - - /** - * This enum represents AnalyticsFirebase default params. - * Use one of these default params or a custom param - * - * @readonly - */ - @CordovaProperty() - readonly DEFAULT_PARAMS: { - ACHIEVEMENT_ID: string; - ACLID: string; - AFFILIATION: string; - CAMPAIGN: string; - CHARACTER: string; - CHECKOUT_OPTION: string; - CHECKOUT_STEP: string; - CONTENT: string; - CONTENT_TYPE: string; - COUPON: string; - CP1: string; - CREATIVE_NAME: string; - CREATIVE_SLOT: string; - CURRENCY: string; - DESTINATION: string; - END_DATE: string; - FLIGHT_NUMBER: string; - GROUP_ID: string; - INDEX: string; - ITEM_BRAND: string; - ITEM_CATEGORY: string; - ITEM_ID: string; - ITEM_LIST: string; - ITEM_LOCATION_ID: string; - ITEM_NAME: string; - ITEM_VARIANT: string; - LEVEL: string; - LEVEL_NAME: string; - LOCATION: string; - MEDIUM: string; - METHOD: string; - NUMBER_OF_NIGHTS: string; - NUMBER_OF_PASSENGERS: string; - NUMBER_OF_ROOMS: string; - ORIGIN: string; - PRICE: string; - QUANTITY: string; - SCORE: string; - SEARCH_TERM: string; - SHIPPING: string; - SOURCE: string; - START_DATE: string; - SUCCESS: string; - TAX: string; - TERM: string; - TRANSACTION_ID: string; - TRAVEL_CLASS: string; - VALUE: string; - VIRTUAL_CURRENCY_NAME: string; - }; - - /** - * Logs an app event. The event can have up to 25 parameters. - * Events with the same name must have the same parameters. - * Up to 500 event names are supported. - * Using predefined [FirebaseAnalytics.Event](https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event.html) and/or [FirebaseAnalytics.Param](https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Param.html) is recommended for optimal reporting. - * - * @param eventName {string} The event name - * @param eventParams {object} (Optional) The event params - * @returns {Promise} Returns a promise that resolves when the event is logged - */ - @Cordova() - logEvent(eventName: string, eventParams?: object): Promise { - return; - } - - /** - * Clears all analytics data for this app from the device and resets the app instance id - * - * @returns {Promise} Returns a promise that resolves when the analytics data is cleared - */ - @Cordova() - resetAnalyticsData(): Promise { - return; - } - - /** - * Sets whether analytics collection is enabled for this app on this device. This setting is persisted across app sessions. By default it is enabled - * - * @param screenName {boolean} The value of the collection - * @param enabled - * @returns {Promise} Returns a promise that resolves when the collection is enabled/disabled - */ - @Cordova() - setAnalyticsCollectionEnabled(enabled: boolean): Promise { - return; - } - - /** - * Sets the current screen name, which specifies the current visual context in your app. - * This helps identify the areas in your app where users spend their time and how they interact with your app - * - * @param screenName {string} The screen name - * @returns {Promise} Returns a promise that resolves when the current screen is setted - */ - @Cordova() - setCurrentScreen(screenName: string): Promise { - return; - } - - /** - * Sets the minimum engagement time required before starting a session. The default value is 10000 (10 seconds) - * - * @param screenName {number} The duration in milliseconds - * @param milliseconds - * @returns {Promise} Returns a promise that resolves when the minimum session duration is set - */ - @Cordova() - setMinimumSessionDuration(milliseconds: number): Promise { - return; - } - - /** - * Sets the duration of inactivity that terminates the current session. The default value is 1800000 (30 minutes) - * - * @param screenName {number} The duration in milliseconds - * @param milliseconds - * @returns {Promise} Returns a promise that resolves when the session timeout duration is set - */ - @Cordova() - setSessionTimeoutDuration(milliseconds: number): Promise { - return; - } - - /** - * Sets the user ID property. This feature must be used in accordance with Google's Privacy Policy - * - * @param userId {string} The user id - * @returns {Promise} Returns a promise that resolves when the user id is setted - */ - @Cordova() - setUserId(userId: string): Promise { - return; - } - - /** - * Sets a user property to a given value. Up to 25 user property names are supported. Once set, user property values persist throughout the app lifecycle and across sessions - * - * @param userPropertyName {string} The user property name - * @param userPropertyValue {string} The user property value - * @returns {Promise} Returns a promise that resolves when the user property setted - */ - @Cordova() - setUserProperty(userPropertyName: string, userPropertyValue: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/android-exoplayer/index.ts b/src/@awesome-cordova-plugins/plugins/android-exoplayer/index.ts deleted file mode 100644 index bda23e87..00000000 --- a/src/@awesome-cordova-plugins/plugins/android-exoplayer/index.ts +++ /dev/null @@ -1,304 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export type AndroidExoPlayerAspectRatio = 'FILL_SCREEN' | 'FIT_SCREEN'; - -export interface AndroidExoPlayerParams { - /** - * Url of the video to play. - */ - url: string; - - /** - * Set the user agent. Default is `ExoPlayerPlugin` - */ - userAgent?: string; - - /** - * Set the player aspect ratio. - */ - aspectRatio?: AndroidExoPlayerAspectRatio; - - /** - * Hide controls after this many milliseconds, default is `5000`. - */ - hideTimeout?: number; - - /** - * When set to false stream will not automatically start. - */ - autoPlay?: boolean; - - /** - * Start playback at this many milliseconds into video, default is `0`. - */ - seekTo?: number; - - /** - * Amount of time in milliseconds to use when skipping forward, default is `1000`. - */ - forwardTime?: number; - - /** - * Amount of time in milliseconds to use when skipping backward, default is `1000`. - */ - rewindTime?: number; - - /** - * Only play audio in the backgroud, default is `false`. - * If you pass in `audioOnly: true`, make sure to manually close the player on some event (like escape button) since the plugin won't be detecting keypresses when playing audio in the background. - */ - audioOnly?: true; - - /** - * Optional subtitle url to display over the video. - * We currently support .srt and .vtt subtitle formats. Subtitles are not supported on all stream types, as ExoPlayer has requirement that both video and subtitle "must have the same number of periods, and must not have any dynamic windows", which means for simple mp4s it should work, but on more complex HLS/Dash setups it might not. - */ - subtitleUrl?: string; - - /** - * okhttp connect timeout in milliseconds (default is `0`) - */ - connectTimeout?: number; - - /** - * okhttp read timeout in milliseconds (default is `0`) - */ - readTimeout?: number; - - /** - * okhttp write timeout in milliseconds (default is `0`) - */ - writeTimeout?: number; - - /** - * okhttp socket ping interval in milliseconds (default is `0` or disabled) - */ - pingInterval?: number; - - /** - * Number of times datasource will retry the stream before giving up (default is `3`) - */ - retryCount?: number; - - /** - * If this object is not present controller will not be visible. - */ - controller?: AndroidExoPlayerControllerConfig; -} - -export interface AndroidExoplayerState { - [s: string]: string; -} - -export interface AndroidExoPlayerControllerConfig { - /** - * Image in the controller. - */ - streamImage: string; - - /** - * - */ - streamTitle: string; - - /** - * - */ - streamDescription: string; - - /** - * Hide entire progress bar. - */ - hideProgress?: true; - - /** - * If progress bar is visible hide current position from it - */ - hidePosition: false; - - /** - * If progress bar is visible Hide stream duration from it - */ - hideDuration: false; - - /** - * Override the player control button icons. - */ - controlIcons?: { - /** - * Rewind button icon. - */ - exo_rew: string; - - /** - * Play button icon. - */ - exo_play: string; - - /** - * Pause button icon. - */ - exo_pause: string; - - /** - * Fast forward button icon. - */ - exo_ffwd: string; - }; -} - -/** - * @name Android ExoPlayer - * @description - * Cordova media player plugin using Google's ExoPlayer framework. - * - * https://github.com/google/ExoPlayer - * @usage - * ```typescript - * import { AndroidExoPlayer } from '@awesome-cordova-plugins/android-exoplayer/ngx'; - * - * constructor(private androidExoPlayer: AndroidExoPlayer) { } - * - * ... - * - * this.androidExoPlayer.show({url: 'http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube'}); - * - * ``` - * @interfaces - * AndroidExoPlayerParams - * AndroidExoplayerState - * AndroidExoPlayerControllerConfig - */ -@Plugin({ - pluginName: 'AndroidExoPlayer', - plugin: 'cordova-plugin-exoplayer', - pluginRef: 'ExoPlayer', - repo: 'https://github.com/frontyard/cordova-plugin-exoplayer', - platforms: ['Android'], -}) -@Injectable() -export class AndroidExoplayer extends AwesomeCordovaNativePlugin { - /** - * Show the player. - * - * @param {AndroidExoPlayerParams} parameters Parameters - * @returns {Observable} - */ - @Cordova({ - observable: true, - clearFunction: 'close', - clearWithArgs: false, - successIndex: 1, - errorIndex: 2, - }) - show(parameters: AndroidExoPlayerParams): Observable { - return; - } - - /** - * Switch stream without disposing of the player. - * - * @param {string} url The url of the new stream. - * @param {AndroidExoPlayerControllerConfig} controller Configuration of the controller. - * @returns {Promise} - */ - @Cordova() - setStream(url: string, controller: AndroidExoPlayerControllerConfig): Promise { - return; - } - - /** - * Will pause if playing and play if paused - * - * @returns {Promise} - */ - @Cordova() - playPause(): Promise { - return; - } - - /** - * Stop playing. - * - * @returns {Promise} - */ - @Cordova() - stop(): Promise { - return; - } - - /** - * Jump to a particular position. - * - * @param {number} milliseconds Position in stream in milliseconds - * @returns {Promise} - */ - @Cordova() - seekTo(milliseconds: number): Promise { - return; - } - - /** - * Jump to a particular time relative to the current position. - * - * @param {number} milliseconds Time in milliseconds - * @returns {Promise} - */ - @Cordova() - seekBy(milliseconds: number): Promise { - return; - } - - /** - * Get the current player state. - * - * @returns {Promise} - */ - @Cordova() - getState(): Promise { - return; - } - - /** - * Show the controller. - * - * @returns {Promise} - */ - @Cordova() - showController(): Promise { - return; - } - - /** - * Hide the controller. - * - * @returns {Promise} - */ - @Cordova() - hideController(): Promise { - return; - } - - /** - * Update the controller configuration. - * - * @param {AndroidExoPlayerControllerConfig} controller Configuration of the controller. - * @returns {Promise} - */ - @Cordova() - setController(controller: AndroidExoPlayerControllerConfig): Promise { - return; - } - - /** - * Close and dispose of player, call before destroy. - * - * @returns {Promise} - */ - @Cordova() - close(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/android-full-screen/index.ts b/src/@awesome-cordova-plugins/plugins/android-full-screen/index.ts deleted file mode 100644 index 26248101..00000000 --- a/src/@awesome-cordova-plugins/plugins/android-full-screen/index.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * Bit flag values for setSystemUiVisibility() - * - * @see https://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int) - */ -export enum AndroidSystemUiFlags { - /** View has requested the system UI (status bar) to be visible (the default). SYSTEM_UI_FLAG_VISIBLE */ - Visible = 0, - /** View has requested the system UI to enter an unobtrusive "low profile" mode. SYSTEM_UI_FLAG_LOW_PROFILE */ - LowProfile = 1, - /** View has requested that the system navigation be temporarily hidden. SYSTEM_UI_FLAG_HIDE_NAVIGATION */ - HideNavigation = 2, - /** View has requested to go into the normal fullscreen mode so that its content can take over the screen while still allowing the user to interact with the application. SYSTEM_UI_FLAG_FULLSCREEN */ - Fullscreen = 4, - /** When using other layout flags, we would like a stable view of the content insets given to fitSystemWindows(Rect). SYSTEM_UI_FLAG_LAYOUT_STABLE */ - LayoutStable = 256, - /** View would like its window to be laid out as if it has requested SYSTEM_UI_FLAG_HIDE_NAVIGATION, even if it currently hasn't. SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION */ - LayoutHideNavigation = 512, - /** View would like its window to be laid out as if it has requested SYSTEM_UI_FLAG_FULLSCREEN, even if it currently hasn't. SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN */ - LayoutFullscreen = 1024, - /** View would like to remain interactive when hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION. SYSTEM_UI_FLAG_IMMERSIVE */ - Immersive = 2048, - /** View would like to remain interactive when hiding the status bar with SYSTEM_UI_FLAG_FULLSCREEN and/or hiding the navigation bar with SYSTEM_UI_FLAG_HIDE_NAVIGATION. SYSTEM_UI_FLAG_IMMERSIVE_STICKY */ - ImmersiveSticky = 4096, - /** Requests the status bar to draw in a mode that is compatible with light status bar backgrounds. SYSTEM_UI_FLAG_LIGHT_STATUS_BAR */ - LightStatusBar = 8192, -} - -/** - * @name Android Full Screen - * @description - * This plugin enables developers to offer users a true full screen experience in their Cordova and PhoneGap apps for Android. - * Using Android 4.0+, you can use true full screen in "lean mode", the way you see in apps like YouTube, expanding the app right to the edges of the screen, hiding the status and navigation bars until the user next interacts. This is ideally suited to video or cut-scene content. - * In Android 4.4+, however, you can now enter true full screen, fully interactive immersive mode. In this mode, your app will remain in true full screen until you choose otherwise; users can swipe down from the top of the screen to temporarily display the system UI. - * @usage - * ```typescript - * import { AndroidFullScreen } from '@awesome-cordova-plugins/android-full-screen/ngx'; - * - * constructor(private androidFullScreen: AndroidFullScreen) { } - * - * ... - * - * this.androidFullScreen.isImmersiveModeSupported() - * .then(() => console.log('Immersive mode supported')) - * .catch(err => console.log(err)); - * - * ``` - */ -@Plugin({ - pluginName: 'AndroidFullScreen', - plugin: 'cordova-plugin-fullscreen', - pluginRef: 'AndroidFullScreen', - repo: 'https://github.com/mesmotronic/cordova-plugin-fullscreen', - platforms: ['Android'], -}) -@Injectable() -export class AndroidFullScreen extends AwesomeCordovaNativePlugin { - /** - * Is this plugin supported? - * - * @returns {Promise} - */ - @Cordova() - isSupported(): Promise { - return; - } - - /** - * Is immersive mode supported? - * - * @returns {Promise} - */ - @Cordova() - isImmersiveModeSupported(): Promise { - return; - } - - /** - * The width of the screen in immersive mode. - * - * @returns {Promise} - */ - @Cordova() - immersiveWidth(): Promise { - return; - } - - /** - * The height of the screen in immersive mode. - * - * @returns {Promise} - */ - @Cordova() - immersiveHeight(): Promise { - return; - } - - /** - * Hide system UI until user interacts. - * - * @returns {Promise} - */ - @Cordova() - leanMode(): Promise { - return; - } - - /** - * Show system UI. - * - * @returns {Promise} - */ - @Cordova() - showSystemUI(): Promise { - return; - } - - /** - * Extend your app underneath the status bar (Android 4.4+ only). - * - * @returns {Promise} - */ - @Cordova() - showUnderStatusBar(): Promise { - return; - } - - /** - * Extend your app underneath the system UI (Android 4.4+ only). - * - * @returns {Promise} - */ - @Cordova() - showUnderSystemUI(): Promise { - return; - } - - /** - * Hide system UI and keep it hidden (Android 4.4+ only). - * - * @returns {Promise} - */ - @Cordova() - immersiveMode(): Promise { - return; - } - - /** - * Manually set the the system UI to a custom mode. This mirrors the Android method of the same name. (Android 4.4+ only). - * - * @see https://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int) - * @param {AndroidSystemUiFlags} visibility Bitwise-OR of flags in AndroidSystemUiFlags - * @returns {Promise} - */ - @Cordova() - setSystemUiVisibility(visibility: AndroidSystemUiFlags): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/android-notch/index.ts b/src/@awesome-cordova-plugins/plugins/android-notch/index.ts deleted file mode 100644 index 9d83e21e..00000000 --- a/src/@awesome-cordova-plugins/plugins/android-notch/index.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Android Notch - * @description - * This plugin enables developers to get the cutout and android devices inset sizes - * It is based on the cordova plugin developed by @tobspr: https://github.com/tobspr/cordova-plugin-android-notch - * This plugin works on all android versions, but we can only detect notches starting from Android 9. - * @usage - * ```typescript - * import { AndroidNotch } from '@awesome-cordova-plugins/android-notch/ngx'; - * - * - * constructor(private androidNotch: AndroidNotch) { } - * - * ... - * - * - * this.androidNotch.hasCutout() - * .then((px: number) => console.log('Inset size: '), px) - * .catch((error: any) => console.log('Error: ', error)) - * - * this.androidNotch.getInsetTop() - * .then((px: number) => console.log('Inset size: '), px) - * .catch((error: any) => console.log('Error: ', error)) - * - * this.androidNotch.getInsetRight() - * .then((px: number) => console.log('Inset size: '), px) - * .catch((error: any) => console.log('Error: ', error)) - * - * this.androidNotch.getInsetBottom() - * .then((px: number) => console.log('Inset size: '), px) - * .catch((error: any) => console.log('Error: ', error)) - * - * this.androidNotch.getInsetLeft() - * .then((px: number) => console.log('Inset size: '), px) - * .catch((error: any) => console.log('Error: ', error)) - * - * ``` - */ -@Plugin({ - pluginName: 'AndroidNotch', - plugin: 'cordova-plugin-android-notch', - pluginRef: 'AndroidNotch', - repo: 'https://github.com/tobspr/cordova-plugin-android-notch.git', - platforms: ['Android'], -}) -@Injectable() -export class AndroidNotch extends AwesomeCordovaNativePlugin { - /** - * Returns true if the android device has cutout - * - * @returns {Promise} - */ - @Cordova() - hasCutout(): Promise { - return; - } - - /** - * Returns the heigth of the top inset - * - * @returns {Promise} - */ - @Cordova() - getInsetTop(): Promise { - return; - } - - /** - * Returns the heigth of the right inset - * - * @returns {Promise} - */ - @Cordova() - getInsetRight(): Promise { - return; - } - - /** - * Returns the heigth of the bottom inset - * - * @returns {Promise} - */ - @Cordova() - getInsetBottom(): Promise { - return; - } - - /** - * Returns the heigth of the left inset - * - * @returns {Promise} - */ - @Cordova() - getInsetLeft(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/android-permissions/index.ts b/src/@awesome-cordova-plugins/plugins/android-permissions/index.ts deleted file mode 100644 index af0a8b37..00000000 --- a/src/@awesome-cordova-plugins/plugins/android-permissions/index.ts +++ /dev/null @@ -1,249 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Android Permissions - * @premier android-permissions - * @description - * This plugin is designed to support Android new permissions checking mechanism. - * - * You can find all permissions here: https://developer.android.com/reference/android/Manifest.permission.html - * @usage - * ``` - * import { AndroidPermissions } from '@awesome-cordova-plugins/android-permissions/ngx'; - * - * - * constructor(private androidPermissions: AndroidPermissions) { } - * - * ... - * - * this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then( - * result => console.log('Has permission?',result.hasPermission), - * err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA) - * ); - * - * this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]); - * - * ``` - * - * Android 26 and above: due to Android 26's changes to permissions handling (permissions are requested at time of use rather than at runtime,) if your app does not include any functions (eg. other Ionic Native plugins) that utilize a particular permission, then `requestPermission()` and `requestPermissions()` will resolve immediately with no prompt shown to the user. Thus, you must include a function utilizing the feature you would like to use before requesting permission for it. - */ -@Plugin({ - pluginName: 'AndroidPermissions', - plugin: 'cordova-plugin-android-permissions', - pluginRef: 'cordova.plugins.permissions', - repo: 'https://github.com/NeoLSN/cordova-plugin-android-permissions', - platforms: ['Android'], -}) -@Injectable() -export class AndroidPermissions extends AwesomeCordovaNativePlugin { - PERMISSION: any = { - ACCESS_CHECKIN_PROPERTIES: 'android.permission.ACCESS_CHECKIN_PROPERTIES', - ACCESS_COARSE_LOCATION: 'android.permission.ACCESS_COARSE_LOCATION', - ACCESS_FINE_LOCATION: 'android.permission.ACCESS_FINE_LOCATION', - ACCESS_LOCATION_EXTRA_COMMANDS: 'android.permission.ACCESS_LOCATION_EXTRA_COMMANDS', - ACCESS_MOCK_LOCATION: 'android.permission.ACCESS_MOCK_LOCATION', - ACCESS_NETWORK_STATE: 'android.permission.ACCESS_NETWORK_STATE', - ACCESS_SURFACE_FLINGER: 'android.permission.ACCESS_SURFACE_FLINGER', - ACCESS_WIFI_STATE: 'android.permission.ACCESS_WIFI_STATE', - ACCOUNT_MANAGER: 'android.permission.ACCOUNT_MANAGER', - ADD_VOICEMAIL: 'com.android.voicemail.permission.ADD_VOICEMAIL', - AUTHENTICATE_ACCOUNTS: 'android.permission.AUTHENTICATE_ACCOUNTS', - BATTERY_STATS: 'android.permission.BATTERY_STATS', - BIND_ACCESSIBILITY_SERVICE: 'android.permission.BIND_ACCESSIBILITY_SERVICE', - BIND_APPWIDGET: 'android.permission.BIND_APPWIDGET', - BIND_CARRIER_MESSAGING_SERVICE: 'android.permission.BIND_CARRIER_MESSAGING_SERVICE', - BIND_DEVICE_ADMIN: 'android.permission.BIND_DEVICE_ADMIN', - BIND_DREAM_SERVICE: 'android.permission.BIND_DREAM_SERVICE', - BIND_INPUT_METHOD: 'android.permission.BIND_INPUT_METHOD', - BIND_NFC_SERVICE: 'android.permission.BIND_NFC_SERVICE', - BIND_NOTIFICATION_LISTENER_SERVICE: 'android.permission.BIND_NOTIFICATION_LISTENER_SERVICE', - BIND_PRINT_SERVICE: 'android.permission.BIND_PRINT_SERVICE', - BIND_REMOTEVIEWS: 'android.permission.BIND_REMOTEVIEWS', - BIND_TEXT_SERVICE: 'android.permission.BIND_TEXT_SERVICE', - BIND_TV_INPUT: 'android.permission.BIND_TV_INPUT', - BIND_VOICE_INTERACTION: 'android.permission.BIND_VOICE_INTERACTION', - BIND_VPN_SERVICE: 'android.permission.BIND_VPN_SERVICE', - BIND_WALLPAPER: 'android.permission.BIND_WALLPAPER', - BLUETOOTH: 'android.permission.BLUETOOTH', - BLUETOOTH_ADMIN: 'android.permission.BLUETOOTH_ADMIN', - BLUETOOTH_ADVERTISE: 'android.permission.BLUETOOTH_ADVERTISE', - BLUETOOTH_CONNECT: 'android.permission.BLUETOOTH_CONNECT', - BLUETOOTH_PRIVILEGED: 'android.permission.BLUETOOTH_PRIVILEGED', - BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN', - BODY_SENSORS: 'android.permission.BODY_SENSORS', - BRICK: 'android.permission.BRICK', - BROADCAST_PACKAGE_REMOVED: 'android.permission.BROADCAST_PACKAGE_REMOVED', - BROADCAST_SMS: 'android.permission.BROADCAST_SMS', - BROADCAST_STICKY: 'android.permission.BROADCAST_STICKY', - BROADCAST_WAP_PUSH: 'android.permission.BROADCAST_WAP_PUSH', - CALL_PHONE: 'android.permission.CALL_PHONE', - CALL_PRIVILEGED: 'android.permission.CALL_PRIVILEGED', - CAMERA: 'android.permission.CAMERA', - CAPTURE_AUDIO_OUTPUT: 'android.permission.CAPTURE_AUDIO_OUTPUT', - CAPTURE_SECURE_VIDEO_OUTPUT: 'android.permission.CAPTURE_SECURE_VIDEO_OUTPUT', - CAPTURE_VIDEO_OUTPUT: 'android.permission.CAPTURE_VIDEO_OUTPUT', - CHANGE_COMPONENT_ENABLED_STATE: 'android.permission.CHANGE_COMPONENT_ENABLED_STATE', - CHANGE_CONFIGURATION: 'android.permission.CHANGE_CONFIGURATION', - CHANGE_NETWORK_STATE: 'android.permission.CHANGE_NETWORK_STATE', - CHANGE_WIFI_MULTICAST_STATE: 'android.permission.CHANGE_WIFI_MULTICAST_STATE', - CHANGE_WIFI_STATE: 'android.permission.CHANGE_WIFI_STATE', - CLEAR_APP_CACHE: 'android.permission.CLEAR_APP_CACHE', - CLEAR_APP_USER_DATA: 'android.permission.CLEAR_APP_USER_DATA', - CONTROL_LOCATION_UPDATES: 'android.permission.CONTROL_LOCATION_UPDATES', - DELETE_CACHE_FILES: 'android.permission.DELETE_CACHE_FILES', - DELETE_PACKAGES: 'android.permission.DELETE_PACKAGES', - DEVICE_POWER: 'android.permission.DEVICE_POWER', - DIAGNOSTIC: 'android.permission.DIAGNOSTIC', - DISABLE_KEYGUARD: 'android.permission.DISABLE_KEYGUARD', - DUMP: 'android.permission.DUMP', - EXPAND_STATUS_BAR: 'android.permission.EXPAND_STATUS_BAR', - FACTORY_TEST: 'android.permission.FACTORY_TEST', - FLASHLIGHT: 'android.permission.FLASHLIGHT', - FORCE_BACK: 'android.permission.FORCE_BACK', - GET_ACCOUNTS: 'android.permission.GET_ACCOUNTS', - GET_PACKAGE_SIZE: 'android.permission.GET_PACKAGE_SIZE', - GET_TASKS: 'android.permission.GET_TASKS', - GET_TOP_ACTIVITY_INFO: 'android.permission.GET_TOP_ACTIVITY_INFO', - GLOBAL_SEARCH: 'android.permission.GLOBAL_SEARCH', - HARDWARE_TEST: 'android.permission.HARDWARE_TEST', - INJECT_EVENTS: 'android.permission.INJECT_EVENTS', - INSTALL_LOCATION_PROVIDER: 'android.permission.INSTALL_LOCATION_PROVIDER', - INSTALL_PACKAGES: 'android.permission.INSTALL_PACKAGES', - INSTALL_SHORTCUT: 'com.android.launcher.permission.INSTALL_SHORTCUT', - INTERNAL_SYSTEM_WINDOW: 'android.permission.INTERNAL_SYSTEM_WINDOW', - INTERNET: 'android.permission.INTERNET', - KILL_BACKGROUND_PROCESSES: 'android.permission.KILL_BACKGROUND_PROCESSES', - LOCATION_HARDWARE: 'android.permission.LOCATION_HARDWARE', - MANAGE_ACCOUNTS: 'android.permission.MANAGE_ACCOUNTS', - MANAGE_APP_TOKENS: 'android.permission.MANAGE_APP_TOKENS', - MANAGE_DOCUMENTS: 'android.permission.MANAGE_DOCUMENTS', - MASTER_CLEAR: 'android.permission.MASTER_CLEAR', - MEDIA_CONTENT_CONTROL: 'android.permission.MEDIA_CONTENT_CONTROL', - MODIFY_AUDIO_SETTINGS: 'android.permission.MODIFY_AUDIO_SETTINGS', - MODIFY_PHONE_STATE: 'android.permission.MODIFY_PHONE_STATE', - MOUNT_FORMAT_FILESYSTEMS: 'android.permission.MOUNT_FORMAT_FILESYSTEMS', - MOUNT_UNMOUNT_FILESYSTEMS: 'android.permission.MOUNT_UNMOUNT_FILESYSTEMS', - NFC: 'android.permission.NFC', - PERSISTENT_ACTIVITY: 'android.permission.PERSISTENT_ACTIVITY', - POST_NOTIFICATIONS: 'android.permission.POST_NOTIFICATIONS', - PROCESS_OUTGOING_CALLS: 'android.permission.PROCESS_OUTGOING_CALLS', - READ_CALENDAR: 'android.permission.READ_CALENDAR', - READ_CALL_LOG: 'android.permission.READ_CALL_LOG', - READ_CONTACTS: 'android.permission.READ_CONTACTS', - READ_EXTERNAL_STORAGE: 'android.permission.READ_EXTERNAL_STORAGE', - READ_FRAME_BUFFER: 'android.permission.READ_FRAME_BUFFER', - READ_HISTORY_BOOKMARKS: 'com.android.browser.permission.READ_HISTORY_BOOKMARKS', - READ_INPUT_STATE: 'android.permission.READ_INPUT_STATE', - READ_LOGS: 'android.permission.READ_LOGS', - READ_MEDIA_AUDIO: 'android.permission.READ_MEDIA_AUDIO', - READ_MEDIA_IMAGES: 'android.permission.READ_MEDIA_IMAGES', - READ_MEDIA_VIDEO: 'android.permission.READ_MEDIA_VIDEO', - READ_PHONE_STATE: 'android.permission.READ_PHONE_STATE', - READ_PROFILE: 'android.permission.READ_PROFILE', - READ_SMS: 'android.permission.READ_SMS', - READ_SOCIAL_STREAM: 'android.permission.READ_SOCIAL_STREAM', - READ_SYNC_SETTINGS: 'android.permission.READ_SYNC_SETTINGS', - READ_SYNC_STATS: 'android.permission.READ_SYNC_STATS', - READ_USER_DICTIONARY: 'android.permission.READ_USER_DICTIONARY', - READ_VOICEMAIL: 'com.android.voicemail.permission.READ_VOICEMAIL', - REBOOT: 'android.permission.REBOOT', - RECEIVE_BOOT_COMPLETED: 'android.permission.RECEIVE_BOOT_COMPLETED', - RECEIVE_MMS: 'android.permission.RECEIVE_MMS', - RECEIVE_SMS: 'android.permission.RECEIVE_SMS', - RECEIVE_WAP_PUSH: 'android.permission.RECEIVE_WAP_PUSH', - RECORD_AUDIO: 'android.permission.RECORD_AUDIO', - REORDER_TASKS: 'android.permission.REORDER_TASKS', - RESTART_PACKAGES: 'android.permission.RESTART_PACKAGES', - SEND_RESPOND_VIA_MESSAGE: 'android.permission.SEND_RESPOND_VIA_MESSAGE', - SEND_SMS: 'android.permission.SEND_SMS', - SET_ACTIVITY_WATCHER: 'android.permission.SET_ACTIVITY_WATCHER', - SET_ALARM: 'com.android.alarm.permission.SET_ALARM', - SET_ALWAYS_FINISH: 'android.permission.SET_ALWAYS_FINISH', - SET_ANIMATION_SCALE: 'android.permission.SET_ANIMATION_SCALE', - SET_DEBUG_APP: 'android.permission.SET_DEBUG_APP', - SET_ORIENTATION: 'android.permission.SET_ORIENTATION', - SET_POINTER_SPEED: 'android.permission.SET_POINTER_SPEED', - SET_PREFERRED_APPLICATIONS: 'android.permission.SET_PREFERRED_APPLICATIONS', - SET_PROCESS_LIMIT: 'android.permission.SET_PROCESS_LIMIT', - SET_TIME: 'android.permission.SET_TIME', - SET_TIME_ZONE: 'android.permission.SET_TIME_ZONE', - SET_WALLPAPER: 'android.permission.SET_WALLPAPER', - SET_WALLPAPER_HINTS: 'android.permission.SET_WALLPAPER_HINTS', - SIGNAL_PERSISTENT_PROCESSES: 'android.permission.SIGNAL_PERSISTENT_PROCESSES', - STATUS_BAR: 'android.permission.STATUS_BAR', - SUBSCRIBED_FEEDS_READ: 'android.permission.SUBSCRIBED_FEEDS_READ', - SUBSCRIBED_FEEDS_WRITE: 'android.permission.SUBSCRIBED_FEEDS_WRITE', - SYSTEM_ALERT_WINDOW: 'android.permission.SYSTEM_ALERT_WINDOW', - TRANSMIT_IR: 'android.permission.TRANSMIT_IR', - UNINSTALL_SHORTCUT: 'com.android.launcher.permission.UNINSTALL_SHORTCUT', - UPDATE_DEVICE_STATS: 'android.permission.UPDATE_DEVICE_STATS', - USE_CREDENTIALS: 'android.permission.USE_CREDENTIALS', - USE_SIP: 'android.permission.USE_SIP', - VIBRATE: 'android.permission.VIBRATE', - WAKE_LOCK: 'android.permission.WAKE_LOCK', - WRITE_APN_SETTINGS: 'android.permission.WRITE_APN_SETTINGS', - WRITE_CALENDAR: 'android.permission.WRITE_CALENDAR', - WRITE_CALL_LOG: 'android.permission.WRITE_CALL_LOG', - WRITE_CONTACTS: 'android.permission.WRITE_CONTACTS', - WRITE_EXTERNAL_STORAGE: 'android.permission.WRITE_EXTERNAL_STORAGE', - WRITE_GSERVICES: 'android.permission.WRITE_GSERVICES', - WRITE_HISTORY_BOOKMARKS: 'com.android.browser.permission.WRITE_HISTORY_BOOKMARKS', - WRITE_PROFILE: 'android.permission.WRITE_PROFILE', - WRITE_SECURE_SETTINGS: 'android.permission.WRITE_SECURE_SETTINGS', - WRITE_SETTINGS: 'android.permission.WRITE_SETTINGS', - WRITE_SMS: 'android.permission.WRITE_SMS', - WRITE_SOCIAL_STREAM: 'android.permission.WRITE_SOCIAL_STREAM', - WRITE_SYNC_SETTINGS: 'android.permission.WRITE_SYNC_SETTINGS', - WRITE_USER_DICTIONARY: 'android.permission.WRITE_USER_DICTIONARY', - WRITE_VOICEMAIL: 'com.android.voicemail.permission.WRITE_VOICEMAIL', - }; - - /** - * Check permission - * - * @param {string} permission The name of the permission - * @returns {Promise} Returns a promise - */ - @Cordova() - checkPermission(permission: string): Promise { - return; - } - - /** - * Request permission - * - * @param {string} permission The name of the permission to request - * @returns {Promise} - */ - @Cordova() - requestPermission(permission: string): Promise { - return; - } - - /** - * Request permissions - * - * @param {string[]} permissions An array with permissions - * @returns {Promise} Returns a promise - */ - @Cordova() - requestPermissions(permissions: string[]): Promise { - return; - } - - /** - * This function still works now, will not support in the future. - * - * @param {string} permission The name of the permission - * @returns {Promise} Returns a promise - */ - @Cordova() - hasPermission(permission: string): Promise { - return; - } -} - -export interface AndroidPermissionResponse { - hasPermission: boolean; -} diff --git a/src/@awesome-cordova-plugins/plugins/anyline/index.ts b/src/@awesome-cordova-plugins/plugins/anyline/index.ts deleted file mode 100644 index 7fcbc4fc..00000000 --- a/src/@awesome-cordova-plugins/plugins/anyline/index.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface AnylineOptions { - // Valid License Key - licenseKey: string; - - // Scanning options - config: any; -} - -/** - * @name Anyline - * @description - * Anyline provides an easy-to-use SDK for applications to enable Optical Character Recognition (OCR) on mobile devices. - * @usage - * ```typescript - * import { Anyline } from '@awesome-cordova-plugins/anyline/ngx'; - * - * - * constructor(private anyline: Anyline) { } - * - * ... - * - * - * this.anyline.scan(options) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'Anyline', - plugin: 'io-anyline-cordova', - pluginRef: 'Anyline', - repo: 'https://github.com/Anyline/anyline-ocr-cordova-module', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Anyline extends AwesomeCordovaNativePlugin { - /** - * Scan - * - * @param options {AnylineOptions} Scanning options - * @returns {Promise} Returns a promise that resolves when Code is captured - */ - @Cordova() - scan(options: AnylineOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/app-availability/index.ts b/src/@awesome-cordova-plugins/plugins/app-availability/index.ts deleted file mode 100644 index 95e21d0d..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-availability/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name App Availability - * @description - * 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. - * - * Requires Cordova plugin: cordova-plugin-appavailability. For more info, please see the [AppAvailability plugin docs](https://github.com/ohh2ahh/AppAvailability). - * @usage - * ```typescript - * import { AppAvailability } from '@awesome-cordova-plugins/app-availability/ngx'; - * import { Platform } from 'ionic-angular'; - * - * constructor(private appAvailability: AppAvailability, private platform: Platform) { } - * - * ... - * - * let app; - * - * if (this.platform.is('ios')) { - * app = 'twitter://'; - * } else if (this.platform.is('android')) { - * app = 'com.twitter.android'; - * } - * - * this.appAvailability.check(app) - * .then( - * (yes: boolean) => console.log(app + ' is available'), - * (no: boolean) => console.log(app + ' is NOT available') - * ); - * ``` - */ -@Plugin({ - pluginName: 'AppAvailability', - plugin: 'cordova-plugin-appavailability', - pluginRef: 'appAvailability', - repo: 'https://github.com/ohh2ahh/AppAvailability', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class AppAvailability extends AwesomeCordovaNativePlugin { - /** - * Checks if an app is available on device - * - * @param {string} app Package name on android, or URI scheme on iOS - * @returns {Promise} - */ - @Cordova() - check(app: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/app-center-analytics/index.ts b/src/@awesome-cordova-plugins/plugins/app-center-analytics/index.ts deleted file mode 100644 index 9151c36b..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-center-analytics/index.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface StringMap { - [s: string]: string; -} - -/** - * @name App Center Analytics - * @description - * App Center Analytics helps you understand user behavior and customer engagement to improve your app. - * The SDK automatically captures session count and device properties like model, OS version, etc. - * You can define your own custom events to measure things that matter to you. - * All the information captured is available in the App Center portal for you to analyze the data. - * - * For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/analytics/cordova - * @usage - * ```typescript - * import { AppCenterAnalytics } from '@awesome-cordova-plugins/app-center-analytics/ngx'; - * - * - * constructor(private appCenterAnalytics: AppCenterAnalytics) { } - * - * ... - * - * this.appCenterAnalytics.setEnabled(true).then(() => { - * this.appCenterAnalytics.trackEvent('My Event', { TEST: 'HELLO_WORLD' }).then(() => { - * console.log('Custom event tracked'); - * }); - * }); - * - * ``` - * @interfaces - * StringMap - */ -@Plugin({ - pluginName: 'AppCenterAnalytics', - plugin: 'cordova-plugin-appcenter-analytics', - pluginRef: 'AppCenter.Analytics', - repo: 'https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-analytics', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class AppCenterAnalytics extends AwesomeCordovaNativePlugin { - /** - * Tracks an custom event. - * You can send up to 200 distinct event names. Also, there is a maximum limit of 256 characters per event name - * and 64 characters per event property name and event property value. - * - * @param {string} eventName Event name - * @param {StringMap} properties Event properties - * @returns {Promise} - */ - @Cordova() - trackEvent(eventName: string, properties: StringMap): Promise { - return; - } - - /** - * Check if App Center Analytics is enabled - * - * @returns {Promise} - */ - @Cordova() - isEnabled(): Promise { - return; - } - - /** - * Enable or disable App Center Analytics at runtime - * - * @param {boolean} shouldEnable Set value - * @returns {Promise} - */ - @Cordova() - setEnabled(shouldEnable: boolean): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/app-center-crashes/index.ts b/src/@awesome-cordova-plugins/plugins/app-center-crashes/index.ts deleted file mode 100644 index b27e7034..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-center-crashes/index.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface AppCenterCrashReport { - id: string; - device: AppCenterCrashReportDevice; - appStartTime: number; - appErrorTime: number; - signal: string; - appProcessIdentifier: number; -} - -export interface AppCenterCrashReportDevice { - oem_name: string; - os_name: string; - app_version: string; - time_zone_offset: number; - carrier_name: string; - screen_size: string; - locale: string; - sdk_version: string; - carrier_country: string; - os_build: string; - app_namespace: string; - os_version: string; - sdk_name: string; - model: string; - app_build: string; -} - -/** - * @name App Center Crashes - * @description - * App Center Analytics helps you understand user behavior and customer engagement to improve your app. - * The SDK automatically captures session count and device properties like model, OS version, etc. - * You can define your own custom events to measure things that matter to you. - * All the information captured is available in the App Center portal for you to analyze the data. - * - * For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/crashes/cordova - * @usage - * ```typescript - * import { AppCenterCrashes } from '@awesome-cordova-plugins/app-center-crashes/ngx'; - * - * - * constructor(private AppCenterCrashes: AppCenterCrashes) { } - * - * ... - * - * this.AppCenterCrashes.setEnabled(true).then(() => { - * this.AppCenterCrashes.lastSessionCrashReport().then(report => { - * console.log('Crash report', report); - * }); - * }); - * - * ``` - * @interfaces - * AppCenterCrashReport - * AppCenterCrashReportDevice - */ -@Plugin({ - pluginName: 'AppCenterCrashes', - plugin: 'cordova-plugin-appcenter-crashes', - pluginRef: 'AppCenter.Crashes', - repo: 'https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-crashes', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class AppCenterCrashes extends AwesomeCordovaNativePlugin { - /** - * App Center Crashes provides you with an API to generate a test crash for easy testing of the SDK. - * This API can only be used in test/beta apps and won't do anything in production apps. - * - * @returns void - */ - @Cordova() - generateTestCrash(): void {} - - /** - * At any time after starting the SDK, you can check if the app crashed in the previous launch - * - * @returns {Promise} - */ - @Cordova() - hasCrashedInLastSession(): Promise { - return; - } - - /** - * Details about the last crash - * - * @returns {Promise} - */ - @Cordova() - lastSessionCrashReport(): Promise { - return; - } - - /** - * Check if App Center Crashes is enabled - * - * @returns {Promise} - */ - @Cordova() - isEnabled(): Promise { - return; - } - - /** - * Enable or disable App Center Crashes at runtime - * - * @param {boolean} shouldEnable Set value - * @returns {Promise} - */ - @Cordova() - setEnabled(shouldEnable: boolean): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/app-center-low-memory/index.ts b/src/@awesome-cordova-plugins/plugins/app-center-low-memory/index.ts deleted file mode 100644 index a1f3acf1..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-center-low-memory/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name App Center Low Memory - * @description - * Generates a low memory warning. - * For more info, please see: https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-generate-low-memory - * @usage - * ```typescript - * import { LowMemory } from '@awesome-cordova-plugins/app-center-low-memory/ngx'; - * - * ... - * - * constructor(private lowMemory: LowMemory) { } - * - * async warning() { - * await this.lowMemory.generateLowMemory(); - * } - * ``` - */ -@Plugin({ - pluginName: 'LowMemory', - plugin: 'https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-generate-low-memory', - pluginRef: 'LowMemory', - repo: 'https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-generate-low-memory', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class LowMemory extends AwesomeCordovaNativePlugin { - /** - * Generates a low memory warning. - * For more info, please see: https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-generate-low-memory - * - * @returns {Promise} - */ - @Cordova() - generateLowMemory(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/app-center-push/index.ts b/src/@awesome-cordova-plugins/plugins/app-center-push/index.ts deleted file mode 100644 index 0561d462..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-center-push/index.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name App Center Push - * @description - * - * For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/push/cordova - * @usage - * ```typescript - * import { AppCenterPush } from '@awesome-cordova-plugins/app-center-push/ngx'; - * - * - * constructor(private appCenterPush: AppCenterPush) { } - * - * ... - * - * this.appCenterPush.setEnabled(true).then(() => { - * this.appCenterPush.addEventListener('My Event').subscribe(pushNotification => { - * console.log('Recived push notification', pushNotification); - * }); - * }); - * - * ``` - */ -@Plugin({ - pluginName: 'AppCenterPush', - plugin: 'cordova-plugin-appcenter-push', - pluginRef: 'AppCenter.Push', - repo: 'https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-push', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class AppCenterPush extends AwesomeCordovaNativePlugin { - /** - * Subscribe to an event - * - * @param {string} eventName Event name - * @returns {Observable} - */ - @Cordova({ - observable: true, - clearFunction: 'removeEventListener', - }) - addEventListener(eventName: string): Observable { - return; - } - /** - * Check if App Center Push is enabled - * - * @returns {Promise} - */ - @Cordova() - isEnabled(): Promise { - return; - } - - /** - * Enable or disable App Center Push at runtime - * - * @param {boolean} shouldEnable Set value - * @returns {Promise} - */ - @Cordova() - setEnabled(shouldEnable: boolean): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/app-center-shared/index.ts b/src/@awesome-cordova-plugins/plugins/app-center-shared/index.ts deleted file mode 100644 index f2f51ab8..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-center-shared/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name App Center Shared - * @capacitorincompatible true - * @description - * Exposes additional shared APIs for App Center. - * - * For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/other-apis/cordova - * @usage - * ```typescript - * import { AppCenter } from '@awesome-cordova-plugins/app-center-shared/ngx'; - * - * ... - * - * constructor(private appCenterShared: AppCenter) { } - * - * async getInstallId() { - * const id = await this.appCenter.getInstallId(); - * } - * - * async setUserId() { - * try{ - * await this.appCenter.setUserId('i-am-john'); - * } catch (e){ - * console.log(e); - * } - * } - * ``` - */ -@Plugin({ - pluginName: 'AppCenter', - plugin: 'cordova-plugin-appcenter-shared', - pluginRef: 'AppCenter', - repo: 'https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-shared', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class AppCenter extends AwesomeCordovaNativePlugin { - /** - * Returns AppCenter UUID. - * For more info, please see: https://docs.microsoft.com/en-us/appcenter/sdk/other-apis/cordova#identify-installations - * - * @returns {Promise} Install ID - */ - @Cordova() - getInstallId(): Promise { - return; - } - - /** - * Set a user ID that's used to augment crash reports. - * For more info, please see: https://docs.microsoft.com/en-us/appcenter/sdk/other-apis/cordova#identify-users - * - * @param {string} userId Ex. "your-user-id" - * @returns {Promise} - */ - @Cordova() - setUserId(userId: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/app-preferences/index.ts b/src/@awesome-cordova-plugins/plugins/app-preferences/index.ts deleted file mode 100644 index 84e8c8cc..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-preferences/index.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; -import { Injectable } from '@angular/core'; - -/** - * @name App Preferences - * @description - * This plugin allows you to read and write app preferences - * @usage - * ```typescript - * import { AppPreferences } from '@awesome-cordova-plugins/app-preferences/ngx'; - * - * constructor(private appPreferences: AppPreferences) { } - * - * ... - * - * this.appPreferences.fetch('key').then((res) => { console.log(res); }); - * - * ``` - */ -@Plugin({ - pluginName: 'AppPreferences', - plugin: 'cordova-plugin-app-preferences', - pluginRef: 'plugins.appPreferences', - repo: 'https://github.com/apla/me.apla.cordova.app-preferences', - platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'macOS', 'Windows 8', 'Windows Phone'], -}) -@Injectable() -export class AppPreferences extends AwesomeCordovaNativePlugin { - /** - * Get a preference value - * - * @param {string} dict Dictionary for key (OPTIONAL) - * @param {string} key Key - * @returns {Promise} Returns a promise - */ - @Cordova({ - callbackOrder: 'reverse', - }) - fetch(dict: string, key?: string): Promise { - return; - } - - /** - * Set a preference value - * - * @param {string} dict Dictionary for key (OPTIONAL) - * @param {string} key Key - * @param {any} value Value - * @returns {Promise} Returns a promise - */ - @Cordova({ - callbackOrder: 'reverse', - }) - store(dict: string, key: string, value?: any): Promise { - return; - } - - /** - * Remove value from preferences - * - * @param {string} dict Dictionary for key (OPTIONAL) - * @param {string} key Key - * @returns {Promise} Returns a promise - */ - @Cordova({ - callbackOrder: 'reverse', - }) - remove(dict: string, key?: string): Promise { - return; - } - - /** - * Clear preferences - * - * @returns {Promise} Returns a promise - */ - @Cordova({ - callbackOrder: 'reverse', - }) - clearAll(): Promise { - return; - } - - /** - * Show native preferences interface - * - * @returns {Promise} Returns a promise - */ - @Cordova({ - callbackOrder: 'reverse', - }) - show(): Promise { - return; - } - - /** - * Show native preferences interface - * - * @param {boolean} subscribe true value to subscribe, false - unsubscribe - * @returns {Observable} Returns an observable - */ - @Cordova({ - observable: true, - }) - watch(subscribe: boolean): Observable { - return; - } - - /** - * Return named configuration context - * In iOS you'll get a suite configuration, on Android — named file - * Supports: Android, iOS - * - * @param {string} suiteName suite name - * @returns {Object} Custom object, bound to that suite - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - suite(suiteName: string): any { - return; - } - - @Cordova({ - platforms: ['iOS'], - sync: true, - }) - iosSuite(suiteName: string): any { - return; - } - - /** - * Return cloud synchronized configuration context - * Currently supports Windows and iOS/macOS - * - * @returns {Object} Custom object, bound to that suite - */ - @Cordova({ - platforms: ['iOS', 'Windows', 'Windows Phone 8'], - }) - cloudSync(): Object { - return; - } - - /** - * Return default configuration context - * Currently supports Windows and iOS/macOS - * - * @returns {Object} Custom Object, bound to that suite - */ - @Cordova({ - platforms: ['iOS', 'Windows', 'Windows Phone 8'], - }) - defaults(): Object { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/app-rate/index.ts b/src/@awesome-cordova-plugins/plugins/app-rate/index.ts deleted file mode 100644 index 21703041..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-rate/index.ts +++ /dev/null @@ -1,295 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export enum AppRateReviewTypeIos { - /** - * Write review directly in your application (iOS 10.3+), limited to 3 prompts per year. - * Will fallback to 'AppStoreReview' for other iOS versions - */ - InAppReview = 'InAppReview', - /** - * Open the store within the app. Use this option as an alternative to inAppReview to avoid the rate action from doing nothing - */ - AppStoreReview = 'AppStoreReview', - /** - * Open the store using the openUrl preference (defaults to InAppBrowser). Be advised that WKWebView might not open the app store links - */ - InAppBrowser = 'InAppBrowser', -} - -export enum AppRateReviewTypeAndroid { - /** - * Write review directly in your application. Will fallback to InAppBrowser if not available - */ - InAppReview = 'InAppReview', - /** - * Open the store using the openUrl preference (defaults to InAppBrowser) - */ - InAppBrowser = 'InAppBrowser', -} - -export enum AppRatePromptType { - /** - * Prompt asking to rate the app. - */ - AppRatingPrompt = 'AppRatingPrompt', - - /** - * Prompt asking to rate the app within the store. - */ - StoreRatingPrompt = 'StoreRatingPrompt', - - /** - * Prompt asking to give feedback. - */ - FeedbackPrompt = 'FeedbackPrompt', -} - -export interface AppRatePreferences { - /** - * Custom BCP 47 language tag - */ - useLanguage?: string; - - /** - * Custom application title - */ - displayAppName?: string; - - /** - * Show dialog again when application version will be updated. Defaults to `true` - */ - promptAgainForEachNewVersion?: boolean; - - /** - * count of runs of application before dialog will be displayed. Defaults to `3` - */ - usesUntilPrompt?: number; - - reviewType?: { - /** - * the type of review display to show the user on iOS - * Default: AppStoreReview - */ - ios?: AppRateReviewTypeIos; - /** - * the type of review display to show the user on Android - * Default: InAppBrowser - */ - android?: AppRateReviewTypeAndroid; - }; - - /** - * Simple Mode to display the rate dialog directly and bypass negative feedback filtering flow - */ - simpleMode?: boolean; - - /** - * Disabling would skip displaying a rate dialog if in app review is set and available. Defaults to `true` - */ - showPromptForInAppReview?: boolean; - - /** - * Custom locale object - */ - customLocale?: AppRateCustomLocale; - - /** - * Callbacks for events - */ - callbacks?: AppRateCallbacks; - - /** - * App Store URLS - */ - storeAppURL?: AppUrls; - - /** - * Open URL function - */ - openUrl?: (url: string) => void; -} - -export interface AppRateCustomLocale { - /** Title */ - title?: string; - - /** Message */ - message?: string; - - /** Cancel button label */ - cancelButtonLabel?: string; - - /** Later button label */ - laterButtonLabel?: string; - - /** Rate button label */ - rateButtonLabel?: string; - - /** Yes button label */ - yesButtonLabel?: string; - - /** No button label */ - noButtonLabel?: string; - - /** App rate prompt title */ - appRatePromptTitle?: string; - - /** Feedback prompt title */ - feedbackPromptTitle?: string; - - /** Feedback prompt message */ - appRatePromptMessage?: string; - - /** Feedback prompt message */ - feedbackPromptMessage?: string; -} - -export interface AppRateLocales { - addLocale(localeObject: AppRateCustomLocale): AppRateCustomLocale; - - getLocale(language: string, applicationTitle?: string, customLocale?: AppRateCustomLocale): AppRateCustomLocale; - - getLocalesNames(): { [prop: string]: AppRateCustomLocale }; -} - -export interface AppRateCallbacks { - /** - * call back function. called when user clicked on rate-dialog buttons - */ - onButtonClicked?: (buttonIndex: number, buttonLabel: string, promptType: AppRatePromptType) => void; - - /** - * call back function. called when rate-dialog showing - */ - onRateDialogShow?: (rateCallback: (buttonIndex: number) => void) => void; - /** - * call back function. called when user clicked on negative feedback - */ - handleNegativeFeedback?: () => void; - - done?: () => void; -} - -export interface AppUrls { - /** - * application id in AppStore - */ - ios?: string; - - /** - * application URL in GooglePlay - */ - android?: string; - - /** - * application URL in Windows Store - */ - windows?: string; - - /** - * application URL in AppWorld - */ - blackberry?: string; - - /** - * application URL in WindowsStore - */ - windows8?: string; -} - -/** - * @name App Rate - * @premier app-rate - * @description - * The AppRate plugin makes it easy to prompt the user to rate your app, either now, later, or never. - * - * Requires Cordova plugin: cordova-plugin-apprate. For more info, please see the [AppRate plugin docs](https://github.com/pushandplay/cordova-plugin-apprate). - * @usage - * ```typescript - * import { AppRate } from '@awesome-cordova-plugins/app-rate/ngx'; - * - * constructor(private appRate: AppRate) { } - * - * ... - * // set certain preferences - * this.appRate.setPreferences({ - * storeAppURL: { - * ios: '', - * android: 'market://details?id=', - * windows: 'ms-windows-store://review/?ProductId=' - * } - * }); - * - * this.appRate.promptForRating(true); - * - * // or, override the whole preferences object - * this.appRate.setPreferences({ - * usesUntilPrompt: 3, - * storeAppURL: { - * ios: '', - * android: 'market://details?id=', - * windows: 'ms-windows-store://review/?ProductId=' - * } - * }); - * - * this.appRate.promptForRating(false); - * ``` - * @interfaces - * AppRatePreferences - * AppUrls - * AppRateCallbacks - * AppRateCustomLocal - */ -@Plugin({ - pluginName: 'AppRate', - plugin: 'cordova-plugin-apprate', - pluginRef: 'AppRate', - repo: 'https://github.com/pushandplay/cordova-plugin-apprate', - platforms: ['Android', 'BlackBerry 10', 'iOS', 'Windows'], -}) -@Injectable() -export class AppRate extends AwesomeCordovaNativePlugin { - /** - * Manager custom locales - */ - @CordovaProperty() - locales: AppRateLocales; - - /** - * Set preferences - * - * @param pref - * @returns void - */ - @Cordova() - setPreferences(pref: AppRatePreferences): void { - return; - } - - /** - * Get preferences - * - * @returns AppRatePreferences - */ - @Cordova() - getPreferences(): AppRatePreferences { - return; - } - - /** - * Prompts the user for rating - * - * @param {boolean} immediately Show the rating prompt immediately. - */ - @Cordova() - promptForRating(immediately?: boolean): void { - return; - } - - /** - * Immediately send the user to the app store rating page - */ - @Cordova() - navigateToAppStore(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/app-review/index.ts b/src/@awesome-cordova-plugins/plugins/app-review/index.ts deleted file mode 100644 index f33adf6b..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-review/index.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name App Review - * @description - * Cordova plugin to review app - * - * @usage - * ```typescript - * import { AppReview } from '@awesome-cordova-plugins/app-review/ngx'; - * - * - * constructor(private appReview: AppReview) { } - * - * ... - * - * - * this.appReview.requestReview() - * .then(() => console.log('Success')) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'AppReview', - plugin: 'cordova-plugin-app-review', - pluginRef: 'cordova.plugins.AppReview', - repo: 'https://github.com/chemerisuk/cordova-plugin-app-review', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class AppReview extends AwesomeCordovaNativePlugin { - /** - * Launches in-app review dialog. - * - * @returns {Promise} Callback when operation is completed - */ - @Cordova({ sync: true }) - requestReview(): Promise { - return; - } - - /** - * Launches App/Play store page with a review form. By default current app screen - * is displayed but you can pass a package name string to show another app details. - * - * @param {string} [packageName] Package name to show instead of the current app. - * @returns {Promise} Callback when operation is completed - */ - @Cordova({ sync: true }) - openStoreScreen(packageName?: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/app-version/index.ts b/src/@awesome-cordova-plugins/plugins/app-version/index.ts deleted file mode 100644 index 572de460..00000000 --- a/src/@awesome-cordova-plugins/plugins/app-version/index.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name App Version - * @premier app-version - * @description - * Reads the version of your app from the target build settings. - * - * 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). - * @usage - * ```typescript - * import { AppVersion } from '@awesome-cordova-plugins/app-version/ngx'; - * - * constructor(private appVersion: AppVersion) { } - * - * ... - * - * - * this.appVersion.getAppName(); - * this.appVersion.getPackageName(); - * this.appVersion.getVersionCode(); - * this.appVersion.getVersionNumber(); - * - * ``` - */ -@Plugin({ - pluginName: 'AppVersion', - plugin: 'cordova-plugin-app-version', - pluginRef: 'cordova.getAppVersion', - repo: 'https://github.com/whiteoctober/cordova-plugin-app-version', - platforms: ['Android', 'iOS', 'Windows'], -}) -@Injectable() -export class AppVersion extends AwesomeCordovaNativePlugin { - /** - * Returns the name of the app, e.g.: "My Awesome App" - * - * @returns {Promise} - */ - @Cordova() - getAppName(): Promise { - return; - } - - /** - * Returns the package name of the app, e.g.: "com.example.myawesomeapp" - * - * @returns {Promise} - */ - @Cordova() - getPackageName(): Promise { - return; - } - - /** - * Returns the build identifier of the app. - * In iOS a string with the build version like "1.6095" - * In Android a number generated from the version string, like 10203 for version "1.2.3" - * - * @returns {Promise} - */ - @Cordova() - getVersionCode(): Promise { - return; - } - - /** - * Returns the version of the app, e.g.: "1.2.3" - * - * @returns {Promise} - */ - @Cordova() - getVersionNumber(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/apple-wallet/index.ts b/src/@awesome-cordova-plugins/plugins/apple-wallet/index.ts deleted file mode 100644 index fd3a0452..00000000 --- a/src/@awesome-cordova-plugins/plugins/apple-wallet/index.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface EncryptedCardData { - activationData: string; - encryptedPassData: string; - wrappedKey: string; -} - -export interface SignatureCertificatesData { - certificateSubCA: string; - certificateLeaf: string; - nonce: string; - nonceSignature: string; -} - -export interface CardData { - cardholderName: string; - primaryAccountNumberSuffix: string; - localizedDescription?: string; - paymentNetwork?: string; -} - -export interface PairedDevicesFlags { - isInWallet: boolean; - isInWatch: boolean; - FPANID: string; -} - -export interface WatchExistData { - isWatchPaired: boolean; -} - -/** - * @name Apple Wallet - * @description - * A Cordova plugin that enables users from Add Payment Cards to their Apple Wallet. - * @usage - * ```typescript - * import { AppleWallet } from '@awesome-cordova-plugins/apple-wallet/ngx'; - * - * - * constructor(private appleWallet: AppleWallet) { } - * - * - * ... - * - * - * // Simple call to determine if the current device supports Apple Pay and has a supported card installed. - * this.appleWallet.isAvailable() - * .then((res: boolean) => { - * // Expect res to be boolean - * }) - * .catch((err) => { - * // Catch {{err}} here - * }); - * - * ... - * - * - * // Simple call to check Card Eligibility - * this.appleWallet.checkCardEligibility(primaryAccountIdentifier: string) - * .then((res: boolean) => { - * // Expect res to be boolean - * }) - * .catch((err) => { - * // Catch {{err}} here - * }); - * - * - * ... - * - * - * // Simple call to checkCardEligibilityBySuffix - * this.appleWallet.checkCardEligibilityBySuffix(cardSuffix: string) - * .then((res: boolean) => { - * // Expect res to be boolean - * }) - * .catch((err) => { - * // Catch {{err}} here - * }); - * - * - * ... - * - * // Simple call to check out if there is any paired Watches so that you can toggle visibility of 'Add to Watch' button - * this.appleWallet.checkPairedDevices() - * .then((res: WatchExistData) => { - * // object contains boolean flags showing paired devices - * }) - * .catch((err) => { - * // Catch {{err}} here - * }); - * - * - * ... - * - * - * - * // Simple call to check paired devices with a card by its suffix - * this.appleWallet.checkPairedDevicesBySuffix(cardSuffix: string) - * .then((res: PairedDevicesFlags) => { - * // object contains boolean values that ensure that card is already exists in wallet or paired-watch - * }) - * .catch((err) => { - * // Catch {{err}} here - * }); - * - * - * ... - * - * - * // Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object. - * // This method provides the data needed to create a request to add your payment pass (credit/debit card). After a successful callback, pass the certificate chain to your issuer server-side using our callback delegate method `AppleWallet.completeAddPaymentPass`. The issuer server-side should returns an encrypted JSON payload containing the encrypted card data, which is required to be get the final response - * - * this.appleWallet.startAddPaymentPass(data: cardData) - * .then((res: SignatureCertificatesData) => { - * // User proceed and successfully asked to add card to his wallet - * // Use the callback response JSON payload to complete addition process - * }) - * .catch((err) => { - * // Catch {{err}} here - * }); - * - * - * ... - * - * - * this.appleWallet.completeAddPaymentPass(data: encryptedCardData) - * .then((res: string) => { - * // Expect res to be string either 'success' or 'error' - * }) - * .catch((err) => { - * // Catch {{err}} here - * // Error and can not add the card, or something wrong happend - * // PKAddPaymentPassViewController will be dismissed - * }); - * - * ``` - * @Interfaces - * EncryptedCardData - * SignatureCertificatesData - * CardData - * PairedDevicesFlags - * WatchExistData - */ -@Plugin({ - pluginName: 'AppleWallet', - plugin: 'cordova-apple-wallet', - pluginRef: 'AppleWallet', - repo: 'https://github.com/tomavic/cordova-apple-wallet', - platforms: ['iOS'], -}) -@Injectable() -export class AppleWallet extends AwesomeCordovaNativePlugin { - /** - * Simple call to determine if the current device supports Apple Pay and has a supported card installed. - * - * @returns {Promise} - */ - @Cordova() - isAvailable(): Promise { - return; - } - - /** - * Simple call to check Card Eligibility - * - * @param {string} primaryAccountIdentifier - * @returns {Promise} - */ - @Cordova() - checkCardEligibility(primaryAccountIdentifier: string): Promise { - return; - } - - /** - * Simple call to checkCardEligibilityBySuffix - * - * @param {string} cardSuffix - * @returns {Promise} - */ - @Cordova() - checkCardEligibilityBySuffix(cardSuffix: string): Promise { - return; - } - - /** - * Simple call to check out if there is any paired Watches so that you can toggle visibility of 'Add to Watch' button - * - * @returns {Promise} - */ - @Cordova() - checkPairedDevices(): Promise { - return; - } - - /** - * Simple call to check paired devices with a card by its suffix - * - * @param {string} cardSuffix - * @returns {Promise} - */ - @Cordova() - checkPairedDevicesBySuffix(cardSuffix: string): Promise { - return; - } - - /** - * Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object. - * - * @param {cardData} data - * @returns {Promise} - */ - @Cordova() - startAddPaymentPass(data: CardData): Promise { - return; - } - - /** - * Simple completion handler that takes encrypted card data returned from your server side, in order to get the final response from Apple to know if the card is added succesfully or not. - * - * @param {encryptedCardData} data - * @returns {Promise} - */ - @Cordova() - completeAddPaymentPass(data: EncryptedCardData): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/applovin/index.ts b/src/@awesome-cordova-plugins/plugins/applovin/index.ts deleted file mode 100644 index b3d6e956..00000000 --- a/src/@awesome-cordova-plugins/plugins/applovin/index.ts +++ /dev/null @@ -1,340 +0,0 @@ -import { Injectable } from '@angular/core'; -import { AwesomeCordovaNativePlugin, Cordova, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface InitializeConfig { - hasUserConsentValue: boolean; - isAgeRestrictedUserValue: boolean; - isDoNotSellValue: boolean; - isTabletValue: boolean; -} - -export interface AdInfo { - adUnitId: string; - creativeId: string; - networkName: string; - placement: string; - revenue: number; -} - -export enum AdViewPosition { - TOP_CENTER = 'top_center', - TOP_RIGHT = 'top_right', - CENTERED = 'centered', - CENTER_LEFT = 'center_left', - CENTER_RIGHT = 'center_right', - BOTTOM_LEFT = 'bottom_left', - BOTTOM_CENTER = 'bottom_center', - BOTTOM_RIGHT = 'bottom_right', -} - -export enum ConsentDialogState { - UNKNOWN = 0, - APPLIES = 1, - DOES_NOT_APPLY = 2, -} - -/** - * @name Applovin - * @description - * This plugin allows you to easily configure, integrate and interact with Applovin ads. - * @usage - * ```typescript - * import { Applovin } from '@awesome-cordova-plugins/applovin'; - * - * - * constructor(private applovin: Applovin) { } - * - * - * this.applovin.initialize(sdkKey) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * - * this.applovin.loadInterstitial(adUnitId) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * - * this.applovin.showInterstitial(adUnitId, placement) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * ``` - */ -@Plugin({ - pluginName: 'Applovin', - plugin: 'cordova-plugin-applovin-max', - pluginRef: 'applovin', - repo: 'https://github.com/AppLovin/AppLovin-MAX-Cordova', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Applovin extends AwesomeCordovaNativePlugin { - /** - * Initialize the AppLovin SDK. - * - * @param {string} sdkKey The SDK key generated for your AppLovin account. - */ - @Cordova() - initialize(sdkKey: string): Promise { - return; - } - - @Cordova() - showMediationDebugger(): Promise { - return; - } - - @Cordova() - getConsentDialogState(): Promise { - return; - } - - @Cordova() - setHasUserConsent(hasUserConsent: boolean): Promise { - return; - } - - @Cordova() - hasUserConsent(): Promise { - return; - } - - @Cordova() - setIsAgeRestrictedUser(isAgeRestrictedUser: boolean): Promise { - return; - } - - @Cordova() - isAgeRestrictedUser(): Promise { - return; - } - - @Cordova() - setDoNotSell(isDoNotSell: boolean): Promise { - return; - } - - @Cordova() - isDoNotSell(): Promise { - return; - } - - @Cordova() - isTablet(): Promise { - return; - } - - @Cordova() - setUserId(userId: string): Promise { - return; - } - - @Cordova() - setMuted(): Promise { - return; - } - - @Cordova() - setVerboseLogging(verboseLoggingEnabled: boolean): Promise { - return; - } - - @Cordova() - setTestDeviceAdvertisingIds(advertisingIds: string[]): Promise { - return; - } - - @Cordova() - trackEvent(event: string, parameters?: object): Promise { - return; - } - - /** BANNERS */ - - @Cordova() - createBanner(adUnitId: string, position: AdViewPosition): Promise { - return; - } - - @Cordova() - setBannerBackgroundColor(adUnitId: string, hexColorCode: string): Promise { - return; - } - - @Cordova() - setBannerPlacement(adUnitId: string, placement: string): Promise { - return; - } - - @Cordova() - setBannerExtraParameter(adUnitId: string, key: string, value: string): Promise { - return; - } - - @Cordova() - showBanner(adUnitId: string): Promise { - return; - } - - @Cordova() - hideBanner(adUnitId: string): Promise { - return; - } - - @Cordova() - destroyBanner(adUnitId: string): Promise { - return; - } - - /** MRECS */ - - @Cordova() - createMRec(adUnitId: string, position: AdViewPosition): Promise { - return; - } - - @Cordova() - setMRecBackgroundColor(adUnitId: string, hexColorCode: string): Promise { - return; - } - - @Cordova() - setMRecPlacement(adUnitId: string, placement: string): Promise { - return; - } - - @Cordova() - setMRecExtraParameter(adUnitId: string, key: string, value: string): Promise { - return; - } - - @Cordova() - showMRec(adUnitId: string): Promise { - return; - } - - @Cordova() - hideMRec(adUnitId: string): Promise { - return; - } - - @Cordova() - destroyMRec(adUnitId: string): Promise { - return; - } - - /** INTERSTITIALS */ - - @Cordova() - loadInterstitial(adUnitId: string): Promise { - return; - } - - @Cordova() - showInterstitial(adUnitId: string, placement?: string): Promise { - return; - } - - @Cordova() - setInterstitialExtraParameter(adUnitId: string, key: string, value: string): Promise { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnInterstitialLoadedEvent', - }) - onInterstitialLoaded(): Observable { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnInterstitialLoadFailedEvent', - }) - onInterstitialLoadFailed(): Observable { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnInterstitialDisplayedEvent', - }) - onInterstitialDisplayed(): Observable { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnInterstitialHiddenEvent', - }) - onInterstitialHidden(): Observable { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnInterstitialAdFailedToDisplayEvent', - }) - onInterstitialAdFailedToDisplay(): Observable { - return; - } - - /** REWARDED ADS */ - - @Cordova() - loadRewardedAd(adUnitId: string): Promise { - return; - } - - @Cordova() - showRewardedAd(adUnitId: string, placement?: string): Promise { - return; - } - - @Cordova() - setRewardedAdExtraParameter(adUnitId: string, key: string, value: string): Promise { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnRewardedAdLoadedEvent', - }) - onRewardedAdLoaded(): Observable { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnRewardedAdLoadFailedEvent', - }) - onRewardedAdLoadFailed(): Observable { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnRewardedAdDisplayedEvent', - }) - onRewardedAdDisplayed(): Observable { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnRewardedAdHiddenEvent', - }) - onRewardedAdHidden(): Observable { - return; - } - - @Cordova({ - eventObservable: true, - event: 'OnRewardedAdAdFailedToDisplayEvent', - }) - onRewardedAdAdFailedToDisplay(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/approov-advanced-http/index.ts b/src/@awesome-cordova-plugins/plugins/approov-advanced-http/index.ts deleted file mode 100644 index 724d8dfd..00000000 --- a/src/@awesome-cordova-plugins/plugins/approov-advanced-http/index.ts +++ /dev/null @@ -1,773 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface HTTPResponse { - /** - * The HTTP status number of the response or a negative internal error code. - */ - status: number; - /** - * The headers of the response. - */ - headers: { [key: string]: string }; - /** - * The URL of the response. This property will be the final URL obtained after any redirects. - */ - url: string; - /** - * The data that is in the response. This property usually exists when a promise returned by a request method resolves. - */ - data?: any; - /** - * Error response from the server. This property usually exists when a promise returned by a request method rejects. - */ - error?: string; -} - -interface AbortedResponse { - aborted: boolean; -} - -export interface ApproovLoggableToken { - /** - * Expiry - * The only mandatory claim for Approov tokens. It specifies the expiry time for the token as a Unix timestamp. - */ - exp: number; - - /** - * Device ID - * This claim identifies the device for which the token was issued. This is a base64 encoded string representing a 128-bit device identifier. - * Note that this is not, strictly speaking, a device identifier as it is also influenced by the app identifier - * and may change if the same app is uninstalled and then reinstalled on the same device. - */ - did?: string; - - /** - * Attestation Response Code - * This is an optional claim that encodes information about a subset of the device property flags and also whether the attestation was a pass or fail. - * The claim is encoded in base32 and is typically 10 characters long (although it may be longer in some circumstances). - * This claim is not included by tokens from the failover. - */ - arc?: string; - - /** - * IP Address - * This holds the IP address of the device as seen by the Approov cloud service. It is provided in a human readable IP address format (in either IPv4 or IPv6 format). - * In practice this value can often change between the time a token is issued and the time it is sent to your backend, so you should never block if it differs, but you may include it as a signal that tokens have somehow been stolen and are being replayed. - * This claim is not included by tokens from the failover or if the IP Tracking Policy for the account has been set to none. - */ - ip?: string; - - /** - * Issuer - * An optional claim that is added if the issuer inclusion option is enabled. This provides the Approov account ID that was used to issue the token (suffixed with approov.io). - * It can be used as an additional layer of backend verification if signing keys are shared between multiple accounts. - * It indicates that tokens were issued from the expected Approov account. This claim may also be set to an explicit value for long lived Approov tokens. - * This flexibility is designed for use with server-to-server communication (which may only be signed with the account specific secret keys). - */ - iss?: string; - - /** - * Annotation - * This is an embedded JSON array of strings showing the list of flags that are set and are in the annotation set for the security policy that is selected. - * This allows additional information to be collected about the state of a particular device without necessarily causing an attestation failure. - * Note that if there are no possible annotations then this claim is not present at all. This claim is not included by tokens from the failover. - */ - anno?: string[]; - - /** - * Payload Hash - * An optional claim that is added if the protected app passes a token binding argument to the setDataHashInToken method. - * The claim value is set to the base64 encoded SHA256 hash of the provided payload string. - * This is typically used to bind an Approov token to some other data used by your app to enhance security (like a user auth token). - */ - pay?: string; - - /** - * Audience - * An optional claim that is added if the audience inclusion option is enabled. This provides the domain for which the token was issued. - * It can be used as an additional layer of backend verification to ensure that tokens intended for one domain cannot be used on to access a different one. - */ - aud?: string; - - /** - * Message Siging Key ID - * This is an optional claim that encodes the ID of a key being used for Message Signing. - * This is only present in Approov tokens for which message signing is active. This claim is not included by tokens from the failover. - */ - mskid?: string; - - /** - * Measurement Proof Key - * An optional claim to provide the measurement proof key if a measurement has been requested by the SDK on the domain for which the token is issued. - * This is a base64 encoded 128-bit proof key value. Note that if measurement is being used, then JWE tokens will be used to keep this claim secret. - */ - mpk?: string; - - /** - * Integrity Measurement Hash - * An optional claim to provide the integrity measurement hash if a measurement has been requested by the SDK on the domain for which the token is issued. - * This is a base64 encoded 256-bit SHA256 measurement value. Note that if measurement is being used, then JWE tokens will be used to keep this claim secret. - */ - imh?: string; - - /** - * Device Measurement Hash - * An optional claim to provide the device measurement hash if a measurement has been requested by the SDK on the domain for which the token is issued. - * This is a base64 encoded 256-bit SHA256 measurement value. Note that if measurement is being used, then JWE tokens will be used to keep this claim secret - */ - dmh?: string; -} - -/** - * @name HTTP - * @description - * Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android. - * - * Advantages over Javascript requests: - * - SSL / TLS Pinning - * - CORS restrictions do not apply - * - Handling of HTTP code 401 - read more at [Issue CB-2415](https://issues.apache.org/jira/browse/CB-2415) - * - * Note: This plugin extends the pre-existing [cordova-advanced-http-plugin](https://github.com/silkimen/cordova-plugin-advanced-http), - * we have only added approov functionality on top of it. All credit goes to the actual plugin developer. - * @usage - * ```typescript - * import { ApproovHttp } from '@awesome-cordova-plugins/http/ngx'; - * - * constructor(private http: ApproovHttp) {} - * - * ... - * - * this.http.get('http://ionic.io', {}, {}) - * .then(data => { - * - * console.log(data.status); - * console.log(data.data); // data received by server - * console.log(data.headers); - * - * }) - * .catch(error => { - * - * console.log(error.status); - * console.log(error.error); // error message as string - * console.log(error.headers); - * - * }); - * - * ``` - * @interfaces - * HTTPResponse - */ -@Plugin({ - pluginName: 'ApproovHttp', - plugin: 'cordova-approov-advanced-http', - pluginRef: 'cordova.plugin.ApproovHttp', - repo: 'https://github.com/approov/quickstart-ionic-advancedhttp', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class ApproovHttp extends AwesomeCordovaNativePlugin { - /** - * This enum represents the internal error codes which can be returned in a HTTPResponse object. - * - * @readonly - */ - @CordovaProperty() - readonly ErrorCode: { - GENERIC: number; - SSL_EXCEPTION: number; - SERVER_NOT_FOUND: number; - TIMEOUT: number; - UNSUPPORTED_URL: number; - NOT_CONNECTED: number; - POST_PROCESSING_FAILED: number; - ABORTED: number; - }; - - /** - * This returns an object representing a basic HTTP Authorization header of the form. - * - * @param username {string} Username - * @param password {string} Password - * @returns {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64EncodedUsernameAndPassword'} - */ - @Cordova({ sync: true }) - getBasicAuthHeader(username: string, password: string): { Authorization: string } { - return; - } - - /** - * This sets up all future requests to use Basic HTTP authentication with the given username and password. - * - * @param username {string} Username - * @param password {string} Password - */ - @Cordova({ sync: true }) - useBasicAuth(username: string, password: string): void {} - - /** - * Get all headers defined for a given hostname. - * - * @param host {string} The hostname - * @returns {string} return all headers defined for the hostname - */ - @Cordova({ sync: true }) - getHeaders(host: string): string { - return; - } - - /** - * Set a header for all future requests. Takes a hostname, a header and a value. - * - * @param host {string} The hostname to be used for scoping this header - * @param header {string} The name of the header - * @param value {string} The value of the header - */ - @Cordova({ sync: true }) - setHeader(host: string, header: string, value: string): void {} - - /** - * Get the name of the data serializer which will be used for all future POST and PUT requests. - * - * @returns {string} returns the name of the configured data serializer - */ - @Cordova({ sync: true }) - getDataSerializer(): string { - return; - } - - /** - * Set the data serializer which will be used for all future POST, PUT and PATCH requests. Takes a string representing the name of the serializer. - * - * @param serializer {string} The name of the serializer. - * @see https://github.com/silkimen/cordova-plugin-advanced-http#setdataserializer - */ - @Cordova({ sync: true }) - setDataSerializer(serializer: 'urlencoded' | 'json' | 'utf8' | 'multipart' | 'raw'): void {} - - /** - * Add a custom cookie. - * - * @param url {string} Scope of the cookie - * @param cookie {string} RFC compliant cookie string - */ - @Cordova({ sync: true }) - setCookie(url: string, cookie: string): void {} - - /** - * Clear all cookies. - */ - @Cordova({ sync: true }) - clearCookies(): void {} - - /** - * Remove cookies for given URL. - * - * @param url {string} - * @param cb - */ - @Cordova({ sync: true }) - removeCookies(url: string, cb: () => void): void {} - - /** - * Resolve cookie string for given URL. - * - * @param url {string} - */ - @Cordova({ sync: true }) - getCookieString(url: string): string { - return; - } - - /** - * Get global request timeout value in seconds. - * - * @returns {number} returns the global request timeout value - */ - @Cordova({ sync: true }) - getRequestTimeout(): number { - return; - } - - /** - * Set global request timeout value in seconds. - * - * @param timeout {number} The timeout in seconds. Default 60 - */ - @Cordova({ sync: true }) - setRequestTimeout(timeout: number): void {} - - /** - * Resolve if it should follow redirects automatically. - * - * @returns {boolean} returns true if it is configured to follow redirects automatically - */ - @Cordova({ sync: true }) - getFollowRedirect(): boolean { - return; - } - - /** - * Configure if it should follow redirects automatically. - * - * @param follow {boolean} Set to false to disable following redirects automatically - */ - @Cordova({ sync: true }) - setFollowRedirect(follow: boolean): void {} - - /** - * Set server trust mode, being one of the following values: - * default: default SSL trustship and hostname verification handling using system's CA certs; - * legacy: use legacy default behavior (< 2.0.3), excluding user installed CA certs (only for Android); - * nocheck: disable SSL certificate checking and hostname verification, trusting all certs (meant to be used only for testing purposes); - * pinned: trust only provided certificates; - * - * @see https://github.com/silkimen/cordova-plugin-advanced-http#setservertrustmode - * @param {string} mode server trust mode - */ - @Cordova() - setServerTrustMode(mode: 'default' | 'legacy' | 'nocheck' | 'pinned'): Promise { - return; - } - - /** - * Make a POST request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - post(url: string, body: any, headers: any): Promise { - return; - } - - /** - * Make a sync POST request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'post', - sync: true, - }) - postSync( - url: string, - body: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a GET request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - get(url: string, parameters: any, headers: any): Promise { - return; - } - - /** - * Make a sync GET request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'get', - sync: true, - }) - getSync( - url: string, - parameters: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a PUT request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - put(url: string, body: any, headers: any): Promise { - return; - } - - /** - * Make a sync PUT request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'put', - sync: true, - }) - putSync( - url: string, - body: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a PATCH request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - patch(url: string, body: any, headers: any): Promise { - return; - } - - /** - * Make a sync PATCH request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'patch', - sync: true, - }) - patchSync( - url: string, - body: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a DELETE request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - delete(url: string, parameters: any, headers: any): Promise { - return; - } - - /** - * Make a sync DELETE request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'delete', - sync: true, - }) - deleteSync( - url: string, - parameters: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a HEAD request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - head(url: string, parameters: any, headers: any): Promise { - return; - } - - /** - * Make a sync HEAD request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'head', - sync: true, - }) - headSync( - url: string, - parameters: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make an OPTIONS request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - options(url: string, parameters: any, headers: any): Promise { - return; - } - - /** - * Make an sync OPTIONS request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'options', - sync: true, - }) - optionsSync( - url: string, - parameters: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param filePath {string} The local path(s) of the file(s) to upload - * @param name {string} The name(s) of the parameter to pass the file(s) along as - * @returns {Promise} returns a FileEntry promise that will resolve on success, and reject on failure - */ - @Cordova() - uploadFile(url: string, body: any, headers: any, filePath: string | string[], name: string | string[]): Promise { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param filePath {string} The local path(s) of the file(s) to upload - * @param name {string} The name(s) of the parameter to pass the file(s) along as - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'uploadFile', - sync: true, - }) - uploadFileSync( - url: string, - body: any, - headers: any, - filePath: string | string[], - name: string | string[], - success: (result: any) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param filePath {string} The path to download the file to, including the file name. - * @returns {Promise} returns a FileEntry promise that will resolve on success, and reject on failure - */ - @Cordova() - downloadFile(url: string, body: any, headers: any, filePath: string): Promise { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param filePath {string} The path to download the file to, including the file name. - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'downloadFile', - sync: true, - }) - downloadFileSync( - url: string, - body: any, - headers: any, - filePath: string, - success: (result: any) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param options {Object} options for individual request - * @param options.method {string} request method - * @param options.data {Object} payload to be send to the server (only applicable on post, put or patch methods) - * @param options.params {Object} query params to be appended to the URL (only applicable on get, head, delete, upload or download methods) - * @param options.serializer {string} data serializer to be used (only applicable on post, put or patch methods), defaults to global serializer value, see setDataSerializer for supported values - * @param options.timeout {number} timeout value for the request in seconds, defaults to global timeout value - * @param options.headers {Object} headers object (key value pair), will be merged with global values - * @param options.filePath {string} file path(s) to be used during upload and download see uploadFile and downloadFile for detailed information - * @param options.name {string} name(s) to be used during upload see uploadFile for detailed information - * @param options.responseType {string} response type, defaults to text - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - sendRequest( - url: string, - options: { - method: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'options' | 'upload' | 'download'; - data?: { [index: string]: any }; - params?: { [index: string]: string | number }; - serializer?: 'json' | 'urlencoded' | 'utf8' | 'multipart' | 'raw'; - timeout?: number; - headers?: { [index: string]: string }; - filePath?: string | string[]; - name?: string | string[]; - responseType?: 'text' | 'arraybuffer' | 'blob' | 'json'; - } - ): Promise { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param options {Object} options for individual request - * @param options.method {string} request method - * @param options.data {Object} payload to be send to the server (only applicable on post, put or patch methods) - * @param options.params {Object} query params to be appended to the URL (only applicable on get, head, delete, upload or download methods) - * @param options.serializer {string} data serializer to be used (only applicable on post, put or patch methods), defaults to global serializer value, see setDataSerializer for supported values - * @param options.timeout {number} timeout value for the request in seconds, defaults to global timeout value - * @param options.headers {Object} headers object (key value pair), will be merged with global values - * @param options.filePath {string} file path(s) to be used during upload and download see uploadFile and downloadFile for detailed information - * @param options.name {string} name(s) to be used during upload see uploadFile for detailed information - * @param options.responseType {string} response type, defaults to text - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'sendRequest', - sync: true, - }) - sendRequestSync( - url: string, - options: { - method: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'options' | 'upload' | 'download'; - data?: { [index: string]: any }; - params?: { [index: string]: string | number }; - serializer?: 'json' | 'urlencoded' | 'utf8' | 'multipart'; - timeout?: number; - headers?: { [index: string]: string }; - filePath?: string | string[]; - name?: string | string[]; - responseType?: 'text' | 'arraybuffer' | 'blob' | 'json'; - }, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * @param requestId {string} The RequestId of the request to abort - */ - @Cordova() - abort(requestId: string): Promise { - return; - } - - @Cordova({ sync: true }) - initializeApproov(): void { - return; - } - - @Cordova({ sync: true }) - approovSetDataHashInToken(dataHash: string): void { - return; - } - - @Cordova({ sync: true }) - approovSetBindingHeader(header: string): void { - return; - } - - @Cordova() - getApproovLoggableToken(host: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/appsflyer/index.ts b/src/@awesome-cordova-plugins/plugins/appsflyer/index.ts deleted file mode 100644 index be0c3a4e..00000000 --- a/src/@awesome-cordova-plugins/plugins/appsflyer/index.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface AppsflyerOptions { - /** - * Appsflyer Dev key - */ - devKey: string; - - /** - * Apple Application ID(for iOS only) - */ - appId?: string; - - /** - * debug mode - */ - isDebug?: boolean; - - /** - * optout of collection of IMEI - */ - collectIMEI?: boolean; - - /** - * optout of collection of collectAndroidID - */ - collectAndroidID?: boolean; - - /** - * default false Accessing AppsFlyer Attribution / Conversion Data from the SDK (Deferred Deeplinking). Read more: Android, iOS. AppsFlyer plugin will return attribution data in onSuccess callback. - */ - onInstallConversionDataListener?: boolean; - - /** - * time for the sdk to wait before launch - IOS 14 ONLY! - */ - waitForATTUserAuthorization?: number; -} - -export interface AppsflyerEvent { - [x: string]: any; -} - -export interface AppsflyerInviteOptions { - channel?: string; - campaign?: string; - userParams?: { - [x: string]: any; - }; -} - -/** - * @name Appsflyer - * @description - * Appsflyer Cordova SDK support for Attribution - * @usage - * ```typescript - * import { Appsflyer } from '@awesome-cordova-plugins/appsflyer/ngx'; - * - * - * constructor(private appsflyer: Appsflyer) { } - * - * ... - * - * - * this.appsflyer.initSdk(options); - * - * ``` - * @interfaces - * AppsflyerOptions - * AppsflyerEvent - * AppsflyerInviteOptions - */ -@Plugin({ - pluginName: 'Appsflyer', - plugin: 'cordova-plugin-appsflyer-sdk', - pluginRef: 'window.plugins.appsFlyer', - repo: 'https://github.com/AppsFlyerSDK/cordova-plugin-appsflyer-sdk', - platforms: ['iOS', 'Android'], - install: 'Add to config.xml like stated on github and then start', -}) -@Injectable() -export class Appsflyer extends AwesomeCordovaNativePlugin { - /** - * initialize the SDK - * - * @param {AppsflyerOptions} options - * @returns {Promise} - */ - @Cordova() - initSdk(options: AppsflyerOptions): Promise { - return; - } - - /** - * These in-app events help you track how loyal users discover your app, and attribute them to specific campaigns/media-sources. Please take the time define the event/s you want to measure to allow you to track ROI (Return on Investment) and LTV (Lifetime Value). - * - * @param {string} eventName custom event name, is presented in your dashboard - * @param {AppsflyerEvent} eventValues event details - */ - @Cordova() - logEvent(eventName: string, eventValues: AppsflyerEvent): void {} - - /** - * Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs. - * - * @param {string} customerUserId user id - */ - @Cordova({ sync: true }) - setAppUserId(customerUserId: string): void {} - - /** - * Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs. - * - * @param {boolean} customerUserId In some extreme cases you might want to shut down all SDK tracking due to legal and privacy compliance. This can be achieved with the isStopTracking API. Once this API is invoked, our SDK will no longer communicate with our servers and stop functioning. - * @param isStopTracking - */ - @Cordova({ sync: true }) - Stop(isStopTracking: boolean): void {} - - /** - * Get the data from Attribution - * - * @returns {Promise} - */ - @Cordova() - registerOnAppOpenAttribution(): Promise { - return; - } - - /** - * @deprecated - * Enables app uninstall tracking - * @param {string} token GCM/FCM ProjectNumber - * @returns {Promise} - */ - @Cordova() - enableUninstallTracking(token: string): Promise { - return; - } - - /** - * Allows to pass GCM/FCM Tokens that where collected by third party plugins to the AppsFlyer server. Can be used for Uninstall Tracking. - * - * @param {string} token GCM/FCM ProjectNumber - */ - @Cordova({ sync: true }) - updateServerUninstallToken(token: string): void {} - - /** - * (iOS) Allows to pass APN Tokens that where collected by third party plugins to the AppsFlyer server. Can be used for Uninstall Tracking. - * - * @param {string} token APN Token - */ - @Cordova({ sync: true }) - registerUninstall(token: string): void {} - - /** - * Get AppsFlyer’s proprietary Device ID. The AppsFlyer Device ID is the main ID used by AppsFlyer in Reports and APIs. - */ - @Cordova() - getAppsFlyerUID(): Promise { - return; - } - - /** - * End User Opt-Out (Optional) AppsFlyer provides you a method to opt‐out specific users from AppsFlyer analytics. This method complies with the latest privacy requirements and complies with Facebook data and privacy policies. Default is FALSE, meaning tracking is enabled by default. - * - * @param {boolean} disable Set to true to opt-out user from tracking - */ - @Cordova({ sync: true }) - anonymizeUser(disable: boolean): void {} - - /** - * Set AppsFlyer’s OneLink ID. Setting a valid OneLink ID will result in shortened User Invite links, when one is generated. The OneLink ID can be obtained on the AppsFlyer Dashboard. - * - * @param {string} oneLinkId OneLink ID - */ - @Cordova({ sync: true }) - setAppInviteOneLinkID(oneLinkId: string): void {} - - /** - * Allowing your existing users to invite their friends and contacts as new users to your app can be a key growth factor for your app. AppsFlyer allows you to track and attribute new installs originating from user invites within your app. - * - * @param {AppsflyerInviteOptions} options Parameters for Invite link - * @returns {Promise} - */ - @Cordova() - generateInviteLink(options: AppsflyerInviteOptions): Promise { - return; - } - - /** - * Use this call to track an impression use the following API call. Make sure to use the promoted App ID as it appears within the AppsFlyer dashboard. - * - * @param {string} appId Promoted Application ID - * @param {string} campaign Promoted Campaign - */ - @Cordova({ sync: true }) - logCrossPromotionImpression(appId: string, campaign: string): void {} - - /** - * Use this call to track the click and launch the app store's app page (via Browser) - * - * @param {string} appId Promoted Application ID - * @param {string} campaign Promoted Campaign - * @param {Object} options Additional Parameters to track - */ - @Cordova({ sync: true }) - logCrossPromotionAndOpenStore(appId: string, campaign: string, options: Object): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/background-fetch/index.ts b/src/@awesome-cordova-plugins/plugins/background-fetch/index.ts deleted file mode 100644 index af66e08f..00000000 --- a/src/@awesome-cordova-plugins/plugins/background-fetch/index.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -export interface BackgroundFetchConfig { - /** - * Set true to cease background-fetch from operating after user "closes" the app. Defaults to true. - */ - stopOnTerminate?: boolean; -} - -/** - * @name Background Fetch - * @description - * iOS Background Fetch Implementation. See: https://developer.apple.com/reference/uikit/uiapplication#1657399 - * iOS Background Fetch is basically an API which wakes up your app about every 15 minutes (during the user's prime-time hours) and provides your app exactly 30s of background running-time. This plugin will execute your provided callbackFn whenever a background-fetch event occurs. There is no way to increase the rate which a fetch-event occurs and this plugin sets the rate to the most frequent possible value of UIApplicationBackgroundFetchIntervalMinimum -- iOS determines the rate automatically based upon device usage and time-of-day (ie: fetch-rate is about ~15min during prime-time hours; less frequently when the user is presumed to be sleeping, at 3am for example). - * For more detail, please see https://github.com/transistorsoft/cordova-plugin-background-fetch - * @usage - * - * ```typescript - * import { BackgroundFetch, BackgroundFetchConfig } from '@awesome-cordova-plugins/background-fetch/ngx'; - * - * - * constructor(private backgroundFetch: BackgroundFetch) { - * - * const config: BackgroundFetchConfig = { - * stopOnTerminate: false, // Set true to cease background-fetch from operating after user "closes" the app. Defaults to true. - * } - * - * backgroundFetch.configure(config) - * .then(() => { - * console.log('Background Fetch initialized'); - * - * this.backgroundFetch.finish(); - * - * }) - * .catch(e => console.log('Error initializing background fetch', e)); - * - * // Start the background-fetch API. Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin - * backgroundFetch.start(); - * - * // Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed. - * backgroundFetch.stop(); - * - * - * } - * - * ``` - * @interfaces - * BackgroundFetchConfig - */ -@Plugin({ - pluginName: 'BackgroundFetch', - plugin: 'cordova-plugin-background-fetch', - pluginRef: 'BackgroundFetch', - repo: 'https://github.com/transistorsoft/cordova-plugin-background-fetch', - platforms: ['iOS'], -}) -@Injectable() -export class BackgroundFetch extends AwesomeCordovaNativePlugin { - /** - * Configures the plugin's fetch callbackFn - * - * @param {BackgroundFetchConfig} config Configuration for plugin - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - configure(config: BackgroundFetchConfig): Promise { - return; - } - - /** - * Start the background-fetch API. - * Your callbackFn provided to #configure will be executed each time a background-fetch event occurs. NOTE the #configure method automatically calls #start. You do not have to call this method after you #configure the plugin - * - * @returns {Promise} - */ - @Cordova() - start(): Promise { - return; - } - - /** - * Stop the background-fetch API from firing fetch events. Your callbackFn provided to #configure will no longer be executed. - * - * @returns {Promise} - */ - @Cordova() - stop(): Promise { - return; - } - - /** - * You MUST call this method in your fetch callbackFn provided to #configure in order to signal to iOS that your fetch action is complete. iOS provides only 30s of background-time for a fetch-event -- if you exceed this 30s, iOS will kill your app. - * - * @param taskId - */ - @Cordova({ - sync: true, - }) - finish(taskId: string): void {} - - /** - * Return the status of the background-fetch - * - * @returns {Promise} - */ - @Cordova() - status(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/background-geolocation/index.ts b/src/@awesome-cordova-plugins/plugins/background-geolocation/index.ts deleted file mode 100644 index 471fc20c..00000000 --- a/src/@awesome-cordova-plugins/plugins/background-geolocation/index.ts +++ /dev/null @@ -1,913 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export enum BackgroundGeolocationLocationCode { - PERMISSION_DENIED = 1, - LOCATION_UNAVAILABLE = 2, - TIMEOUT = 3, -} - -export enum BackgroundGeolocationNativeProvider { - gps = 'gps', - network = 'network', - passive = 'passive', - fused = 'fused', -} - -export enum BackgroundGeolocationLocationProvider { - DISTANCE_FILTER_PROVIDER = 0, - ACTIVITY_PROVIDER = 1, - RAW_PROVIDER = 2, -} - -export enum BackgroundGeolocationEvents { - http_authorization = 'http_authorization', // Triggered when server responded with "401 Unauthorized" to post/sync request. - abort_requested = 'abort_requested', // Triggered when server responded with "285 Updates Not Required" to post/sync request. - background = 'background', // Triggered when app entered background state and (not visible to the user). - foreground = 'foreground', // Triggered when app entered foreground state and (visible to the user). - authorization = 'authorization', // Triggered when user changes authorization/permissions for the app or toggles location services. - error = 'error', // Register error listener. - stop = 'stop', // Triggered when background service has been stopped succesfully. - start = 'start', // Event is triggered when background service has been started succesfully. - activity = 'activity', // Register activity monitoring listener. - stationary = 'stationary', // Register stationary location event listener. - location = 'location', // Register location event listener. -} - -export enum BackgroundGeolocationAuthorizationStatus { - NOT_AUTHORIZED = 0, - AUTHORIZED = 1, - AUTHORIZED_FOREGROUND = 2, -} - -export enum BackgroundGeolocationLogLevel { - TRACE = 'TRACE', - DEBUG = 'DEBUG', - INFO = 'INFO', - WARN = 'WARN', - ERROR = 'ERROR', -} - -export interface BackgroundGeolocationLogEntry { - /** ID of log entry as stored in db. */ - id: number; - - /** Timestamp in milliseconds since beginning of UNIX epoch. */ - timestamp: number; - - /** Log level */ - level: BackgroundGeolocationLogLevel; - - /** Log message */ - message: string; - - /** Recorded stacktrace. (Android only, on iOS part of message) */ - stackTrace: string; -} - -export interface ServiceStatus { - /** TRUE if service is running. */ - isRunning: boolean; - - /** TRUE if location services are enabled */ - locationServicesEnabled: boolean; - - /** - * Authorization status. - * - * Posible values: - * NOT_AUTHORIZED, AUTHORIZED, AUTHORIZED_FOREGROUND - * - * @example - * if (authorization == BackgroundGeolocation.NOT_AUTHORIZED) {...} - */ - authorization: BackgroundGeolocationAuthorizationStatus; -} - -export interface BackgroundGeolocation { - code: BackgroundGeolocationLocationCode; - message: string; -} - -export interface BackgroundGeolocationCurrentPositionConfig { - timeout: number; - maximumAge: number; - enableHighAccuracy: boolean; -} - -export interface BackgroundGeolocationResponse { - /** ID of location as stored in DB (or null) */ - id: number; - - /** - * Native provider reponsible for location. - * - * Possible values: - * "gps", "network", "passive" or "fused" - */ - provider: BackgroundGeolocationNativeProvider; - - /** Configured location provider. */ - locationProvider: BackgroundGeolocationLocationProvider; - - /** UTC time of this fix, in milliseconds since January 1, 1970. */ - time: number; - - /** Latitude, in degrees. */ - latitude: number; - - /** Longitude, in degrees. */ - longitude: number; - - /** Estimated accuracy of this location, in meters. */ - accuracy: number; - - /** - * Speed if it is available, in meters/second over ground. - * - * Note: Not all providers are capable of providing speed. - * Typically network providers are not able to do so. - */ - speed: number; - - /** Altitude if available, in meters above the WGS 84 reference ellipsoid. */ - altitude: number; - - /** Bearing, in degrees. */ - bearing: number; - - /** - * True if location was recorded by mock provider. (ANDROID ONLY) - * - * Note: this property is not enabled by default! - * You can enable it "postTemplate" configure option. - */ - isFromMockProvider?: boolean; - - /** - * True if device has mock locations enabled. (ANDROID ONLY) - * - * Note: this property is not enabled by default! - * You can enable it "postTemplate" configure option. - */ - mockLocationsEnabled?: boolean; -} - -export interface BackgroundGeolocationConfig { - /** - * Set location provider - * - * Platform: all - * Available providers: - * DISTANCE_FILTER_PROVIDER, - * ACTIVITY_PROVIDER - * RAW_PROVIDER - * - * @default DISTANCE_FILTER_PROVIDER - * @example - * { locationProvider: LocationProvider.RAW_PROVIDER } - */ - locationProvider?: number; - - /** - * Desired accuracy in meters. - * - * Platform: all - * Provider: all - * Possible values: - * HIGH_ACCURACY, - * MEDIUM_ACCURACY, - * LOW_ACCURACY, - * PASSIVE_ACCURACY - * Note: Accuracy has direct effect on power drain. Lower accuracy = lower power drain. - * - * @default MEDIUM_ACCURACY - * @example - * { desiredAccuracy: BackgroundGeolocationAccuracy.LOW } - */ - desiredAccuracy?: number; - - /** - * Stationary radius in meters. - * - * When stopped, the minimum distance the device must move beyond the stationary location for aggressive background-tracking to engage. - * Platform: all - * Provider: DISTANCE_FILTER - * - * @default 50 - */ - stationaryRadius?: number; - - /** - * When enabled, the plugin will emit sounds for life-cycle events of background-geolocation! See debugging sounds table. - * - * Platform: all - * Provider: all - * - * @default false - */ - debug?: boolean; - - /** - * The minimum distance (measured in meters) a device must move horizontally before an update event is generated. - * - * Platform: all - * Provider: DISTANCE_FILTER, RAW - * - * @default 500 - * @see {@link https://apple.co/2oHo2CV|Apple docs} - */ - distanceFilter?: number; - - /** - * Enable this in order to force a stop() when the application terminated. - * E.g. on iOS, double-tap home button, swipe away the app. - * - * Platform: all - * Provider: all - * - * @default true - */ - stopOnTerminate?: boolean; - - /** - * Start background service on device boot. - * - * Platform: Android - * Provider: all - * - * @default false - */ - startOnBoot?: boolean; - - /** - * The minimum time interval between location updates in milliseconds. - * - * Platform: Android - * Provider: all - * - * @default 60000 - * @see {@link https://bit.ly/1x00RUu|Android docs} - */ - interval?: number; - - /** - * Fastest rate in milliseconds at which your app can handle location updates. - * - * Platform: Android - * Provider: ACTIVITY - * - * @default 120000 - * @see {@link https://bit.ly/1x00RUu|Android docs} - */ - fastestInterval?: number; - - /** - * Rate in milliseconds at which activity recognition occurs. - * Larger values will result in fewer activity detections while improving battery life. - * - * Platform: Android - * Provider: ACTIVITY - * - * @default 10000 - */ - activitiesInterval?: number; - - /** - * @deprecated Stop location updates, when the STILL activity is detected. - */ - stopOnStillActivity?: boolean; - - /** - * Enable/disable local notifications when tracking and syncing locations. - * - * Platform: Android - * Provider: all - * - * @default true - */ - notificationsEnabled?: boolean; - - /** - * Allow location sync service to run in foreground state. - * Foreground state also requires a notification to be presented to the user. - * - * Platform: Android - * Provider: all - * - * @default false - */ - startForeground?: boolean; - - /** - * Custom notification title in the drawer. - * - * Platform: Android - * Provider: all - * - * @default "Background tracking" - */ - notificationTitle?: string; - - /** - * Custom notification text in the drawer. - * - * Platform: Android - * Provider: all - * - * @default "ENABLED" - */ - notificationText?: string; - - /** - * The accent color (hex triplet) to use for notification. - * Eg. #4CAF50. - * - * Platform: Android - * Provider: all - */ - notificationIconColor?: string; - - /** - * The filename of a custom notification icon. - * - * Platform: Android - * Provider: all - */ - notificationIconLarge?: string; - - /** - * The filename of a custom notification icon. - * - * Platform: Android - * Provider: all - */ - notificationIconSmall?: string; - - /** - * Activity type. - * Presumably, this affects iOS GPS algorithm. - * - * Possible values: - * "AutomotiveNavigation", "OtherNavigation", "Fitness", "Other" - * - * Platform: iOS - * Provider: all - * - * @default "OtherNavigation" - * @see {@link https://apple.co/2oHofpH|Apple docs} - */ - activityType?: string; - - /** - * Pauses location updates when app is paused. - * - * Platform: iOS - * Provider: all - * - * @default false - * @see {@link https://apple.co/2CbjEW2|Apple docs} - */ - pauseLocationUpdates?: boolean; - - /** - * Switch to less accurate significant changes and region monitory when in background. - * - * Platform: iOS - * Provider: all - * - * @default false - */ - saveBatteryOnBackground?: boolean; - - /** - * Server url where to send HTTP POST with recorded locations - * - * Platform: all - * Provider: all - */ - url?: string; - - /** - * Server url where to send fail to post locations - * - * Platform: all - * Provider: all - */ - syncUrl?: string; - - /** - * Specifies how many previously failed locations will be sent to server at once. - * - * Platform: all - * Provider: all - * - * @default 100 - */ - syncThreshold?: number; - - /** - * Optional HTTP headers sent along in HTTP request. - * - * Platform: all - * Provider: all - */ - httpHeaders?: any; - - /** - * Limit maximum number of locations stored into db. - * - * Platform: all - * Provider: all - * - * @default 10000 - */ - maxLocations?: number; - - /** - * Customization post template. - * - * Platform: all - * Provider: all - */ - postTemplate?: any; -} - -/** - * Set location service provider @see https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers - * - * Possible values: - * ANDROID_DISTANCE_FILTER_PROVIDER: 0, - * ANDROID_ACTIVITY_PROVIDER: 1 - * - * @enum {number} - */ -export declare enum BackgroundGeolocationProvider { - ANDROID_DISTANCE_FILTER_PROVIDER = 0, - ANDROID_ACTIVITY_PROVIDER = 1, -} - -/** - * Desired accuracy in meters. Possible values [0, 10, 100, 1000]. - * The lower the number, the more power devoted to GeoLocation resulting in higher accuracy readings. - * 1000 results in lowest power drain and least accurate readings. - * - * Possible values: - * HIGH: 0 - * MEDIUM: 10 - * LOW: 100 - * PASSIVE: 1000 - * - * enum {number} - */ -export declare enum BackgroundGeolocationAccuracy { - HIGH = 0, - MEDIUM = 10, - LOW = 100, - PASSIVE = 1000, -} - -/** - * Used in the switchMode function - * - * Possible values: - * BACKGROUND: 0 - * FOREGROUND: 1 - * - * @enum {number} - */ -export declare enum BackgroundGeolocationMode { - BACKGROUND = 0, - FOREGROUND = 1, -} - -export declare enum BackgroundGeolocationIOSActivity { - AutomotiveNavigation = 'AutomotiveNavigation', - OtherNavigation = 'OtherNavigation', - Fitness = 'Fitness', - Other = 'Other', -} - -/** - * @name Background Geolocation - * @description - * This plugin provides foreground and background geolocation with battery-saving "circular region monitoring" and "stop detection". For - * more detail, please see https://github.com/mauron85/cordova-plugin-background-geolocation - * @usage - * - * BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission. - * - * ```typescript - * import { BackgroundGeolocation, BackgroundGeolocationConfig, BackgroundGeolocationEvents, BackgroundGeolocationResponse } from '@awesome-cordova-plugins/background-geolocation/ngx'; - * - * constructor(private backgroundGeolocation: BackgroundGeolocation) { } - * - * ... - * - * const config: BackgroundGeolocationConfig = { - * desiredAccuracy: 10, - * stationaryRadius: 20, - * distanceFilter: 30, - * debug: true, // enable this hear sounds for background-geolocation life-cycle. - * stopOnTerminate: false, // enable this to clear background location settings when the app terminates - * }; - * - * this.backgroundGeolocation.configure(config) - * .then(() => { - * - * this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe((location: BackgroundGeolocationResponse) => { - * console.log(location); - * - * // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished, - * // and the background-task may be completed. You must do this regardless if your operations are successful or not. - * // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background. - * this.backgroundGeolocation.finish(); // FOR IOS ONLY - * }); - * - * }); - * - * // start recording location - * this.backgroundGeolocation.start(); - * - * // If you wish to turn OFF background-tracking, call the #stop method. - * this.backgroundGeolocation.stop(); - * - * ``` - * @interfaces - * BackgroundGeolocationResponse - * BackgroundGeolocationConfig - */ -@Plugin({ - pluginName: 'BackgroundGeolocation', - plugin: '@mauron85/cordova-plugin-background-geolocation', - pluginRef: 'BackgroundGeolocation', - repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class BackgroundGeolocation extends AwesomeCordovaNativePlugin { - /** - * Configure the plugin. - * - * @param options {BackgroundGeolocationConfig} options An object of type Config - * @returns {Promise} - */ - @Cordova() - configure(options: BackgroundGeolocationConfig): Promise { - return; - } - - /** - * Turn ON the background-geolocation system. - * The user will be tracked whenever they suspend the app. - * - * @returns {Promise} - */ - @Cordova() - start(): Promise { - return; - } - - /** - * Turn OFF background-tracking - * - * @returns {Promise} - */ - @Cordova() - stop(): Promise { - return; - } - - /** - * Inform the native plugin that you're finished, the background-task may be completed - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - finish(): Promise { - return; - } - - /** - * Force the plugin to enter "moving" or "stationary" state - * - * @param isMoving {boolean} - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - changePace(isMoving: boolean): Promise { - return; - } - - /** - * Setup configuration - * - * @param options {BackgroundGeolocationConfig} - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - setConfig(options: BackgroundGeolocationConfig): Promise { - return; - } - - /** - * Returns current stationaryLocation if available. null if not - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - getStationaryLocation(): Promise { - return; - } - - /** - * Add a stationary-region listener. Whenever the devices enters "stationary-mode", - * your #success callback will be executed with #location param containing #radius of region - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - onStationary(): Promise { - return; - } - - /** - * Check if location is enabled on the device - * - * @returns {Promise} Returns a promise with int argument that takes values 0, 1 (true). - */ - @Cordova({ - platforms: ['Android'], - }) - isLocationEnabled(): Promise { - return; - } - - /** - * Display app settings to change permissions - */ - @Cordova({ sync: true }) - showAppSettings(): void {} - - /** - * Display device location settings - */ - @Cordova({ sync: true }) - showLocationSettings(): void {} - - /** - * Method can be used to detect user changes in location services settings. - * If user enable or disable location services then success callback will be executed. - * In case or (SettingNotFoundException) fail callback will be executed. - * - * @returns {Observable} - */ - @Cordova({ - platforms: ['Android'], - observable: true, - }) - watchLocationMode(): Observable { - return; - } - - /** - * Stop watching for location mode changes. - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - stopWatchingLocationMode(): Promise { - return; - } - - /** - * Method will return all stored locations. - * Locations are stored when: - * - config.stopOnTerminate is false and main activity was killed - * by the system - * or - * - option.debug is true - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - getLocations(): Promise { - return; - } - - /** - * Method will return locations, which has not been yet posted to server. NOTE: Locations does contain locationId. - * - * @returns {Promise} - */ - @Cordova() - getValidLocations(): Promise { - return; - } - - /** - * Delete stored location by given locationId. - * - * @param locationId {number} - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - deleteLocation(locationId: number): Promise { - return; - } - - /** - * Delete all stored locations. - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - deleteAllLocations(): Promise { - return; - } - - /** - * Normally plugin will handle switching between BACKGROUND and FOREGROUND mode itself. - * Calling switchMode you can override plugin behavior and force plugin to switch into other mode. - * - * In FOREGROUND mode plugin uses iOS local manager to receive locations and behavior is affected by option.desiredAccuracy and option.distanceFilter. - * In BACKGROUND mode plugin uses significant changes and region monitoring to receive locations and uses option.stationaryRadius only. - * - * BackgroundGeolocation.Mode.FOREGROUND - * BackgroundGeolocation.Mode.BACKGROUND - * - * @param modeId {number} - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - switchMode(modeId: number): Promise { - return; - } - - /** - * Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries. - * - * @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information. - * @param fromId - * @param minLevel - * @param limit {number} Limits the number of entries - * @returns {Promise} - */ - @Cordova() - getLogEntries( - limit: number, - fromId: number, - minLevel: BackgroundGeolocationLogLevel - ): Promise { - return; - } - - /** - * Return all logged events. Useful for plugin debugging. Parameter limit limits number of returned entries. - * - * @see https://github.com/mauron85/cordova-plugin-background-geolocation/tree/v2.2.1#debugging for more information. - * @returns {Promise} - */ - @Cordova() - getConfig(): Promise { - return; - } - - /** - * One time location check to get current location of the device. - * {timeout: Maximum time in milliseconds device will wait for location, - * maximumAge: Maximum age in milliseconds of a possible cached location that is acceptable to return; - * enableHighAccuracy: if true and if the device is able to provide a more accurate position, it will do so} - * - * @param {BackgroundGeolocationCurrentPositionConfig} options - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getCurrentLocation(options?: BackgroundGeolocationCurrentPositionConfig): Promise { - return; - } - - /** - * Check status of the service - */ - @Cordova() - checkStatus(): Promise { - return; - } - - /** - * Start background task (iOS only) - * - * To perform any long running operation on iOS - * you need to create background task - * IMPORTANT: task has to be ended by endTask - * - * @returns {Promise} taskKey - */ - @Cordova({ - platforms: ['IOS'], - }) - startTask(): Promise { - return; - } - - /** - * End background task indentified by taskKey (iOS only) - * - * @param taskKey - */ - @Cordova({ - platforms: ['IOS'], - }) - endTask(taskKey: number): Promise { - return; - } - - /** - * A special task that gets executed when the app is terminated, but - * the plugin was configured to continue running in the background - * (option stopOnTerminate: false). - * - * In this scenario the Activity was killed by the system and all registered - * event listeners will not be triggered until the app is relaunched. - * - * @example - * BackgroundGeolocation.headlessTask(function(event) { - * - * if (event.name === 'location' || event.name === 'stationary') { - * var xhr = new XMLHttpRequest(); - * xhr.open('POST', 'http://192.168.81.14:3000/headless'); - * xhr.setRequestHeader('Content-Type', 'application/json'); - * xhr.send(JSON.stringify(event.params)); - * } - * - * return 'Processing event: ' + event.name; // will be logged - * }); - * @param func - */ - @Cordova() - headlessTask(func: any): Promise { - return; - } - - /** - * Force sync of pending locations. - * Option syncThreshold will be ignored and all pending locations will be immediately posted to syncUrl in single batch. - * - * Platform: Android, iOS - */ - @Cordova() - forceSync(): Promise { - return; - } - - /** - * Register event listener. - * - * Triggered when server responded with "285 Updates Not Required" to post/sync request. - * - * @param event - * @param callbackFn - */ - @Cordova({ - observable: true, - }) - on(event: BackgroundGeolocationEvents): Observable { - return; - } - - /** - * Unregister all event listeners for given event. - * - * If parameter event is not provided then all event listeners will be removed. - * - * @param event - */ - @Cordova() - removeAllListeners(event?: BackgroundGeolocationEvents): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/background-mode/index.ts b/src/@awesome-cordova-plugins/plugins/background-mode/index.ts deleted file mode 100644 index 742e1355..00000000 --- a/src/@awesome-cordova-plugins/plugins/background-mode/index.ts +++ /dev/null @@ -1,283 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * Configurations items that can be updated. - */ -export interface BackgroundModeConfiguration { - /** - * Title of the background task - */ - title?: string; - - /** - * Description of background task - */ - text?: string; - - /** - * This will look for `.png` in platforms/android/res/drawable|mipmap - */ - icon?: string; - - /** - * Set the background color of the notification circle - */ - color?: string; - - /** - * By default the app will come to foreground when tapping on the notification. If false, plugin won't come to foreground when tapped. - */ - resume?: boolean; - - /** - * When set to false makes the notifications visible on lock screen (Android 5.0+) - */ - hidden?: boolean; - - /** Big text */ - bigText?: boolean; - - /** - * The text that scrolls itself on statusbar - */ - ticker?: string; - - /** - * if true plugin will not display a notification. Default is false. - */ - silent?: boolean; -} - -/** - * @name Background Mode - * @description - * Cordova plugin to prevent the app from going to sleep while in background. - * Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, visit: https://github.com/katzer/cordova-plugin-background-mode - * @usage - * ```typescript - * import { BackgroundMode } from '@awesome-cordova-plugins/background-mode/ngx'; - * - * constructor(private backgroundMode: BackgroundMode) { } - * - * ... - * - * this.backgroundMode.enable(); - * ``` - * @interfaces - * BackgroundModeConfiguration - */ -@Plugin({ - pluginName: 'BackgroundMode', - plugin: 'cordova-plugin-background-mode', - pluginRef: 'cordova.plugins.backgroundMode', - repo: 'https://github.com/katzer/cordova-plugin-background-mode', - platforms: ['AmazonFire OS', 'Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class BackgroundMode extends AwesomeCordovaNativePlugin { - /** - * Enable the background mode. - * Once called, prevents the app from being paused while in background. - */ - @Cordova({ - sync: true, - }) - enable(): void {} - - /** - * Disable the background mode. - * Once the background mode has been disabled, the app will be paused when in background. - */ - @Cordova({ - sync: true, - }) - disable(): void { - return; - } - - /** - * Enable or disable the background mode. - * - * @param enable {boolean} The status to set for. - * @returns {void} - */ - @Cordova({ - sync: true, - }) - setEnabled(enable: boolean): void {} - - /** - * Fire event with given arguments. - * - * @param event {string} event The event's name. - * @param args {array} The callback's arguments. - * @returns {string} - */ - @Cordova({ - sync: true, - }) - fireEvent(event: string, ...args: any[]): string { - return; - } - - /** - * Checks if background mode is enabled or not. - * - * @returns {boolean} returns a boolean that indicates if the background mode is enabled. - */ - @Cordova({ - sync: true, - }) - isEnabled(): boolean { - return; - } - - /** - * Can be used to get the information if the background mode is active. - * - * @returns {boolean} returns a boolean that indicates if the background mode is active. - */ - @Cordova({ - sync: true, - }) - isActive(): boolean { - return; - } - - /** - * Overwrite the default settings. - * Available only for Android platform. - * - * @param overrides {BackgroundModeConfiguration} Dict of options to be overridden. - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - setDefaults(overrides?: BackgroundModeConfiguration): void {} - - /** - * Modify the displayed information. - * Available only for Android platform. - * - * @param {BackgroundModeConfiguration} [options] Any options you want to update. See table below. - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - configure(options?: BackgroundModeConfiguration): void {} - - /** - * Register callback for given event. - * > Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`. - * - * @param event {string} Event name - * @returns {Observable} - */ - @Cordova({ - observable: true, - clearFunction: 'un', - clearWithArgs: true, - }) - on(event: string): Observable { - return; - } - - /** - * Listen for events that the plugin fires. Available events are `enable`, `disable`, `activate`, `deactivate` and `failure`. - * - * @param event {string} Event name - * @param callback {function} The function to be exec as callback. - * @returns {Observable} - */ - @Cordova() - un(event: string, callback: (...args: any[]) => void): void { - return; - } - - /** - * Android allows to programmatically move from foreground to background. - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - moveToBackground(): void {} - - /** - * Enable GPS-tracking in background (Android). - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - disableWebViewOptimizations(): void {} - - /** - * Android allows to programmatically move from background to foreground. - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - moveToForeground(): void {} - - /** - * Override the back button on Android to go to background instead of closing the app. - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - overrideBackButton(): void {} - - /** - * Exclude the app from the recent task list. Works on Android 5.0+. - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - excludeFromTaskList(): void {} - - /** - * If the screen is off. - * - * @param fn {function} Callback function to invoke with boolean arg. - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - isScreenOff(fn: (arg0: boolean) => void): void {} - - /** - * Turn screen on - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - wakeUp(): void {} - - /** - * Turn screen on and show app even locked - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - unlock(): void {} - - /** - * Disables battery optimazation mode for the app (android only) - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - disableBatteryOptimizations(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/background-upload/index.ts b/src/@awesome-cordova-plugins/plugins/background-upload/index.ts deleted file mode 100644 index 3ca6bba4..00000000 --- a/src/@awesome-cordova-plugins/plugins/background-upload/index.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, CordovaInstance, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -declare const window: any; - -export enum UploadState { - UPLOADED = 'UPLOADED', - FAILED = 'FAILED', - UPLOADING = 'UPLOADING', - INITIALIZED = 'INITIALIZED', -} - -export type UploadStateType = keyof typeof UploadState; - -export interface UploadEvent { - id?: string; // id of the upload - state?: UploadStateType; // state of the upload (either UPLOADING, UPLOADED or FAILED) - statusCode?: number; // response code returned by server after upload is completed - serverResponse?: any; // server response received after upload is completed - error?: any; // error message in case of failure - errorCode?: number; // error code for any exception encountered - progress?: any; // progress for ongoing upload - eventId?: string; // id of the event -} - -export interface FTMPayloadOptions { - id: string; - filePath: string; - fileKey?: string; - serverUrl: string; - notificationTitle?: string; - headers?: { - [name: string]: string; - }; - parameters?: { - [name: string]: string; - }; - [prop: string]: any; -} - -export interface FTMOptions { - callBack: (event: UploadEvent) => any; - config?: { - parallelUploadsLimit?: number; - }; -} - -export class FileTransferManager { - private _objectInstance: any; - - constructor(options: FTMOptions) { - this._objectInstance = window.FileTransferManager.init(options.config, options.callBack); - } - - @CordovaInstance() - startUpload(payload: FTMPayloadOptions): void { - return; - } - - @CordovaInstance() - removeUpload(id: any): Promise { - return; - } - - @CordovaInstance() - acknowledgeEvent(id: string): Promise { - return; - } - - @CordovaInstance() - destroy(): Promise { - return; - } -} - -/** - * @name BackgroundUpload - * @description - * This plugin does something - * @usage - * ```typescript - * import { BackgroundUpload } from '@awesome-cordova-plugins/background-upload/ngx'; - * - * - * constructor(private backgroundUpload: BackgroundUpload) { } - * - * ... - * - * - * this.backgroundUpload.init({}) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'BackgroundUpload', - plugin: '@spoonconsulting/cordova-plugin-background-upload', - pluginRef: 'FileTransferManager', - repo: 'https://github.com/spoonconsulting/cordova-plugin-background-upload', - install: 'ionic cordova plugin add @spoonconsulting/cordova-plugin-background-upload', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class BackgroundUpload extends AwesomeCordovaNativePlugin { - FileTransferManager = FileTransferManager; - - init(options: FTMOptions): FileTransferManager { - return new FileTransferManager(options); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/badge/index.ts b/src/@awesome-cordova-plugins/plugins/badge/index.ts deleted file mode 100644 index d40253a0..00000000 --- a/src/@awesome-cordova-plugins/plugins/badge/index.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Badge - * @premier badge - * @description - * The essential purpose of badge numbers is to enable an application to inform its users that it has something for them — for example, unread messages — when the application isn’t running in the foreground. - * - * Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge). - * - * Android Note: Badges have historically only been a feature implemented by third party launchers and not visible unless one of those launchers was being used (E.G. Samsung or Nova Launcher) and if enabled by the user. As of Android 8 (Oreo), [notification badges](https://developer.android.com/training/notify-user/badges) were introduced officially to reflect unread notifications. This plugin is unlikely to work as expected on devices running Android 8 or newer. Please see the [local notifications plugin docs](https://github.com/katzer/cordova-plugin-local-notifications) for more information on badge use with notifications. - * @usage - * ```typescript - * import { Badge } from '@awesome-cordova-plugins/badge/ngx'; - * - * constructor(private badge: Badge) { } - * - * ... - * - * this.badge.set(10); - * this.badge.increase(1); - * this.badge.clear(); - * ``` - */ -@Plugin({ - pluginName: 'Badge', - plugin: 'cordova-plugin-badge', - pluginRef: 'cordova.plugins.notification.badge', - repo: 'https://github.com/katzer/cordova-plugin-badge', - platforms: ['Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class Badge extends AwesomeCordovaNativePlugin { - /** - * Clear the badge of the app icon. - * - * @returns {Promise} - */ - @Cordova() - clear(): Promise { - return; - } - - /** - * Set the badge of the app icon. - * - * @param {number} badgeNumber The new badge number. - * @returns {Promise} - */ - @Cordova() - set(badgeNumber: number): Promise { - return; - } - - /** - * Get the badge of the app icon. - * - * @returns {Promise} - */ - @Cordova() - get(): Promise { - return; - } - - /** - * Increase the badge number. - * - * @param {number} increaseBy Count to add to the current badge number - * @returns {Promise} - */ - @Cordova() - increase(increaseBy: number): Promise { - return; - } - - /** - * Decrease the badge number. - * - * @param {number} decreaseBy Count to subtract from the current badge number - * @returns {Promise} - */ - @Cordova() - decrease(decreaseBy: number): Promise { - return; - } - - /** - * Check support to show badges. - * - * @returns {Promise} - */ - @Cordova() - isSupported(): Promise { - return; - } - - /** - * Determine if the app has permission to show badges. - * - * @returns {Promise} - */ - @Cordova() - hasPermission(): Promise { - return; - } - - /** - * Register permission to set badge notifications - * - * @returns {Promise} - */ - @Cordova() - requestPermission(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/barcode-scanner/index.ts b/src/@awesome-cordova-plugins/plugins/barcode-scanner/index.ts deleted file mode 100644 index 567653a6..00000000 --- a/src/@awesome-cordova-plugins/plugins/barcode-scanner/index.ts +++ /dev/null @@ -1,154 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface BarcodeScannerOptions { - /** - * Prefer front camera. Supported on iOS and Android. - */ - preferFrontCamera?: boolean; - - /** - * Show flip camera button. Supported on iOS and Android. - */ - showFlipCameraButton?: boolean; - - /** - * Show torch button. Supported on iOS and Android. - */ - showTorchButton?: boolean; - - /** - * Disable animations. Supported on iOS only. - */ - disableAnimations?: boolean; - - /** - * Disable success beep. Supported on iOS only. - */ - disableSuccessBeep?: boolean; - - /** - * Prompt text. Supported on Android only. - */ - prompt?: string; - - /** - * Formats separated by commas. Defaults to all formats except `PDF_417` and `RSS_EXPANDED`. - */ - formats?: string; - - /** - * Orientation. Supported on Android only. Can be set to `portrait` or `landscape`. Defaults to none so the user can rotate the phone and pick an orientation. - */ - orientation?: string; - - /** - * Launch with the torch switched on (if available). Supported on Android only. - */ - torchOn?: boolean; - - /** - * Save scan history. Defaults to `false`. Supported on Android only. - */ - saveHistory?: boolean; - - /** - * Display scanned text for X ms. 0 suppresses it entirely, default 1500. Supported on Android only. - */ - resultDisplayDuration?: number; -} - -export interface BarcodeScanResult { - format: - | 'QR_CODE' - | 'DATA_MATRIX' - | 'UPC_E' - | 'UPC_A' - | 'EAN_8' - | 'EAN_13' - | 'CODE_128' - | 'CODE_39' - | 'CODE_93' - | 'CODABAR' - | 'ITF' - | 'RSS14' - | 'RSS_EXPANDED' - | 'PDF_417' - | 'AZTEC' - | 'MSI'; - cancelled: boolean; - text: string; -} - -/** - * @name Barcode Scanner - * @description - * The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you. - * - * Requires Cordova plugin: `phonegap-plugin-barcodescanner`. For more info, please see the [BarcodeScanner plugin docs](https://github.com/phonegap/phonegap-plugin-barcodescanner). - * @usage - * ```typescript - * import { BarcodeScanner } from '@awesome-cordova-plugins/barcode-scanner/ngx'; - * - * constructor(private barcodeScanner: BarcodeScanner) { } - * - * ... - * - * - * this.barcodeScanner.scan().then(barcodeData => { - * console.log('Barcode data', barcodeData); - * }).catch(err => { - * console.log('Error', err); - * }); - * ``` - * @interfaces - * BarcodeScannerOptions - * BarcodeScanResult - */ -@Plugin({ - pluginName: 'BarcodeScanner', - plugin: 'phonegap-plugin-barcodescanner', - pluginRef: 'cordova.plugins.barcodeScanner', - repo: 'https://github.com/phonegap/phonegap-plugin-barcodescanner', - platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class BarcodeScanner extends AwesomeCordovaNativePlugin { - Encode: { - TEXT_TYPE: string; - EMAIL_TYPE: string; - PHONE_TYPE: string; - SMS_TYPE: string; - } = { - TEXT_TYPE: 'TEXT_TYPE', - EMAIL_TYPE: 'EMAIL_TYPE', - PHONE_TYPE: 'PHONE_TYPE', - SMS_TYPE: 'SMS_TYPE', - }; - - /** - * Open the barcode scanner. - * - * @param {BarcodeScannerOptions} [options] Optional options to pass to the scanner - * @returns {Promise} Returns a Promise that resolves with scanner data, or rejects with an error. - */ - @Cordova({ - callbackOrder: 'reverse', - }) - scan(options?: BarcodeScannerOptions): Promise { - return; - } - - /** - * Encodes data into a barcode. - * NOTE: not well supported on Android - * - * @param {string} type Type of encoding - * @param {any} data Data to encode - * @returns {Promise} - */ - @Cordova() - encode(type: string, data: any): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/battery-status/index.ts b/src/@awesome-cordova-plugins/plugins/battery-status/index.ts deleted file mode 100644 index 5fad2840..00000000 --- a/src/@awesome-cordova-plugins/plugins/battery-status/index.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface BatteryStatusResponse { - /** - * The battery charge percentage - */ - level: number; - - /** - * A boolean that indicates whether the device is plugged in - */ - isPlugged: boolean; -} - -/** - * @name Battery Status - * @description - * Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status). - * @usage - * ```typescript - * import { BatteryStatus } from '@awesome-cordova-plugins/battery-status/ngx'; - * - * constructor(private batteryStatus: BatteryStatus) { } - * - * ... - * - * - * // watch change in battery status - * const subscription = this.batteryStatus.onChange().subscribe(status => { - * console.log(status.level, status.isPlugged); - * }); - * - * // stop watch - * subscription.unsubscribe(); - * - * ``` - * @interfaces - * BatteryStatusResponse - */ -@Plugin({ - pluginName: 'BatteryStatus', - plugin: 'cordova-plugin-battery-status', - pluginRef: 'navigator.battery', - repo: 'https://github.com/apache/cordova-plugin-battery-status', - platforms: ['iOS', 'Android', 'Windows', 'Browser'], -}) -@Injectable() -export class BatteryStatus extends AwesomeCordovaNativePlugin { - /** - * Watch the change in battery level - * - * @returns {Observable} Returns an observable that pushes a status object - */ - @Cordova({ - eventObservable: true, - event: 'batterystatus', - }) - onChange(): Observable { - return; - } - - /** - * Watch when the battery level goes low - * - * @returns {Observable} Returns an observable that pushes a status object - */ - @Cordova({ - eventObservable: true, - event: 'batterylow', - }) - onLow(): Observable { - return; - } - - /** - * Watch when the battery level goes to critical - * - * @returns {Observable} Returns an observable that pushes a status object - */ - @Cordova({ - eventObservable: true, - event: 'batterycritical', - }) - onCritical(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/biocatch/index.ts b/src/@awesome-cordova-plugins/plugins/biocatch/index.ts deleted file mode 100644 index 42952a14..00000000 --- a/src/@awesome-cordova-plugins/plugins/biocatch/index.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name BioCatch - * @description - * BioCatch SDK Cordova support - * @usage - * ```typescript - * import { BioCatch } from '@awesome-cordova-plugins/biocatch'; - * - * - * constructor(private biocatch: BioCatch) { } - * - * ... - * - * - * this.biocatch.start('customer-session-1', 'http://example.com', 'some-public-key') - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'BioCatch', - plugin: 'cordova-plugin-biocatch', - pluginRef: 'BioCatch', - repo: 'https://bitbucket.org/carlos_orellana/ionic-plugin', - platforms: ['iOS', 'Android'], -}) -@Injectable() -export class BioCatch extends AwesomeCordovaNativePlugin { - /** - * Start a session - * - * @param customerSessionID {String} Customer session id - * @param wupUrl {String} WUP server URL - * @param publicKey {String} Public Key - * @returns {Promise} Returns a promise - */ - @Cordova() - start(customerSessionID: string | null, wupUrl: string, publicKey: string | null): Promise { - return; - } - - /** - * Pause the session - * - * @returns {Promise} Returns a promise - */ - @Cordova() - pause(): Promise { - return; - } - - /** - * Resume the session - * - * @returns {Promise} Returns a promise - */ - @Cordova() - resume(): Promise { - return; - } - - /** - * Stop the session - * - * @returns {Promise} Returns a promise - */ - @Cordova() - stop(): Promise { - return; - } - - /** - * Reset the session - * - * @returns {Promise} Returns a promise - */ - @Cordova() - resetSession(): Promise { - return; - } - - /** - * Change the session context - * - * @param contextName {String} Context name - * @returns {Promise} Returns a promise - */ - @Cordova() - changeContext(contextName: string): Promise { - return; - } - - /** - * Update the customer session ID - * - * @param customerSessionID {String} - * @returns {Promise} Returns a promise - */ - @Cordova() - updateCustomerSessionID(customerSessionID: string | null): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/biometric-wrapper/index.ts b/src/@awesome-cordova-plugins/plugins/biometric-wrapper/index.ts deleted file mode 100644 index bd6c7b0d..00000000 --- a/src/@awesome-cordova-plugins/plugins/biometric-wrapper/index.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name BiometricWrapper - * @description - * This plugin capture biometric(Iris and Fingerprint) and validate the user. - * May be used in Banking domain - * @usage - * ```typescript - * import { BiometricWrapper } from '@awesome-cordova-plugins/biometric-wrapper/ngx'; - * - * - * constructor(private biometricWrapper: BiometricWrapper) { } - * - * ... - * - * - * this.biometricWrapper.activateIris({'PID_XML': ''}) - * .then((res: any) => ) - * .catch((error: any) => ); - * - * ``` - */ - -@Plugin({ - pluginName: 'BiometricWrapper', - plugin: 'cordova-plugin-biometric', - pluginRef: 'cordova.plugins.BiometricWrapper', - repo: '', - install: '', - installVariables: [], - platforms: ['Android'], -}) -@Injectable() -export class BiometricWrapper extends AwesomeCordovaNativePlugin { - /** - * This function activate iris activity - * - * @param args - * @returns {Promise} Returns a promise that resolves when iris data captured - */ - @Cordova() - activateIris(args: any): Promise { - return; - } - - /** - * This function activate fingerprint activity - * - * @param args - * @returns {Promise} Returns a promise that resolves when FP data captured - */ - @Cordova() - activateFingerprint(args: any): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/ble/index.ts b/src/@awesome-cordova-plugins/plugins/ble/index.ts deleted file mode 100644 index 6ec27e78..00000000 --- a/src/@awesome-cordova-plugins/plugins/ble/index.ts +++ /dev/null @@ -1,675 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface BLEScanOptions { - /** true if duplicate devices should be reported, false (default) if devices should only be reported once. */ - reportDuplicates?: boolean; -} - -/** - * @name BLE - * @description - * This plugin enables communication between a phone and Bluetooth Low Energy (BLE) peripherals. - * - * The plugin provides a simple JavaScript API for iOS and Android. - * - * - Scan for peripherals - * - Connect to a peripheral - * - Read the value of a characteristic - * - Write new value to a characteristic - * - Get notified when characteristic's value changes - * - * Advertising information is returned when scanning for peripherals. Service, characteristic, and property info is returned when connecting to a peripheral. All access is via service and characteristic UUIDs. The plugin manages handles internally. - * - * Simultaneous connections to multiple peripherals are supported. - * @usage - * - * ```typescript - * - * import { BLE } from '@awesome-cordova-plugins/ble/ngx'; - * - * constructor(private ble: BLE) { } - * - * ``` - * - * ## Peripheral Data - * - * Peripheral Data is passed to the success callback when scanning and connecting. Limited data is passed when scanning. - * - * ```typescript - * { - * 'name': 'Battery Demo', - * 'id': '20:FF:D0:FF:D1:C0', - * 'advertising': [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121], - * 'rssi': -55 - * } - * ``` - * After connecting, the peripheral object also includes service, characteristic and descriptor information. - * - * ```typescript - * { - * 'name': 'Battery Demo', - * 'id': '20:FF:D0:FF:D1:C0', - * 'advertising': [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121], - * 'rssi': -55, - * 'services': [ - * '1800', - * '1801', - * '180f' - * ], - * 'characteristics': [ - * { - * 'service': '1800', - * 'characteristic': '2a00', - * 'properties': [ - * 'Read' - * ] - * }, - * { - * 'service': '1800', - * 'characteristic': '2a01', - * 'properties': [ - * 'Read' - * ] - * }, - * { - * 'service': '1801', - * 'characteristic': '2a05', - * 'properties': [ - * 'Read' - * ] - * }, - * { - * 'service': '180f', - * 'characteristic': '2a19', - * 'properties': [ - * 'Read' - * ], - * 'descriptors': [ - * { - * 'uuid': '2901' - * }, - * { - * 'uuid': '2904' - * } - * ] - * } - * ] - * } - * ``` - * - * ## Advertising Data - * Bluetooth advertising data is returned in when scanning for devices. The format varies depending on your platform. On Android advertising data will be the raw advertising bytes. iOS does not allow access to raw advertising data, so a dictionary of data is returned. - * - * The advertising information for both Android and iOS appears to be a combination of advertising data and scan response data. - * - * ### Android - * - * ```typescript - * { - * 'name': 'demo', - * 'id': '00:1A:7D:DA:71:13', - * 'advertising': ArrayBuffer, - * 'rssi': -37 - * } - * ``` - * - * Convert the advertising info to a Uint8Array for processing. `var adData = new Uint8Array(peripheral.advertising)` - * - * ### iOS - * - * Note that iOS uses the string value of the constants for the [Advertisement Data Retrieval Keys](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentralManagerDelegate_Protocol/index.html#//apple_ref/doc/constant_group/Advertisement_Data_Retrieval_Keys). This will likely change in the future. - * - * ```typescript - * { - * 'name': 'demo', - * 'id': 'D8479A4F-7517-BCD3-91B5-3302B2F81802', - * 'advertising': { - * 'kCBAdvDataChannel': 37, - * 'kCBAdvDataServiceData': { - * 'FED8': { - * 'byteLength': 7 // data not shown - * } - * }, - * 'kCBAdvDataLocalName': 'demo', - * 'kCBAdvDataServiceUUIDs': ['FED8'], - * 'kCBAdvDataManufacturerData': { - * 'byteLength': 7 // data not shown - * }, - * 'kCBAdvDataTxPowerLevel': 32, - * 'kCBAdvDataIsConnectable': true - * }, - * 'rssi': -53 - * } - * ``` - * - * ## Typed Arrays - * - * This plugin uses typed Arrays or ArrayBuffers for sending and receiving data. - * - * This means that you need convert your data to ArrayBuffers before sending and from ArrayBuffers when receiving. - * - * ```typescript - * // ASCII only - * function stringToBytes(string) { - * var array = new Uint8Array(string.length); - * for (var i = 0, l = string.length; i < l; i++) { - * array[i] = string.charCodeAt(i); - * } - * return array.buffer; - * } - * - * // ASCII only - * function bytesToString(buffer) { - * return String.fromCharCode.apply(null, new Uint8Array(buffer)); - * } - * ``` - * You can read more about typed arrays in these articles on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays) and [HTML5 Rocks](http://www.html5rocks.com/en/tutorials/webgl/typed_arrays/). - * - * ## UUIDs - * - * UUIDs are always strings and not numbers. Some 16-bit UUIDs, such as '2220' look like integers, but they're not. (The integer 2220 is 0x8AC in hex.) This isn't a problem with 128 bit UUIDs since they look like strings 82b9e6e1-593a-456f-be9b-9215160ebcac. All 16-bit UUIDs should also be passed to methods as strings. - * @interfaces - * BLEScanOptions - */ -@Plugin({ - pluginName: 'BLE', - plugin: 'cordova-plugin-ble-central', - pluginRef: 'ble', - repo: 'https://github.com/don/cordova-plugin-ble-central', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class BLE extends AwesomeCordovaNativePlugin { - /** - * Scan and discover BLE peripherals for the specified amount of time. - * - * @usage - * ``` - * BLE.scan([], 5).subscribe(device => { - * console.log(JSON.stringify(device)); - * }); - * ``` - * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices - * @param {number} seconds Number of seconds to run discovery - * @returns {Observable} Returns an Observable that notifies of each peripheral that is discovered during the specified time. - */ - @Cordova({ - observable: true, - }) - scan(services: string[], seconds: number): Observable { - return; - } - - /** - * Scan and discover BLE peripherals until `stopScan` is called. - * - * @usage - * ``` - * BLE.startScan([]).subscribe(device => { - * console.log(JSON.stringify(device)); - * }); - * - * setTimeout(() => { - * BLE.stopScan(); - * }, 5000); - * ``` - * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices - * @returns {Observable} Returns an Observable that notifies of each peripheral discovered. - */ - @Cordova({ - observable: true, - clearFunction: 'stopScan', - clearWithArgs: false, - }) - startScan(services: string[]): Observable { - return; - } - - /** - * Scans for BLE devices. This function operates similarly to the `startScan` function, but allows you to specify extra options (like allowing duplicate device reports). - * - * @param {string[]} services List of service UUIDs to discover, or `[]` to find all devices - * @param {BLEScanOptions} options Options - * @returns {Observable} Returns an Observable that notifies of each peripheral discovered. - */ - @Cordova({ - observable: true, - clearFunction: 'stopScan', - clearWithArgs: false, - }) - startScanWithOptions(services: string[], options: BLEScanOptions): Observable { - return; - } - - /** - * Stop a scan started by `startScan`. - * - * @usage - * ``` - * BLE.startScan([]).subscribe(device => { - * console.log(JSON.stringify(device)); - * }); - * setTimeout(() => { - * BLE.stopScan().then(() => { console.log('scan stopped'); }); - * }, 5000); - * ``` - * @returns {Promise} - */ - @Cordova() - stopScan(): Promise { - return; - } - - /** - * Set device pin. - * - * @usage - * ``` - * BLE.setPin(pin).subscribe(success => { - * console.log(success); - * }, - * failure => { - * console.log('failure'); - * }); - * ``` - * @param {string} pin Pin of the device as a string - * @returns {Observable} Returns an Observable that notifies of success/failure. - */ - @Cordova({ - observable: true, - }) - setPin(pin: string): Observable { - return; - } - - /** - * Connect to a peripheral. - * - * @usage - * ``` - * BLE.connect('12:34:56:78:9A:BC').subscribe(peripheralData => { - * console.log(peripheralData); - * }, - * peripheralData => { - * console.log('disconnected'); - * }); - * ``` - * @param {string} deviceId UUID or MAC address of the peripheral - * @returns {Observable} Returns an Observable that notifies of connect/disconnect. - */ - @Cordova({ - observable: true, - clearFunction: 'disconnect', - clearWithArgs: true, - }) - connect(deviceId: string): Observable { - return; - } - - /** - * Establish an automatic connection to a peripheral. The phone will automatically connect to the Bluetooth peripheral - * whenever it is in range. The autoConnect function uses callbacks instead of observables because connect and - * disconnect can each be called many times as a devices connects and disconnects. - * - * On Android you can pass a MAC address directly to autoConnect. With iOS, you need to get a device id by scanning, - * calling ble.peripheralsWithIdentifiers, or calling ble.connectedPeripheralsWithServices. - * - * @usage - * ``` - * someFunction() { - * this.ble.autoConnect(deviceId, onConnected.bind(this), onDisconnected.bind(this)); - * } - * - * onConnected(peripheral) { - * console.log(`Connected to ${peripheral.id}`)l - * } - * - * onDisconnected(peripheral) { - * console.log(`Disconnected from ${peripheral.id}`)l - * } - * - * ``` - * @param {string} deviceId UUID or MAC address of the peripheral - * @param {Function} connectCallback function that is called with peripheral data when the devices connects - * @param {Function} disconnectCallback function that is called with peripheral data when the devices disconnects - */ - @Cordova({ sync: true }) - autoConnect(deviceId: string, connectCallback: any, disconnectCallback: any) { - return; - } - - /** - * Request MTU size. - * May be used to fix the Error 14 "Unlikely" on write requests with more than 20 bytes. - * - * @usage - * ``` - * BLE.requestMtu('12:34:56:78:9A:BC', 512).then(() => { - * console.log('MTU Size Accepted'); - * }, error => { - * console.log('MTU Size Failed'); - * }); - * ``` - * @param {string} deviceId UUID or MAC address of the peripheral - * @param {number} mtuSize The new MTU size. (23 - 517, default is usually 23. Max recommended: 512) - * @returns {Promise} Returns a Promise. - */ - @Cordova() - requestMtu(deviceId: string, mtuSize: number): Promise { - return; - } - - /** - * Refresh Device Cache - * This method may fix a issue of old cached services and characteristics. - * NOTE Since this uses an undocumented API it's not guaranteed to work. - * If you choose a too low delay time (timeoutMillis) the method could fail. - * - * @usage - * ``` - * BLE.refreshDeviceCache('12:34:56:78:9A:BC', 10000).then(discoveredServices => { - * console.log('The new discovered services after the clean: ', discoveredServices); - * }, error => { - * console.log('Refresh device cache failed.'); - * }); - * ``` - * @param {string} deviceId UUID or MAC address of the peripheral - * @param {number} timeoutMillis Delay in milliseconds after refresh before discovering services. - * @returns {Promise} Returns a Promise. - */ - @Cordova() - refreshDeviceCache(deviceId: string, timeoutMillis: number): Promise { - return; - } - - /** - * Disconnect from a peripheral. - * - * @usage - * ``` - * BLE.disconnect('12:34:56:78:9A:BC').then(() => { - * console.log('Disconnected'); - * }); - * ``` - * @param {string} deviceId UUID or MAC address of the peripheral - * @returns {Promise} Returns a Promise - */ - @Cordova() - disconnect(deviceId: string): Promise { - return; - } - - /** - * Read the value of a characteristic. - * - * @param {string} deviceId UUID or MAC address of the peripheral - * @param {string} serviceUUID UUID of the BLE service - * @param {string} characteristicUUID UUID of the BLE characteristic - * @returns {Promise} Returns a Promise - */ - @Cordova() - read(deviceId: string, serviceUUID: string, characteristicUUID: string): Promise { - return; - } - - /** - * Write the value of a characteristic. - * - * @usage - * ``` - * // send 1 byte to switch a light on - * var data = new Uint8Array(1); - * data[0] = 1; - * BLE.write(device_id, 'FF10', 'FF11', data.buffer); - * - * // send a 3 byte value with RGB color - * var data = new Uint8Array(3); - * data[0] = 0xFF; // red - * data[0] = 0x00; // green - * data[0] = 0xFF; // blue - * BLE.write(device_id, 'ccc0', 'ccc1', data.buffer); - * - * // send a 32 bit integer - * var data = new Uint32Array(1); - * data[0] = counterInput.value; - * BLE.write(device_id, SERVICE, CHARACTERISTIC, data.buffer); - * - * ``` - * @param {string} deviceId UUID or MAC address of the peripheral - * @param {string} serviceUUID UUID of the BLE service - * @param {string} characteristicUUID UUID of the BLE characteristic - * @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer. - * @returns {Promise} Returns a Promise - */ - @Cordova() - write(deviceId: string, serviceUUID: string, characteristicUUID: string, value: ArrayBuffer): Promise { - return; - } - - /** - * Write the value of a characteristic without waiting for confirmation from the peripheral. - * - * @param {string} deviceId UUID or MAC address of the peripheral - * @param {string} serviceUUID UUID of the BLE service - * @param {string} characteristicUUID UUID of the BLE characteristic - * @param {ArrayBuffer} value Data to write to the characteristic, as an ArrayBuffer. - * @returns {Promise} Returns a Promise - */ - @Cordova() - writeWithoutResponse( - deviceId: string, - serviceUUID: string, - characteristicUUID: string, - value: ArrayBuffer - ): Promise { - return; - } - - /** - * Register to be notified when the value of a characteristic changes. - * - * @usage - * ``` - * BLE.startNotification(device_id, 'FF10', 'FF11').subscribe(buffer => { - * console.log(String.fromCharCode.apply(null, new Uint8Array(buffer)); - * }); - * ``` - * @param {string} deviceId UUID or MAC address of the peripheral - * @param {string} serviceUUID UUID of the BLE service - * @param {string} characteristicUUID UUID of the BLE characteristic - * @returns {Observable} Returns an Observable that notifies of characteristic changes. - * The observer emit an array with data at index 0 and sequence order at index 1. - * The sequence order is always undefined on iOS. On android it leave the client to check the sequence order and reorder if needed - */ - @Cordova({ - observable: true, - destruct: true, - clearFunction: 'stopNotification', - clearWithArgs: true, - }) - startNotification(deviceId: string, serviceUUID: string, characteristicUUID: string): Observable { - return; - } - - /** - * Stop being notified when the value of a characteristic changes. - * - * @param {string} deviceId UUID or MAC address of the peripheral - * @param {string} serviceUUID UUID of the BLE service - * @param {string} characteristicUUID UUID of the BLE characteristic - * @returns {Promise} - */ - @Cordova() - stopNotification(deviceId: string, serviceUUID: string, characteristicUUID: string): Promise { - return; - } - - /** - * Report the connection status. - * - * @usage - * ``` - * BLE.isConnected('FFCA0B09-CB1D-4DC0-A1EF-31AFD3EDFB53').then( - * () => { console.log('connected'); }, - * () => { console.log('not connected'); } - * ); - * ``` - * @param {string} deviceId UUID or MAC address of the peripheral - * @returns {Promise} - */ - @Cordova() - isConnected(deviceId: string): Promise { - return; - } - - /** - * Report if bluetooth is enabled. - * - * @returns {Promise} Returns a Promise that resolves if Bluetooth is enabled, and rejects if disabled. - */ - @Cordova() - isEnabled(): Promise { - return; - } - - /** - * Register to be notified when Bluetooth state changes on the device. - * - * @usage - * ``` - * BLE.startStateNotifications().subscribe(state => { - * console.log("Bluetooth is " + state); - * }); - * ``` - * @returns {Observable} Returns an Observable that notifies when the Bluetooth is enabled or disabled on the device. - */ - @Cordova({ - observable: true, - clearFunction: 'stopStateNotifications', - clearWithArgs: false, - }) - startStateNotifications(): Observable { - return; - } - - /** - * Stop state notifications. - * - * @returns {Promise} - */ - @Cordova() - stopStateNotifications(): Promise { - return; - } - - /** - * Registers to be notified when Location service state changes on the device. - * - * @usage - * ``` - * ble.startLocationStateNotifications(success, failure); - * // Or using await with promises - * // Note, initial promise resolves or rejects depending on whether the subscribe was successful - * await ble.withPromises.startLocationStateNotifications(success, failure) - * ``` - * @returns {Observable} Returns an Observable that notifies when Location is enabled or disabled on the device. - */ - @Cordova({ - observable: true, - clearFunction: 'stopLocationStateNotifications', - clearWithArgs: false, - }) - startLocationStateNotifications(): Observable { - return; - } - - /** - * Stop location state notifications. - * - * @returns {Promise} - */ - @Cordova() - stopLocationStateNotifications(): Promise { - return; - } - - /** - * Open System Bluetooth settings (Android only). - * - * @returns {Promise} - */ - @Cordova() - showBluetoothSettings(): Promise { - return; - } - - /** - * Enable Bluetooth on the device (Android only). - * - * @returns {Promise} - */ - @Cordova() - enable(): Promise { - return; - } - - /** - * Read the RSSI value on the device connection. - * - * @param {string} deviceId UUID or MAC address of the peripheral - * @returns {Promise} - */ - @Cordova() - readRSSI(deviceId: string): Promise { - return; - } - - /** - * Retrieves a list of the peripherals (containing any of the specified services) - * currently connected to the system. The peripheral list is sent to the success callback. - * iOS only - * - * @param {string[]} services List of services to discover - * @returns {Promise} Returns a promise with a list of peripheral objects - */ - @Cordova() - connectedPeripheralsWithServices(services: string[]): Promise { - return; - } - - /** - * Find the connected peripherals offering the listed service UUIDs. - * iOS only - * - * @param {string[]} uuids List of peripheral UUIDs - * @returns {Promise} Returns a promise with a list of peripheral objects - */ - @Cordova() - peripheralsWithIdentifiers(uuids: string[]): Promise { - return; - } - - /** - * Find the bonded devices - * Android only - * - * @returns {Promise} Returns a promise with a list of peripheral objects - */ - @Cordova() - bondedDevices(): Promise { - return; - } - - /** - * Reports if location services are enabled. - * Android only - * - * @returns {Promise} - */ - @Cordova() - isLocationEnabled(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/blinkid/index.ts b/src/@awesome-cordova-plugins/plugins/blinkid/index.ts deleted file mode 100644 index 70a96871..00000000 --- a/src/@awesome-cordova-plugins/plugins/blinkid/index.ts +++ /dev/null @@ -1,2949 +0,0 @@ -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -export interface Licenses { - ios: string; - android: string; -} - -export enum BarcodeType { - None = 1, - QRCode = 2, - DataMatrix = 3, - UPCE = 4, - UPCA = 5, - EAN8 = 6, - EAN13 = 7, - Code128 = 8, - Code39 = 9, - ITF = 10, - Aztec = 11, - PDF417 = 12, -} - -export enum RecognizerResultState { - empty = 1, - uncertain = 2, - valid = 3, -} - -export enum MrtdDocumentType { - Unknown = 1, - IdentityCard = 2, - Passport = 3, - Visa = 4, - GreenCard = 5, - MalaysianPassIMM13P = 6, -} - -export enum EudlCountry { - UK = 1, - Germany = 2, - Austria = 3, - Automatic = 4, -} - -export enum DocumentFaceDetectorType { - TD1 = 1, - TD2 = 2, - PassportsAndVisas = 3, -} - -export enum UsdlKeys { - DocumentType = 0, - StandardVersionNumber = 1, - CustomerFamilyName = 2, - CustomerFirstName = 3, - CustomerFullName = 4, - DateOfBirth = 5, - Sex = 6, - EyeColor = 7, - AddressStreet = 8, - AddressCity = 9, - AddressJurisdictionCode = 10, - AddressPostalCode = 11, - FullAddress = 12, - Height = 13, - HeightIn = 14, - HeightCm = 15, - CustomerMiddleName = 16, - HairColor = 17, - NameSuffix = 18, - AKAFullName = 19, - AKAFamilyName = 20, - AKAGivenName = 21, - AKASuffixName = 22, - WeightRange = 23, - WeightPounds = 24, - WeightKilograms = 25, - CustomerIdNumber = 26, - FamilyNameTruncation = 27, - FirstNameTruncation = 28, - MiddleNameTruncation = 29, - PlaceOfBirth = 30, - AddressStreet2 = 31, - RaceEthnicity = 32, - NamePrefix = 33, - CountryIdentification = 34, - ResidenceStreetAddress = 35, - ResidenceStreetAddress2 = 36, - ResidenceCity = 37, - ResidenceJurisdictionCode = 38, - ResidencePostalCode = 39, - ResidenceFullAddress = 40, - Under18 = 41, - Under19 = 42, - Under21 = 43, - SocialSecurityNumber = 44, - AKASocialSecurityNumber = 45, - AKAMiddleName = 46, - AKAPrefixName = 47, - OrganDonor = 48, - Veteran = 49, - AKADateOfBirth = 50, - IssuerIdentificationNumber = 51, - DocumentExpirationDate = 52, - JurisdictionVersionNumber = 53, - JurisdictionVehicleClass = 54, - JurisdictionRestrictionCodes = 55, - JurisdictionEndorsementCodes = 56, - DocumentIssueDate = 57, - FederalCommercialVehicleCodes = 58, - IssuingJurisdiction = 59, - StandardVehicleClassification = 60, - IssuingJurisdictionName = 61, - StandardEndorsementCode = 62, - StandardRestrictionCode = 63, - JurisdictionVehicleClassificationDescription = 64, - JurisdictionEndorsmentCodeDescription = 65, - JurisdictionRestrictionCodeDescription = 66, - InventoryControlNumber = 67, - CardRevisionDate = 68, - DocumentDiscriminator = 69, - LimitedDurationDocument = 70, - AuditInformation = 71, - ComplianceType = 72, - IssueTimestamp = 73, - PermitExpirationDate = 74, - PermitIdentifier = 75, - PermitIssueDate = 76, - NumberOfDuplicates = 77, - HAZMATExpirationDate = 78, - MedicalIndicator = 79, - NonResident = 80, - UniqueCustomerId = 81, - DataDiscriminator = 82, - DocumentExpirationMonth = 83, - DocumentNonexpiring = 84, - SecurityVersion = 85, -} - -export interface ImageExtensionFactors { - upFactor: number; - rightFactor: number; - downFactor: number; - leftFactor: number; -} - -export interface Date { - day: string; - month: string; - year: string; -} -export interface DateCtor { - new (nativeDate: Date): Date; -} - -export interface Point { - x: string; - y: string; -} -export interface PointCtor { - new (nativePoint: Point): Point; -} - -export interface Quadrilateral { - upperLeft: string; - upperRight: string; - lowerLeft: string; - lowerRight: string; -} -export interface QuadrilateralCtor { - new (nativeQuad: Quadrilateral): Quadrilateral; -} - -export interface OverlaySettings { - overlaySettingsType: string; -} - -export type BarcodeOverlaySettings = OverlaySettings; -export interface BarcodeOverlaySettingsCtor { - new (): BarcodeOverlaySettings; -} - -export type DocumentOverlaySettings = OverlaySettings; -export interface DocumentOverlaySettingsCtor { - new (): DocumentOverlaySettings; -} - -export interface DocumentVerificationOverlaySettings extends OverlaySettings { - firstSideSplashMessage: string; - secondSideSplashMessage: string; - scanningDoneSplashMessage: string; - firstSideInstructions: string; - secondSideInstructions: string; - glareMessage: string; -} -export interface DocumentVerificationOverlaySettingsCtor { - new (): DocumentVerificationOverlaySettings; -} - -export interface BlinkCardOverlaySettings extends OverlaySettings { - glareMessage: string; -} -export interface BlinkCardOverlaySettingsCtor { - new (): BlinkCardOverlaySettings; -} - -export interface RecognizerResult { - resultState: RecognizerResultState; -} - -export interface RecognizerResultCtor { - new (nativeResult: any): T; -} - -export interface Recognizer { - recognizerType: string; - result: T; - createResultFromNative(nativeResult: any): T; -} - -export interface RecognizerCtor { - new (): T; -} - -export interface RecognizerCollection { - recognizerArray: Recognizer[]; - allowMultipleResults: boolean; - // sic - milisecondsBeforeTimeout: number; -} -export interface RecognizerCollectionCtor { - new (recognizerCollection: Recognizer[]): RecognizerCollection; -} - -export interface BarcodeRecognizerResult extends RecognizerResult { - barcodeType: BarcodeType; - rawData: string; - stringData: string; - uncertain: boolean; -} -export type BarcodeRecognizerResultCtor = RecognizerResultCtor; - -export interface BarcodeRecognizer extends Recognizer { - autoScaleDetection: boolean; - nullQuietZoneAllowed: boolean; - readCode39AsExtendedData: boolean; - scanAztecCode: boolean; - scanCode128: boolean; - scanCode39: boolean; - scanDataMatrix: boolean; - scanEan13: boolean; - scanEan8: boolean; - scanInverse: boolean; - scanItf: boolean; - scanPdf417: boolean; - scanQrCode: boolean; - scanUncertain: boolean; - scanUpca: boolean; - scanUpce: boolean; - slowerThoroughScan: boolean; -} -export type BarcodeRecognizerCtor = RecognizerCtor; - -export interface MrzResult { - documentType: string; - primaryId: string; - secondaryId: string; - issuer: string; - dateOfBirth: Date; - documentNumber: string; - nationality: string; - gender: string; - documentCode: string; - dateOfExpiry: Date; - opt1: string; - opt2: string; - alienNumber: string; - applicationReceiptNumber: string; - immigrantCaseNumber: string; - mrzText: string; - mrzParsed: boolean; - mrzVerified: boolean; -} - -export interface SuccessFrameGrabberRecognizerResult extends RecognizerResult { - successFrame: string; -} -export type SuccessFrameGrabberRecognizerResultCtor = RecognizerResultCtor; - -export interface SuccessFrameGrabberRecognizer extends Recognizer { - slaveRecognizer: Recognizer; - createResultFromNative(nativeResult: { slaveRecognizerResult: any }): SuccessFrameGrabberRecognizerResult; -} -export interface SuccessFrameGrabberRecognizerCtor { - new (recognizer: Recognizer): SuccessFrameGrabberRecognizer; -} - -export interface AustraliaDlBackRecognizerResult extends RecognizerResult { - address: string; - dateOfExpiry: Date; - fullDocumentImage: string; - lastName: string; - licenseNumber: string; -} -export type AustraliaDlBackRecognizerResultCtor = RecognizerResultCtor; - -export interface AustraliaDlBackRecognizer extends Recognizer { - extractAddress: boolean; - extractDateOfBirth: boolean; - extractLastName: boolean; - fullDocumentImageDpi: number; - returnFullDocumentImage: boolean; -} -export type AustraliaDlBackRecognizerCtor = RecognizerCtor; - -export interface AustraliaDlFrontRecognizerResult extends RecognizerResult { - address: string; - dateOfBirth: Date; - dateOfExpiry: Date; - faceImage: string; - fullDocumentImage: string; - licenseNumber: string; - licenseType: string; - name: string; - signatureImage: string; -} -export type AustraliaDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface AustraliaDlFrontRecognizer extends Recognizer { - extractAddress: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - fullDocumentImageDpi: number; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; -} -export type AustraliaDlFrontRecognizerCtor = RecognizerCtor; - -export interface AustriaCombinedRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssuance: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: boolean; - documentNumber: string; - eyeColor: string; - faceImage: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - givenName: string; - height: string; - issuingAuthority: string; - mrtdVerified: boolean; - nationality: string; - placeOfBirth: string; - principalResidence: string; - scanningFirstSideDone: boolean; - sex: string; - signatureImage: string; - surname: string; -} -export type AustriaCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface AustriaCombinedRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssuance: boolean; - extractDateOfIssue: boolean; - extractGivenName: boolean; - extractHeight: boolean; - extractIssuingAuthority: boolean; - extractNationality: boolean; - extractPassportNumber: boolean; - extractPlaceOfBirth: boolean; - extractPrincipalResidence: boolean; - extractSex: boolean; - extractSurname: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - signResult: boolean; - signatureImageDpi: number; -} -export type AustriaCombinedRecognizerCtor = RecognizerCtor; - -export interface AustriaDlFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - faceImage: string; - firstName: string; - fullDocumentImage: string; - issuingAuthority: string; - licenseNumber: string; - name: string; - placeOfBirth: string; - signatureImage: string; - vehicleCategories: string; -} -export type AustriaDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface AustriaDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractFirstName: boolean; - extractIssuingAuthority: boolean; - extractName: boolean; - extractPlaceOfBirth: boolean; - extractVehicleCategories: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type AustriaDlFrontRecognizerCtor = RecognizerCtor; - -export interface AustriaIdBackRecognizerResult extends RecognizerResult { - dateOfIssuance: Date; - documentNumber: string; - eyeColor: string; - fullDocumentImage: string; - height: string; - issuingAuthority: string; - mrzResult: MrzResult; - placeOfBirth: string; - principalResidence: string; -} -export type AustriaIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface AustriaIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfIssuance: boolean; - extractHeight: boolean; - extractIssuingAuthority: boolean; - extractPlaceOfBirth: boolean; - extractPrincipalResidence: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; -} -export type AustriaIdBackRecognizerCtor = RecognizerCtor; - -export interface AustriaIdFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - givenName: string; - sex: string; - signatureImage: string; - surname: string; -} -export type AustriaIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface AustriaIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractGivenName: boolean; - extractSex: boolean; - extractSurname: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type AustriaIdFrontRecognizerCtor = RecognizerCtor; - -export interface AustriaPassportRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssuance: Date; - faceImage: string; - fullDocumentImage: string; - givenName: string; - height: string; - issuingAuthority: string; - mrzResult: MrzResult; - nationality: string; - passportNumber: string; - placeOfBirth: string; - sex: string; - signatureImage: string; - surname: string; -} -export type AustriaPassportRecognizerResultCtor = RecognizerResultCtor; - -export interface AustriaPassportRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractGivenName: boolean; - extractHeight: boolean; - extractIssuingAuthority: boolean; - extractNationality: boolean; - extractPassportNumber: boolean; - extractPlaceOfBirth: boolean; - extractSex: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type AustriaPassportRecognizerCtor = RecognizerCtor; - -export interface ColombiaDlFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfIssue: Date; - driverRestrictions: string; - faceImage: string; - fullDocumentImage: string; - issuingAgency: string; - licenseNumber: string; - name: string; -} -export type ColombiaDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface ColombiaDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDriverRestrictions: boolean; - extractIssuingAgency: boolean; - extractName: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} - -export interface ColombiaIdBackRecognizerResult extends RecognizerResult { - birthDate: Date; - bloodGroup: string; - documentNumber: string; - fingerprint: string; - firstName: string; - fullDocumentImage: string; - lastName: string; - sex: string; -} -export type ColombiaIdBackRecognizerResultCtor = Recognizer; - -export interface ColombiaIdBackRecognizer extends Recognizer { - detectGlare: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - nullQuietZoneAllowed: boolean; - returnFullDocumentImage: boolean; - scanUncertain: boolean; -} -export type ColombiaIdBackRecognizerCtor = RecognizerCtor; - -export interface ColombiaIdFrontRecognizerResult extends RecognizerResult { - documentNumber: string; - faceImage: string; - firstName: string; - fullDocumentImage: string; - lastName: string; - signatureImage: string; -} -export type ColombiaIdFrontRecognizerResultCtor = Recognizer; - -export interface ColombiaIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractFirstName: boolean; - extractLastName: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type ColombiaIdFrontRecognizerCtor = RecognizerCtor; - -export interface CroatiaCombinedRecognizerResult extends RecognizerResult { - address: string; - citizenship: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfExpiryPermanent: Date; - dateOfIssue: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentBilingual: boolean; - documentDataMatch: string; - faceImage: string; - firstName: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - identityCardNumber: string; - issuingAuthority: string; - lastName: string; - mrzVerified: boolean; - nonResident: boolean; - personalIdentificationNumber: string; - scanningFirstSideDone: boolean; - sex: string; - signatureImage: string; -} -export type CroatiaCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface CroatiaCombinedRecognizer extends Recognizer { - detectGlare: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signResult: boolean; -} - -export interface CroatiaIdBackRecognizerResult extends RecognizerResult { - dateOfExpiryPermanent: boolean; - dateOfIssue: Date; - documentForNonResident: boolean; - fullDocumentImage: string; - issuedBy: string; - mrzResult: MrzResult; - residence: string; -} -export type CroatiaIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface CroatiaIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfIssue: boolean; - extractIssuedBy: boolean; - extractResidence: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; -} - -export interface CroatiaIdFrontRecognizerResult extends RecognizerResult { - citizenship: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfExpiryPermanent: boolean; - documentBilingual: boolean; - documentNumber: string; - faceImage: string; - firstName: string; - fullDocumentImage: string; - lastName: string; - sex: string; - signatureImage: string; -} -export type CroatiaIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface CroatiaIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractCitizenship: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractFirstName: boolean; - extractLastName: boolean; - extractSex: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} - -export interface CyprusIdBackRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - expiresOn: Date; - fullDocumentImage: string; - sex: string; -} -export type CyprusIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface CyprusIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractExpiresOn: boolean; - extractSex: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; -} -export type CyprusIdBackRecognizerCtor = RecognizerCtor; - -export interface CyprusIdFrontRecognizerResult extends RecognizerResult { - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - idNumber: string; - name: string; - surname: string; -} -export type CyprusIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface CyprusIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDocumentNumber: boolean; - extractName: boolean; - extractSurname: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type CyprusIdFrontRecognizerCtor = RecognizerCtor; - -export interface CzechiaCombinedRecognizerResult extends RecognizerResult { - address: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: boolean; - faceImage: string; - firstName: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - identityCardNumber: string; - issuingAuthority: string; - lastName: string; - mrzVerified: boolean; - nationality: string; - personalIdentificationNumber: string; - placeOfBirth: string; - scanningFirstSideDone: boolean; - sex: string; - signatureImage: string; -} -export type CzechiaCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface CzechiaCombinedRecognizer extends Recognizer { - detectGlare: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - signResult: boolean; -} - -export interface CzechiaIdBackRecognizerResult extends RecognizerResult { - authority: string; - dateOfBirth: Date; - dateOfExpiry: Date; - documentCode: string; - documentNumber: string; - fullDocumentImage: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - opt1: string; - opt2: string; - permanentStay: string; - personalNumber: string; - primaryId: string; - secondaryId: string; - sex: string; -} -export type CzechiaIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface CzechiaIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractAuthority: boolean; - extractPermanentStay: boolean; - extractPersonalNumber: boolean; - returnFullDocumentImage: boolean; -} - -export interface CyprusIdFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - faceImage: string; - firstName: string; - fullDocumentImage: string; - identityCardNumber: string; - lastName: string; - placeOfBirth: string; - sex: string; - signatureImage: string; -} -export type CyprusIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface CyprusIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractGivenNames: boolean; - extractPlaceOfBirth: boolean; - extractSex: boolean; - extractSurname: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; -} -export type CyprusIdFrontRecognizerCtor = RecognizerCtor; - -export interface DocumentFaceRecognizerResult extends RecognizerResult { - documentLocation: string; - faceImage: string; - faceLocation: Quadrilateral; - fullDocumentImage: string; -} -export type DocumentFaceRecognizerResultCtor = RecognizerResultCtor; - -export interface DocumentFaceRecognizer extends Recognizer { - detectorType: DocumentFaceDetectorType.TD1; - faceImageDpi: number; - fullDocumentImage: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - numStableDetectionsThreshold: number; - returnFaceImage: boolean; -} - -export interface EgyptIdFrontRecognizerResult extends RecognizerResult { - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - nationalNumber: string; -} -export type EgyptIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface EgyptIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractNationalNumber: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type EgyptIdFrontRecognizerCtor = RecognizerCtor; - -export interface BlinkCardEliteRecognizerResult extends RecognizerResult { - cardNumber: string; - cvv: string; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: boolean; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - inventoryNumber: string; - owner: string; - scanningFirstSideDone: boolean; - validThru: Date; -} -export type BlinkCardEliteRecognizerResultCtor = RecognizerResultCtor; - -export interface BlinkCardEliteRecognizer extends Recognizer { - anonymizeCardNumber: boolean; - anonymizeCvv: boolean; - anonymizeOwner: boolean; - detectGlare: boolean; - extractInventoryNumber: boolean; - extractOwner: boolean; - extractValidThru: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; - signResult: boolean; -} -export type BlinkCardEliteRecognizerCtor = RecognizerCtor; - -export interface EudlRecognizerResult extends RecognizerResult { - address: string; - birthData: string; - country: string; - driverNumber: string; - expiryDate: Date; - faceImage: string; - firstName: string; - fullDocumentImage: string; - issueDate: Date; - issuingAuthority: string; - lastName: string; - personalNumber: string; -} -export type EudlRecognizerResultCtor = RecognizerResultCtor; - -export interface EudlRecognizer extends Recognizer { - country: EudlCountry.Automatic; - extractAddress: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractIssuingAuthority: boolean; - extractPersonalNumber: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} - -export interface GermanyCombinedRecognizerResult extends RecognizerResult { - address: string; - canNumber: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: boolean; - eyeColor: string; - faceImage: string; - firstName: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - height: string; - identityCardNumber: string; - issuingAuthority: string; - lastName: string; - mrzVerified: boolean; - nationality: string; - placeOfBirth: string; - scanningFirstSideDone: boolean; - sex: boolean; - signatureImage: string; -} -export type GermanyCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface GermanyCombinedRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signResult: boolean; -} -export type GermanyCombinedRecognizerCtor = RecognizerCtor; - -export interface GermanyDlBackRecognizerResult extends RecognizerResult { - dateOfIssueB10: string; - dateOfIssueB10NotSpecified: boolean; - fullDocumentImage: string; -} -export type GermanyDlBackRecognizerResultCtor = RecognizerResultCtor; - -export interface GermanyDlBackRecognizer extends Recognizer { - detectGlare: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; -} -export type GermanyDlBackRecognizerCtor = RecognizerCtor; - -export interface GermanyIdBackRecognizerResult extends RecognizerResult { - address: string; - addressCity: string; - addressHouseNumber: string; - addressStreet: string; - addressZipCode: string; - authority: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - documentCode: string; - documentNumber: string; - eyeColour: string; - fullDocumentImage: string; - height: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - opt1: string; - opt2: string; - primaryId: string; - secondaryId: string; - sex: string; -} -export type GermanyIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface GermanyIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractDateOfIssue: boolean; - extractEyeColour: boolean; - extractHeight: boolean; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; -} -export type GermanyIdBackRecognizerCtor = RecognizerCtor; - -export interface GermanyIdFrontRecognizerResult extends RecognizerResult { - canNumber: string; - dateOfBirth: Date; - dateOfExpiry: Date; - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - givenNames: string; - nationality: string; - placeOfBirth: string; - signatureImage: string; - surname: string; -} -export type GermanyIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface GermanyIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractCanNumber: boolean; - extractDateOfExpiry: boolean; - extractDocumentNumber: boolean; - extractGivenNames: boolean; - extractNationality: boolean; - extractPlaceOfBirth: boolean; - extractSurname: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type GermanyIdFrontRecognizerCtor = RecognizerCtor; - -export interface GermanyOldIdRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - documentCode: string; - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - opt1: string; - opt2: string; - placeOfBirth: string; - primaryId: string; - secondaryId: string; - sex: string; - signatureImage: string; -} -export type GermanyOldIdRecognizerResultCtor = RecognizerResultCtor; - -export interface GermanyOldIdRecognizer extends Recognizer { - detectGlare: boolean; - extractPlaceOfBirth: boolean; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; -} -export type GermanyOldIdRecognizerCtor = RecognizerCtor; - -export interface GermanyPassportRecognizerResult extends RecognizerResult { - authority: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - documentCode: string; - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: string; - name: string; - nationality: string; - opt1: string; - opt2: string; - placeOfBirth: string; - primaryId: string; - secondaryId: string; - sex: string; - signatureImage: string; - surname: string; -} -export type GermanyPassportRecognizerResultCtor = RecognizerResultCtor; - -export interface GermanyPassportRecognizer extends Recognizer { - detectGlare: boolean; - extractAuthority: boolean; - extractDateOfIssue: boolean; - extractName: boolean; - extractNationality: boolean; - extractPlaceOfBirth: boolean; - extractSurname: boolean; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; -} -export type GermanyPassportRecognizerCtor = RecognizerCtor; - -export interface HongKongIdFrontRecognizerResult extends RecognizerResult { - commercialCode: string; - dateOfBirth: Date; - dateOfIssue: Date; - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - fullName: string; - residentialStatus: string; - sex: string; -} -export type HongKongIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface HongKongIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfIssue: boolean; - extractFullName: boolean; - extractResidentialStatus: boolean; - extractSex: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type HongKongIdFrontRecognizerCtor = RecognizerCtor; - -export interface IkadRecognizerResult extends RecognizerResult { - address: string; - dateOfBirth: Date; - employer: string; - expiryDate: Date; - faceImage: string; - facultyAddress: string; - fullDocumentImage: string; - name: string; - nationality: string; - passportNumber: string; - sectory: string; - sex: string; -} -export type IkadRecognizerResultCtor = RecognizerResultCtor; - -export interface IkadRecognizer extends Recognizer { - detectGlare: boolean; - extractEmployer: boolean; - extractExpiryDate: boolean; - extractFacultyAddress: boolean; - extractNationality: boolean; - extractPassportNumber: boolean; - extractSector: boolean; - extractSex: boolean; - fullDocumentImageDpi: number; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type IkadRecognizerCtor = RecognizerCtor; - -export interface IndonesiaIdFrontRecognizerResult extends RecognizerResult { - address: string; - bloodType: string; - citizenship: string; - city: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfExpiryPermanent: string; - district: string; - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - kelDesa: string; - maritalStatus: string; - name: string; - occupation: string; - placeOfBirth: string; - province: string; - religion: string; - rt: string; - rw: string; - sex: string; - signatureImage: string; -} -export type IndonesiaIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface IndonesiaIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractBloodType: boolean; - extractCitizenship: boolean; - extractCity: boolean; - extractDateOfExpiry: boolean; - extractDistrict: boolean; - extractKelDesa: boolean; - extractMaritalStatus: boolean; - extractName: boolean; - extractOccupation: boolean; - extractPlaceOfBirth: boolean; - extractReligion: boolean; - extractRt: boolean; - extractRw: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type IndonesiaIdFrontRecognizerCtor = RecognizerCtor; - -export interface IrelandDlFrontRecognizerResult extends RecognizerResult { - address: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - driverNumber: string; - faceImage: string; - firstName: string; - fullDocumentImage: string; - issuedBy: string; - // sic - licenceCategories: string; - // sic - licenceNumber: string; - placeOfBirth: string; - signatureImage: string; - surname: string; -} -export type IrelandDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface IrelandDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractFirstName: boolean; - extractIssuedBy: boolean; - extractLicenceCategories: boolean; - extractLicenceNumber: boolean; - extractPlaceOfBirth: boolean; - extractSurname: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type IrelandDlFrontRecognizerCtor = RecognizerCtor; - -export interface ItalyDlFrontRecognizerResult extends RecognizerResult { - address: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - faceImage: string; - firstName: string; - fullDocumentImage: string; - givenName: string; - issuingAuthority: string; - // sic - licenceCategories: string; - // sic - licenceNumber: string; - placeOfBirth: string; - signatureImage: string; - surname: string; -} -export type ItalyDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface ItalyDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractGivenName: boolean; - extractIssuingAuthority: boolean; - extractLicenceCategories: boolean; - extractPlaceOfBirth: boolean; - extractSurname: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type ItalyDlFrontRecognizerCtor = RecognizerCtor; - -export interface JordanCombinedRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: boolean; - documentNumber: string; - faceImage: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - issuer: string; - mrzVerified: boolean; - name: string; - nationalNumber: string; - nationality: string; - scanningFirstSideDone: boolean; - sex: string; -} -export type JordanCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface JordanCombinedRecognizer extends Recognizer { - detectGlare: boolean; - returnFullDocumentImage: boolean; -} -export type JordanCombinedRecognizerCtor = RecognizerCtor; - -export interface JordanIdBackRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - documentCode: string; - documentNumber: string; - fullDocumentImage: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - opt1: string; - opt2: string; - primaryId: string; - secondaryId: string; - sex: string; -} -export type JordanIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface JordanIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractName: boolean; - extractSex: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - signResult: boolean; -} -export type JordanIdBackRecognizerCtor = RecognizerCtor; - -export interface JordanIdFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - faceImage: string; - fullDocumentImage: string; - name: string; - nationalNumber: string; - sex: string; -} -export type JordanIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface JordanIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractName: boolean; - extractSex: boolean; - fullDocumentImageDpi: number; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type JordanIdFrontRecognizerCtor = RecognizerCtor; - -export interface KuwaitIdBackRecognizerResult extends RecognizerResult { - fullDocumentImage: string; - mrzResult: MrzResult; - serialNo: string; -} -export type KuwaitIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface KuwaitIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractSerialNo: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; -} -export type KuwaitIdBackRecognizerCtor = RecognizerCtor; - -export interface KuwaitIdFrontRecognizerResult extends RecognizerResult { - birthData: Date; - civilIdNumber: string; - expiryDate: Date; - faceImage: string; - fullDocumentImage: string; - name: string; - nationality: string; - sex: string; -} -export type KuwaitIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface KuwaitIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractBirthDate: boolean; - extractName: boolean; - extractNationality: boolean; - extractSex: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type KuwaitIdFrontRecognizerCtor = RecognizerCtor; - -export interface MalaysiaDlFrontRecognizerResult extends RecognizerResult { - city: string; - dlClass: string; - faceImage: string; - fullAddress: string; - fullDocumentImage: string; - identityNumber: string; - name: string; - nationality: string; - ownerState: string; - street: string; - validFrom: Date; - validUntil: Date; - zipcode: string; -} -export type MalaysiaDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface MalaysiaDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractClass: boolean; - extractName: boolean; - extractNationality: boolean; - extractValidFrom: boolean; - extractValidUntil: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type MalaysiaDlFrontRecognizerCtor = RecognizerCtor; - -export interface MalaysiaMyTenteraRecognizerResult extends RecognizerResult { - armyNumber: string; - birthData: Date; - city: string; - faceImage: string; - fullAddress: string; - fullDocumentImage: string; - fullName: string; - nric: string; - ownerState: string; - religion: string; - sex: string; - street: string; - zipcode: string; -} -export type MalaysiaMyTenteraRecognizerResultCtor = RecognizerResultCtor; - -export interface MalaysiaMyTenteraRecognizer extends Recognizer { - detectGlare: boolean; - extractFullNameAndAddress: boolean; - extractReligion: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type MalaysiaMyTenteraRecognizerCtor = RecognizerCtor; - -export interface MexicoVoterIdFrontRecognizerResult extends RecognizerResult { - address: string; - curp: string; - dateOfBirth: Date; - electorKey: string; - faceImage: string; - fullDocumentImage: string; - fullName: string; - sex: string; - signatureImage: string; -} -export type MexicoVoterIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface MexicoVoterIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractCurp: boolean; - extractFullName: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type MexicoVoterIdFrontRecognizerCtor = RecognizerCtor; - -export interface MoroccoIdBackRecognizerResult extends RecognizerResult { - address: string; - civilStatusNumber: string; - dateOfExpiry: Date; - documentNumber: string; - fathersName: string; - fullDocumentImage: string; - mothersName: string; - sex: string; -} -export type MoroccoIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface MoroccoIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractCivilStatusNumber: boolean; - extractDateOfExpiry: boolean; - extractFathersName: boolean; - extractMothersName: boolean; - extractSex: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; -} -export type MoroccoIdBackRecognizerCtor = RecognizerCtor; - -export interface MoroccoIdFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - name: string; - placeOfBirth: string; - sex: string; - signatureImage: string; - surname: string; -} -export type MoroccoIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface MoroccoIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfExpiry: boolean; - extractDateOfBirth: boolean; - extractName: boolean; - extractPlaceOfBirth: boolean; - extractSex: boolean; - extractSurname: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type MoroccoIdFrontRecognizerCtor = RecognizerCtor; - -export interface MrtdCombinedRecognizerResult extends RecognizerResult { - alienNumber: string; - applicationReceiptNumber: string; - dateOfBirth: Date; - dateOfExpiry: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentCode: string; - documentDataMatch: boolean; - documentNumber: string; - documentType: string; - faceImage: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - immigrantCaseNumber: string; - issuer: string; - mrzImage: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - opt1: string; - opt2: string; - primaryId: string; - scanningFirstSideDone: boolean; - secondaryId: string; - sex: string; -} -export type MrtdCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface MrtdCombinedRecognizer extends Recognizer { - allowUnparsedResults: boolean; - allowUnverifiedResults: boolean; - numStableDetectionsThreshold: number; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnMrzImage: boolean; - signResult: boolean; -} -export type MrtdCombinedRecognizerCtor = RecognizerCtor; - -export interface MrtdRecognizerResult extends RecognizerResult { - fullDocumentImage: string; - mrzImage: string; - mrzResult: MrzResult; -} -export type MrtdRecognizerResultCtor = RecognizerResultCtor; - -export interface MrtdRecognizer extends Recognizer { - allowUnparsedResults: boolean; - allowUnverifiedResults: boolean; - detectGlare: boolean; - returnFullDocumentImage: boolean; - returnMrzImage: boolean; - saveImageDPI: number; -} -export type MrtdRecognizerCtor = RecognizerCtor; - -export interface MyKadBackRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - extendedNric: string; - fullDocumentImage: string; - nric: string; - oldNric: string; - sex: string; - signatureImage: string; -} -export type MyKadBackRecognizerResultCtor = RecognizerResultCtor; - -export interface MyKadBackRecognizer extends Recognizer { - detectGlare: boolean; - extractOldNric: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type MyKadBackRecognizerCtor = RecognizerCtor; - -export interface MyKadFrontRecognizerResult extends RecognizerResult { - armyNumber: string; - faceImage: string; - fullDocumentImage: string; - nricNumber: string; - ownerAddress: string; - ownerAddressCity: string; - ownerAddressState: string; - ownerAddressStreet: string; - ownerAddressZipCode: string; - ownerBirthDate: Date; - ownerFullName: string; - ownerReligion: string; - ownerSex: string; -} -export type MyKadFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface MyKadFrontRecognizer extends Recognizer { - extractArmyNumber: boolean; - fullDocumentImageDpi: number; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type MyKadFrontRecognizerCtor = RecognizerCtor; - -export interface NewZealandDlFrontRecognizerResult extends RecognizerResult { - address: string; - cardVersion: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - donorIndicator: string; - faceImage: string; - firstNames: string; - fullDocumentImage: string; - licenceNumber: string; - signatureImage: string; - surname: string; -} -export type NewZealandDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface NewZealandDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractDonorIndicator: boolean; - extractFirstName: boolean; - extractSurname: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type NewZealandDlFrontRecognizerCtor = RecognizerCtor; - -export interface BlinkCardRecognizerResult extends RecognizerResult { - cardNumber: string; - cvv: string; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - inventoryNumber: string; - issuer: string; - owner: string; - scanningFirstSideDone: boolean; - validThru: Date; -} -export type BlinkCardRecognizerResultCtor = RecognizerResultCtor; - -export interface BlinkCardRecognizer extends Recognizer { - anonymizeCardNumber: boolean; - anonymizeCvv: boolean; - anonymizeOwner: boolean; - detectGlare: boolean; - extractCvv: boolean; - extractInventoryNumber: boolean; - extractOwner: boolean; - extractValidThru: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; - signResult: boolean; -} -export type BlinkCardRecognizerCtor = RecognizerCtor; - -export interface Pdf417RecognizerResult extends RecognizerResult { - barcodeType: string; - rawData: string; - stringData: string; - uncertain: boolean; -} -export type Pdf417RecognizerResultCtor = RecognizerResultCtor; - -export interface Pdf417Recognizer extends Recognizer { - nullQuietZoneAllowed: boolean; - scanInverse: boolean; - scanUncertain: boolean; -} -export type Pdf417RecognizerCtor = RecognizerCtor; - -export interface PolandCombinedRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: string; - documentNumber: string; - faceImage: string; - familyName: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - givenNames: string; - issuer: string; - mrzVerified: boolean; - nationality: string; - parentsGivenNames: string; - personalNumber: string; - scanningFirstSideDone: boolean; - sex: string; - surname: string; -} -export type PolandCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface PolandCombinedRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractFamilyName: boolean; - extractGivenName: boolean; - extractParentsGivenNames: boolean; - extractSex: boolean; - extractSurname: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - signResult: boolean; -} -export type PolandCombinedRecognizerCtor = RecognizerCtor; - -export interface PolandIdBackRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - documentCode: string; - documentNumber: string; - fullDocumentImage: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - opt1: string; - opt2: string; - primaryId: string; - secondaryId: string; - sex: string; -} -export type PolandIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface PolandIdBackRecognizer extends Recognizer { - detectGlare: boolean; - returnFullDocumentImage: boolean; -} -export type PolandIdBackRecognizerCtor = RecognizerCtor; - -export interface PolandIdFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - faceImage: string; - familyName: string; - fullDocumentImage: string; - givenNames: string; - parentsGivenNames: string; - sex: string; - surname: string; -} -export type PolandIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface PolandIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractFamilyName: boolean; - extractGivenNames: boolean; - extractParentsGivenNames: boolean; - extractSex: boolean; - extractSurname: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type PolandIdFrontRecognizerCtor = RecognizerCtor; - -export interface RomaniaIdFrontRecognizerResult extends RecognizerResult { - address: string; - cardNumber: string; - cnp: string; - dateOfBirth: Date; - dateOfExpiry: Date; - documentCode: string; - documentNumber: string; - faceImage: string; - firstName: string; - fullDocumentImage: string; - idSeries: string; - issuedBy: string; - issuer: string; - lastName: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - nonMRZNationality: string; - nonMRZSex: string; - opt1: string; - opt2: string; - parentNames: string; - placeOfBirth: string; - primaryId: string; - secondaryId: string; - sex: string; - validFrom: Date; - validUntil: Date; -} -export type RomaniaIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface RomaniaIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractFirstName: boolean; - extractIssuedBy: boolean; - extractLastName: boolean; - extractNonMRZSex: boolean; - extractPlaceOfBirth: boolean; - extractValidFrom: boolean; - extractValidUntil: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type RomaniaIdFrontRecognizerCtor = RecognizerCtor; - -export interface SerbiaCombinedRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: boolean; - faceImage: string; - firstName: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - identityCardNumber: string; - issuer: string; - jmbg: string; - lastName: string; - mrzVerified: boolean; - nationality: string; - scanningFirstSideDone: boolean; - sex: string; - signatureImage: string; -} -export type SerbiaCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface SerbiaCombinedRecognizer extends Recognizer { - detectGlare: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signResult: boolean; -} -export type SerbiaCombinedRecognizerCtor = RecognizerCtor; - -export interface SerbiaIdBackRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - documentCode: string; - documentNumber: string; - fullDocumentImage: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - opt1: string; - opt2: string; - primaryId: string; - secondaryId: string; - sex: string; -} -export type SerbiaIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface SerbiaIdBackRecognizer extends Recognizer { - detectGlare: boolean; - returnFullDocumentImage: boolean; -} -export type SerbiaIdBackRecognizerCtor = RecognizerCtor; - -export interface SerbiaIdFrontRecognizerResult extends RecognizerResult { - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - issuingDate: Date; - signatureImage: string; - validThru: Date; - validUntil: Date; -} -export type SerbiaIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface SerbiaIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractIssuingDate: boolean; - extractValidUntil: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; -} -export type SerbiaIdFrontRecognizerCtor = RecognizerCtor; - -export interface SimNumberRecognizerResult extends RecognizerResult { - simNumber: string; -} -export type SimNumberRecognizerResultCtor = RecognizerResultCtor; - -export type SimNumberRecognizer = Recognizer; -export type SimNumberRecognizerCtor = RecognizerCtor; - -export interface SingaporeChangiEmployeeIdRecognizerResult extends RecognizerResult { - companyName: string; - dateOfExpiry: Date; - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - name: string; -} -export type SingaporeChangiEmployeeIdRecognizerResultCtor = - RecognizerResultCtor; - -export interface SingaporeChangiEmployeeIdRecognizer extends Recognizer { - detectGlare: boolean; - extractCompanyName: boolean; - extractDateOfExpiry: boolean; - extractName: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type SingaporeChangiEmployeeIdRecognizerCtor = RecognizerCtor; - -export interface SingaporeCombinedRecognizerResult extends RecognizerResult { - address: string; - addressChangeDate: Date; - bloodGroup: string; - countryOfBirth: string; - dateOfBirth: Date; - dateOfIssue: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: boolean; - faceImage: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - identityCardNumber: string; - name: string; - race: string; - scanningFirstSideDone: string; - sex: string; -} -export type SingaporeCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface SingaporeCombinedRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractAddressChangeDate: boolean; - extractBloodGroup: boolean; - extractCountryOfBirth: boolean; - extractDateOfBirth: boolean; - extractDateOfIssue: boolean; - extractName: boolean; - extractRace: boolean; - extractSex: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - signResult: boolean; -} -export type SingaporeCombinedRecognizerCtor = RecognizerCtor; - -export interface SingaporeDlFrontRecognizerResult extends RecognizerResult { - birthData: Date; - faceImage: string; - fullDocumentImage: string; - issueDate: Date; - licenceNumber: string; - name: string; - validTill: Date; -} -export type SingaporeDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface SingaporeDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractBirthDate: boolean; - extractIssueDate: boolean; - extractName: boolean; - extractValidTill: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type SingaporeDlFrontRecognizerCtor = RecognizerCtor; - -export interface SingaporeIdBackRecognizerResult extends RecognizerResult { - address: string; - addressChangeDate: string; - bloodGroup: string; - cardNumber: string; - dateOfIssue: Date; - fullDocumentImage: string; -} -export type SingaporeIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface SingaporeIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractAddress: boolean; - extractAddressChangeDate: boolean; - extractBloodGroup: boolean; - extractDateOfIssue: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; -} -export type SingaporeIdBackRecognizerCtor = RecognizerCtor; - -export interface SingaporeIdFrontRecognizerResult extends RecognizerResult { - countryOfBirth: string; - dateOfBirth: Date; - faceImage: string; - fullDocumentImage: string; - identityCardNumber: string; - name: string; - race: string; - sex: string; -} -export type SingaporeIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface SingaporeIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractCountryOfBirth: boolean; - extractDateOfBirth: boolean; - extractName: boolean; - extractRace: boolean; - extractSex: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type SingaporeIdFrontRecognizerCtor = RecognizerCtor; - -export interface SlovakiaCombinedRecognizerResult extends RecognizerResult { - address: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - digitalSignature: number; - digitalSignatureVersion: number; - documentDataMatch: boolean; - documentNumber: string; - faceImage: string; - firstName: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - issuingAuthority: string; - lastName: string; - mrzVerified: boolean; - nationality: string; - personalIdentificationNumber: string; - placeOfBirth: string; - scanningFirstSideDone: string; - sex: string; - signatureImage: string; - specialRemarks: string; - surnameAtBirth: string; -} -export type SlovakiaCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface SlovakiaCombinedRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractDocumentNumber: boolean; - extractIssuedBy: boolean; - extractNationality: boolean; - extractPlaceOfBirth: boolean; - extractSex: boolean; - extractSpecialRemarks: boolean; - extractSurnameAtBirth: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - signResult: boolean; -} -export type SlovakiaCombinedRecognizerCtor = RecognizerCtor; - -export interface SlovakiaIdBackRecognizerResult extends RecognizerResult { - address: string; - dateOfBirth: Date; - dateOfExpiry: Date; - documentCode: string; - fullDocumentImage: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - opt1: string; - opt2: string; - placeOfBirth: string; - primaryId: string; - secondaryId: string; - sex: string; - specialRemarks: string; - surnameAtBirth: string; -} -export type SlovakiaIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface SlovakiaIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractPlaceOfBirth: boolean; - extractSpecialRemarks: boolean; - extractSurnameAtBirth: boolean; - returnFullDocumentImage: boolean; -} -export type SlovakiaIdBackRecognizerCtor = RecognizerCtor; - -export interface SlovakiaIdFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - documentNumber: string; - faceImage: string; - firstName: string; - fullDocumentImage: string; - issuedBy: string; - lastName: string; - nationality: string; - personalNumber: string; - sex: string; - signatureImage: string; -} -export type SlovakiaIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface SlovakiaIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractPlaceOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractDocumentNumber: boolean; - extractIssuedBy: boolean; - extractNationality: boolean; - extractSex: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; -} -export type SlovakiaIdFrontRecognizerCtor = RecognizerCtor; - -export interface SloveniaCombinedRecognizerResult extends RecognizerResult { - address: string; - citizenship: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: boolean; - faceImage: string; - firstName: string; - fullDocumentBackImage: string; - fullDocumentFrontImage: string; - identityCardNumber: string; - issuingAuthority: string; - lastName: string; - mrzVerified: boolean; - personalIdentificationNumber: string; - scanningFirstSideDone: boolean; - sex: string; - signatureImage: string; -} -export type SloveniaCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface SloveniaCombinedRecognizer extends Recognizer { - detectGlare: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signResult: boolean; -} -export type SloveniaCombinedRecognizerCtor = RecognizerCtor; - -export interface SloveniaIdBackRecognizerResult extends RecognizerResult { - address: string; - authority: string; - dateOfExpiry: Date; - dateOfIssue: Date; - documentCode: string; - documentNumber: string; - fullDocumentImage: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - opt1: string; - opt2: string; - primaryId: string; - secondaryId: string; - sex: string; -} -export type SloveniaIdBackRecognizerResultCtor = RecognizerResultCtor; - -export interface SloveniaIdBackRecognizer extends Recognizer { - detectGlare: boolean; - extractAuthority: boolean; - extractDateOfIssue: boolean; - returnFullDocumentImage: boolean; -} -export type SloveniaIdBackRecognizerCtor = RecognizerCtor; - -export interface SloveniaIdFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - faceImage: string; - firstName: string; - fullDocumentImage: string; - lastName: string; - nationality: string; - sex: string; - signatureImage: string; -} -export type SloveniaIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface SloveniaIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractNationality: boolean; - extractSex: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; -} -export type SloveniaIdFrontRecognizerCtor = RecognizerCtor; - -export interface SpainDlFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - faceImage: string; - firstName: string; - fullDocumentImage: string; - issuingAuthority: string; - licenceCategories: string; - number: string; - placeOfBirth: string; - signatureImage: string; - surname: string; - validFrom: Date; - validUntil: Date; -} -export type SpainDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface SpainDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractFirstName: boolean; - extractIssuingAuthority: boolean; - extractLicenceCategories: boolean; - extractPlaceOfBirth: boolean; - extractSurname: boolean; - extractValidFrom: boolean; - extractValidUntil: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type SpainDlFrontRecognizerCtor = RecognizerCtor; - -export interface SwedenDlFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - faceImage: string; - fullDocumentImage: string; - issuingAgency: string; - licenceCategories: string; - licenceNumber: string; - name: string; - referenceNumber: string; - signatureImage: string; - surname: string; -} -export type SwedenDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface SwedenDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractIssuingAuthority: boolean; - extractLicenceCategories: boolean; - extractName: boolean; - extractReferenceNumber: boolean; - extractSurname: boolean; - extractValidFrom: boolean; - fullDocumentImageDpi: number; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; -} -export type SwedenDlFrontRecognizerCtor = RecognizerCtor; - -export interface SwitzerlandDlFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - expiryDatePermanent: boolean; - faceImage: string; - firstName: string; - fullDocumentImage: string; - issuingAuthority: string; - lastName: string; - licenseNumber: string; - placeOfBirth: string; - signatureImage: string; - vehicleCategories: string; -} -export type SwitzerlandDlFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface SwitzerlandDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractFirstName: boolean; - extractIssuingAuthority: boolean; - extractLastName: boolean; - extractPlaceOfBirth: boolean; - extractVehicleCategories: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type SwitzerlandDlFrontRecognizerCtor = RecognizerCtor; - -export interface SwitzerlandDlBackRecognizerResult extends RecognizerResult { - authority: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - documentCode: string; - documentNumber: string; - fullDocumentImage: string; - height: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - nonMrzDateOfExpiry: Date; - nonMrzSex: string; - opt1: string; - opt2: string; - placeOfOrigin: string; - primaryId: string; - secondaryId: string; - sex: string; -} -export type SwitzerlandDlBackRecognizerResultCtor = RecognizerResultCtor; - -export interface SwitzerlandDlBackRecognizer extends Recognizer { - detectGlare: boolean; - extractAuthority: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractHeight: boolean; - extractPlaceOfOrigin: boolean; - extractSex: boolean; - returnFullDocumentImage: boolean; -} -export type SwitzerlandDlBackRecognizerCtor = RecognizerCtor; - -export interface SwitzerlandIdFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - faceImage: string; - fullDocumentImage: string; - givenName: string; - signatureImage: string; - surname: string; -} -export type SwitzerlandIdFrontRecognizerResultCtor = RecognizerResultCtor; - -export interface SwitzerlandIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractGivenName: boolean; - extractSurname: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - returnSignatureImage: boolean; - signatureImageDpi: number; -} -export type SwitzerlandIdFrontRecognizerCtor = RecognizerCtor; - -export interface SwitzerlandPassportRecognizerResult extends RecognizerResult { - authority: string; - dateOfBirth: Date; - dateOfExpiry: Date; - dateOfIssue: Date; - documentCode: string; - documentNumber: string; - faceImage: string; - fullDocumentImage: string; - givenName: string; - height: string; - issuer: string; - mrzParsed: boolean; - mrzText: string; - mrzVerified: boolean; - nationality: string; - nonMrzDateOfBirth: Date; - nonMrzDateOfExpiry: Date; - nonMrzSex: string; - opt1: string; - opt2: string; - passportNumber: string; - placeOfBirth: string; - primaryId: string; - secondaryId: string; - sex: string; - surname: string; -} -export type SwitzerlandPassportRecognizerResultCtor = RecognizerResultCtor; - -export interface SwitzerlandPassportRecognizer extends Recognizer { - detectGlare: boolean; - extractAuthority: boolean; - extractDateOfBirth: boolean; - extractDateOfExpiry: boolean; - extractDateOfIssue: boolean; - extractGivenName: boolean; - extractHeight: boolean; - extractPassportNumber: boolean; - extractPlaceOfBirth: boolean; - extractSex: boolean; - extractSurname: boolean; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type SwitzerlandPassportRecognizerCtor = RecognizerCtor; - -export interface UnitedArabEmiratesDlFrontRecognizerResult extends RecognizerResult { - dateOfBirth: Date; - expiryDate: Date; - faceImage: string; - fullDocumentImage: string; - issueDate: Date; - licenseNumber: string; - licensingAuthority: string; - name: string; - nationality: string; - placeOfIssue: string; -} -export type UnitedArabEmiratesDlFrontRecognizerResultCtor = - RecognizerResultCtor; - -export interface UnitedArabEmiratesDlFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractDateOfBirth: boolean; - extractDateOfIssue: boolean; - extractLicenseNumber: boolean; - extractLicensingAuthority: boolean; - extractName: boolean; - extractNationality: boolean; - extractPlaceOfIssue: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type UnitedArabEmiratesDlFrontRecognizerCtor = RecognizerCtor; - -export interface UnitedArabEmiratesIdBackRecognizerResult extends RecognizerResult { - fullDocumentImage: string; - mrzResult: MrzResult; -} -export type UnitedArabEmiratesIdBackRecognizerResultCtor = - RecognizerResultCtor; - -export interface UnitedArabEmiratesIdBackRecognizer extends Recognizer { - detectGlare: boolean; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFullDocumentImage: boolean; -} -export type UnitedArabEmiratesIdBackRecognizerCtor = RecognizerCtor; - -export interface UnitedArabEmiratesIdFrontRecognizerResult extends RecognizerResult { - faceImage: string; - fullDocumentImage: string; - idNumber: string; - name: string; - nationality: string; -} -export type UnitedArabEmiratesIdFrontRecognizerResultCtor = - RecognizerResultCtor; - -export interface UnitedArabEmiratesIdFrontRecognizer extends Recognizer { - detectGlare: boolean; - extractName: boolean; - extractNationality: boolean; - faceImageDpi: number; - fullDocumentImageDpi: number; - fullDocumentImageExtensionFactors: ImageExtensionFactors; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; -} -export type UnitedArabEmiratesIdFrontRecognizerCtor = RecognizerCtor; - -export interface VinRecognizerResult extends RecognizerResult { - vin: string; -} -export type VinRecognizerResultCtor = RecognizerResultCtor; - -export type VinRecognizer = Recognizer; -export type VinRecognizerCtor = RecognizerCtor; - -export interface UsdlRecognizerResult extends RecognizerResult { - optionalElements: any[]; - rawData: string; - rawStringData: string; - uncertain: string; - fields: any[]; -} -export type UsdlRecognizerResultCtor = RecognizerResultCtor; - -export interface UsdlRecognizer extends Recognizer { - nullQuietZoneAllowed: boolean; - uncertainDecoding: boolean; -} -export type UsdlRecognizerCtor = RecognizerCtor; - -export interface UsdlCombinedRecognizerResult extends RecognizerResult { - digitalSignature: string; - digitalSignatureVersion: string; - documentDataMatch: boolean; - faceImage: string; - fullDocumentImage: string; - scanningFirstSideDone: boolean; - optionalElements: any[]; - rawData: string; - rawStringData: string; - uncertain: boolean; - fields: any[]; -} -export type UsdlCombinedRecognizerResultCtor = RecognizerResultCtor; - -export interface UsdlCombinedRecognizer extends Recognizer { - faceImageDpi: number; - fullDocumentImageDpi: number; - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - signResult: boolean; -} -export type UsdlCombinedRecognizerCtor = RecognizerCtor; - -export type BlinkIdRecognizerCtor = RecognizerCtor; - -export interface BlinkIdRecognizer extends Recognizer { - returnFaceImage: boolean; - returnFullDocumentImage: boolean; - anonymizationMode: number; -} - -export interface BlinkIdRecognizerResult extends RecognizerResult { - firstName: string; - lastName: string; - fullName: string; - localizedName: string; - additionalNameInformation: string; - placeOfBirth: string; - documentNumber: string; - dateOfBirth: Date; - sex: string; - nationality: string; - fullDocumentImage: string; - mrzResult: MrzResult; -} - -export interface BlinkIdOverlaySettingsCtor { - new (): BlinkIdOverlaySettings; -} -export type BlinkIdOverlaySettings = OverlaySettings; - -export type BlinkIdRecognizerResultCtor = RecognizerResultCtor; -/** - * @name BlinkId - * @description - * Microblink SDK wrapper for barcode and document scanning. See the - * blinkid-phonegap repository for available recognizers and other settings - * @usage - * ```typescript - * import { BlinkId, RecognizerResultState } from '@awesome-cordova-plugins/blinkid/ngx'; - * - * constructor(private blinkId: BlinkId) { } - * - * ... - * - * const overlaySettings = new this.blinkId.DocumentOverlaySettings(); - * - * const usdlRecognizer = new this.blinkId.UsdlRecognizer(); - * const usdlSuccessFrameGrabber = new this.blinkId.SuccessFrameGrabberRecognizer(usdlRecognizer); - * - * const barcodeRecognizer = new this.blinkId.BarcodeRecognizer(); - * barcodeRecognizer.scanPdf417 = true; - * - * const recognizerCollection = new this.blinkId.RecognizerCollection([ - * usdlSuccessFrameGrabber, - * barcodeRecognizer, - * ]); - * - * const canceled = await this.blinkId.scanWithCamera( - * overlaySettings, - * recognizerCollection, - * { ios: IOS_LICENSE_KEY, android: ANDROID_LICENSE_KEY }, - * ); - * - * if (!canceled) { - * if (usdlRecognizer.result.resultState === RecognizerResultState.valid) { - * const successFrame = usdlSuccessFrameGrabber.result.successFrame; - * if (successFrame) { - * this.base64Img = `data:image/jpg;base64, ${successFrame}`; - * this.fields = usdlRecognizer.result.fields; - * } - * } else { - * this.barcodeStringData = barcodeRecognizer.result.stringData; - * } - * } - * - * ... - * - * const overlaySettings = new this.blinkId.BlinkCardOverlaySettings(); - * const recognizer = new this.blinkId.BlinkCardRecognizer(); - * recognizer.returnFullDocumentImage = false; - * recognizer.detectGlare = true; - * recognizer.extractCvv = true; - * recognizer.extractValidThru = true; - * recognizer.extractOwner = true; - * - * const recognizerCollection = new this.blinkId.RecognizerCollection([recognizer]); - * const canceled = await this.blinkId.scanWithCamera( - * overlaySettings, - * recognizerCollection, - * { - * ios: '', //iOS License Key - * android: '' //Android License Key - * }, - * ); - * - * if (!canceled) { - * if (recognizer.result.resultState === RecognizerResultState.valid) { - * const results = recognizer.result; - * - * if (results.resultState === RecognizerResultState.valid) { - * const ccInfo = { - * cardNumber: Number(results.cardNumber), - * expirationMonth: Number(results.validThru.month), - * expirationYear: Number(results.validThru.year), - * cvv: Number(results.cvv) - * }; - * } - * } - * ``` - */ -@Plugin({ - pluginName: 'BlinkId', - plugin: 'blinkid-cordova', - pluginRef: 'cordova.plugins.BlinkID', - repo: 'https://github.com/BlinkID/blinkid-phonegap', - install: - 'ionic cordova plugin add blinkid-cordova --variable CAMERA_USAGE_DESCRIPTION="Enable your camera so that you can scan your ID to validate your account"', - platforms: ['iOS', 'Android'], -}) -@Injectable() -export class BlinkId extends AwesomeCordovaNativePlugin { - /** - * Opens the camera dialog and attempts to scan a barcode/document - * - * @param overlaySettings {OverlaySettings} for camera overlay customization - * @param recognizerCollection {RecognizerCollection} collection of recognizers to scan with - * @param licenses - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - scanWithCamera( - overlaySettings: OverlaySettings, - recognizerCollection: RecognizerCollection, - licenses: Licenses - ): Promise { - return; - } - - @CordovaProperty() Date: DateCtor; - @CordovaProperty() Point: PointCtor; - @CordovaProperty() Quadrilateral: QuadrilateralCtor; - - @CordovaProperty() BarcodeOverlaySettings: BarcodeOverlaySettingsCtor; - @CordovaProperty() DocumentOverlaySettings: DocumentOverlaySettingsCtor; - @CordovaProperty() DocumentVerificationOverlaySettings: DocumentVerificationOverlaySettingsCtor; - @CordovaProperty() BlinkCardOverlaySettings: BlinkCardOverlaySettingsCtor; - - @CordovaProperty() RecognizerCollection: RecognizerCollectionCtor; - - @CordovaProperty() BarcodeRecognizerResult: BarcodeRecognizerResultCtor; - @CordovaProperty() BarcodeRecognizer: BarcodeRecognizerCtor; - @CordovaProperty() SuccessFrameGrabberRecognizerResult: SuccessFrameGrabberRecognizerResultCtor; - @CordovaProperty() SuccessFrameGrabberRecognizer: SuccessFrameGrabberRecognizerCtor; - - @CordovaProperty() AustraliaDlBackRecognizerResult: AustraliaDlBackRecognizerResultCtor; - @CordovaProperty() AustraliaDlBackRecognizer: AustraliaDlBackRecognizerCtor; - @CordovaProperty() AustraliaDlFrontRecognizerResult: AustraliaDlFrontRecognizerResultCtor; - @CordovaProperty() AustraliaDlFrontRecognizer: AustraliaDlFrontRecognizerCtor; - @CordovaProperty() AustriaCombinedRecognizerResult: AustriaCombinedRecognizerResultCtor; - @CordovaProperty() AustriaCombinedRecognizer: AustriaCombinedRecognizerCtor; - @CordovaProperty() AustriaDlFrontRecognizerResult: AustriaDlFrontRecognizerResultCtor; - @CordovaProperty() AustriaDlFrontRecognizer: AustriaDlFrontRecognizerCtor; - @CordovaProperty() AustriaIdBackRecognizerResult: AustriaIdBackRecognizerResultCtor; - @CordovaProperty() AustriaIdBackRecognizer: AustriaIdBackRecognizerCtor; - @CordovaProperty() AustriaIdFrontRecognizerResult: AustriaIdFrontRecognizerResultCtor; - @CordovaProperty() AustriaIdFrontRecognizer: AustriaIdFrontRecognizerCtor; - @CordovaProperty() AustriaPassportRecognizerResult: AustriaPassportRecognizerResultCtor; - @CordovaProperty() AustriaPassportRecognizer: AustriaPassportRecognizerCtor; - @CordovaProperty() BlinkCardEliteRecognizer: BlinkCardEliteRecognizerCtor; - @CordovaProperty() BlinkCardEliteRecognizerResult: BlinkCardEliteRecognizerResultCtor; - @CordovaProperty() BlinkCardRecognizerResult: BlinkCardRecognizerResultCtor; - @CordovaProperty() BlinkCardRecognizer: BlinkCardRecognizerCtor; - @CordovaProperty() ColombiaDlFrontRecognizerResult: ColombiaDlFrontRecognizerResultCtor; - @CordovaProperty() ColombiaIdBackRecognizerResult: ColombiaIdBackRecognizerResultCtor; - @CordovaProperty() ColombiaIdBackRecognizer: ColombiaIdBackRecognizerCtor; - @CordovaProperty() ColombiaIdFrontRecognizerResult: ColombiaIdFrontRecognizerResultCtor; - @CordovaProperty() ColombiaIdFrontRecognizer: ColombiaIdFrontRecognizerCtor; - @CordovaProperty() CroatiaCombinedRecognizerResult: CroatiaCombinedRecognizerResultCtor; - @CordovaProperty() CroatiaIdBackRecognizerResult: CroatiaIdBackRecognizerResultCtor; - @CordovaProperty() CroatiaIdFrontRecognizerResult: CroatiaIdFrontRecognizerResultCtor; - @CordovaProperty() CyprusIdBackRecognizerResult: CyprusIdBackRecognizerResultCtor; - @CordovaProperty() CyprusIdBackRecognizer: CyprusIdBackRecognizerCtor; - @CordovaProperty() CyprusIdFrontRecognizerResult: CyprusIdFrontRecognizerResultCtor; - @CordovaProperty() CyprusIdFrontRecognizer: CyprusIdFrontRecognizerCtor; - @CordovaProperty() CzechiaCombinedRecognizerResult: CzechiaCombinedRecognizerResultCtor; - @CordovaProperty() CzechiaIdBackRecognizerResult: CzechiaIdBackRecognizerResultCtor; - @CordovaProperty() DocumentFaceRecognizerResult: DocumentFaceRecognizerResultCtor; - @CordovaProperty() EgyptIdFrontRecognizerResult: EgyptIdFrontRecognizerResultCtor; - @CordovaProperty() EgyptIdFrontRecognizer: EgyptIdFrontRecognizerCtor; - @CordovaProperty() EudlRecognizerResult: EudlRecognizerResultCtor; - @CordovaProperty() GermanyCombinedRecognizerResult: GermanyCombinedRecognizerResultCtor; - @CordovaProperty() GermanyCombinedRecognizer: GermanyCombinedRecognizerCtor; - @CordovaProperty() GermanyDlBackRecognizerResult: GermanyDlBackRecognizerResultCtor; - @CordovaProperty() GermanyDlBackRecognizer: GermanyDlBackRecognizerCtor; - @CordovaProperty() GermanyIdBackRecognizerResult: GermanyIdBackRecognizerResultCtor; - @CordovaProperty() GermanyIdBackRecognizer: GermanyIdBackRecognizerCtor; - @CordovaProperty() GermanyIdFrontRecognizerResult: GermanyIdFrontRecognizerResultCtor; - @CordovaProperty() GermanyIdFrontRecognizer: GermanyIdFrontRecognizerCtor; - @CordovaProperty() GermanyOldIdRecognizerResult: GermanyOldIdRecognizerResultCtor; - @CordovaProperty() GermanyOldIdRecognizer: GermanyOldIdRecognizerCtor; - @CordovaProperty() GermanyPassportRecognizerResult: GermanyPassportRecognizerResultCtor; - @CordovaProperty() GermanyPassportRecognizer: GermanyPassportRecognizerCtor; - @CordovaProperty() HongKongIdFrontRecognizerResult: HongKongIdFrontRecognizerResultCtor; - @CordovaProperty() HongKongIdFrontRecognizer: HongKongIdFrontRecognizerCtor; - @CordovaProperty() IkadRecognizerResult: IkadRecognizerResultCtor; - @CordovaProperty() IkadRecognizer: IkadRecognizerCtor; - @CordovaProperty() IndonesiaIdFrontRecognizerResult: IndonesiaIdFrontRecognizerResultCtor; - @CordovaProperty() IndonesiaIdFrontRecognizer: IndonesiaIdFrontRecognizerCtor; - @CordovaProperty() IrelandDlFrontRecognizerResult: IrelandDlFrontRecognizerResultCtor; - @CordovaProperty() IrelandDlFrontRecognizer: IrelandDlFrontRecognizerCtor; - @CordovaProperty() ItalyDlFrontRecognizerResult: ItalyDlFrontRecognizerResultCtor; - @CordovaProperty() ItalyDlFrontRecognizer: ItalyDlFrontRecognizerCtor; - @CordovaProperty() JordanCombinedRecognizerResult: JordanCombinedRecognizerResultCtor; - @CordovaProperty() JordanCombinedRecognizer: JordanCombinedRecognizerCtor; - @CordovaProperty() JordanIdBackRecognizerResult: JordanIdBackRecognizerResultCtor; - @CordovaProperty() JordanIdBackRecognizer: JordanIdBackRecognizerCtor; - @CordovaProperty() JordanIdFrontRecognizerResult: JordanIdFrontRecognizerResultCtor; - @CordovaProperty() JordanIdFrontRecognizer: JordanIdFrontRecognizerCtor; - @CordovaProperty() KuwaitIdBackRecognizerResult: KuwaitIdBackRecognizerResultCtor; - @CordovaProperty() KuwaitIdBackRecognizer: KuwaitIdBackRecognizerCtor; - @CordovaProperty() KuwaitIdFrontRecognizerResult: KuwaitIdFrontRecognizerResultCtor; - @CordovaProperty() KuwaitIdFrontRecognizer: KuwaitIdFrontRecognizerCtor; - @CordovaProperty() MalaysiaDlFrontRecognizerResult: MalaysiaDlFrontRecognizerResultCtor; - @CordovaProperty() MalaysiaDlFrontRecognizer: MalaysiaDlFrontRecognizerCtor; - @CordovaProperty() MalaysiaMyTenteraRecognizerResult: MalaysiaMyTenteraRecognizerResultCtor; - @CordovaProperty() MalaysiaMyTenteraRecognizer: MalaysiaMyTenteraRecognizerCtor; - @CordovaProperty() MexicoVoterIdFrontRecognizerResult: MexicoVoterIdFrontRecognizerResultCtor; - @CordovaProperty() MexicoVoterIdFrontRecognizer: MexicoVoterIdFrontRecognizerCtor; - @CordovaProperty() MoroccoIdBackRecognizerResult: MoroccoIdBackRecognizerResultCtor; - @CordovaProperty() MoroccoIdBackRecognizer: MoroccoIdBackRecognizerCtor; - @CordovaProperty() MoroccoIdFrontRecognizerResult: MoroccoIdFrontRecognizerResultCtor; - @CordovaProperty() MoroccoIdFrontRecognizer: MoroccoIdFrontRecognizerCtor; - @CordovaProperty() MrtdCombinedRecognizerResult: MrtdCombinedRecognizerResultCtor; - @CordovaProperty() MrtdCombinedRecognizer: MrtdCombinedRecognizerCtor; - @CordovaProperty() MrtdRecognizerResult: MrtdRecognizerResultCtor; - @CordovaProperty() MrtdRecognizer: MrtdRecognizerCtor; - @CordovaProperty() MyKadBackRecognizerResult: MyKadBackRecognizerResultCtor; - @CordovaProperty() MyKadBackRecognizer: MyKadBackRecognizerCtor; - @CordovaProperty() MyKadFrontRecognizerResult: MyKadFrontRecognizerResultCtor; - @CordovaProperty() MyKadFrontRecognizer: MyKadFrontRecognizerCtor; - @CordovaProperty() NewZealandDlFrontRecognizerResult: NewZealandDlFrontRecognizerResultCtor; - @CordovaProperty() NewZealandDlFrontRecognizer: NewZealandDlFrontRecognizerCtor; - @CordovaProperty() Pdf417RecognizerResult: Pdf417RecognizerResultCtor; - @CordovaProperty() Pdf417Recognizer: Pdf417RecognizerCtor; - @CordovaProperty() PolandCombinedRecognizerResult: PolandCombinedRecognizerResultCtor; - @CordovaProperty() PolandCombinedRecognizer: PolandCombinedRecognizerCtor; - @CordovaProperty() PolandIdBackRecognizerResult: PolandIdBackRecognizerResultCtor; - @CordovaProperty() PolandIdBackRecognizer: PolandIdBackRecognizerCtor; - @CordovaProperty() PolandIdFrontRecognizerResult: PolandIdFrontRecognizerResultCtor; - @CordovaProperty() PolandIdFrontRecognizer: PolandIdFrontRecognizerCtor; - @CordovaProperty() RomaniaIdFrontRecognizerResult: RomaniaIdFrontRecognizerResultCtor; - @CordovaProperty() RomaniaIdFrontRecognizer: RomaniaIdFrontRecognizerCtor; - @CordovaProperty() SerbiaCombinedRecognizerResult: SerbiaCombinedRecognizerResultCtor; - @CordovaProperty() SerbiaCombinedRecognizer: SerbiaCombinedRecognizerCtor; - @CordovaProperty() SerbiaIdBackRecognizerResult: SerbiaIdBackRecognizerResultCtor; - @CordovaProperty() SerbiaIdBackRecognizer: SerbiaIdBackRecognizerCtor; - @CordovaProperty() SerbiaIdFrontRecognizerResult: SerbiaIdFrontRecognizerResultCtor; - @CordovaProperty() SerbiaIdFrontRecognizer: SerbiaIdFrontRecognizerCtor; - @CordovaProperty() SimNumberRecognizerResult: SimNumberRecognizerResultCtor; - @CordovaProperty() SimNumberRecognizer: SimNumberRecognizerCtor; - @CordovaProperty() SingaporeChangiEmployeeIdRecognizerResult: SingaporeChangiEmployeeIdRecognizerResultCtor; - @CordovaProperty() SingaporeChangiEmployeeIdRecognizer: SingaporeChangiEmployeeIdRecognizerCtor; - @CordovaProperty() SingaporeCombinedRecognizerResult: SingaporeCombinedRecognizerResultCtor; - @CordovaProperty() SingaporeCombinedRecognizer: SingaporeCombinedRecognizerCtor; - @CordovaProperty() SingaporeDlFrontRecognizerResult: SingaporeDlFrontRecognizerResultCtor; - @CordovaProperty() SingaporeDlFrontRecognizer: SingaporeDlFrontRecognizerCtor; - @CordovaProperty() SingaporeIdBackRecognizerResult: SingaporeIdBackRecognizerResultCtor; - @CordovaProperty() SingaporeIdBackRecognizer: SingaporeIdBackRecognizerCtor; - @CordovaProperty() SingaporeIdFrontRecognizerResult: SingaporeIdFrontRecognizerResultCtor; - @CordovaProperty() SingaporeIdFrontRecognizer: SingaporeIdFrontRecognizerCtor; - @CordovaProperty() SlovakiaCombinedRecognizerResult: SlovakiaCombinedRecognizerResultCtor; - @CordovaProperty() SlovakiaCombinedRecognizer: SlovakiaCombinedRecognizerCtor; - @CordovaProperty() SlovakiaIdBackRecognizerResult: SlovakiaIdBackRecognizerResultCtor; - @CordovaProperty() SlovakiaIdBackRecognizer: SlovakiaIdBackRecognizerCtor; - @CordovaProperty() SlovakiaIdFrontRecognizerResult: SlovakiaIdFrontRecognizerResultCtor; - @CordovaProperty() SlovakiaIdFrontRecognizer: SlovakiaIdFrontRecognizerCtor; - @CordovaProperty() SloveniaCombinedRecognizerResult: SloveniaCombinedRecognizerResultCtor; - @CordovaProperty() SloveniaCombinedRecognizer: SloveniaCombinedRecognizerCtor; - @CordovaProperty() SloveniaIdBackRecognizerResult: SloveniaIdBackRecognizerResultCtor; - @CordovaProperty() SloveniaIdBackRecognizer: SloveniaIdBackRecognizerCtor; - @CordovaProperty() SloveniaIdFrontRecognizerResult: SloveniaIdFrontRecognizerResultCtor; - @CordovaProperty() SloveniaIdFrontRecognizer: SloveniaIdFrontRecognizerCtor; - @CordovaProperty() SpainDlFrontRecognizerResult: SpainDlFrontRecognizerResultCtor; - @CordovaProperty() SpainDlFrontRecognizer: SpainDlFrontRecognizerCtor; - @CordovaProperty() SwedenDlFrontRecognizerResult: SwedenDlFrontRecognizerResultCtor; - @CordovaProperty() SwedenDlFrontRecognizer: SwedenDlFrontRecognizerCtor; - @CordovaProperty() SwitzerlandDlFrontRecognizerResult: SwitzerlandDlFrontRecognizerResultCtor; - @CordovaProperty() SwitzerlandDlFrontRecognizer: SwitzerlandDlFrontRecognizerCtor; - @CordovaProperty() SwitzerlandDlBackRecognizerResult: SwitzerlandDlBackRecognizerResultCtor; - @CordovaProperty() SwitzerlandDlBackRecognizer: SwitzerlandDlBackRecognizerCtor; - @CordovaProperty() SwitzerlandIdFrontRecognizerResult: SwitzerlandIdFrontRecognizerResultCtor; - @CordovaProperty() SwitzerlandIdFrontRecognizer: SwitzerlandIdFrontRecognizerCtor; - @CordovaProperty() SwitzerlandPassportRecognizerResult: SwitzerlandPassportRecognizerResultCtor; - @CordovaProperty() SwitzerlandPassportRecognizer: SwitzerlandPassportRecognizerCtor; - @CordovaProperty() UnitedArabEmiratesDlFrontRecognizerResult: UnitedArabEmiratesDlFrontRecognizerResultCtor; - @CordovaProperty() UnitedArabEmiratesDlFrontRecognizer: UnitedArabEmiratesDlFrontRecognizerCtor; - @CordovaProperty() UnitedArabEmiratesIdBackRecognizerResult: UnitedArabEmiratesIdBackRecognizerResultCtor; - @CordovaProperty() UnitedArabEmiratesIdBackRecognizer: UnitedArabEmiratesIdBackRecognizerCtor; - @CordovaProperty() UnitedArabEmiratesIdFrontRecognizerResult: UnitedArabEmiratesIdFrontRecognizerResultCtor; - @CordovaProperty() UnitedArabEmiratesIdFrontRecognizer: UnitedArabEmiratesIdFrontRecognizerCtor; - @CordovaProperty() VinRecognizerResult: VinRecognizerResultCtor; - @CordovaProperty() VinRecognizer: VinRecognizerCtor; - @CordovaProperty() UsdlRecognizerResult: UsdlRecognizerResultCtor; - @CordovaProperty() UsdlRecognizer: UsdlRecognizerCtor; - @CordovaProperty() UsdlCombinedRecognizerResult: UsdlCombinedRecognizerResultCtor; - @CordovaProperty() UsdlCombinedRecognizer: UsdlCombinedRecognizerCtor; - @CordovaProperty() BlinkIdRecognizer: BlinkIdRecognizerCtor; - @CordovaProperty() BlinkIdOverlaySettings: BlinkIdOverlaySettingsCtor; - @CordovaProperty() BlinkIdRecognizerResult: BlinkIdRecognizerResultCtor; -} diff --git a/src/@awesome-cordova-plugins/plugins/bluetooth-classic-serial-port/index.ts b/src/@awesome-cordova-plugins/plugins/bluetooth-classic-serial-port/index.ts deleted file mode 100644 index 606545b0..00000000 --- a/src/@awesome-cordova-plugins/plugins/bluetooth-classic-serial-port/index.ts +++ /dev/null @@ -1,358 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface BluetoothClassicSerialPortDevice { - id: string; - class?: string | number; - address?: string; - name?: string; - protocols?: string[]; // ios only - [p: string]: any; -} - -/** - * @name Bluetooth Classic Serial Port - * @description This plugin is written using the iOS Accessory Framework (MFi) to support Classic Bluetooth on iOS. - * @usage - * ```typescript - * import { BluetoothClassicSerialPort } from '@awesome-cordova-plugins/bluetooth-classic-serial-port/ngx'; - * - * constructor(private bluetoothClassicSerialPort: BluetoothClassicSerialPort) { } - * - * - * // Write a string - * this.bluetoothClassicSerialPort.write("00001101-0000-1000-8000-00805F9B34FB", "hello, world", success, failure); - * - * // Array of int or bytes - * this.bluetoothClassicSerialPort.write("00001101-0000-1000-8000-00805F9B34FB", [186, 220, 222], success, failure); - * - * // Typed Array - * var data = new Uint8Array(4); - * data[0] = 0x41; - * data[1] = 0x42; - * data[2] = 0x43; - * data[3] = 0x44; - * this.bluetoothClassicSerialPort.write(interfaceId, data, success, failure); - * - * // Array Buffer - * this.bluetoothClassicSerialPort.write(interfaceId, data.buffer, success, failure); - * ``` - * - * // iOS select accessory - * - * ```typescript - * async selectAccessory() { - * const deviceDiscovery = this.bluetoothClassicSerialPort.setDeviceDiscoveredListener().subscribe(async (connectionConfig) => { - * deviceDiscovery.unsubscribe(); - * }) - * - * await this.bluetoothClassicSerialPort.discoverUnpaired().catch(error => { - * deviceDiscovery.unsubscribe(); - * }) - * - * } - * ``` - */ -@Plugin({ - pluginName: 'BluetoothClassicSerialPort', - repo: 'https://github.com/MaximBelov/cordova-plugin-bluetooth-classic-serial-port', - plugin: 'cordova-plugin-bluetooth-classic-serial-port', - pluginRef: 'bluetoothClassicSerial', - platforms: ['Android', 'iOS', 'Browser'], -}) -@Injectable() -export class BluetoothClassicSerialPort extends AwesomeCordovaNativePlugin { - /** - * Connect to a Bluetooth device - * - * @param {string} deviceId Identifier of the remote device. - * @param {string} deviceId this is the MAC address. - * @param {string|string[]} interfaceId Identifier of the remote device - * @param {string|string[]} interfaceId This identifies the serial port to connect to. - * @returns {Observable} Subscribe to connect. - */ - @Cordova({ - platforms: ['Android', 'iOS'], - observable: true, - }) - connect(deviceId: string | number, interfaceId: string | string[]): Observable { - return; - } - - /** - * Connect to a Bluetooth device - * - * @deprecated - * @param {string} deviceId Identifier of the remote device. - * @param {number} deviceId this is the connection ID - * @param {string|string[]} interfaceArray Identifier of the remote device - * @param {string|string[]} interfaceArray this is the Protocol String - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - methodName: 'connect', - }) - connectIos(deviceId: string | number, interfaceArray: string | string[]): Promise { - return; - } - - /** - * Connect insecurely to a Bluetooth device - * - * @param {string} deviceId Identifier of the remote device. For Android this is the MAC address - * @param {string | string[]} interfaceArray This identifies the serial port to connect to. For Android this is the SPP_UUID. - * @returns {Promise} Subscribe to connect. - */ - @Cordova({ - platforms: ['Android'], - observable: true, - }) - connectInsecure(deviceId: string, interfaceArray: string | string[]): Promise { - return; - } - - /** - * Disconnect from the connected device - * - * @param {string} interfaceId The interface to Disconnect - * @returns {Promise} - */ - @Cordova() - disconnect(interfaceId: string | string[]): Promise { - return; - } - - /** - * Disconnect from all the connected device - * - * @returns {Promise} - */ - @Cordova({ - methodName: 'connect', - }) - disconnectAll(): Promise { - return; - } - - /** - * Writes data to the serial port - * - * @param {string} interfaceId The interface to send the data to - * @param {ArrayBuffer | string | number[] | Uint8Array} data ArrayBuffer of data - * @returns {Promise} returns a promise when data has been written - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - write(interfaceId: string, data: ArrayBuffer | string | number[] | Uint8Array): Promise { - return; - } - - /** - * Gets the number of bytes of data available - * - * @param {string} interfaceId The interface to check - * @returns {Promise} returns a promise that contains the available bytes - */ - @Cordova({ - platforms: ['Android', 'Browser'], - }) - available(interfaceId: string): Promise { - return; - } - - /** - * Function read reads the data from the buffer. The data is passed to the success callback as a String. Calling read when no data is available will pass an empty String to the callback. - * - * @param {string} interfaceId The interface to read - * @returns {Promise} returns a promise with data from the buffer - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - read(interfaceId: string): Promise { - return; - } - - /** - * Reads data from the buffer until it reaches a delimiter - * - * @param {string} interfaceId The interface to read - * @param {string} delimiter string that you want to search until - * @returns {Observable} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - readUntil(interfaceId: string, delimiter: string): Observable { - return; - } - - /** - * Subscribe to be notified when data is received - * - * @param {string | string[]} interfaceId The interface to subscribe to - * @param {string} delimiter the string you want to watch for - * @returns {Observable} returns an observable. - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - observable: true, - }) - subscribe(interfaceId: string | string[], delimiter: string): Observable { - return; - } - - /** - * Unsubscribe from a subscription - * - * @param {string | string[]} interfaceId The interface to unsubscribe from - * @returns {Promise} returns an promise. - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - unsubscribe(interfaceId: string | string[]): Promise { - return; - } - - /** - * Subscribe to be notified when data is received - * - * @param {string | string[]} interfaceId The interface to subscribe to - * @returns {Observable} returns an observable - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - observable: true, - }) - subscribeRawData(interfaceId: string | string[]): Observable { - return; - } - - /** - * Unsubscribe from a subscription - * - * @param {string | string[]} interfaceId The interface to unsubscribe from - * @returns {Promise} returns an promise. - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - unsubscribeRawData(interfaceId: string | string[]): Promise { - return; - } - - /** - * Clears data in buffer - * - * @param {string} interfaceId The interface to clear data - * @returns {Promise} returns a promise when completed - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - clear(interfaceId: string): Promise<[]> { - return; - } - - /** - * Lists bonded devices - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - list(): Promise { - return; - } - - /** - * Reports the connection status - * - * @param {string} interfaceId The interface to check - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - isConnected(interfaceId: string): Promise { - return; - } - - /** - * Reports if bluetooth is enabled - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - isEnabled(): Promise { - return; - } - - /** - * Show the Bluetooth settings on the device - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android'], - }) - showBluetoothSettings(): Promise { - return; - } - - /** - * Enable Bluetooth on the device - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'Browser'], - }) - enable(): Promise { - return; - } - - /** - * Discover unpaired devices - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - }) - discoverUnpaired(): Promise { - return; - } - - /** - * Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function. - * - * @returns {Observable} Returns an observable - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - observable: true, - clearFunction: 'clearDeviceDiscoveredListener', - }) - setDeviceDiscoveredListener(): Observable { - return; - } - - /** - * Clears notify callback function registered with setDeviceDiscoveredListener. - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Browser'], - sync: true, - }) - clearDeviceDiscoveredListener() { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/bluetooth-le/index.ts b/src/@awesome-cordova-plugins/plugins/bluetooth-le/index.ts deleted file mode 100644 index 7cf9e0c7..00000000 --- a/src/@awesome-cordova-plugins/plugins/bluetooth-le/index.ts +++ /dev/null @@ -1,1175 +0,0 @@ -import { Injectable } from '@angular/core'; -import { AwesomeCordovaNativePlugin, Cordova, CordovaProperty, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/* Available status of device */ -export type Status = - | 'scanStarted' - | 'scanStopped' - | 'scanResult' - | 'connected' - | 'disconnected' - | 'bonding' - | 'bonded' - | 'unbonded' - | 'closed' - | 'services' - | 'discovered' - | 'characteristics' - | 'descriptors' - | 'read' - | 'subscribed' - | 'unsubscribed' - | 'subscribedResult' - | 'written' - | 'readDescriptor' - | 'writeDescriptor' - | 'rssi' - | 'mtu' - | 'connectionPriorityRequested' - | 'enabled' - | 'disabled' - | 'readRequested' - | 'writeRequested' - | 'mtuChanged' - | 'notifyReady' - | 'notifySent' - | 'serviceAdded' - | 'serviceRemoved' - | 'allServicesRemoved' - | 'advertisingStarted' - | 'advertisingStopped' - | 'responded' - | 'notified' - | 'notificationSent'; - -/** Available connection priorities */ -export type ConnectionPriority = 'low' | 'balanced' | 'high'; - -export interface Params { - /** The address/identifier provided by the scan's return object */ - address: string; - /** The service's ID */ - service: string; -} - -export interface InitPeripheralParams { - /** Should user be prompted to enable Bluetooth */ - request?: boolean; - /* A unique string to identify your app. Bluetooth Central background mode is required to use this, but background mode doesn't seem to require specifying the restoreKey */ - restoreKey?: string; -} - -export interface InitParams extends InitPeripheralParams { - /** Should change in Bluetooth status notifications be sent */ - statusReceiver?: boolean; -} - -export interface ScanParams { - /* An array of service IDs to filter the scan or empty array / null. This parameter is not supported on Windows platform yet */ - services?: string[]; - /* True/false to allow duplicate advertisement packets, defaults to false (iOS)*/ - allowDuplicates?: boolean; - /** Defaults to Low Power. Available from API21 / API 23 (Android) */ - scanMode?: BluetoothScanMode; - /** Defaults to Aggressive. Available from API23 (Android) */ - matchMode?: BluetoothMatchMode; - /** Defaults to One Advertisement. Available from API23 (Android) */ - matchNum?: BluetoothMatchNum; - /** Defaults to All Matches. Available from API21 / API 23. (Android) */ - callbackType?: BluetoothCallbackType; - /** True/false to show only connectable devices, rather than all devices ever seen, defaults to false (Windows) */ - isConnectable?: boolean; -} - -export interface NotifyParams { - /** Service's UUID */ - service: string; - /** Characteristic's UUID */ - characteristic: string; - /** Base64 encoded string, number or string */ - value: string; - /** Android only: address of the device the notification should be sent to. */ - address?: string; -} - -export interface RespondParams { - /** This integer value will be incremented every read/writeRequested */ - requestId: number; - /** base64 string */ - value: string; - /** not documented */ - offset?: number; -} - -export interface ConnectionParams { - /** The address/identifier provided by the scan's return object */ - address: string; - /** Automatically connect as soon as the remote device becomes available (Android) */ - autoConnect?: boolean; - /** - * Transport mode. Available from API 23 (Android). - * If none is specified the default behavior is TRANSPORT_AUTO - * - * Note: On Android 10, TRANSPORT_AUTO can lead to connection errors with Status code 133. - * In this case TRANSPORT_LE can be used. - */ - transport?: AndroidGattTransportMode; -} - -export enum AndroidGattTransportMode { - /** - * No preference of physical transport for GATT connections to remote dual-mode devices - */ - TRANSPORT_AUTO = 0, - - /** - * Prefer BR/EDR transport for GATT connections to remote dual-mode devices - */ - TRANSPORT_BREDR = 1, - - /** - * Prefer LE transport for GATT connections to remote dual-mode devices - */ - TRANSPORT_LE = 2, -} - -export interface CharacteristicParams extends Params { - /** An array of characteristic IDs to discover or empty array / null */ - characteristics?: string[]; -} - -export interface DescriptorParams extends Params { - /** The characteristic's ID */ - characteristic: string; -} - -export interface OperationDescriptorParams extends DescriptorParams { - /** The descriptor's ID */ - descriptor: string; -} - -export interface WriteCharacteristicParams extends DescriptorParams { - /* Base64 encoded string */ - value: string; - /* Set to "noResponse" to enable write without response, all other values will write normally. */ - type?: string; -} - -export interface WriteDescriptorParams extends DescriptorParams { - /** The descriptor's ID */ - descriptor: string; - /** Base64 encoded string, number or string */ - value: string; -} - -export type AdvertisingParams = AdvertisingParamsAndroid | AdvertisingParamsIOS; -export type AdvertiseMode = 'balanced' | 'lowLatency' | 'lowPower'; -export type TxPowerLevel = 'high' | 'low' | 'ultralow' | 'medium'; - -export interface AdvertisingParamsAndroid { - /** Service UUID on Android */ - service: string; - /** not documented */ - mode?: AdvertiseMode; - /** not documented */ - connectable?: boolean; - /** not documented */ - timeout?: number; - /** not documented */ - txPowerLevel?: TxPowerLevel; - /** not documented */ - manufacturerId?: number; - /** not documented */ - manufacturerSpecificData?: any; - /** not documented */ - includeDeviceName: boolean; - /** not documented */ - includeTxPowerLevel: boolean; -} - -export interface AdvertisingParamsIOS { - /** Array of service UUIDs on iOS */ - services: string[]; - /** device's name */ - name?: string; -} - -export interface CommonInfo { - /** The device's display name */ - name: string; - /** The device's address / identifier for connecting to the object */ - address: string; -} - -export interface DeviceInfo extends CommonInfo { - /** Device's status */ - status: Status; -} - -export interface RSSI extends DeviceInfo { - /** signal strength */ - rssi: number; -} - -export interface MTU extends DeviceInfo { - /* mtu value */ - mtu: number; -} - -export interface BondedStatus extends CommonInfo { - /* Bonded status*/ - isBonded: boolean; -} - -export interface PrevConnectionStatus extends CommonInfo { - /** Determine whether the device was connected */ - wasConnected: boolean; -} - -export interface CurrConnectionStatus extends CommonInfo { - /** Determine whether the device is connected */ - isConnected: boolean; -} - -export interface DiscoverStatus extends CommonInfo { - /** Determine whether the device's characteristics and descriptors have been discovered */ - isDiscovered: boolean; -} - -export interface ScanStatus extends DeviceInfo { - /** signal strength */ - rssi: number; - /** - * advertisement data in encoded string of bytes, use bluetoothle.encodedStringToBytes() (Android) - * advertisement hash with the keys (iOS) - * empty (Windows) - */ - advertisement: - | { - /** An array of service UUIDs */ - serviceUuids: string[]; - /** A string representing the name of the manufacturer of the device */ - manufacturerData: string; - /** A number containing the transmit power of a peripheral */ - txPowerLevel: number; - /** An array of one or more CBUUID objects, representing CBService UUIDs that were found in the “overflow” area of the advertisement data */ - overflowServiceUuids: string[]; - /** A boolean value that indicates whether the advertising event type is connectable */ - isConnectable: boolean; - /** An array of one or more CBUUID objects, representing CBService UUIDs */ - solicitedServiceUuids: string[]; - /* A dictionary containing service-specific advertisement data */ - serviceData: any; - /* A string containing the local name of a peripheral */ - localName: string; - } - | string; -} - -export interface Service { - /** Service's uuid */ - uuid: string; - /** Array of characteristics */ - characteristics: Characteristic[]; -} - -export interface Characteristic { - /* Array of descriptors */ - descriptors?: Descriptor[]; - /** Characteristic's uuid */ - uuid: string; - /** - * Characteristic's properties - * If the property is defined as a key, the characteristic has that property - */ - properties?: { - write?: boolean; - broadcast?: boolean; - extendedProps?: boolean; - writeWithoutResponse?: boolean; - writeNoResponse?: boolean; - signedWrite?: boolean; - read?: boolean; - notify?: boolean; - indicate?: boolean; - authenticatedSignedWrites?: boolean; - notifyEncryptionRequired?: boolean; - indicateEncryptionRequired?: boolean; - }; - /** - * If the permission is defined as a key, the character has that permission - */ - permissions?: { - read?: boolean; - readEncrypted?: boolean; - readEncryptedMITM?: boolean; - write?: boolean; - writeSigned?: boolean; - writeSignedMITM?: boolean; - writeEncryptedMITM?: boolean; - readEncryptionRequired?: boolean; - writeEncryptionRequired?: boolean; - }; -} - -export interface Descriptor { - uuid: string; -} - -export interface Device extends DeviceInfo { - /** Device's services */ - services: Service[]; -} - -export interface Services extends DeviceInfo { - /** Array of service UUIDS */ - services: string[]; -} - -export interface Descriptors extends DeviceInfo { - /** Characteristic's UUID */ - characteristic: string; - /** Service's UUID */ - service: string; - /* Array of descriptor UUIDs */ - descriptors: string[]; -} - -export interface OperationResult extends DeviceInfo { - /** Characteristic UUID */ - characteristic: string; - /** Service's UUID */ - service: string; - /** Base64 encoded string of bytes */ - value: string; -} - -export interface UnsubscribeResult extends DeviceInfo { - /** Characteristic UUID */ - characteristic: string; - /** Service's UUID */ - service: string; -} - -export interface DescriptorResult extends OperationResult { - descriptor: string; -} - -export interface Characteristics extends DeviceInfo { - /** Service's id */ - service: string; - /* Array of characteristic objects*/ - characteristics: Characteristic[]; -} - -export interface InitializeResult { - /** Device's status */ - status: Status; - /** The address/identifier provided by the scan's return object */ - address: string; - /** Service's UUID */ - service: string; - /** Characteristic UUID */ - characteristic: string; - /** This integer value will be incremented every read/writeRequested */ - requestId: number; - /** Offset value */ - offset: number; - /** mtu value */ - mtu: number; - /** Base64 encoded string of bytes */ - value: string; -} - -export enum BluetoothScanMode { - SCAN_MODE_OPPORTUNISTIC = -1, - SCAN_MODE_LOW_POWER = 0, - SCAN_MODE_BALANCED = 1, - SCAN_MODE_LOW_LATENCY = 2, -} - -export enum BluetoothMatchMode { - MATCH_MODE_AGRESSIVE = 1, - MATCH_MODE_STICKY = 2, -} - -export enum BluetoothMatchNum { - MATCH_NUM_ONE_ADVERTISEMENT = 1, - MATCH_NUM_FEW_ADVERTISEMENT = 2, - MATCH_NUM_MAX_ADVERTISEMENT = 3, -} - -export enum BluetoothCallbackType { - CALLBACK_TYPE_ALL_MATCHES = 1, - CALLBACK_TYPE_FIRST_MATCH = 2, - CALLBACK_TYPE_MATCH_LOST = 4, -} - -export interface Error { - code: number; - message: string; -} - -export interface AdapterInfo { - name: string; - address: string; - isInitialized: boolean; - isEnabled: boolean; - isScanning: boolean; - isDiscoverable: boolean; -} - -/** - * @name BluetoothLE - * @description - * This plugin has the most complete implementation for interacting with Bluetooth LE devices on Android, iOS and partially Windows. - * It's a wrap around [randdusing/cordova-plugin-bluetoothle](https://github.com/randdusing/cordova-plugin-bluetoothle/blob/master/readme.md) cordova plugin for Ionic. - * It supports peripheral **and** central modes and covers most of the API methods available on Android and iOS. - * @usage - * ```typescript - * import { BluetoothLE } from '@awesome-cordova-plugins/bluetooth-le/ngx'; - * - * - * constructor(public bluetoothle: BluetoothLE, public plt: Platform) { - * - * this.plt.ready().then((readySource) => { - * - * console.log('Platform ready from', readySource); - * - * this.bluetoothle.initialize().then(ble => { - * console.log('ble', ble.status) // logs 'enabled' - * }); - * - * }); - * } - * - * ``` - */ -@Plugin({ - pluginName: 'BluetoothLE', - plugin: 'cordova-plugin-bluetoothle', // npm package name, example: cordova-plugin-camera - pluginRef: 'bluetoothle', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/randdusing/cordova-plugin-bluetoothle', // the github repository URL for the plugin - install: 'ionic cordova plugin add cordova-plugin-bluetoothle', // OPTIONAL install command, in case the plugin requires variables - installVariables: [], // OPTIONAL the plugin requires variables - platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] -}) -@Injectable() -export class BluetoothLE extends AwesomeCordovaNativePlugin { - /** - * @name initialize - * Initialize Bluetooth on the device - * @param {InitParams} [params] - * @returns {(Observable<{ status: 'enabled' | 'disabled'}>)} The callback that is passed initialize status (enabled/disabled) - */ - @Cordova({ successIndex: 0, errorIndex: 2, observable: true }) - initialize(params?: InitParams): Observable<{ status: 'enabled' | 'disabled' }> { - return; - } - - /** - * @name enable (Android) - * Enable Bluetooth on the device. Android support only - * @returns void - */ - @Cordova({ callbackOrder: 'reverse', sync: true }) - enable() { - return; - } - - /** - * @name disable (Android) - * Disable Bluetooth on the device. Android support only - * @returns void - */ - @Cordova({ callbackOrder: 'reverse', sync: true }) - disable() { - return; - } - - /** - * @name getAdapterInfo (Android) - * Retrieve useful information such as the address, name, and various states (initialized, enabled, scanning, discoverable). - * This can be very useful when the general state of the adapter has been lost, and we would otherwise need to go through a series of callbacks to get the correct state (first initialized, then enabled, then isScanning, and so forth). - * The result of this method allows us to take business logic decisions while avoiding a large part of the callback hell. - * Currently the discoverable state does not have any relevance because there is no "setDiscoverable" functionality in place. That may change in the future. - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - getAdapterInfo(): Promise { - return; - } - - /** - * @name startScan - * Scan for Bluetooth LE devices. - * Since scanning is expensive, stop as soon as possible. The Cordova app should use a timer to limit the scan interval. - * Android API >= 23 requires ACCESS_COARSE_LOCATION permissions to find unpaired devices. - * Permissions can be requested by using the hasPermission and requestPermission functions. - * Android API >= 23 also requires location services to be enabled. Use isLocationEnabled to determine whether location services are enabled. - * If not enabled, use requestLocation to prompt the location services settings page. - * @param {ScanParams} params Scan params - * @returns {(Observable< ScanStatus >)} - */ - @Cordova({ callbackOrder: 'reverse', observable: true }) - startScan(params: ScanParams): Observable { - return; - } - - /** - * @name stopScan - * Stop scan for Bluetooth LE devices. Since scanning is expensive, stop as soon as possible - * The app should use a timer to limit the scanning time. - * @returns {Promise<{status: 'scanStopped'}>} - */ - @Cordova({ callbackOrder: 'reverse' }) - stopScan(): Promise<{ status: 'scanStopped' }> { - return; - } - - /** - * @name retrieveConnected - * @param params - * @param params.services - * Retrieved paired Bluetooth LE devices. In iOS, devices that are "paired" to will not return during a normal scan. - * Callback is "instant" compared to a scan. - * @param {{ services: string[] }} An array of service IDs to filter the retrieval by. If no service IDs are specified, no devices will be returned. - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - retrieveConnected(params?: { services?: string[] }): Promise { - return; - } - - /** - * @name bond (Android) - * @param params.address - * Bond with a device. - * The device doesn't need to be connected to initiate bonding. Android support only. - * @param {{ address: string }} params The address/identifier provided by the scan's return object - * @returns {(Observable)} - * success: - * The first success callback should always return with status == bonding. - * If the bond is created, the callback will return again with status == bonded. - * If the bonding popup is canceled or the wrong code is entered, the callback will return again with status == unbonded. - * error: - * The callback that will be triggered when the bond operation fails - */ - @Cordova({ callbackOrder: 'reverse', observable: true }) - bond(params: { address: string }): Observable { - return; - } - - /** - * @name unbond (Android) - * @param params.address - * Unbond with a device. The device doesn't need to be connected to initiate bonding. Android support only. - * @param {{address: string}} params The address/identifier - * @returns {Promise} - * success: The success callback should always return with status == unbonded, that is passed with device object - * error: The callback that will be triggered when the unbond operation fails - */ - @Cordova({ callbackOrder: 'reverse' }) - unbond(params: { address: string }): Promise { - return; - } - - /** - * @name connect - * Connect to a Bluetooth LE device - * @param connectSuccess The success callback that is passed with device object - * @param connectError The callback that will be triggered when the connect operation fails - * @param params The connection params - * @param {ConnectionParams} params - * @returns {(Observable)} - * success: device object with status - * error: The callback that will be triggered when the unbond operation fails - */ - @Cordova({ callbackOrder: 'reverse', observable: true }) - connect(params: ConnectionParams): Observable { - return; - } - - /** - * @name reconnect - * @param params.address - * Reconnect to a previously connected Bluetooth device - * @param {{address: string}} params The address/identifier - * @returns {(Observable)} - */ - @Cordova({ callbackOrder: 'reverse', observable: true }) - reconnect(params: { address: string }): Observable { - return; - } - - /** - * @name disconnect - * @param params.address - * Disconnect from a Bluetooth LE device. - * Note: It's simpler to just call close(). Starting with iOS 10, disconnecting before closing seems required! - * @param {{address: string}} params The address/identifier - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - disconnect(params: { address: string }): Promise { - return; - } - - /** - * @name close - * @param params.address - * Close/dispose a Bluetooth LE device. - * Prior to 2.7.0, you needed to disconnect to the device before closing, but this is no longer the case. - * Starting with iOS 10, disconnecting before closing seems required! - * @param {{ address: string }} params The address/identifier - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - close(params: { address: string }): Promise { - return; - } - - /** - * @name discover - * @param params.address - * @param params.clearCache - * Discover all the devices services, characteristics and descriptors. - * Doesn't need to be called again after disconnecting and then reconnecting. - * If using iOS, you shouldn't use discover and services/characteristics/descriptors on the same device. - * There seems to be an issue with calling discover on iOS8 devices, so use with caution. - * On some Android versions, the discovered services may be cached for a device. - * Subsequent discover events will make use of this cache. - * If your device's services change, set the clearCache parameter to force Android to re-discover services. - * @param {{ address: string, clearCache: boolean }} params The address/identifier - * @returns {Promise} - * success: device object (contains array of service objects) - * error: The callback that will be triggered when the unbond operation fails - */ - @Cordova({ callbackOrder: 'reverse' }) - discover(params: { address: string; clearCache?: boolean }): Promise { - return; - } - - /** - * @name services (iOS) - * @param params.address - * @param params.services - * Discover the device's services. - * Not providing an array of services will return all services and take longer to discover. iOS support only. - * @param {{address: string, services: string[]}} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - services(params: { address: string; services?: string[] }): Promise { - return; - } - - /** - * @name characteristics (iOS) - * Discover the service's characteristics. - * Not providing an array of characteristics will return all characteristics and take longer to discover. iOS support only. - * @param {CharacteristicParams} params Characteristic params - * @returns {Promise} The service id and an Array of characteristics - */ - @Cordova({ callbackOrder: 'reverse' }) - characteristics(params: CharacteristicParams): Promise { - return; - } - - /** - * @name descriptors (iOS) - * Discover the characteristic's descriptors. iOS support only. - * @param {DescriptorParams} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - descriptors(params: DescriptorParams): Promise { - return; - } - - /** - * @name read - * Read a particular service's characteristic once - * @param {DescriptorParams} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - read(params: DescriptorParams): Promise { - return; - } - - /** - * @name subscribe - * Subscribe to a particular service's characteristic. - * Once a subscription is no longer needed, execute unsubscribe in a similar fashion. - * The Client Configuration descriptor will automatically be written to enable notification/indication based on the characteristic's properties. - * @param {DescriptorParams} params - * @returns {Observable} - */ - @Cordova({ callbackOrder: 'reverse', observable: true }) - subscribe(params: DescriptorParams): Observable { - return; - } - - /** - * @name unsubscribe - * Unsubscribe to a particular service's characteristic. - * @param {DescriptorParams} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - unsubscribe(params: DescriptorParams): Promise { - return; - } - - /** - * @name write (limitation on iOS, read below) - * Write a particular service's characteristic - * Note: no callback will occur on write without response on iOS. - * @param {WriteCharacteristicParams} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - write(params: WriteCharacteristicParams): Promise { - return; - } - - /** - * @name write (limitation on iOS, read below) - * Write Quick / Queue, use this method to quickly execute write without response commands when writing more than 20 bytes at a time. - * Note: no callback will occur on write without response on iOS. - * @param {WriteCharacteristicParams} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - writeQ(params: WriteCharacteristicParams): Promise { - return; - } - - /** - * @name readDescriptor - * Read a particular characterist's descriptor - * @param {OperationDescriptorParams} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - readDescriptor(params: OperationDescriptorParams): Promise { - return; - } - - /** - * @name writeDescriptor - * Write a particular characteristic's descriptor. Unable to write characteristic configuration directly to keep in line with iOS implementation. - * Instead use subscribe/unsubscribe, which will automatically enable/disable notification. - * @param {WriteDescriptorParams} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - writeDescriptor(params: WriteDescriptorParams): Promise { - return; - } - - /** - * @name rssi - * @param params.address - * Read RSSI of a connected device. RSSI is also returned with scanning. - * @param {{ address: string }} params - * @returns {Promise< RSSI >} - */ - @Cordova({ callbackOrder: 'reverse' }) - rssi(params: { address: string }): Promise { - return; - } - - /** - * @name mtu (Android, Android 5+) - * @param params.address - * @param params.mtu - * Set MTU of a connected device. Android only. - * @param {{ address: string, mtu: number }} params - * @returns {Promise< MTU >} - */ - @Cordova({ callbackOrder: 'reverse' }) - mtu(params: { address: string; mtu?: number }): Promise { - return; - } - - /** - * @name requestConnectionPriority (Android, Android 5+) - * @param params.address - * @param params.connectionPriority - * Request a change in the connection priority to improve throughput when transfer large amounts of data via BLE. - * Android support only. iOS will return error. - * @param {{ address: string, connectionPriority: ConnectionPriority }} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - requestConnectionPriority(params: { address: string; connectionPriority: ConnectionPriority }): Promise { - return; - } - - /** - * @name isInitialized - * Determine whether the adapter is initialized. No error callback. Returns true or false - * @returns {Promise<{ isInitialized: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - isInitialized(): Promise<{ isInitialized: boolean }> { - return; - } - - /** - * @name isEnabled - * Determine whether the adapter is enabled. No error callback - * @returns {Promise<{ isEnabled: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - isEnabled(): Promise<{ isEnabled: boolean }> { - return; - } - - /** - * @name isScanning - * Determine whether the adapter is scanning. No error callback. Returns true or false - * @returns {Promise<{ isScanning: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - isScanning(): Promise<{ isScanning: boolean }> { - return; - } - - /** - * @name isBonded (Android) - * @param params.address - * Determine whether the device is bonded or not, or error if not initialized. Android support only. - * @param {{ address: string }} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - isBonded(params: { address: string }): Promise { - return; - } - - /** - * @name wasConnected - * @param params.address - * Determine whether the device was connected, or error if not initialized. - * @param {{ address: string }} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - wasConnected(params: { address: string }): Promise { - return; - } - - /** - * @name isConnected - * @param params.address - * Determine whether the device is connected, or error if not initialized or never connected to device - * @param {{ address: string }} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - isConnected(params: { address: string }): Promise { - return; - } - - /** - * @name isDiscovered - * @param params.address - * Determine whether the device's characteristics and descriptors have been discovered, or error if not initialized or not connected to device. - * @param {{ address: string }} params - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - isDiscovered(params: { address: string }): Promise { - return; - } - - /** - * @name hasPermission (useful only for Android 6+ / API 23) - * Determine whether coarse location privileges are granted since scanning for unpaired devices requires it in Android API 23 - * @returns {Promise<{ hasPermission: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - hasPermission(): Promise<{ hasPermission: boolean }> { - return; - } - - /** - * @name requestPermission (useful only for Android 6+ / API 23) - * Request coarse location privileges since scanning for unpaired devices requires it in Android API 23. - * Will return an error if called on iOS or Android versions prior to 6.0. - * @returns {Promise<{ requestPermission: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - requestPermission(): Promise<{ requestPermission: boolean }> { - return; - } - - /** - * @name isLocationEnabled (useful only for Android 6+ / API 23) - * Determine if location services are enabled or not. Location Services are required to find devices in Android API 23 - * @returns {Promise<{ isLocationEnabled: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - isLocationEnabled(): Promise<{ isLocationEnabled: boolean }> { - return; - } - - /** - * @name requestLocation (useful only for Android 6+ / API 23) - * Prompt location services settings pages. requestLocation property returns whether location services are enabled or disabled. - * Location Services are required to find devices in Android API 23. - * @returns {Promise<{ requestLocation: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - requestLocation(): Promise<{ requestLocation: boolean }> { - return; - } - - /** - * @name hasPermissionBtScan (useful only for Android 12+ / API 31+) - * Determine whether scan privileges in Android API 31+ - * Will return an error if called on iOS or Android versions prior to 12.0. - * @returns {Promise<{ hasPermission: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - hasPermissionBtScan(): Promise<{ hasPermission: boolean }> { - return; - } - - /** - * @name requestPermissionBtScan (useful only for Android 12+ / API 31) - * Request scan privileges in Android API 31. - * Will return an error if called on iOS or Android versions prior to 12.0. - * @returns {Promise<{ requestPermission: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - requestPermissionBtScan(): Promise<{ requestPermission: boolean }> { - return; - } - - /** - * @name hasPermissionBtConnect (useful only for Android 12+ / API 31) - * Determine if device has the permission to connect or not. - * Will return an error if called on iOS or Android versions prior to 12.0. - * @returns {Promise<{ hasPermission: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - hasPermissionBtConnect(): Promise<{ hasPermission: boolean }> { - return; - } - - /** - * @name requestPermissionBtConnect (useful only for Android 12+ / API 31) - * Prompt permission settings page. requestPermissionBtConnect property returns whether connect permission has been granted or not. - * Will return an error if called on iOS or Android versions prior to 12.0. - * @returns {Promise<{ requestPermission: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - requestPermissionBtConnect(): Promise<{ requestPermission: boolean }> { - return; - } - - /** - * @name hasPermissionBtAdvertise (useful only for Android 12+ / API 31) - * Determine if device has the permission to advertise or not. - * Will return an error if called on iOS or Android versions prior to 12.0. - * @returns {Promise<{ hasPermission: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - hasPermissionBtAdvertise(): Promise<{ hasPermission: boolean }> { - return; - } - - /** - * @name requestPermissionBtAdvertise (useful only for Android 12+ / API 31) - * Prompt permission settings page. requestPermissionBtAdvertise property returns whether connect permission has been granted or not. - * Will return an error if called on iOS or Android versions prior to 12.0. - * @returns {Promise<{ requestPermission: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - requestPermissionBtAdvertise(): Promise<{ requestPermission: boolean }> { - return; - } - - /** - * @name initializePeripheral - * Initialize Bluetooth on the device. Must be called before anything else. - * Callback will continuously be used whenever Bluetooth is enabled or disabled. - * @param {InitPeripheralParams} [params] - * @returns {Observable} - */ - @Cordova({ callbackOrder: 'reverse', observable: true }) - initializePeripheral(params?: InitPeripheralParams): Observable { - return; - } - - /** - * @name addService - * @param params.service - * @param params.characteristics - * Add a service with characteristics and descriptors. If more than one service is added, add them sequentially - * @param {{ service: string, characteristics: Characteristic[] }} params - * @returns {Promise<{ service: string, status: Status }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - addService(params: { - service: string; - characteristics: Characteristic[]; - }): Promise<{ service: string; status: Status }> { - return; - } - - /** - * @name removeService - * @param params.service - * Remove a service - * @param {{ service: string }} params - * @returns {Promise<{ service: string, status: Status }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - removeService(params: { service: string }): Promise<{ service: string; status: Status }> { - return; - } - - /** - * @name removeAllServices - * Remove all services - * @returns {Promise<{ status: Status }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - removeAllServices(): Promise<{ status: Status }> { - return; - } - - /** - * @name startAdvertising (different behavior on Android/iOS, read below) - * Start advertising as a BLE device. - * Note: This needs to be improved so services can be used for both Android and iOS. - * On iOS, the advertising devices likes to rename itself back to the name of the device, i.e. Rand' iPhone - * @param {AdvertisingParams} params - * @returns {Promise<{ status: Status }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - startAdvertising(params: AdvertisingParams): Promise<{ status: Status }> { - return; - } - - /** - * @name stopAdvertising - * Stop advertising - * @returns {Promise<{ status: Status }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - stopAdvertising(): Promise<{ status: Status }> { - return; - } - - /** - * @name isAdvertising - * Determine if app is advertising or not. - * @returns {Promise<{ status: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - isAdvertising(): Promise<{ status: boolean }> { - return; - } - - /** - * @name respond - * Respond to a read or write request - * @param {RespondParams} params - * @returns {Promise<{ status: Status }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - respond(params: RespondParams): Promise<{ status: Status }> { - return; - } - - /** - * @name notify - * Update a value for a subscription. Currently all subscribed devices will receive update. - * Device specific updates will be added in the future. - * If sent equals false in the return value, you must wait for the peripheralManagerIsReadyToUpdateSubscribers event before sending more updates. - * @param {NotifyParams} params - * @returns {Promise<{ status: Status, sent: boolean }>} - */ - @Cordova({ callbackOrder: 'reverse' }) - notify(params: NotifyParams): Promise<{ status: Status; sent: boolean }> { - return; - } - - /** - * @name encodedStringToBytes - * @param value - * Helper function to convert a base64 encoded string from a characteristic or descriptor value into a uint8Array object - * @param {string} str - * @returns {Uint8Array} - */ - @Cordova({ sync: true }) - encodedStringToBytes(value: string): Uint8Array { - return; - } - - /** - * @name bytesToEncodedString - * @param value - * Helper function to convert a unit8Array to a base64 encoded string for a characteric or descriptor write - * @param {Uint8Array} bytes - * @returns {string} - */ - @Cordova({ sync: true }) - bytesToEncodedString(value: Uint8Array): string { - return; - } - - /** - * @name stringToBytes - * Helper function to convert a string to bytes - * @param {string} value - * @returns {Uint8Array} - */ - @Cordova({ sync: true }) - stringToBytes(value: string): Uint8Array { - return; - } - - /** - * @name bytesToString - * Helper function to convert bytes to a string. - * @param {Uint8Array} value - * @returns {string} - */ - @Cordova({ sync: true }) - bytesToString(value: Uint8Array): string { - return; - } - - @CordovaProperty() - SCAN_MODE_OPPORTUNISTIC: number; - @CordovaProperty() - SCAN_MODE_LOW_POWER: number; - @CordovaProperty() - SCAN_MODE_BALANCED: number; - @CordovaProperty() - SCAN_MODE_LOW_LATENCY: number; - @CordovaProperty() - MATCH_MODE_AGGRESSIVE: number; - @CordovaProperty() - MATCH_MODE_STICKY: number; - @CordovaProperty() - MATCH_NUM_ONE_ADVERTISEMENT: number; - @CordovaProperty() - MATCH_NUM_FEW_ADVERTISEMENT: number; - @CordovaProperty() - MATCH_NUM_MAX_ADVERTISEMENT: number; - @CordovaProperty() - CALLBACK_TYPE_ALL_MATCHES: number; - @CordovaProperty() - CALLBACK_TYPE_FIRST_MATCH: number; - @CordovaProperty() - CALLBACK_TYPE_MATCH_LOST: number; -} diff --git a/src/@awesome-cordova-plugins/plugins/bluetooth-serial/index.ts b/src/@awesome-cordova-plugins/plugins/bluetooth-serial/index.ts deleted file mode 100644 index 56d93aa4..00000000 --- a/src/@awesome-cordova-plugins/plugins/bluetooth-serial/index.ts +++ /dev/null @@ -1,292 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name Bluetooth Serial - * @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino (not Android to Android or iOS to iOS). - * @usage - * ```typescript - * import { BluetoothSerial } from '@awesome-cordova-plugins/bluetooth-serial/ngx'; - * - * constructor(private bluetoothSerial: BluetoothSerial) { } - * - * - * // Write a string - * this.bluetoothSerial.write('hello world').then(success, failure); - * - * // Array of int or bytes - * this.bluetoothSerial.write([186, 220, 222]).then(success, failure); - * - * // Typed Array - * var data = new Uint8Array(4); - * data[0] = 0x41; - * data[1] = 0x42; - * data[2] = 0x43; - * data[3] = 0x44; - * this.bluetoothSerial.write(data).then(success, failure); - * - * // Array Buffer - * this.bluetoothSerial.write(data.buffer).then(success, failure); - * ``` - */ -@Plugin({ - pluginName: 'BluetoothSerial', - repo: 'https://github.com/don/BluetoothSerial', - plugin: 'cordova-plugin-bluetooth-serial', - pluginRef: 'bluetoothSerial', - platforms: ['Android', 'iOS', 'Windows Phone 8'], -}) -@Injectable() -export class BluetoothSerial extends AwesomeCordovaNativePlugin { - /** - * Connect to a Bluetooth device - * - * @param {string} macAddress_or_uuid Identifier of the remote device - * @returns {Observable} Subscribe to connect, unsubscribe to disconnect. - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - observable: true, - clearFunction: 'disconnect', - }) - connect(macAddress_or_uuid: string): Observable { - return; - } - - /** - * Connect insecurely to a Bluetooth device - * - * @param {string} macAddress Identifier of the remote device - * @returns {Observable} Subscribe to connect, unsubscribe to disconnect. - */ - @Cordova({ - platforms: ['Android'], - observable: true, - clearFunction: 'disconnect', - }) - connectInsecure(macAddress: string): Observable { - return; - } - - /** - * Disconnect from the connected device - * - * @returns {Promise} - */ - @Cordova() - disconnect(): Promise { - return; - } - - /** - * Writes data to the serial port - * - * @param {any} data ArrayBuffer of data - * @returns {Promise} returns a promise when data has been written - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - write(data: any): Promise { - return; - } - - /** - * Gets the number of bytes of data available - * - * @returns {Promise} returns a promise that contains the available bytes - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - available(): Promise { - return; - } - - /** - * Reads data from the buffer - * - * @returns {Promise} returns a promise with data from the buffer - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - read(): Promise { - return; - } - - /** - * Reads data from the buffer until it reaches a delimiter - * - * @param {string} delimiter string that you want to search until - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - readUntil(delimiter: string): Promise { - return; - } - - /** - * Subscribe to be notified when data is received - * - * @param {string} delimiter the string you want to watch for - * @returns {Observable} returns an observable. - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - observable: true, - clearFunction: 'unsubscribe', - }) - subscribe(delimiter: string): Observable { - return; - } - - /** - * Subscribe to be notified when data is received - * - * @returns {Observable} returns an observable - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - observable: true, - clearFunction: 'unsubscribeRawData', - }) - subscribeRawData(): Observable { - return; - } - - /** - * Clears data in buffer - * - * @returns {Promise} returns a promise when completed - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - clear(): Promise { - return; - } - - /** - * Lists bonded devices - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - list(): Promise { - return; - } - - /** - * Reports if bluetooth is enabled - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - isEnabled(): Promise { - return; - } - - /** - * Reports the connection status - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - isConnected(): Promise { - return; - } - - /** - * Reads the RSSI from the connected peripheral - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - readRSSI(): Promise { - return; - } - - /** - * Show the Bluetooth settings on the device - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - showBluetoothSettings(): Promise { - return; - } - - /** - * Enable Bluetooth on the device - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - enable(): Promise { - return; - } - - /** - * Discover unpaired devices - * - * @returns {Promise} returns a promise - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - }) - discoverUnpaired(): Promise { - return; - } - - /** - * Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function. - * - * @returns {Observable} Returns an observable - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows Phone'], - observable: true, - clearFunction: 'clearDeviceDiscoveredListener', - }) - setDeviceDiscoveredListener(): Observable { - return; - } - - /** - * Sets the human readable device name that is broadcasted to other devices - * - * @param {string} newName Desired name of device - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - setName(newName: string): void {} - - /** - * Makes the device discoverable by other devices - * - * @param {number} discoverableDuration Desired number of seconds device should be discoverable for - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - setDiscoverable(discoverableDuration: number): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/branch-io/index.ts b/src/@awesome-cordova-plugins/plugins/branch-io/index.ts deleted file mode 100644 index ff150b8b..00000000 --- a/src/@awesome-cordova-plugins/plugins/branch-io/index.ts +++ /dev/null @@ -1,261 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface BranchIoPromise { - $identity_id?: number; - $one_time_use?: boolean; - '+click_timestamp'?: number; - '+clicked_branch_link'?: boolean; - '+is_first_session'?: boolean; - '+match_guaranteed'?: boolean; - contentMetadata?: string; - source?: string; - '~campaign'?: string; - '~channel'?: string; - '~creation_source'?: string; - '~feature'?: string; - '~id'?: number; - '~referring_link:'?: string; - [x: string]: any; -} - -export interface BranchIoAnalytics { - channel?: string; - feature?: string; - campaign?: string; - stage?: string; - tags?: string[]; - [x: string]: any; -} - -export interface BranchIoProperties { - contentMetadata?: { - [x: string]: any; - }; - [x: string]: any; -} - -export interface BranchUniversalObject { - generateShortUrl(analytics: BranchIoAnalytics, properties: BranchIoProperties): Promise; - registerView(): Promise; - showShareSheet(analytics: BranchIoAnalytics, properties: BranchIoProperties, shareText: string): Promise; - onShareSheetLaunched(callback: any): void; - onShareSheetDismissed(callback: any): void; - onLinkShareResponse(callback: any): void; - onChannelSelected(callback: any): void; - listOnSpotlight(): Promise; -} - -/** - * @name BranchIo - * @description - * Branch.io is an attribution service for deeplinking and invitation links - * @usage - * ``` - * import { BranchIo } from '@awesome-cordova-plugins/branch-io/ngx'; - * - * - * constructor(private branch: BranchIo) { } - * - * ``` - * @interfaces - * BranchIoPromise - * BranchIoAnalytics - * BranchIoProperties - * BranchUniversalObject - */ -@Plugin({ - pluginName: 'BranchIo', - plugin: 'branch-cordova-sdk', - pluginRef: 'Branch', - repo: 'https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking', - platforms: ['iOS', 'Android'], -}) -@Injectable() -export class BranchIo extends AwesomeCordovaNativePlugin { - /** - * for development and debugging only - * - * @param {boolean} enable Enable debug - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - setDebug(enable: boolean): Promise { - return; - } - - /** - * Disable tracking - * - * @param {boolean} disable disable tracking - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - disableTracking(disable: boolean): Promise { - return; - } - - /** - * Initializes Branch - * - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - initSession(): Promise { - return; - } - - /** - * Initializes Branch with callback - * - * @returns {Observable} - */ - @Cordova({ observable: true }) - initSessionWithCallback(): Observable { - return; - } - - /** - * Set Request Metadata - * - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - setRequestMetadata(): Promise { - return; - } - - /** - * for better Android matching - * - * @param {string} linkDomain LinkDomain at branch - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - setCookieBasedMatching(linkDomain: string): Promise { - return; - } - - /** - * First data - * - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - getFirstReferringParams(): Promise { - return; - } - - /** - * Latest data - * - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - getLatestReferringParams(): Promise { - return; - } - - /** - * Set identy of user - * - * @param {string} userId - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - setIdentity(userId: string): Promise { - return; - } - - /** - * Logout user - * - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - logout(): Promise { - return; - } - - /** - * Registers a custom event - * - * @param {string} eventName - * @param {any} metaData - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - userCompletedAction(eventName: string, metaData: any): Promise { - return; - } - - /** - * Send Commerce Event - * - * @deprecated since v.3.1.0. As of https://help.branch.io/developers-hub/docs/cordova-phonegap-ionic#track-commerce - * @param {string} event - * @param {any} metaData - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - sendCommerceEvent(event: string, metaData: any): Promise { - return; - } - - /** - * Send Branch Event - * - * @param {string} event - * @param {any} metaData - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - sendBranchEvent(event: string, metaData: any): Promise { - return; - } - - /** - * create a branchUniversalObj variable to reference with other Branch methods - * - * @param {BranchIoProperties} properties - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - createBranchUniversalObject(properties: BranchIoProperties): Promise { - return; - } - - /** - * Load credits - * - * @param {any} bucket - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - loadRewards(bucket: any): Promise { - return; - } - - /** - * Redeem Rewards - * - * @param {string} value - * @param {any} bucket - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - redeemRewards(value: string, bucket: any): Promise { - return; - } - - /** - * Show credit history - * - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - creditHistory(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/brightness/index.ts b/src/@awesome-cordova-plugins/plugins/brightness/index.ts deleted file mode 100644 index 5af5c96a..00000000 --- a/src/@awesome-cordova-plugins/plugins/brightness/index.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Brightness - * @description - * The Brightness plugin let you control the display brightness of your device. - * - * Requires Cordova plugin: `cordova-plugin-brightness`. For more info, please see the [Brightness plugin docs](https://github.com/mgcrea/cordova-plugin-brightness). - * - * @usage - * ```typescript - * import { Brightness } from '@awesome-cordova-plugins/brightness/ngx'; - * - * - * constructor(private brightness: Brightness) { } - * - * ... - * - * - * let brightnessValue = 0.8; - * this.brightness.setBrightness(brightnessValue); - * ``` - */ -@Plugin({ - pluginName: 'Brightness', - plugin: 'cordova-plugin-brightness', - pluginRef: 'cordova.plugins.brightness', - repo: 'https://github.com/mgcrea/cordova-plugin-brightness', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Brightness extends AwesomeCordovaNativePlugin { - /** - * Sets the brightness of the display. - * @param value {number} Floating number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness. - * @returns {Promise} Returns a Promise that resolves if setting brightness was successful. - */ - @Cordova() - setBrightness(value: number): Promise { - return; - } - - /** - * Reads the current brightness of the device display. - * @returns {Promise} Returns a Promise that resolves with the - * brightness value of the device display (floating number between 0 and 1). - */ - @Cordova() - getBrightness(): Promise { - return; - } - - /** - * Keeps the screen on. Prevents the device from setting the screen to sleep. - * @param {boolean} value - */ - @Cordova() - setKeepScreenOn(value: boolean): void { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/broadcaster/index.ts b/src/@awesome-cordova-plugins/plugins/broadcaster/index.ts deleted file mode 100644 index 03332936..00000000 --- a/src/@awesome-cordova-plugins/plugins/broadcaster/index.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * Specific data for Android implementation - */ -export interface AndroidData { - extras: object; - flags: number; - category: string; -} - -/** - * Possibly Event Data types - */ -export type EventData = object | AndroidData | null; - -/** - * @name Broadcaster - * @description - * This plugin adds exchanging events between native code and your app. - * @usage - * ```typescript - * import { Broadcaster } from '@awesome-cordova-plugins/broadcaster/ngx'; - * - * constructor(private broadcaster: Broadcaster) { } - * - * ... - * - * // Listen to events from Native - * this.broadcaster.addEventListener('eventName').subscribe((event) => console.log(event)); - * - * // Send event to Native - * this.broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success')); - * - * ``` - */ -@Plugin({ - pluginName: 'Broadcaster', - plugin: 'cordova-plugin-broadcaster', - pluginRef: 'broadcaster', - repo: 'https://github.com/bsorrentino/cordova-broadcaster', - platforms: ['Android', 'iOS', 'Browser'], -}) -@Injectable() -export class Broadcaster extends AwesomeCordovaNativePlugin { - /** - * This function listen to an event sent from the native code - * - * @param {string} eventName - * @param {boolean} isGlobal Valid only for Android. It allows to listen for global messages(i.e. intents) - * @returns {Observable} Returns an observable to watch when an event is received - */ - @Cordova({ - observable: true, - clearFunction: 'removeEventListener', - clearWithArgs: true, - }) - addEventListener(eventName: string, isGlobal = false): Observable { - return; - } - - /** - * This function sends data to the native code - * - * @param {string} eventName - * @param {boolean} isGlobalOrEventData means that message is global (valid only on Android) - * @param {AndroidData} isGlobalOrEventData allows to specify 'flags` and 'category' (valid only on Android) - * @param {object} isGlobalOrEventData allows to specify a generic object containing custom event data (all platform) - * @param {AndroidData} [data] if isGlobal is set, allows to specify 'flags` and 'category' if isGlobal is set (valid only on Android) - * @param {object} [data] if isGlobal is set, allows to specify a generic object containing custom event data (all platform) - * @returns {Promise} Returns a promise that resolves when an event is successfully fired - */ - @Cordova() - fireNativeEvent(eventName: string, isGlobalOrEventData: boolean | EventData, data?: EventData): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/browser-tab/index.ts b/src/@awesome-cordova-plugins/plugins/browser-tab/index.ts deleted file mode 100644 index 1125b9e4..00000000 --- a/src/@awesome-cordova-plugins/plugins/browser-tab/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Browser Tab - * @description - * 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. - * - * @usage - * ```typescript - * import { BrowserTab } from '@awesome-cordova-plugins/browser-tab/ngx'; - * - * constructor(private browserTab: BrowserTab) { - * - * browserTab.isAvailable() - * .then(isAvailable => { - * if (isAvailable) { - * browserTab.openUrl('https://ionic.io'); - * } else { - * // open URL with InAppBrowser instead or SafariViewController - * } - * }); - * } - * - * ``` - */ -@Plugin({ - pluginName: 'BrowserTab', - plugin: 'cordova-plugin-browsertab', - pluginRef: 'cordova.plugins.browsertab', - repo: 'https://github.com/google/cordova-plugin-browsertab', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class BrowserTab extends AwesomeCordovaNativePlugin { - /** - * Check if BrowserTab option is available - * @return {Promise} Returns a promise that resolves when check is successful and returns true or false - */ - @Cordova() - isAvailable(): Promise { - return; - } - - /** - * Opens the provided URL using a browser tab - * @param {string} url The URL you want to open - * @return {Promise} Returns a promise that resolves when check open was successful - */ - @Cordova() - openUrl(url: string): Promise { - return; - } - - /** - * Closes browser tab - * @return {Promise} Returns a promise that resolves when close was finished - */ - @Cordova() - close(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/build-info/index.ts b/src/@awesome-cordova-plugins/plugins/build-info/index.ts deleted file mode 100644 index bafb3043..00000000 --- a/src/@awesome-cordova-plugins/plugins/build-info/index.ts +++ /dev/null @@ -1,329 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, CordovaProperty, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Build Info - * @description - * This plugin provides build information. - * @usage - * ``` - * import { BuildInfo } from '@awesome-cordova-plugins/build-info/ngx'; - * - * this.platform.ready().then(() => { - * console.log('BuildInfo.baseUrl =' + BuildInfo.baseUrl) - * console.log('BuildInfo.packageName =' + BuildInfo.packageName) - * console.log('BuildInfo.basePackageName=' + BuildInfo.basePackageName) - * console.log('BuildInfo.displayName =' + BuildInfo.displayName) - * console.log('BuildInfo.name =' + BuildInfo.name) - * console.log('BuildInfo.version =' + BuildInfo.version) - * console.log('BuildInfo.versionCode =' + BuildInfo.versionCode) - * console.log('BuildInfo.debug =' + BuildInfo.debug) - * console.log('BuildInfo.buildType =' + BuildInfo.buildType) - * console.log('BuildInfo.flavor =' + BuildInfo.flavor) - * console.log('BuildInfo.buildDate =' + BuildInfo.buildDate) - * console.log('BuildInfo.installDate =' + BuildInfo.installDate) - * }) - * ``` - */ -@Plugin({ - pluginName: 'BuildInfo', - plugin: 'cordova-plugin-buildinfo', - pluginRef: 'BuildInfo', - repo: 'https://github.com/lynrin/cordova-plugin-buildinfo', - platforms: ['Android', 'iOS', 'Windows', 'macOS', 'browser', 'Electron'], -}) -@Injectable() -export class BuildInfo extends AwesomeCordovaNativePlugin { - /** - * The baseUrl where cordova.js was loaded. - */ - @CordovaProperty() - baseUrl: string; - - /** - * Get the packageName of Application ID. - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|Package Name|String| - * |iOS|Bundle Identifier|String| - * |Windows|Identity name|String| - * |macOS(OS X)|Bundle Identifier|String| - * |Browser|Get the id attribute of the widget element in config.xml file.|String| - * |Electron|Get the id attribute of the widget element in config.xml file.|String| - */ - @CordovaProperty() - packageName: string; - - /** - * Android only. - * - * Get the packageName of BuildConfig class. - * - * If you use the configure of "build types" or "product flavors", because you can specify a different package name is the id attribute of the widget element of config.xml, is the property to get the package name that BuildConfig class belongs. - * (ought be the same as the id attribute of the widget element of config.xml) - * - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|Package name of BuildConfig class|String| - * |iOS|Bundle Identifier(equals BuildInfo.packageName)|String| - * |Windows|Identity name(equals BuildInfo.packageName)|String| - * |macOS(OS X)|Bundle Identifier(equals BuildInfo.packageName)|String| - * |Browser|equals BuildInfo.packageName|String| - * |Electron|equals BuildInfo.packageName|String| - */ - @CordovaProperty() - basePackageName: string; - - /** - * Get the displayName. - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|Application Label|String| - * |iOS|CFBundleDisplayName (CFBundleName if not present)|String| - * |Windows|Get the DisplayName attribute of the VisualElements element in AppxManifest.xml file.|String| - * |macOS(OS X)|CFBundleDisplayName (CFBundleName if not present)|String| - * |Browser|Get the short attribute of the name element in config.xml file.|String| - * |Electron|Get the short attribute of the name element in config.xml file.|String| - */ - @CordovaProperty() - displayName: string; - - /** - * Get the name. - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|Application Label(equal BuildInfo.displayName)|String| - * |iOS|CFBundleName|String| - * |Windows|Windows Store display name|String| - * |macOS(OS X)|CFBundleName|String| - * |Browser|Get value of the name element in config.xml file.|String| - * |Electron|Get value of the name element in config.xml file.|String| - */ - @CordovaProperty() - name: string; - - /** - * Get the version. - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|BuildConfig.VERSION_NAME|String| - * |iOS|CFBundleShortVersionString|String| - * |Windows|Major.Minor.Build ex) "1.2.3"|String| - * |macOS(OS X)|CFBundleShortVersionString|String| - * |Browser|Get the version attribute of the widget element in config.xml file.|String| - * |Electron|Get the version attribute of the widget element in config.xml file.|String| - */ - @CordovaProperty() - version: string; - - /** - * Get the version code. - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|BuildConfig.VERSION_CODE|integer| - * |iOS|CFBundleVersion|String| - * |Windows|Major.Minor.Build.Revision ex) "1.2.3.4"|String| - * |macOS(OS X)|CFBundleVersion|String| - * |Browser|equals BuildInfo.version|String| - * |Electron|equals BuildInfo.version|String| - */ - @CordovaProperty() - versionCode: string | number; - - /** - * Get the debug flag. - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|BuildConfig.DEBUG|Boolean| - * |iOS|defined "DEBUG" is true|Boolean| - * |Windows|isDevelopmentMode is true|Boolean| - * |macOS(OS X)|defined "DEBUG" is true|Boolean| - * |Browser|Always false|Boolean| - * |Electron|True when ```cordova build electron --debug``` is executed with the "--debug" flag.|Boolean| - */ - @CordovaProperty() - debug: boolean; - - /** - * Android , Windows Only. - * - * Get the build type. - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|BuildConfig.BUILD_TYPE|String| - * |iOS|empty string|String| - * |Windows|"release" or "debug"|String| - * |macOS(OS X)|empty string|String| - * |Browser|empty string|String| - * |Electron|empty string|String| - * - */ - @CordovaProperty() - buildType: string; - /** - * Android Only. - * - * Get the flavor. - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|BuildConfig.FLAVOR|String| - * |iOS|empty string|String| - * |Windows|empty string|String| - * |macOS(OS X)|empty string|String| - * |Browser|empty string|String| - * |Electron|empty string|String| - */ - @CordovaProperty() - flavor: string; - - /** - * Get the build date and time in the Date object returns. - * - * Attention: - * - Android: Add the BuildInfo.gradle file to your Android project. - * The BuildInfo.gradle file contains the setting to add the _BUILDINFO_TIMESTAMP field to the BuildConfig class. - * - Windows: Add the buildinfo.resjson file to your Windows project. - * The buildinfo.resjson file into the "strings" folder. - * And also add a task to rewrite buildinfo.resjson in the CordovaApp.projitems file. - * - Browser and Electron: When ```cordova prepare``` is executed Build date and time is embedded in - * platforms/**browser**\/www/plugins/cordova-plugin-buildinfo/src/browser/BuildInfoProxy.js file. - * (Or platforms/**electron**\/www/plugins/cordova-plugin-buildinfo/src/browser/BuildInfoProxy.js file.) - * ```cordova prepare``` is also executed for ```cordova build```, ```cordova run``` and ```cordova platform add```. - * (Reference: [Hooks Guide - Apache Cordova](https://cordova.apache.org/docs/en/9.x/guide/appdev/hooks/index.html)) - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|BuildConfig.\_BUILDINFO\_TIMESTAMP value|Date| - * |iOS|Get the modification date and time of the Info.plist file acquired from the executionPath property of the main bundle.|Date| - * |Windows|Resource value of "/buildinfo/Timestamp" string.|Date| - * |macOS(OS X)|Get the modification date and time of the config.xml file acquired from the resource of the main bundle.|Date| - * |Browser|The date and time when ```cordova prepare``` was executed.|Date| - * |Electron|The date and time when ```cordova prepare``` was executed.|Date| - * - */ - @CordovaProperty() - buildDate: Date; - - /** - * Get the install date and time in the Date object returns. - * - * Attention: - * - Browser and Electron: Installation date and time is unknown. - * - * |Platform|Value|Type| - * |--------|-----|----| - * |Android|The firstInstallTime property of PackageInfo|Date| - * |iOS|Get the creation date and time of the document directory.|Date| - * |Windows|The installedDate property of Windows.ApplicatinoModel.Package.current|Date| - * |macOS(OS X)|Date and time of kMDItemDateAdded recorded in File Metadata of application package.|Date| - * |Browser|Not available.|null| - * |Electron|Not available.|null| - */ - @CordovaProperty() - installDate: Date | null; - - /** - * Windows Only. - * - * Get the windows extra information. - */ - @CordovaProperty() - windows?: { - /** - * indows.ApplicationModel.Package.current.id.architecture| - */ - architecture: number; - /** - * Windows.ApplicationModel.Package.current.description| - */ - description: string; - /** - * Windows.ApplicationModel.Package.current.displayName| - */ - displayName: string; - /** - * Windows.ApplicationModel.Package.current.id.familyName| - */ - familyName: string; - /** - * Windows.ApplicationModel.Package.current.id.fullName| - */ - fullName: string; - logo: WindowsLogo; - /** - * Windows.ApplicationModel.Package.current.id.publisher| - */ - publisher: string; - /** - * Windows.ApplicationModel.Package.current.id.publisherId| - */ - publisherId: string; - /** - * Windows.ApplicationModel.Package.current.publisherDisplayName| - */ - publisherDisplayName: string; - /** - * Windows.ApplicationModel.Package.current.id.resourceId| - */ - resourceId: string; - /** - * Windows.ApplicationModel.Package.current.id.version| - */ - version: WindowsVersionInfo; - }; -} - -export interface WindowsLogo { - /** - * Windows.ApplicationModel.Package.logo.absoluteCanonicalUri - */ - absoluteCannonicalUri: string; - /** - * Windows.ApplicationModel.Package.logo.absoluteUri - */ - absoluteUri: string; - /** - * Windows.ApplicationModel.Package.logo.displayIri - */ - displayIri: string; - /** - * Windows.ApplicationModel.Package.logo.displayUri - */ - displayUri: string; - /** - * Windows.ApplicationModel.Package.logo.path - */ - path: string; - /** - * Windows.ApplicationModel.Package.logo.rawUri - */ - rawUri: string; -} - -export interface WindowsVersionInfo { - /** - * Windows.ApplicationModel.Package.current.id.version.major - */ - major: number; - /** - * Windows.ApplicationModel.Package.current.id.version.minor - */ - minor: number; - /** - * Windows.ApplicationModel.Package.current.id.version.build - */ - build: number; - /** - * Windows.ApplicationModel.Package.current.id.version.revision - */ - revision: number; -} diff --git a/src/@awesome-cordova-plugins/plugins/calendar/index.ts b/src/@awesome-cordova-plugins/plugins/calendar/index.ts deleted file mode 100644 index a4593af7..00000000 --- a/src/@awesome-cordova-plugins/plugins/calendar/index.ts +++ /dev/null @@ -1,493 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface CalendarOptions { - /** - * Id - */ - id?: string; - - /** - * - */ - firstReminderMinutes?: number; - - /** - * - */ - secondReminderMinutes?: number; - - /** - * Recurrence. Can be set to `daily`, `weekly`, `monthly` or `yearly` - */ - recurrence?: string; - - /** - * Recurrence interval. Valid only when `recurrence` option is set. - */ - recurrenceInterval?: number; - - /** - * Recurrence end date. Valid only when `recurrence` option is set. - */ - recurrenceEndDate?: Date; - - /** - * Calendar name. Ths is supported by `iOS` only. - */ - calendarName?: string; - - /** - * Calendar id - */ - calendarId?: number; - - /** - * URL - */ - url?: string; -} - -export interface NameOrOptions { - /** Calendar name */ - calendarName?: string; - - /** Calendar color as a HEX string */ - calendarColor?: string; -} - -/** - * @name Calendar - * @premier calendar - * @description - * This plugin allows you to add events to the Calendar of the mobile device. - * - * Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin). - * @usage - * ```typescript - * import { Calendar } from '@awesome-cordova-plugins/calendar/ngx'; - * - * constructor(private calendar: Calendar) { } - * - * - * this.calendar.createCalendar('MyCalendar').then( - * (msg) => { console.log(msg); }, - * (err) => { console.log(err); } - * ); - * ``` - * @interfaces - * CalendarOptions - * NameOrOptions - */ -@Plugin({ - pluginName: 'Calendar', - plugin: 'cordova-plugin-calendar', - pluginRef: 'plugins.calendar', - repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Calendar extends AwesomeCordovaNativePlugin { - /** - * This function checks if we have permission to read/write from/to the calendar. - * The promise will resolve with `true` when: - * - You're running on iOS, or - * - You're targeting API level lower than 23, or - * - You're using Android < 6, or - * - You've already granted permission - * - * If this returns false, you should call the `requestReadWritePermission` function - * - * @returns {Promise} - */ - @Cordova() - hasReadWritePermission(): Promise { - return; - } - - /** - * Check if we have read permission - * - * @returns {Promise} - */ - @Cordova() - hasReadPermission(): Promise { - return; - } - - /** - * Check if we have write permission - * - * @returns {Promise} - */ - @Cordova() - hasWritePermission(): Promise { - return; - } - - /** - * Request write permission - * - * @returns {Promise} - */ - @Cordova() - requestWritePermission(): Promise { - return; - } - - /** - * Request read permission - * - * @returns {Promise} - */ - @Cordova() - requestReadPermission(): Promise { - return; - } - - /** - * Requests read/write permissions - * - * @returns {Promise} - */ - @Cordova() - requestReadWritePermission(): Promise { - return; - } - - /** - * Create a calendar. (iOS only) - * - * @param {string | NameOrOptions} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string - * @returns {Promise} Returns a Promise - */ - @Cordova() - createCalendar(nameOrOptions: string | NameOrOptions): Promise { - return; - } - - /** - * Delete a calendar. (iOS only) - * - * @param {string} name Name of the calendar to delete. - * @returns {Promise} Returns a Promise - */ - @Cordova() - deleteCalendar(name: string): Promise { - return; - } - - /** - * Returns the default calendar options. - * - * @returns {CalendarOptions} Returns an object with the default calendar options - */ - @Cordova({ - sync: true, - }) - getCalendarOptions(): CalendarOptions { - return; - } - - /** - * Returns options for a custom calender with specific color - * - * @returns {NameOrOptions} Returns an object with the default options - */ - @Cordova({ - sync: true, - }) - getCreateCalendarOptions(): NameOrOptions { - return; - } - - /** - * Silently create an event. - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @returns {Promise} Returns a Promise - */ - @Cordova() - createEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise { - return; - } - - /** - * Silently create an event with additional options. - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` - * @returns {Promise} Returns a Promise - */ - @Cordova() - createEventWithOptions( - title?: string, - location?: string, - notes?: string, - startDate?: Date, - endDate?: Date, - options?: CalendarOptions - ): Promise { - return; - } - - /** - * Interactively create an event. - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @returns {Promise} Returns a Promise - */ - @Cordova() - createEventInteractively( - title?: string, - location?: string, - notes?: string, - startDate?: Date, - endDate?: Date - ): Promise { - return; - } - - /** - * Interactively create an event with additional options. - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` - * @returns {Promise} - */ - @Cordova() - createEventInteractivelyWithOptions( - title?: string, - location?: string, - notes?: string, - startDate?: Date, - endDate?: Date, - options?: CalendarOptions - ): Promise { - return; - } - - /** - * Find an event. - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @returns {Promise} - */ - @Cordova() - findEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise { - return; - } - - /** - * Find an event with additional options. - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` - * @returns {Promise} Returns a Promise that resolves with the event, or rejects with an error. - */ - @Cordova() - findEventWithOptions( - title?: string, - location?: string, - notes?: string, - startDate?: Date, - endDate?: Date, - options?: CalendarOptions - ): Promise { - return; - } - - /** - * Find a list of events within the specified date range. (Android only) - * - * @param {Date} [startDate] The start date - * @param {Date} [endDate] The end date - * @returns {Promise} Returns a Promise that resolves with the list of events, or rejects with an error. - */ - @Cordova({ - platforms: ['Android'], - }) - listEventsInRange(startDate: Date, endDate: Date): Promise { - return; - } - - /** - * Get a list of all calendars. - * - * @returns {Promise} A Promise that resolves with the list of calendars, or rejects with an error. - */ - @Cordova() - listCalendars(): Promise { - return; - } - - /** - * Get a list of all future events in the specified calendar. (iOS only) - * - * @param calendarName - * @returns {Promise} Returns a Promise that resolves with the list of events, or rejects with an error. - */ - @Cordova({ - platforms: ['iOS'], - }) - findAllEventsInNamedCalendar(calendarName: string): Promise { - return; - } - - /** - * Modify an event. (iOS only) - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @param {string} [newTitle] The new event title - * @param {string} [newLocation] The new event location - * @param {string} [newNotes] The new event notes - * @param {Date} [newStartDate] The new event start date - * @param {Date} [newEndDate] The new event end date - * @returns Returns a Promise - */ - @Cordova({ - platforms: ['iOS'], - }) - modifyEvent( - title?: string, - location?: string, - notes?: string, - startDate?: Date, - endDate?: Date, - newTitle?: string, - newLocation?: string, - newNotes?: string, - newStartDate?: Date, - newEndDate?: Date - ): Promise { - return; - } - - /** - * Modify an event with additional options. (iOS only) - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @param {string} [newTitle] The new event title - * @param {string} [newLocation] The new event location - * @param {string} [newNotes] The new event notes - * @param {Date} [newStartDate] The new event start date - * @param {Date} [newEndDate] The new event end date - * @param {CalendarOptions} [filterOptions] Event Options, see `getCalendarOptions` - * @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions` - * @returns Returns a Promise - */ - @Cordova({ - platforms: ['iOS'], - }) - modifyEventWithOptions( - title?: string, - location?: string, - notes?: string, - startDate?: Date, - endDate?: Date, - newTitle?: string, - newLocation?: string, - newNotes?: string, - newStartDate?: Date, - newEndDate?: Date, - filterOptions?: CalendarOptions, - newOptions?: CalendarOptions - ): Promise { - return; - } - - /** - * Delete an event. - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @returns Returns a Promise - */ - @Cordova() - deleteEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise { - return; - } - - /** - * Delete an event from the specified Calendar. (iOS only) - * - * @param {string} [title] The event title - * @param {string} [location] The event location - * @param {string} [notes] The event notes - * @param {Date} [startDate] The event start date - * @param {Date} [endDate] The event end date - * @param {string} calendarName - * @returns Returns a Promise - */ - @Cordova({ - platforms: ['iOS'], - }) - deleteEventFromNamedCalendar( - title?: string, - location?: string, - notes?: string, - startDate?: Date, - endDate?: Date, - calendarName?: string - ): Promise { - return; - } - - /** - * Delete an event by id. - * - * @param {string} [id] The event id - * @param {Date} [fromDate] The date where it start deleting from - * @returns Returns a Promise - */ - @Cordova() - deleteEventById(id: string, fromDate?: Date): Promise { - return; - } - - /** - * Open the calendar at the specified date. - * - * @param {Date} date The date you want to open the calendar on - * @returns {Promise} Promise returns a promise - */ - @Cordova() - openCalendar(date: Date): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/call-directory/index.ts b/src/@awesome-cordova-plugins/plugins/call-directory/index.ts deleted file mode 100644 index 20c9d5c6..00000000 --- a/src/@awesome-cordova-plugins/plugins/call-directory/index.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface CallDirectoryItem { - label: string; - number: string; -} - -export interface CallDirectoryLog { - plugin: string[]; - extension: string[]; -} - -/** - * @name Call Directory - * @description - * This plugin can add phone numbers to an Callkit call directory extension. Call `reloadExtension` after using `addIdentification` and `removeIdentification` - * to process the changes in the call directory extension. - * @usage - * ```typescript - * import { CallDirectory } from '@awesome-cordova-plugins/call-directory/ngx'; - * - * - * constructor(private callDirectory: CallDirectory) { } - * - * - * let items = [{label: "Hello", number: "123"}]; - * this.callDirectory.addIdentification(items) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * this.callDirectory.reloadExtension() - * .then(res: string) => console.log(res)) - * .catch((error: any) => console.error(error)); - * ``` - * @Interfaces - * CallDirectoryItem - * CallDirectoryLog - */ -@Plugin({ - pluginName: 'CallDirectory', - plugin: 'cordova-plugin-call-directory', - pluginRef: 'CallDirectory', - repo: 'https://github.com/GEDYSIntraWare/cordova-plugin-call-directory', - install: - 'cordova plugin add cordova-plugin-call-directory --variable EXT_NAME="Cordova-Directory" --variable ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES="NO"', - installVariables: ['EXT_NAME', 'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'], - platforms: ['iOS'], -}) -@Injectable() -export class CallDirectory extends AwesomeCordovaNativePlugin { - /** - * Check if the call directory extension is available and enabled - * - * @returns {Promise} Returns a promise with result - */ - @Cordova() - isAvailable(): Promise { - return; - } - - /** - * Add identification numbers - * - * @param {CallDirectoryItem[]} items Set of numbers with labels - * @returns {Promise} Returns a promise that resolves when numbers are added - */ - @Cordova() - addIdentification(items: CallDirectoryItem[]): Promise { - return; - } - - /** - * Remove identification numbers - * - * @param {CallDirectoryItem[]} items Set of numbers with arbitrary label - * @returns {Promise} Returns a promise that resolves when numbers are removed - */ - @Cordova() - removeIdentification(items: CallDirectoryItem[]): Promise { - return; - } - - /** - * Remove all items from call directory. Refreshes immediately. - * - * @returns {Promise} Returns a promise after refresh with message - */ - @Cordova() - removeAllIdentification(): Promise { - return; - } - - /** - * Get all numbers and labels in call directory - * - * @returns {CallDirectoryItem[]} Returns a promise that resolves with an array of all items - */ - @Cordova() - getAllItems(): Promise { - return; - } - - /** - * Reload extension to process queued changes - * - * @returns {Promise} Returns a promise after refresh with message - */ - @Cordova() - reloadExtension(): Promise { - return; - } - - /** - * Get log from plugin and call directory extension - * - * @returns {Promise} Returns a promise with an object of log messages - */ - @Cordova() - getLog(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/call-number/index.ts b/src/@awesome-cordova-plugins/plugins/call-number/index.ts deleted file mode 100644 index b1cc7596..00000000 --- a/src/@awesome-cordova-plugins/plugins/call-number/index.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Call Number - * @description - * Call a number directly from your Cordova/Ionic application. - * NOTE**: The iOS Simulator (and maybe Android Simulators) do not provide access to the phone subsystem. - * @usage - * ```typescript - * import { CallNumber } from '@awesome-cordova-plugins/call-number/ngx'; - * - * constructor(private callNumber: CallNumber) { } - * - * ... - * - * - * this.callNumber.callNumber("18001010101", true) - * .then(res => console.log('Launched dialer!', res)) - * .catch(err => console.log('Error launching dialer', err)); - * - * ``` - */ -@Plugin({ - pluginName: 'CallNumber', - plugin: 'call-number', - pluginRef: 'plugins.CallNumber', - repo: 'https://github.com/Rohfosho/CordovaCallNumberPlugin', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class CallNumber extends AwesomeCordovaNativePlugin { - /** - * Calls a phone number - * - * @param {string} numberToCall The phone number to call as a string - * @param {boolean} bypassAppChooser Set to true to bypass the app chooser and go directly to dialer - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - callNumber(numberToCall: string, bypassAppChooser: boolean): Promise { - return; - } - - /** - * Check if call feature is available - * - * @returns {Promise} - */ - @Cordova() - isCallSupported(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/camera-preview/index.ts b/src/@awesome-cordova-plugins/plugins/camera-preview/index.ts deleted file mode 100644 index fece1f7c..00000000 --- a/src/@awesome-cordova-plugins/plugins/camera-preview/index.ts +++ /dev/null @@ -1,551 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface CameraPreviewDimensions { - /** The width of the camera preview, default to window.screen.width */ - width?: number; - - /** The height of the camera preview, default to window.screen.height */ - height?: number; -} - -export interface CameraPreviewOptions { - /** The left edge in pixels, default 0 */ - x?: number; - - /** The top edge in pixels, default 0 */ - y?: number; - - /** The width in pixels, default window.screen.width */ - width?: number; - - /** The height in pixels, default window.screen.height */ - height?: number; - - /** Choose the camera to use 'front' or 'rear', default 'front' */ - camera?: string; - - /** Tap to take a photo, default true (picture quality by default : 85) */ - tapPhoto?: boolean; - - /** Preview box drag across the screen, default 'false' */ - previewDrag?: boolean; - - /** Capture images to a file and return back the file path instead of returning base64 encoded data. */ - storeToFile: boolean; - - /** Preview box to the back of the webview (true => back, false => front) , default false */ - toBack?: boolean; - - /** Alpha channel of the preview box, float, [0,1], default 1 */ - alpha?: number; - - /** Tap to set specific focus point. Note, this assumes the camera is full-screen. default false */ - tapFocus?: boolean; - - /** On Android disable automatic rotation of the image and stripping of Exit header. default false */ - disableExifHeaderStripping?: boolean; -} - -export interface CameraPreviewPictureOptions { - /** The width in pixels, default 0 */ - width?: number; - /** The height in pixels, default 0 */ - height?: number; - /** The picture quality, 0 - 100, default 85 */ - quality?: number; -} - -/** - * @beta - * @name Camera Preview - * @description - * Showing camera preview in HTML - * - * Requires Cordova plugin: `https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview.git`. For more info, please see the [Cordova Camera Preview docs](https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview). - * @usage - * ```typescript - * import { CameraPreview, CameraPreviewPictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '@awesome-cordova-plugins/camera-preview/ngx'; - * - * constructor(private cameraPreview: CameraPreview) { } - * - * ... - * - * // camera options (Size and location). In the following example, the preview uses the rear camera and display the preview in the back of the webview - * const cameraPreviewOpts: CameraPreviewOptions = { - * x: 0, - * y: 0, - * width: window.screen.width, - * height: window.screen.height, - * camera: 'rear', - * tapPhoto: true, - * previewDrag: true, - * toBack: true, - * alpha: 1 - * } - * - * // start camera - * this.cameraPreview.startCamera(cameraPreviewOpts).then( - * (res) => { - * console.log(res) - * }, - * (err) => { - * console.log(err) - * }); - * - * // Set the handler to run every time we take a picture - * this.cameraPreview.setOnPictureTakenHandler().subscribe((result) => { - * console.log(result); - * // do something with the result - * }); - * - * - * // picture options - * const pictureOpts: CameraPreviewPictureOptions = { - * width: 1280, - * height: 1280, - * quality: 85 - * } - * - * // take a picture - * this.cameraPreview.takePicture(this.pictureOpts).then((imageData) => { - * this.picture = 'data:image/jpeg;base64,' + imageData; - * }, (err) => { - * console.log(err); - * this.picture = 'assets/img/test.jpg'; - * }); - * - * // take a snap shot - * this.cameraPreview.takeSnapshot(this.pictureOpts).then((imageData) => { - * this.picture = 'data:image/jpeg;base64,' + imageData; - * }, (err) => { - * console.log(err); - * this.picture = 'assets/img/test.jpg'; - * }); - * - * - * // Switch camera - * this.cameraPreview.switchCamera(); - * - * // set color effect to negative - * this.cameraPreview.setColorEffect('negative'); - * - * // Stop the camera preview - * this.cameraPreview.stopCamera(); - * - * ``` - * @interfaces - * CameraPreviewOptions - * CameraPreviewPictureOptions - * CameraPreviewDimensions - */ -@Plugin({ - pluginName: 'CameraPreview', - plugin: 'cordova-plugin-camera-preview', - pluginRef: 'CameraPreview', - repo: 'https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class CameraPreview extends AwesomeCordovaNativePlugin { - FOCUS_MODE = { - FIXED: 'fixed', - AUTO: 'auto', - CONTINUOUS: 'continuous', // IOS Only - CONTINUOUS_PICTURE: 'continuous-picture', // Android Only - CONTINUOUS_VIDEO: 'continuous-video', // Android Only - EDOF: 'edof', // Android Only - INFINITY: 'infinity', // Android Only - MACRO: 'macro', // Android Only - }; - - EXPOSURE_MODE = { - LOCK: 'lock', // IOS Only - AUTO: 'auto', // IOS Only - CONTINUOUS: 'continuous', - CUSTOM: 'custom', - }; - - FLASH_MODE = { - OFF: 'off', - ON: 'on', - AUTO: 'auto', - RED_EYE: 'red-eye', - TORCH: 'torch', // Android Only - }; - - COLOR_EFFECT = { - AQUA: 'aqua', // Android Only - BLACKBOARD: 'blackboard', // Android Only - MONO: 'mono', - NEGATIVE: 'negative', - NONE: 'none', - POSTERIZE: 'posterize', - SEPIA: 'sepia', - SOLARIZE: 'solarize', // Android Only - WHITEBOARD: 'whiteboard', // Android Only - }; - - CAMERA_DIRECTION = { - BACK: 'back', - FRONT: 'front', - }; - - /** - * Starts the camera preview instance. - * - * @param {CameraPreviewOptions} options - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - startCamera(options: CameraPreviewOptions): Promise { - return; - } - - /** - * Starts the camera video instance. - * - * @param {any} options - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - startRecordVideo(options: any): Promise { - return; - } - - /** - * Stops the camera preview instance. (iOS & Android) - * - * @returns {Promise} - */ - @Cordova() - stopCamera(): Promise { - return; - } - - /** - * Stops the camera video instance. (iOS & Android) - * - * @returns {Promise} - */ - @Cordova() - stopRecordVideo(): Promise { - return; - } - - /** - * Switch from the rear camera and front camera, if available. - * - * @returns {Promise} - */ - @Cordova() - switchCamera(): Promise { - return; - } - - /** - * Hide the camera preview box. - * - * @returns {Promise} - */ - @Cordova() - hide(): Promise { - return; - } - - /** - * Show the camera preview box. - * - * @returns {Promise} - */ - @Cordova() - show(): Promise { - return; - } - - /** - * Take the picture (base64) - * - * @param {CameraPreviewPictureOptions} [options] size and quality of the picture to take - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - takePicture(options?: CameraPreviewPictureOptions): Promise { - return; - } - - /** - * Take a snapshot of preview window (size specified in startCamera options) - * - * @param {CameraPreviewPictureOptions} [options] quality of the picture to take - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - takeSnapshot(options?: CameraPreviewPictureOptions): Promise { - return; - } - - /** - * - * Set camera color effect. - * - * @static - * @param {string} effect name : 'none' (iOS & Android), 'aqua' (Android), 'blackboard' (Android), 'mono' (iOS & Android), 'negative' (iOS & Android), 'posterize' (iOS & Android), 'sepia' (iOS & Android), 'solarize' (Android) or 'whiteboard' (Android) - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - setColorEffect(effect: string): Promise { - return; - } - - /** - * Set the zoom (Android) - * - * @param [zoom] {number} Zoom value - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - setZoom(zoom?: number): Promise { - return; - } - - /** - * Get the maximum zoom (Android) - * - * @returns {Promise} - */ - @Cordova() - getMaxZoom(): Promise { - return; - } - - /** - * Get current zoom (Android) - * - * @returns {Promise} - */ - @Cordova() - getZoom(): Promise { - return; - } - - /** - * Set the preview Size - * - * @param {CameraPreviewDimensions} [dimensions] - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - setPreviewSize(dimensions?: CameraPreviewDimensions): Promise { - return; - } - - /** - * Get focus mode - * - * @returns {Promise} - */ - @Cordova() - getFocusMode(): Promise { - return; - } - - /** - * Set the focus mode - * - * @param {string} [focusMode] 'fixed', 'auto', 'continuous-picture', 'continuous-video' (iOS & Android), 'edof', 'infinity', 'macro' (Android Only) - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - setFocusMode(focusMode?: string): Promise { - return; - } - - /** - * Get supported focus modes - * - * @returns {Promise} - */ - @Cordova() - getSupportedFocusModes(): Promise { - return; - } - - /** - * Get the current flash mode - * - * @returns {Promise} - */ - @Cordova() - getFlashMode(): Promise { - return; - } - - /** - * Set the flash mode - * - * @param {string} [flashMode] 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android) - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - setFlashMode(flashMode?: string): Promise { - return; - } - - /** - * Get supported flash modes - * - * @returns {Promise} - */ - @Cordova() - getSupportedFlashModes(): Promise { - return; - } - - /** - * Get supported picture sizes - * - * @returns {Promise} - */ - @Cordova() - getSupportedPictureSizes(): Promise { - return; - } - - /** - * Get exposure mode - * - * @returns {Promise} - */ - @Cordova() - getExposureMode(): Promise { - return; - } - - /** - * Get exposure modes - * - * @returns {Promise} - */ - @Cordova() - getExposureModes(): Promise { - return; - } - - /** - * Set exposure mode - * - * @param {string} [lock] - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - setExposureMode(lock?: string): Promise { - return; - } - - /** - * Get exposure compensation (Android) - * - * @returns {Promise} - */ - @Cordova() - getExposureCompensation(): Promise { - return; - } - - /** - * Set exposure compensation (Android) - * - * @param {number} [exposureCompensation] - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - setExposureCompensation(exposureCompensation?: number): Promise { - return; - } - - /** - * Get exposure compensation range (Android) - * - * @returns {Promise} - */ - @Cordova() - getExposureCompensationRange(): Promise { - return; - } - - /** - * Set specific focus point. Note, this assumes the camera is full-screen. - * - * @param {number} xPoint - * @param {number} yPoint - * @returns {Promise} - */ - @Cordova() - tapToFocus(xPoint: number, yPoint: number): Promise { - return; - } - - /** - * Add a listener for the back event for the preview - * - * @returns {Promise} if back button pressed - */ - @Cordova() - onBackButton(): Promise { - return; - } - - /** - * Return in use device camera fov - * - * @returns {Promise} - */ - @Cordova() - getHorizontalFOV(): Promise { - return; - } - - /** - * Get the characteristics of all available cameras - * - * @returns {Promise} - */ - @Cordova() - getCameraCharacteristics(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/camera/index.ts b/src/@awesome-cordova-plugins/plugins/camera/index.ts deleted file mode 100644 index ffa2278a..00000000 --- a/src/@awesome-cordova-plugins/plugins/camera/index.ts +++ /dev/null @@ -1,268 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface CameraOptions { - /** Picture quality in range 0-100. Default is 50 */ - quality?: number; - /** - * Choose the format of the return value. - * Defined in Camera.DestinationType. Default is FILE_URI. - * DATA_URL : 0, Return image as base64-encoded string (DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible), - * FILE_URI : 1, Return image file URI, - * NATIVE_URI : 2 Return image native URI - * (e.g., assets-library:// on iOS or content:// on Android) - */ - destinationType?: number; - /** - * Set the source of the picture. - * Defined in Camera.PictureSourceType. Default is CAMERA. - * PHOTOLIBRARY : 0, - * CAMERA : 1, - * SAVEDPHOTOALBUM : 2 - */ - sourceType?: number; - /** Allow simple editing of image before selection. */ - allowEdit?: boolean; - /** - * Choose the returned image file's encoding. - * Defined in Camera.EncodingType. Default is JPEG - * JPEG : 0 Return JPEG encoded image - * PNG : 1 Return PNG encoded image - */ - encodingType?: number; - /** - * Width in pixels to scale image. Must be used with targetHeight. - * Aspect ratio remains constant. - */ - targetWidth?: number; - /** - * Height in pixels to scale image. Must be used with targetWidth. - * Aspect ratio remains constant. - */ - targetHeight?: number; - /** - * Set the type of media to select from. Only works when PictureSourceType - * is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in Camera.MediaType - * PICTURE: 0 allow selection of still pictures only. DEFAULT. - * Will return format specified via DestinationType - * VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI - * ALLMEDIA : 2 allow selection from all media types - */ - mediaType?: number; - /** Rotate the image to correct for the orientation of the device during capture. */ - correctOrientation?: boolean; - /** Save the image to the photo album on the device after capture. */ - saveToPhotoAlbum?: boolean; - /** - * Choose the camera to use (front- or back-facing). - * Defined in Camera.Direction. Default is BACK. - * BACK: 0 - * FRONT: 1 - */ - cameraDirection?: number; - /** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */ - popoverOptions?: CameraPopoverOptions; -} - -/** - * iOS-only parameters that specify the anchor element location and arrow direction - * of the popover when selecting images from an iPad's library or album. - */ -export interface CameraPopoverOptions { - x: number; - y: number; - width: number; - height: number; - /** - * Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection - * Matches iOS UIPopoverArrowDirection constants. - * ARROW_UP : 1, - * ARROW_DOWN : 2, - * ARROW_LEFT : 4, - * ARROW_RIGHT : 8, - * ARROW_ANY : 15 - */ - arrowDir: number; -} - -export enum DestinationType { - DATA_URL = 0, - FILE_URL, - NATIVE_URI, -} - -export enum EncodingType { - JPEG = 0, - PNG, -} - -export enum MediaType { - PICTURE = 0, - VIDEO, - ALLMEDIA, -} - -export enum PictureSourceType { - PHOTOLIBRARY = 0, - CAMERA, - SAVEDPHOTOALBUM, -} - -export enum PopoverArrowDirection { - ARROW_UP = 1, - ARROW_DOWN, - ARROW_LEFT, - ARROW_RIGHT, - ARROW_ANY, -} - -export enum Direction { - BACK = 0, - FRONT, -} - -/** - * @name Camera - * @premier camera - * @description - * Take a photo or capture video. - * - * Requires the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera). - * - * [Warning] Since IOS 10 the camera requires permissions to be placed in your config.xml add - * ```xml - * - * You can take photos - * - * ``` - * inside of the ` { - * // imageData is either a base64 encoded string or a file URI - * // If it's base64 (DATA_URL): - * let base64Image = 'data:image/jpeg;base64,' + imageData; - * }, (err) => { - * // Handle error - * }); - * ``` - * @interfaces - * CameraOptions - * CameraPopoverOptions - */ -@Plugin({ - pluginName: 'Camera', - plugin: 'cordova-plugin-camera', - pluginRef: 'navigator.camera', - repo: 'https://github.com/apache/cordova-plugin-camera', - platforms: ['Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class Camera extends AwesomeCordovaNativePlugin { - /** - * Constant for possible destination types - */ - DestinationType = { - /** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */ - DATA_URL: 0, - /** Return file uri (content://media/external/images/media/2 for Android) */ - FILE_URI: 1, - /** Return native uri (eg. asset-library://... for iOS) */ - NATIVE_URI: 2, - }; - - /** - * Convenience constant - */ - EncodingType = { - /** Return JPEG encoded image */ - JPEG: 0, - /** Return PNG encoded image */ - PNG: 1, - }; - - /** - * Convenience constant - */ - MediaType = { - /** Allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType */ - PICTURE: 0, - /** Allow selection of video only, ONLY RETURNS URL */ - VIDEO: 1, - /** Allow selection from all media types */ - ALLMEDIA: 2, - }; - - /** - * Convenience constant - */ - PictureSourceType = { - /** Choose image from picture library (same as PHOTOLIBRARY for Android) */ - PHOTOLIBRARY: 0, - /** Take picture from camera */ - CAMERA: 1, - /** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */ - SAVEDPHOTOALBUM: 2, - }; - - /** - * Convenience constant - */ - PopoverArrowDirection = { - ARROW_UP: 1, - ARROW_DOWN: 2, - ARROW_LEFT: 4, - ARROW_RIGHT: 8, - ARROW_ANY: 15, - }; - - /** - * Convenience constant - */ - Direction = { - /** Use the back-facing camera */ - BACK: 0, - /** Use the front-facing camera */ - FRONT: 1, - }; - - /** - * Take a picture or video, or load one from the library. - * - * @param {CameraOptions} [options] Options that you want to pass to the camera. Encoding type, quality, etc. Platform-specific quirks are described in the [Cordova plugin docs](https://github.com/apache/cordova-plugin-camera#cameraoptions-errata-). - * @returns {Promise} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error. - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getPicture(options?: CameraOptions): Promise { - return; - } - - /** - * Remove intermediate image files that are kept in temporary storage after calling camera.getPicture. - * Applies only when the value of Camera.sourceType equals Camera.PictureSourceType.CAMERA and the Camera.destinationType equals Camera.DestinationType.FILE_URI. - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - cleanup(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/checkout/index.ts b/src/@awesome-cordova-plugins/plugins/checkout/index.ts deleted file mode 100644 index 58c3ae6d..00000000 --- a/src/@awesome-cordova-plugins/plugins/checkout/index.ts +++ /dev/null @@ -1,223 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export interface CkoCardTokenRequest { - /** - * The card number - */ - number: string; - /** - * The expiry month of the card - */ - expiry_month: string; - /** - * The expiry year of the card - */ - expiry_year: string; - /** - * The card verification value/code. 3 digits, except for Amex (4 digits) - */ - cvv?: string; - /** - * The cardholder's name - */ - name?: string; - /** - * The cardholder's billing address - */ - billing_address?: Address; - /** - * The cardholder's phone number - */ - phone?: Phone; -} - -export interface CkoCardTokenResponse { - /** - * The token type - */ - type: string; - /** - * The token value - */ - token: string; - /** - * The expiration datetime of the token - */ - expires_on: string; - /** - * The expiry month of the card - */ - expiry_month: number; - /** - * The expiry year of the card - */ - expiry_year: number; - /** - * The cardholder's name - */ - name: string; - /** - * The card scheme - */ - scheme: string; - /** - * The last 4 digit of the card number - */ - last4: string; - /** - * The bin range of the card - */ - bin: string; - /** - * The card type - */ - card_type: string; - /** - * The card category - */ - card_category: string; - /** - * The card issuer name - */ - issuer: string; - /** - * The card issuer country (two-letter ISO) - */ - issuer_country: string; - /** - * The card product id - */ - product_id: string; - /** - * The card product type - */ - product_type: string; - /** - * The cardholder's billing address - */ - billing_address: Address; - /** - * The cardholder's phone number - */ - phone: Phone; -} - -export interface Address { - /** - * The first line of the address - */ - address_line1?: string; - /** - * The second line of the address - */ - address_line2?: string; - /** - * The address city - */ - city?: string; - /** - * The address state - */ - state?: string; - /** - * The address zip/postal code - */ - zip?: string; - /** - * The two-letter ISO country code of the address - */ - country?: string; -} - -export interface Phone { - /** - * The international country calling code. Required for some risk checks - */ - country_code: string; - /** - * The phone number - */ - number: string; -} - -/** - * @name Checkout - * @description - * Checkout.com cordova plugin - * @usage - * ```typescript - * import { Checkout } from '@awesome-cordova-plugins/checkout/ngx'; - * - * - * constructor(private checkout: Checkout) { } - * - * ... - * - * - * this.checkout.initSandboxClient("pk_test_7d395871-0d66-4b62-85b6-8424df78b125") - * .then(() => this.label = "CKO init completed") - * .catch(err => this.label = err) - * - * ... - * - * let tokenRequest: CkoCardTokenRequest = { - * number: "4543474002249996", - * cvv: "010", - * expiry_month: "08", - * expiry_year: "2025", - * billing_address: { - * country: "FR" - * } - * } - * - * - * this.cko.generateToken(tokenRequest) - * .then(tokenResponse => this.label = "Token: " + tokenResponse.token) - * .catch(err => this.label = err) - * ``` - */ -@Plugin({ - pluginName: 'Checkout', - plugin: '@checkout.com/cordova-plugin-checkout', - pluginRef: 'cordova.plugins.Checkout', - repo: 'https://github.com/checkout/frames-cordova', - install: '', - installVariables: [], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Checkout extends AwesomeCordovaNativePlugin { - /** - * Initialize Frames plugin in Sandbox mode - * - * @param publicKey {string} Merchant's sandbox public key - * @returns {Promise} Returns a promise that resolves when Frames initiation is completed - */ - @Cordova() - initSandboxClient(publicKey: string): Promise { - return; - } - - /** - * Initialize Frames plugin in Live mode - * - * @param publicKey {string} Merchant's live public key - * @returns {Promise} Returns a promise that resolves when Frames initiation is completed - */ - @Cordova() - initLiveClient(publicKey: string): Promise { - return; - } - - /** - * Exchange card details for a reference token that can be used later to request a card payment from your backend. Tokens are single use and expire after 15 minutes. - * - * @param ckoCardTokenRequest {CkoCardTokenRequest} Card tokenization request object - * @returns {Promise} Returns a promise that resolves when Token response object - */ - @Cordova() - generateToken(ckoCardTokenRequest: CkoCardTokenRequest): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/chooser-simple-file/index.ts b/src/@awesome-cordova-plugins/plugins/chooser-simple-file/index.ts deleted file mode 100644 index 4c1b79d6..00000000 --- a/src/@awesome-cordova-plugins/plugins/chooser-simple-file/index.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface ChooserResult { - mediaType: string; - name: string; - uri: string; -} - -/** - * @name Chooser - * @description - * File chooser plugin for Cordova. - * - * The following must be added to config.xml to prevent crashing when selecting large files on Android: - * ```xml - * - * - * - * - * - * ``` - * @usage - * ```typescript - * import { Chooser } from '@awesome-cordova-plugins/chooser-simple-file/ngx'; - * - * - * constructor(private chooser: Chooser) { } - * - * ... - * - * - * this.chooser.getFiles() - * .then(files => console.log(files ? files.name : 'canceled')) - * .catch((error: any) => console.error(error)); - * - * ``` - * @interfaces - * ChooserResult - */ -@Plugin({ - pluginName: 'Chooser', - plugin: 'cordova-plugin-simple-file-chooser', - pluginRef: 'chooser', - repo: 'https://github.com/hc-oss/cordova-plugin-simple-file-chooser', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Chooser extends AwesomeCordovaNativePlugin { - /** - * Displays native prompt for user to select a file. - * - * @param {string} [accept] Optional MIME type filter (e.g. 'image/gif,video/*'). - * @returns {Promise} Promise containing selected file's - * data: MIME type, display name, and original URI. - */ - @Cordova() - getFiles(accept?: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/chooser/index.ts b/src/@awesome-cordova-plugins/plugins/chooser/index.ts deleted file mode 100644 index b674b3c3..00000000 --- a/src/@awesome-cordova-plugins/plugins/chooser/index.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface ChooserOptions { - mimeTypes?: string; - maxFileSize?: number; -} - -export interface ChooserResult { - path: string; - /** - * without extension - */ - name: string; - /** - * with extension - */ - displayName: string; - mimeType: string; - extension: string; - size: number; -} - -/** - * @name Chooser - * @description - * File chooser plugin for Cordova. - * - * The following must be added to config.xml to prevent crashing when selecting large files on Android: - * ```xml - * - * - * - * - * - * ``` - * @usage - * ```typescript - * import { Chooser } from '@awesome-cordova-plugins/chooser/ngx'; - * - * - * constructor(private chooser: Chooser) { } - * - * ... - * - * - * this.chooser.getFile() - * .then(file => console.log(file ? file.name : 'canceled')) - * .catch((error: any) => console.error(error)); - * - * ``` - * @interfaces - * ChooserResult - */ -@Plugin({ - pluginName: 'Chooser', - plugin: 'cordova-plugin-chooser', - pluginRef: 'chooser', - repo: 'https://github.com/MaximBelov/cordova-plugin-chooser', - platforms: ['Android', 'iOS'], - install: 'ionic cordova plugin add http://github.com/MaximBelov/cordova-plugin-chooser.git', -}) -@Injectable() -export class Chooser extends AwesomeCordovaNativePlugin { - /** - * Displays native prompt for user to select a file. - * - * @param {Object} options - * @param {string} options.mimeTypes Optional MIME type filter (e.g. 'image/gif,video/*'). - * @param {string} options.maxFileSize Optional Max file size. - * @returns {Promise} Promise containing selected file's - * data: MIME type, display name, and original URI. - */ - @Cordova() - getFile(options?: ChooserOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/clevertap/index.ts b/src/@awesome-cordova-plugins/plugins/clevertap/index.ts deleted file mode 100644 index 5ad10be2..00000000 --- a/src/@awesome-cordova-plugins/plugins/clevertap/index.ts +++ /dev/null @@ -1,1048 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -declare let clevertap: any; - -/** - * @name CleverTap - * @description - * Cordova Plugin that wraps CleverTap SDK for Android and iOS - * @usage - * ```typescript - * import { CleverTap } from '@awesome-cordova-plugins/clevertap/ngx'; - * - * constructor(private clevertap: CleverTap) { } - * - * ``` - */ -@Plugin({ - pluginName: 'CleverTap', - plugin: 'clevertap-cordova', - pluginRef: 'CleverTap', - repo: 'https://github.com/CleverTap/clevertap-cordova', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class CleverTap extends AwesomeCordovaNativePlugin { - /** - * notify device ready - * NOTE: in iOS use to be notified of launch Push Notification or Deep Link - * in Android use only in android phonegap build projects - * - * @returns {Promise} - */ - @Cordova() - notifyDeviceReady(): Promise { - return; - } - - /******************* - * Personalization - ******************/ - - /** - * Personalization - * Enables the Personalization API - * - * @returns {Promise} - */ - @Cordova() - enablePersonalization(): Promise { - return; - } - - /** - * Personalization - * Disables the Personalization API - * - * @returns {Promise} - */ - @Cordova() - disablePersonalization(): Promise { - return; - } - - /** - * Enables tracking opt out for the currently active user. - * - * @param optOut {boolean} - * @returns {Promise} - */ - @Cordova() - setOptOut(optOut: boolean): Promise { - return; - } - - /** - * Sets CleverTap SDK to offline mode. - * - * @param offline {boolean} - * @returns {Promise} - */ - @Cordova() - setOffline(offline: boolean): Promise { - return; - } - - /** - * Enables the reporting of device network related information, including IP address. This reporting is disabled by default. - * - * @param enable {boolean} - * @returns {Promise} - */ - @Cordova() - enableDeviceNetworkInfoReporting(enable: boolean): Promise { - return; - } - - /******************* - * Push - ******************/ - - /** - * Registers for push notifications - * - * @returns {Promise} - */ - @Cordova() - registerPush(): Promise { - return; - } - - /** - * Sets the device's push token - * - * @param token {string} - * @returns {Promise} - */ - @Cordova() - setPushToken(token: string): Promise { - return; - } - - /** - * Sets the device's Xiaomi push token. - * clevertap-cordova 2.6.0 onwards method requires region as a mandatory parameter. - * @param token {string} - * @param region {string} - * @returns {Promise} - */ - @Cordova() - setPushXiaomiToken(token: string, region: string): Promise { - return; - } - - /** - * Sets the device's Baidu push token - * - * @param token {string} - * @returns {Promise} - */ - @Cordova() - setPushBaiduToken(token: string): Promise { - return; - } - - /** - * Sets the device's Huawei push token - * - * @param token {string} - * @returns {Promise} - */ - @Cordova() - setPushHuaweiToken(token: string): Promise { - return; - } - - /** - * Create Notification Channel for Android O+ - * - * @param extras {any} - * @returns {Promise} - */ - @Cordova() - createNotification(extras: any): Promise { - return; - } - - /** - * Create Notification Channel for Android O+ - * - * @param channelID {string} - * @param channelName {string} - * @param channelDescription {string} - * @param importance {number} - * @param showBadge {boolean} - * @returns {Promise} - */ - @Cordova() - createNotificationChannel( - channelID: string, - channelName: string, - channelDescription: string, - importance: number, - showBadge: boolean - ): Promise { - return; - } - - /** - * Create Notification Channel for Android O+ - * - * @param channelID {string} - * @param channelName {string} - * @param channelDescription {string} - * @param importance {number} - * @param showBadge {boolean} - * @param sound {string} - * @returns {Promise} - */ - @Cordova() - createNotificationChannelWithSound( - channelID: string, - channelName: string, - channelDescription: string, - importance: number, - showBadge: boolean, - sound: string - ): Promise { - return; - } - - /** - * Create Notification Channel with Group ID for Android O+ - * - * @param channelID {string} - * @param channelName {string} - * @param channelDescription {string} - * @param importance {number} - * @param groupId {string} - * @param showBadge {boolean} - * @param sound {string} - * @returns {Promise} - */ - @Cordova() - createNotificationChannelWithGroupId( - channelID: string, - channelName: string, - channelDescription: string, - importance: number, - groupId: string, - showBadge: boolean - ): Promise { - return; - } - - /** - * Create Notification Channel with Group ID for Android O+ - * - * @param channelID {string} - * @param channelName {string} - * @param channelDescription {string} - * @param importance {number} - * @param groupId {string} - * @param showBadge {boolean} - * @param sound - * @returns {Promise} - */ - @Cordova() - createNotificationChannelWithGroupIdAndSound( - channelID: string, - channelName: string, - channelDescription: string, - importance: number, - groupId: string, - showBadge: boolean, - sound: string - ): Promise { - return; - } - - /** - * Create Notification Channel Group for Android O+ - * - * @param groupID {string} - * @param groupName {string} - * @returns {Promise} - */ - @Cordova() - createNotificationChannelGroup(groupID: string, groupName: string): Promise { - return; - } - - /** - * Delete Notification Channel for Android O+ - * - * @param channelID {string} - * @returns {Promise} - */ - @Cordova() - deleteNotificationChannel(channelID: string): Promise { - return; - } - - /** - * Delete Notification Group for Android O+ - * - * @param groupID {string} - * @returns {Promise} - */ - @Cordova() - deleteNotificationChannelGroup(groupID: string): Promise { - return; - } - - /******************* - * Events - ******************/ - - /** - * Record Screen View - * - * @param screenName {string} - * @returns {Promise} - */ - @Cordova() - recordScreenView(screenName: string): Promise { - return; - } - - /** - * Record Event with Name - * - * @param eventName {string} - * @returns {Promise} - */ - @Cordova() - recordEventWithName(eventName: string): Promise { - return; - } - - /** - * Record Event with Name and Event properties - * - * @param eventName {string} - * @param eventProps {any} - * @returns {Promise} - */ - @Cordova() - recordEventWithNameAndProps(eventName: string, eventProps: any): Promise { - return; - } - - /** - * Record Charged Event with Details and Items - * - * @param details {any} object with transaction details - * @param items {any} array of items purchased - * @returns {Promise} - */ - @Cordova() - recordChargedEventWithDetailsAndItems(details: any, items: any): Promise { - return; - } - - /** - * Get Event First Time - * - * @param eventName {string} - * callback returns epoch seconds or -1 - * @returns {Promise} - */ - @Cordova() - eventGetFirstTime(eventName: string): Promise { - return; - } - - /** - * Get Event Last Time - * - * @param eventName {string} - * callback returns epoch seconds or -1 - * @returns {Promise} - */ - @Cordova() - eventGetLastTime(eventName: string): Promise { - return; - } - - /** - * Get Event Number of Occurrences - * - * @param eventName {string} - * calls back with int or -1 - * @returns {Promise} - */ - @Cordova() - eventGetOccurrences(eventName: string): Promise { - return; - } - - /** - * Get Event Details - * - * @param eventName {string} - * calls back with object {"eventName": , "firstTime":, "lastTime": , "count": } or empty object - * @returns {Promise} - */ - @Cordova() - eventGetDetails(eventName: string): Promise { - return; - } - - /** - * Get Event History - * calls back with object {"eventName1":, "eventName2":} - * - * @returns {Promise} - */ - @Cordova() - getEventHistory(): Promise { - return; - } - - /******************* - * Profiles - ******************/ - - /** - * Get the device location if available. - * On iOS: - * Calling this will prompt the user location permissions dialog. - * Please be sure to include the NSLocationWhenInUseUsageDescription key in your Info.plist. - * Uses desired accuracy of kCLLocationAccuracyHundredMeters. - * If you need background location updates or finer accuracy please implement your own location handling. - * On Android: - * Requires Location Permission in AndroidManifest e.g. "android.permission.ACCESS_COARSE_LOCATION" - * You can use location to pass it to CleverTap via the setLocation API - * for, among other things, more fine-grained geo-targeting and segmentation purposes. - * Note: on iOS the call to CleverTapSDK must be made on the main thread due to LocationManager restrictions, but the CleverTapSDK method itself is non-blocking. - * calls back with {lat:lat, lon:lon} lat and lon are floats - * - * @returns {Promise} - */ - @Cordova() - getLocation(): Promise { - return; - } - - /** - * Set location - * - * @param lat {number} - * @param lon {number} - * @returns {Promise} - */ - @Cordova() - setLocation(lat: number, lon: number): Promise { - return; - } - - /** - * Creates a separate and distinct user profile identified by one or more of Identity, Email, FBID or GPID values, - * and populated with the key-values included in the profile dictionary. - * If your app is used by multiple users, you can use this method to assign them each a unique profile to track them separately. - * If instead you wish to assign multiple Identity, Email, FBID and/or GPID values to the same user profile, - * use profileSet rather than this method. - * If none of Identity, Email, FBID or GPID is included in the profile dictionary, - * all properties values will be associated with the current user profile. - * When initially installed on this device, your app is assigned an "anonymous" profile. - * The first time you identify a user on this device (whether via onUserLogin or profileSet), - * the "anonymous" history on the device will be associated with the newly identified user. - * Then, use this method to switch between subsequent separate identified users. - * Please note that switching from one identified user to another is a costly operation - * in that the current session for the previous user is automatically closed - * and data relating to the old user removed, and a new session is started - * for the new user and data for that user refreshed via a network call to CleverTap. - * In addition, any global frequency caps are reset as part of the switch. - * - * @param profile {any} object - * @returns {Promise} - */ - @Cordova() - onUserLogin(profile: any): Promise { - return; - } - - /** - * Set profile attributes - * - * @param profile {any} object - * @returns {Promise} - */ - @Cordova() - profileSet(profile: any): Promise { - return; - } - - /** - * Get User Profile Property - * - * @param propertyName {string} - * calls back with value of propertyName or false - * @returns {Promise} - */ - @Cordova() - profileGetProperty(propertyName: string): Promise { - return; - } - - /** - * @deprecated This method is deprecated. Use getCleverTapID() instead. - * Get a unique CleverTap identifier suitable for use with install attribution providers. - * calls back with unique CleverTap attribution identifier - * - * @returns {Promise} - */ - @Cordova() - profileGetCleverTapAttributionIdentifier(): Promise { - return; - } - - /** - * @deprecated This method is deprecated. Use getCleverTapID() instead. - * Get User Profile CleverTapID - * calls back with CleverTapID or false - * - * @returns {Promise} - */ - @Cordova() - profileGetCleverTapID(): Promise { - return; - } - - /** - * Get User Profile CleverTapID - * calls back with CleverTapID - * - * @returns {Promise} - */ - @Cordova() - getCleverTapID(): Promise { - return; - } - - /** - * Remove the property specified by key from the user profile - * - * @param key {string} - * @returns {Promise} - */ - @Cordova() - profileRemoveValueForKey(key: string): Promise { - return; - } - - /** - * Method for setting a multi-value user profile property - * - * @param key {string} - * @param values {any} array of strings - * @returns {Promise} - */ - @Cordova() - profileSetMultiValues(key: string, values: any): Promise { - return; - } - - /** - * Method for adding a value to a multi-value user profile property - * - * @param key {string} - * @param value {string} - * @returns {Promise} - */ - @Cordova() - profileAddMultiValue(key: string, value: string): Promise { - return; - } - - /** - * Method for adding values to a multi-value user profile property - * - * @param key {string} - * @param values {any} array of strings - * @returns {Promise} - */ - @Cordova() - profileAddMultiValues(key: string, values: any): Promise { - return; - } - - /** - * Method for removing a value from a multi-value user profile property - * - * @param key {string} - * @param value {string} - * @returns {Promise} - */ - @Cordova() - profileRemoveMultiValue(key: string, value: string): Promise { - return; - } - - /** - * Method for removing a value from a multi-value user profile property - * - * @param key {string} - * @param values {any} array of strings - * @returns {Promise} - */ - @Cordova() - profileRemoveMultiValues(key: string, values: any): Promise { - return; - } - - /** - * Method for incrementing a value for a single-value profile property (if it exists). - * - * @param key {string} - * @param value {number} - * @returns {Promise} - */ - @Cordova() - profileIncrementValueBy(key: string,value: number): Promise { - return; - } - - /** - * Method for decrementing a value for a single-value profile property (if it exists). - * - * @param key {string} - * @param value {number} - * @returns {Promise} - */ - @Cordova() - profileDecrementValueBy(key: string,value: number): Promise { - return; - } - - /******************* - * In-App Controls - ******************/ - - /** - * Suspends and saves inApp notifications until 'resumeInAppNotifications' is called for current session. - * Automatically resumes InApp notifications display on CleverTap shared instance creation. - * Pending inApp notifications are displayed only for current session. - * - * @returns {Promise} - */ - @Cordova() - suspendInAppNotifications(): Promise { - return; - } - - /** - * Discards inApp notifications until 'resumeInAppNotifications' is called for current session. - * Automatically resumes InApp notifications display on CleverTap shared instance creation. - * Pending inApp notifications are not displayed. - */ - @Cordova() - discardInAppNotifications(): Promise { - return; - } - - /** - * Resumes displaying inApps notifications and shows pending inApp notifications if any. - * - * @returns {Promise} - */ - @Cordova() - resumeInAppNotifications(): Promise { - return; - } - - /******************* - * Session - ******************/ - - /** - * Get Session Elapsed Time - * calls back with seconds - * - * @returns {Promise} - */ - @Cordova() - sessionGetTimeElapsed(): Promise { - return; - } - - /** - * Get Session Total Visits - * calls back with with int or -1 - * - * @returns {Promise} - */ - @Cordova() - sessionGetTotalVisits(): Promise { - return; - } - - /** - * Get Session Screen Count - * calls back with with int - * - * @returns {Promise} - */ - @Cordova() - sessionGetScreenCount(): Promise { - return; - } - - /** - * Get Session Previous Visit Time - * calls back with with epoch seconds or -1 - * - * @returns {Promise} - */ - @Cordova() - sessionGetPreviousVisitTime(): Promise { - return; - } - - /** - * Get Sesssion Referrer UTM details - * object {"source": , "medium": , "campaign": } or empty object - * - * @returns {Promise} - */ - @Cordova() - sessionGetUTMDetails(): Promise { - return; - } - - /** - * Call this to manually track the utm details for an incoming install referrer - * - * @param source {string} - * @param medium {string} - * @param campaign {string} - * @returns {Promise} - */ - @Cordova() - pushInstallReferrer(source: string, medium: string, campaign: string): Promise { - return; - } - - /**************************** - * Notification Inbox methods - ****************************/ - - /** - * Call this method to initialize the App Inbox - */ - @Cordova() - initializeInbox(): Promise { - return; - } - - /** - * Call this method to get the count of unread Inbox messages - */ - @Cordova() - getInboxMessageUnreadCount(): Promise { - return; - } - - /** - * Call this method to get the count of total Inbox messages - */ - @Cordova() - getInboxMessageCount(): Promise { - return; - } - - /** - * Call this method to open the App Inbox - * - * @param styleConfig : any or empty object - */ - @Cordova() - showInbox(styleConfig: any): Promise { - return; - } - - /** - * Call this to Fetch all Inbox Messages - * - * @returns {Promise} - */ - @Cordova() - getAllInboxMessages(): Promise { - return; - } - - /** - * Call this to Fetch all Unread Inbox Messages - * - * @returns {Promise} - */ - @Cordova() - getUnreadInboxMessages(): Promise { - return; - } - - /** - * Call this to Fetch Inbox Message For Id - * - * @param messageId {string} - * @returns {Promise} - */ - @Cordova() - getInboxMessageForId(messageId: string): Promise { - return; - } - - /** - * Call this to Delete Inbox Message For Id - * - * @param messageId {string} - * @returns {Promise} - */ - @Cordova() - deleteInboxMessageForId(messageId: string): Promise { - return; - } - - /** - * Call this method to delete bulk Inbox Messages for Given Message Ids - * - * @param messageIds {any} array of strings - * @returns {Promise} - */ - @Cordova() - deleteInboxMessagesForIds(messageIds: any): Promise { - return; - } - - /** - * Call this to Mark Read Inbox Message For Id - * - * @param messageId {string} - * @returns {Promise} - */ - @Cordova() - markReadInboxMessageForId(messageId: string): Promise { - return; - } - - /** - * Call this to Mark Push Inbox Notification Viewed Event for Id - * - * @param messageId {string} - * @returns {Promise} - */ - @Cordova() - pushInboxNotificationViewedEventForId(messageId: string): Promise { - return; - } - - /** - * Call this to Mark Push Inbox Notification Clicked Event for Id - * - * @param messageId {string} - * @returns {Promise} - */ - @Cordova() - pushInboxNotificationClickedEventForId(messageId: string): Promise { - return; - } - - /** - * Call this to Get All Display Units - * - * @returns {Promise} - */ - @Cordova() - getAllDisplayUnits(): Promise { - return; - } - - /** - * Call this to Get Display Unit For Id - * - * @param id {string} - * @returns {Promise} - */ - @Cordova() - getDisplayUnitForId(id: string): Promise { - return; - } - - /** - * Call this to Push DisplayUnit Viewed Event for ID - * - * @param id {string} - * @returns {Promise} - */ - @Cordova() - pushDisplayUnitViewedEventForID(id: string): Promise { - return; - } - - /** - * Call this to Push DisplayUnit Clicked Event for ID - * - * @param id {string} - * @returns {Promise} - */ - @Cordova() - pushDisplayUnitClickedEventForID(id: string): Promise { - return; - } - - /** - * Call this to Get Feature Flag for key - * - * @param key {string} - * @param defaultValue {string} - * @returns {Promise} - */ - @Cordova() - getFeatureFlag(key: string, defaultValue: string): Promise { - return; - } - - /** - * Call this to Set Defaults for Product Config - * - * @param defaults {any} - * @returns {Promise} - */ - @Cordova() - setDefaultsMap(defaults: any): Promise { - return; - } - - /** - * Call this for Product Config Fetch - * - * @param defaults {any} - * @returns {Promise} - */ - @Cordova() - fetch(): Promise { - return; - } - - /** - * Call this for Product Config Fetch with Min Interval - * - * @param timeInterval {number} - * @returns {Promise} - */ - @Cordova() - fetchWithMinimumFetchIntervalInSeconds(timeInterval: number): Promise { - return; - } - - /** - * Call this for Product Config Activate - * - * @returns {Promise} - */ - @Cordova() - activate(): Promise { - return; - } - - /** - * Call this for Product Config Fetch and Activate - * - * @returns {Promise} - */ - @Cordova() - fetchAndActivate(): Promise { - return; - } - - /** - * Call this to set Product Config Fetch with Min Interval - * - * @param timeInterval {number} - * @returns {Promise} - */ - @Cordova() - setMinimumFetchIntervalInSeconds(timeInterval: number): Promise { - return; - } - - /** - * Call this to Get Last Fetch Time Interval - * - * @returns {Promise} - */ - @Cordova() - getLastFetchTimeStampInMillis(): Promise { - return; - } - - /** - * Call this to Get String - * - * @param key {string} - * @returns {Promise} - */ - @Cordova() - getString(key: string): Promise { - return; - } - - /** - * Call this to Get Boolean - * - * @param key {string} - * @returns {Promise} - */ - @Cordova() - getBoolean(key: string): Promise { - return; - } - - /** - * Call this to Get Long - * - * @param key {string} - * @returns {Promise} - */ - @Cordova() - getLong(key: string): Promise { - return; - } - - /** - * Call this to Get Double - * - * @param key {string} - * @returns {Promise} - */ - @Cordova() - getDouble(key: string): Promise { - return; - } - - /** - * Call this to Reset Product Config - * - * @returns {Promise} - */ - @Cordova() - reset(): Promise { - return; - } - - /******************* - * Developer Options - ******************/ - /** - * 0 is off, 1 is info, 2 is debug, default is 1 - * - * @param level {number} - * @returns {Promise} - */ - @Cordova() - setDebugLevel(level: number): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/clipboard/index.ts b/src/@awesome-cordova-plugins/plugins/clipboard/index.ts deleted file mode 100644 index 146ac45a..00000000 --- a/src/@awesome-cordova-plugins/plugins/clipboard/index.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -/** - * @name Clipboard - * @premier clipboard - * @description - * Clipboard management plugin for Cordova that supports iOS, Android, and Windows Phone 8. - * @usage - * ```typescript - * import { Clipboard } from '@awesome-cordova-plugins/clipboard/ngx'; - * - * constructor(private clipboard: Clipboard) { } - * - * ... - * - * - * this.clipboard.copy('Hello world'); - * - * this.clipboard.paste().then( - * (resolve: string) => { - * alert(resolve); - * }, - * (reject: string) => { - * alert('Error: ' + reject); - * } - * ); - * - * this.clipboard.clear(); - * ``` - */ -@Plugin({ - pluginName: 'Clipboard', - plugin: 'cordova-clipboard', - pluginRef: 'cordova.plugins.clipboard', - repo: 'https://github.com/ihadeed/cordova-clipboard', - platforms: ['Android', 'iOS', 'Windows Phone 8'], -}) -@Injectable() -export class Clipboard extends AwesomeCordovaNativePlugin { - /** - * Copies the given text - * - * @param {string} text Text that gets copied on the system clipboard - * @returns {Promise} Returns a promise after the text has been copied - */ - @Cordova() - copy(text: string): Promise { - return; - } - - /** - * Pastes the text stored in clipboard - * - * @returns {Promise} Returns a promise after the text has been pasted - */ - @Cordova() - paste(): Promise { - return; - } - - /** - * Clear the text stored in clipboard - * - * @returns {Promise} Returns a promise after the text has been cleaned - */ - @Cordova() - clear(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/cloud-settings/index.ts b/src/@awesome-cordova-plugins/plugins/cloud-settings/index.ts deleted file mode 100644 index f0a48d52..00000000 --- a/src/@awesome-cordova-plugins/plugins/cloud-settings/index.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Cloud Settings - * @description - * Stores app settings in cloud storage so if the user re-installs the app or installs it on a different device, the settings will be restored and available in the new installation. - * @usage - * ```typescript - * import { CloudSettings } from '@awesome-cordova-plugins/cloud-settings/ngx'; - * - * - * constructor(private cloudSettings: CloudSettings) { } - * - * ... - * - * this.cloudSettings.exists() - * .then((exists: boolean) => console.log("Saved settings exist: " + exists) ) - * - * this.cloudSettings.load() - * .then((settings: any) => this.settings = settings) - * .catch((error: any) => console.error(error)); - * - * this.cloudSettings.save(this.settings) - * .then((savedSettings: any) => console.log("Saved settings: " + JSON.stringify(savedSettings))) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'CloudSettings', - plugin: 'cordova-plugin-cloud-settings', - pluginRef: 'cordova.plugin.cloudsettings', - repo: 'https://github.com/dpa99c/cordova-plugin-cloud-settings', - install: 'ionic cordova plugin add cordova-plugin-cloud-settings --variable ANDROID_BACKUP_SERVICE_KEY=myapikey', - installVariables: ['ANDROID_BACKUP_SERVICE_KEY'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class CloudSettings extends AwesomeCordovaNativePlugin { - /** - * Indicates if any stored cloud settings currently exist for the current user. - * - * @returns {Promise} Will be passed a boolean flag which indicates whether an store settings exist for the user. - */ - @Cordova() - exists(): Promise { - return; - } - - /** - * Saves the settings to cloud backup. - * - * @param {object} settings - a JSON structure representing the user settings to save to cloud backup. - * @param {boolean} [overwrite] - (optional) if true, existing settings will be replaced rather than updated. Defaults to false. - * If false, existing settings will be merged with the new settings passed to this function. - * @returns {Promise} Will be passed a single object argument which contains the saved settings as a JSON object. - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - save(settings: any, overwrite?: boolean): Promise { - return; - } - - /** - * Loads the current settings. - * - * @returns {Promise} Will be passed a single object argument which contains the saved settings as a JSON object. - */ - @Cordova() - load(): Promise { - return; - } - - /** - * Registers a function which will be called if/when settings on the device have been updated from the cloud. - * - * @param {Function} handler - callback function to invoke when device settings have been updated from the cloud. - */ - @Cordova({ sync: true }) - onRestore(handler: Function): void {} - - /** - * Outputs verbose log messages from the native plugin components to the JS console. - * - * @returns {Promise} - */ - @Cordova() - enableDebug(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/code-push/index.ts b/src/@awesome-cordova-plugins/plugins/code-push/index.ts deleted file mode 100644 index 5d4b9fa8..00000000 --- a/src/@awesome-cordova-plugins/plugins/code-push/index.ts +++ /dev/null @@ -1,553 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -namespace Http { - export const enum Verb { - GET, - HEAD, - POST, - PUT, - DELETE, - TRACE, - OPTIONS, - CONNECT, - PATCH, - } - - export interface Response { - statusCode: number; - body?: string; - } - - export interface Requester { - request(verb: Verb, url: string, callback: Callback): void; - request(verb: Verb, url: string, requestBody: string, callback: Callback): void; - } -} - -/** - * Defines a package. All fields are non-nullable, except when retrieving the currently running package on the first run of the app, - * in which case only the appVersion is compulsory. - * - * !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !! - */ -export interface IPackage { - deploymentKey: string; - description: string; - label: string; - appVersion: string; - isMandatory: boolean; - packageHash: string; - packageSize: number; - failedInstall: boolean; -} - -/** - * Defines a remote package, which represents an update package available for download. - */ -export interface IRemotePackage extends IPackage { - /** - * The URL at which the package is available for download. - */ - downloadUrl: string; - - /** - * Downloads the package update from the CodePush service. - * - * @param {SuccessCallback} downloadSuccess Called with one parameter, the downloaded package information, once the download completed successfully. - * @param {ErrorCallback} [downloadError] Optional callback invoked in case of an error. - * @param {SuccessCallback} [downloadProgress] Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. - */ - download( - downloadSuccess: SuccessCallback, - downloadError?: ErrorCallback, - downloadProgress?: SuccessCallback - ): void; - - /** - * Aborts the current download session, previously started with download(). - * - * @param {SuccessCallback} [abortSuccess] Optional callback invoked if the abort operation succeeded. - * @param {ErrorCallback} [abortError] Optional callback invoked in case of an error. - */ - abortDownload(abortSuccess?: SuccessCallback, abortError?: ErrorCallback): void; -} - -/** - * Defines a local package. - * - * !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !! - */ -export interface ILocalPackage extends IPackage { - /** - * The local storage path where this package is located. - */ - localPath: string; - - /** - * Indicates if the current application run is the first one after the package was applied. - */ - isFirstRun: boolean; - - /** - * Applies this package to the application. The application will be reloaded with this package and on every application launch this package will be loaded. - * On the first run after the update, the application will wait for a codePush.notifyApplicationReady() call. Once this call is made, the install operation is considered a success. - * Otherwise, the install operation will be marked as failed, and the application is reverted to its previous version on the next run. - * - * @param {SuccessCallback} installSuccess Callback invoked if the install operation succeeded. - * @param {ErrorCallback} [installError] Optional callback invoked in case of an error. - * @param {InstallOptions} [installOptions] Optional parameter used for customizing the installation behavior. - */ - install( - installSuccess: SuccessCallback, - errorCallback?: ErrorCallback, - installOptions?: InstallOptions - ): void; -} - -/** - * Decomposed static side of RemotePackage. - * For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics - */ - -/* tslint:disable */ -interface RemotePackage_Static { - new (): IRemotePackage; -} - -/* tslint:enable */ - -/** - * Decomposed static side of LocalPackage. - * For Class Decomposition guidelines see http://www.typescriptlang.org/Handbook#writing-dts-files-guidelines-and-specifics - */ - -/* tslint:disable */ -interface LocalPackage_Static { - new (): ILocalPackage; -} - -/* tslint:enable */ - -declare const RemotePackage: RemotePackage_Static; -declare const LocalPackage: LocalPackage_Static; - -/** - * Defines the JSON format of the current package information file. - * This file is stored in the local storage of the device and persists between store updates and code-push updates. - * - * !! THIS FILE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !! - */ -interface IPackageInfoMetadata extends ILocalPackage { - nativeBuildTime: string; -} - -interface NativeUpdateNotification { - updateAppVersion: boolean; // Always true - appVersion: string; -} - -export type Callback = (error: Error, parameter: T) => void; -export type SuccessCallback = (result?: T) => void; -export type ErrorCallback = (error?: Error) => void; - -interface Configuration { - appVersion: string; - clientUniqueId: string; - deploymentKey: string; - serverUrl: string; - ignoreAppVersion?: boolean; -} - -declare class AcquisitionStatus { - static DeploymentSucceeded: string; - static DeploymentFailed: string; -} - -declare class AcquisitionManager { - constructor(httpRequester: Http.Requester, configuration: Configuration); - queryUpdateWithCurrentPackage( - currentPackage: IPackage, - callback?: Callback - ): void; - reportStatusDeploy( - pkg?: IPackage, - status?: string, - previousLabelOrAppVersion?: string, - previousDeploymentKey?: string, - callback?: Callback - ): void; - reportStatusDownload(pkg: IPackage, callback?: Callback): void; -} - -interface CodePushCordovaPlugin { - /** - * Get the current package information. - * - * @param packageSuccess Callback invoked with the currently deployed package information. - * @param packageError Optional callback invoked in case of an error. - */ - getCurrentPackage(packageSuccess: SuccessCallback, packageError?: ErrorCallback): void; - - /** - * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code. - * This happens only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet. - */ - getPendingPackage(packageSuccess: SuccessCallback, packageError?: ErrorCallback): void; - - /** - * Checks with the CodePush server if an update package is available for download. - * - * @param {SuccessCallback} querySuccess Callback invoked in case of a successful response from the server. - * The callback takes one RemotePackage parameter. A non-null package is a valid update. - * A null package means the application is up to date for the current native application version. - * @param {ErrorCallback} [queryError] Optional callback invoked in case of an error. - * @param {string} [deploymentKey] Optional deployment key that overrides the config.xml setting. - */ - checkForUpdate( - querySuccess: SuccessCallback, - queryError?: ErrorCallback, - deploymentKey?: string - ): void; - - /** - * Notifies the plugin that the update operation succeeded and that the application is ready. - * Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop. - * If using sync API, calling this function is not required since sync calls it internally. - * - * @param {SuccessCallback} [notifySucceeded] Optional callback invoked if the plugin was successfully notified. - * @param {ErrorCallback} [notifyFailed] Optional callback invoked in case of an error during notifying the plugin. - */ - notifyApplicationReady(notifySucceeded?: SuccessCallback, notifyFailed?: ErrorCallback): void; - - /** - * Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update - * will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application. - * - * @param {SuccessCallback} installSuccess - * @param {ErrorCallback} [errorCallback] - */ - restartApplication(installSuccess: SuccessCallback, errorCallback?: ErrorCallback): void; - - /** - * Convenience method for installing updates in one method call. - * This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods. - * - * The algorithm of this method is the following: - * - Checks for an update on the CodePush server. - * - If an update is available - * - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version. - * The update package will then be downloaded and applied. - * - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version. - * If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED. - * - Otherwise, the update package will be downloaded and applied with no user interaction. - * - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE. - * - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR. - * - * @param {SuccessCallback} [syncCallback] Optional callback to be called with the status of the sync operation. - * The callback will be called only once, and the possible statuses are defined by the SyncStatus enum. - * @param {SyncOptions} [syncOptions] Optional SyncOptions parameter configuring the behavior of the sync operation. - * @param {SuccessCallback} [downloadProgress] Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. - */ - sync( - syncCallback?: SuccessCallback, - syncOptions?: SyncOptions, - downloadProgress?: SuccessCallback - ): void; -} - -/** - * Defines the possible result statuses of the window.codePush.sync operation. - */ -export enum SyncStatus { - /** - * The application is up to date. - */ - UP_TO_DATE, - - /** - * An update is available, it has been downloaded, unzipped and copied to the deployment folder. - * After the completion of the callback invoked with SyncStatus.UPDATE_INSTALLED, the application will be reloaded with the updated code and resources. - */ - UPDATE_INSTALLED, - - /** - * An optional update is available, but the user declined to install it. The update was not downloaded. - */ - UPDATE_IGNORED, - - /** - * An error happened during the sync operation. This might be an error while communicating with the server, downloading or unziping the update. - * The console logs should contain more information about what happened. No update has been applied in this case. - */ - ERROR, - - /** - * There is an ongoing sync in progress, so this attempt to sync has been aborted. - */ - IN_PROGRESS, - - /** - * Intermediate status - the plugin is about to check for updates. - */ - CHECKING_FOR_UPDATE, - - /** - * Intermediate status - a user dialog is about to be displayed. This status will be reported only if user interaction is enabled. - */ - AWAITING_USER_ACTION, - - /** - * Intermediate status - the update package is about to be downloaded. - */ - DOWNLOADING_PACKAGE, - - /** - * Intermediate status - the update package is about to be installed. - */ - INSTALLING_UPDATE, -} - -/** - * Defines the available install modes for updates. - */ -export enum InstallMode { - /** - * The update will be applied to the running application immediately. The application will be reloaded with the new content immediately. - */ - IMMEDIATE, - - /** - * The update is downloaded but not installed immediately. The new content will be available the next time the application is started. - */ - ON_NEXT_RESTART, - - /** - * The udpate is downloaded but not installed immediately. The new content will be available the next time the application is resumed or restarted, whichever event happends first. - */ - ON_NEXT_RESUME, -} - -/** - * Defines the install operation options. - */ -export interface InstallOptions { - /** - * Used to specify the InstallMode used for the install operation. This is optional and defaults to InstallMode.ON_NEXT_RESTART. - */ - installMode?: InstallMode; - - /** - * If installMode === ON_NEXT_RESUME, the minimum amount of time (in seconds) which needs to pass with the app in the background before an update install occurs when the app is resumed. - */ - minimumBackgroundDuration?: number; - - /** - * Used to specify the InstallMode used for the install operation if the update is mandatory. This is optional and defaults to InstallMode.IMMEDIATE. - */ - mandatoryInstallMode?: InstallMode; -} - -/** - * Defines the sync operation options. - */ -export interface SyncOptions extends InstallOptions { - /** - * Optional boolean flag. If set, previous updates which were rolled back will be ignored. Defaults to true. - */ - ignoreFailedUpdates?: boolean; - - /** - * Used to enable, disable or customize the user interaction during sync. - * If set to false, user interaction will be disabled. If set to true, the user will be alerted or asked to confirm new updates, based on whether the update is mandatory. - * To customize the user dialog, this option can be set to a custom UpdateDialogOptions instance. - */ - updateDialog?: boolean | UpdateDialogOptions; - - /** - * Overrides the config.xml deployment key when checking for updates. - */ - deploymentKey?: string; -} - -/** - * Defines the configuration options for the alert or confirmation dialog - */ -export interface UpdateDialogOptions { - /** - * If a mandatory update is available and this option is set, the message will be displayed to the user in an alert dialog before downloading and installing the update. - * The user will not be able to cancel the operation, since the update is mandatory. - */ - mandatoryUpdateMessage?: string; - - /** - * If an optional update is available and this option is set, the message will be displayed to the user in a confirmation dialog. - * If the user confirms the update, it will be downloaded and installed. Otherwise, the update update is not downloaded. - */ - optionalUpdateMessage?: string; - - /** - * The title of the dialog box used for interacting with the user in case of a mandatory or optional update. - * This title will only be used if at least one of mandatoryUpdateMessage or optionalUpdateMessage options are set. - */ - updateTitle?: string; - - /** - * The label of the confirmation button in case of an optional update. - */ - optionalInstallButtonLabel?: string; - - /** - * The label of the cancel button in case of an optional update. - */ - optionalIgnoreButtonLabel?: string; - - /** - * The label of the continue button in case of a mandatory update. - */ - mandatoryContinueButtonLabel?: string; - - /** - * Flag indicating if the update description provided by the CodePush server should be displayed in the dialog box appended to the update message. - */ - appendReleaseDescription?: boolean; - - /** - * Optional prefix to add to the release description. - */ - descriptionPrefix?: string; -} - -/** - * Defines the JSON format of the package diff manifest file. - */ -interface IDiffManifest { - deletedFiles: string[]; -} - -/** - * Defines the format of the DownloadProgress object, used to send periodical update notifications on the progress of the update download. - */ -export interface DownloadProgress { - totalBytes: number; - receivedBytes: number; -} - -/** - * @name Code Push - * @description - * CodePush plugin for Cordova by Microsoft that supports iOS and Android. - * - * For more info, please see https://github.com/Dellos7/example-cordova-code-push-plugin - * @usage - * ```typescript - * import { CodePush } from '@awesome-cordova-plugins/code-push/ngx'; - * - * constructor(private codePush: CodePush) { } - * - * ... - * - * // note - mostly error & completed methods of observable will not fire - * // as syncStatus will contain the current state of the update - * this.codePush.sync().subscribe((syncStatus) => console.log(syncStatus)); - * - * const downloadProgress = (progress) => { console.log(`Downloaded ${progress.receivedBytes} of ${progress.totalBytes}`); } - * this.codePush.sync({}, downloadProgress).subscribe((syncStatus) => console.log(syncStatus)); - * - * ``` - */ -@Plugin({ - pluginName: 'CodePush', - plugin: 'cordova-plugin-code-push', - pluginRef: 'codePush', - repo: 'https://github.com/Microsoft/cordova-plugin-code-push', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class CodePush extends AwesomeCordovaNativePlugin { - /** - * Get the current package information. - * - * @returns {Promise} - */ - @Cordova() - getCurrentPackage(): Promise { - return; - } - - /** - * Gets the pending package information, if any. A pending package is one that has been installed but the application still runs the old code. - * This happens only after a package has been installed using ON_NEXT_RESTART or ON_NEXT_RESUME mode, but the application was not restarted/resumed yet. - * - * @returns {Promise} - */ - @Cordova() - getPendingPackage(): Promise { - return; - } - - /** - * Checks with the CodePush server if an update package is available for download. - * - * @param {string} [deploymentKey] Optional deployment key that overrides the config.xml setting. - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - checkForUpdate(deploymentKey?: string): Promise { - return; - } - - /** - * Notifies the plugin that the update operation succeeded and that the application is ready. - * Calling this function is required on the first run after an update. On every subsequent application run, calling this function is a noop. - * If using sync API, calling this function is not required since sync calls it internally. - * - * @returns {Promise} - */ - @Cordova() - notifyApplicationReady(): Promise { - return; - } - - /** - * Reloads the application. If there is a pending update package installed using ON_NEXT_RESTART or ON_NEXT_RESUME modes, the update - * will be immediately visible to the user. Otherwise, calling this function will simply reload the current version of the application. - * - * @returns {Promise} - */ - @Cordova() - restartApplication(): Promise { - return; - } - - /** - * Convenience method for installing updates in one method call. - * This method is provided for simplicity, and its behavior can be replicated by using window.codePush.checkForUpdate(), RemotePackage's download() and LocalPackage's install() methods. - * - * The algorithm of this method is the following: - * - Checks for an update on the CodePush server. - * - If an update is available - * - If the update is mandatory and the alertMessage is set in options, the user will be informed that the application will be updated to the latest version. - * The update package will then be downloaded and applied. - * - If the update is not mandatory and the confirmMessage is set in options, the user will be asked if they want to update to the latest version. - * If they decline, the syncCallback will be invoked with SyncStatus.UPDATE_IGNORED. - * - Otherwise, the update package will be downloaded and applied with no user interaction. - * - If no update is available on the server, or if a previously rolled back update is available and the ignoreFailedUpdates is set to true, the syncCallback will be invoked with the SyncStatus.UP_TO_DATE. - * - If an error occurs during checking for update, downloading or installing it, the syncCallback will be invoked with the SyncStatus.ERROR. - * - * @param {SyncOptions} [syncOptions] Optional SyncOptions parameter configuring the behavior of the sync operation. - * @param {SuccessCallback} [downloadProgress] Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. - * @returns {Observable} - */ - @Cordova({ - observable: true, - successIndex: 0, - errorIndex: 3, // we don't need this, so we set it to a value higher than # of args - }) - sync(syncOptions?: SyncOptions, downloadProgress?: SuccessCallback): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/crop-plugin-privacy/index.ts b/src/@awesome-cordova-plugins/plugins/crop-plugin-privacy/index.ts deleted file mode 100644 index 7a65e2d2..00000000 --- a/src/@awesome-cordova-plugins/plugins/crop-plugin-privacy/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export interface CropOption { - /** The resulting JPEG quality (ignored on Android). default: 100 */ - quality?: number; - - /** The resulting JPEG picture width. default: -1 */ - targetWidth?: number; - - /** The resulting JPEG picture height. default: -1 */ - targetHeight?: number; -} - -/** - * @name Crop Plugin Privacy - * @description - * This plugin does something - * - * @usage - * ```typescript - * import { CropPluginPrivacy } from '@awesome-cordova-plugins/crop-plugin-privacy/ngx'; - * - * - * constructor(private cropPluginPrivacy: CropPluginPrivacy) { } - * - * ... - * - * - * this.cropPluginPrivacy.functionName('/path/to/image', { quality: 100, targetWidth: 1, targetHeight: 1 }) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'CropPluginPrivacy', - plugin: 'cordova-plugin-crop-privacy', - pluginRef: 'crop', - repo: 'https://github.com/BaraAksayeth25/cordova-plugin-crop-privacy', - platforms: ['Android'] -}) -@Injectable() -export class CropPluginPrivacy extends AwesomeCordovaNativePlugin { - - /** - * This function does something - * @param arg1 {string} path destination - * @param arg2 {object} Cropping configuration - * @return {Promise} return the file path - */ - @Cordova() - cropImage(arg1: string, arg2: CropOption): Promise { - return; // We add return; here to avoid any IDE / Compiler errors - } - -} diff --git a/src/@awesome-cordova-plugins/plugins/custom-uisdk/index.ts b/src/@awesome-cordova-plugins/plugins/custom-uisdk/index.ts deleted file mode 100755 index c3171f43..00000000 --- a/src/@awesome-cordova-plugins/plugins/custom-uisdk/index.ts +++ /dev/null @@ -1,315 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Plugin, - Cordova, - CordovaProperty, - CordovaInstance, - InstanceProperty, - AwesomeCordovaNativePlugin, -} from '@awesome-cordova-plugins/core'; - -/** - * @name CustomUISDK - * @description - * This plugin is used to access Paytm's native CustomUISDK framework's apis. - * @usage - * ```typescript - * import { CustomUISDK } from '@awesome-cordova-plugins/custom-uisdk/ngx'; - * - * constructor(private customuisdk: CustomUISDK) { } - * - * ... - * this.customuisdk.functionName('Hello', 123) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * ``` - */ -@Plugin({ - pluginName: 'cordova-paytm-customuisdk', - plugin: 'cordova-paytm-customuisdk', - pluginRef: 'paytm.customuisdk', - repo: 'https://github.com/paytm/paytm-customuisdk-cordova', - install: '', - installVariables: [], - platforms: ['Android, iOS'], -}) -@Injectable() -export class CustomUISDK extends AwesomeCordovaNativePlugin { - /** - * This function show dialog to ask user permision to fetch authcode - * - * @param clientId {string} unique id give to each merchant - * @param mid {string} merchant id - * @returns {Promise} Returns authcode - */ - @Cordova() - fetchAuthCode(clientId: string, mid: string): Promise { - return; - } - - /** - * This function check that paytm app is installed or not - * - * @returns {Promise} Returns installed - true or not -false - */ - @Cordova() - isPaytmAppInstalled(): Promise { - return; - } - - /** - * @param mid {string} merchant id - * @returns {Promise} Returns if has payment methods - true or not -false - */ - @Cordova() - checkHasInstrument(mid: string): Promise { - return; - } - - /** - * @param mid {string} merchant id - * @param orderId {string} order id - * @param txnToken {string} transaction token - * @param amount {string} transaction amount - * @param isStaging {boolean} staging or production - * @param callbackUrl {string} callback url only required for custom url page - */ - @Cordova() - initPaytmSDK( - mid: string, - orderId: string, - txnToken: string, - amount: string, - isStaging: boolean, - callbackUrl: string - ) { - return; - } - - /** - * @param paymentFlow {string} payment type NONE, ADDANDPAY - * @returns {Promise} Returns object of response - */ - @Cordova() - goForWalletTransaction(paymentFlow: string): Promise { - return; - } - - /** - * @returns {Promise} Returns object of response - */ - @Cordova() - appInvoke(): Promise { - return; - } - - /** - * @param cardNumber {string} card number - * @param cardExpiry {string} card expiry - * @param cardCvv {string} card cvv - * @param cardType {string} card type debit or credit - * @param paymentFlow {string} payment type NONE, ADDANDPAY - * @param channelCode {string} bank channel code - * @param issuingBankCode {string} issuing bank code - * @param emiChannelId {string} emi plan id - * @param authMode {string} authentication mode 'otp' 'pin' - * @param saveCard {boolean} save card for next time - * @returns {Promise} Returns object of response - */ - @Cordova() - goForNewCardTransaction( - cardNumber: string, - cardExpiry: string, - cardCvv: string, - cardType: string, - paymentFlow: string, - channelCode: string, - issuingBankCode: string, - emiChannelId: string, - authMode: string, - saveCard: boolean - ): Promise { - return; - } - - /** - * @param cardId {string} card id of saved card - * @param cardCvv {string} card cvv - * @param cardType {string} card type debit or credit - * @param paymentFlow {string} payment type NONE, ADDANDPAY - * @param channelCode {string} bank channel code - * @param issuingBankCode {string} issuing bank code - * @param emiChannelId {string} emi plan id - * @param authMode {string} authentication mode 'otp' 'pin' - * @returns {Promise} Returns object of response - */ - @Cordova() - goForSavedCardTransaction( - cardId: string, - cardCvv: string, - cardType: string, - paymentFlow: string, - channelCode: string, - issuingBankCode: string, - emiChannelId: string, - authMode: string - ): Promise { - return; - } - - /** - * @param netBankingCode {string} bank channel code - * @param paymentFlow {string} payment type NONE, ADDANDPAY - * @returns {Promise} Returns object of response - */ - @Cordova() - goForNetBankingTransaction(netBankingCode: string, paymentFlow: string): Promise { - return; - } - - /** - * @param upiCode {string} upi code - * @param paymentFlow {string} payment type NONE, ADDANDPAY - * @param saveVPA {boolean} save vpa for future transaction - * @returns {Promise} Returns object of response - */ - @Cordova() - goForUpiCollectTransaction(upiCode: string, paymentFlow: string, saveVPA: boolean): Promise { - return; - } - - /** - * @returns {Promise} Returns upi app list names - */ - @Cordova() - getUpiIntentList(): Promise { - return; - } - - /** - * @param appName {string} upi app name - * @param paymentFlow {string} payment type NONE, ADDANDPAY - * @returns {Promise} Returns object of response - */ - @Cordova() - goForUpiIntentTransaction(appName: string, paymentFlow: string): Promise { - return; - } - - /** - * @param vpaName {string} vpa name - * @param paymentFlow {string} payment type NONE, ADDANDPAY - * @param bankAccountJson {{}} bank account json object - * @param merchantDetailsJson {{}} merchant detail json - * @returns {Promise} Returns object of response - */ - @Cordova() - goForUpiPushTransaction( - paymentFlow: string, - bankAccountJson: {}, - vpaName: string, - merchantDetailsJson: {} - ): Promise { - return; - } - - /** - * @param vpaName {string} vpa name - * @param bankAccountJson {{}} bank account json object - * @returns {Promise} Returns object of response - */ - @Cordova() - fetchUpiBalance(bankAccountJson: {}, vpaName: string): Promise { - return; - } - - /** - * @param vpaName {string} vpa name - * @param bankAccountJson {{}} bank account json object - * @returns {Promise} Returns object of response - */ - @Cordova() - setUpiMpin(bankAccountJson: {}, vpaName: string): Promise { - return; - } - - /** - * @param cardSixDigit {string} card starting six digit - * @param tokenType {string} token type ACCESS or TXN_TOKEN - * @param token {string} token fetch from api - * @param mid {string} merchant id - * @param referenceId {string} reference id - * @returns {Promise} Returns object of response - */ - @Cordova() - getBin(cardSixDigit: string, tokenType: string, token: string, mid: string, referenceId: string): Promise { - return; - } - - /** - * @param tokenType {string} token type ACCESS or TXN_TOKEN - * @param token {string} token fetch from api - * @param mid {string} merchant id - * @param orderId {string} order id required only if token type is TXN_TOKEN - * @param referenceId {string} reference id required only if token type is ACCESS - * @returns {Promise} Returns object of response - */ - @Cordova() - fetchNBList(tokenType: string, token: string, mid: string, orderId: string, referenceId: string): Promise { - return; - } - - /** - * @param channelCode {string} bank channel code - * @param cardType {string} card type debit or credit - * @returns {Promise} Returns object of response - */ - @Cordova() - fetchEmiDetails(channelCode: string, cardType: string): Promise { - return; - } - - /** - * @returns {Promise} Returns last successfully used net backing code - */ - - @Cordova() - getLastNBSavedBank(): Promise { - return; - } - - /** - * @returns {Promise} Returns last successfully used vpa code - */ - - @Cordova() - getLastSavedVPA(): Promise { - return; - } - - /** - * @param clientId {string} unique id give to each merchant - * @param authCode {string} fetched auth code - * @returns {Promise} Returns last successfully used vpa code - */ - @Cordova() - isAuthCodeValid(clientId: string, authCode: string): Promise { - return; - } - - /** - * @returns {Promise} Returns current environment - */ - @Cordova() - getEnvironment(): Promise { - return; - } - - /** - * @param environment {string} setting environment PRODUCTION or STAGING - */ - @Cordova() - setEnvironment(environment: string): void { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/deeplinks/index.ts b/src/@awesome-cordova-plugins/plugins/deeplinks/index.ts deleted file mode 100644 index 932057e7..00000000 --- a/src/@awesome-cordova-plugins/plugins/deeplinks/index.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface DeeplinkMatch { - /** - * The route info for the matched route - */ - $route: any; - - /** - * Any arguments passed either through route parameters or GET parameters - */ - $args: any; - - /** - * The deeplink object processed from the plugin, along with any - * any internal native data available as "extras" at the time - * the route was matched (for example, Facebook sometimes adds extra data) - */ - $link: any; -} - -export interface DeeplinkOptions { - /** - * Set the matched route as root page using `navCtrl.setRoot()` method. - */ - root: boolean; -} - -/** - * @name Deeplinks - * @premier deeplinks - * @description This plugin handles deeplinks on iOS and Android for both custom URL scheme links - * and Universal App Links. - * - * Please read the [ionic plugin deeplinks docs](https://github.com/ionic-team/ionic-plugin-deeplinks) for iOS and Android integration. - * You must add `universal-links` to your `config.xml` and set up Apple App Site Association (AASA) for iOS and Asset Links for Android. - * @usage - * ```typescript - * import { Deeplinks } from '@awesome-cordova-plugins/deeplinks/ngx'; - * - * constructor(private deeplinks: Deeplinks) { } - * - * this.deeplinks.route({ - * '/about-us': AboutPage, - * '/universal-links-test': AboutPage, - * '/products/:productId': ProductPage - * }).subscribe(match => { - * // match.$route - the route we matched, which is the matched entry from the arguments to route() - * // match.$args - the args passed in the link - * // match.$link - the full link data - * console.log('Successfully matched route', match); - * }, nomatch => { - * // nomatch.$link - the full link data - * console.error('Got a deeplink that didn\'t match', nomatch); - * }); - * ``` - * - * Alternatively, if you're using Ionic, there's a convenience method that takes a reference to a `NavController` and handles - * the actual navigation for you: - * - * ```typescript - * this.deeplinks.routeWithNavController(this.navController, { - * '/about-us': AboutPage, - * '/products/:productId': ProductPage - * }).subscribe(match => { - * // match.$route - the route we matched, which is the matched entry from the arguments to route() - * // match.$args - the args passed in the link - * // match.$link - the full link data - * console.log('Successfully matched route', match); - * }, nomatch => { - * // nomatch.$link - the full link data - * console.error('Got a deeplink that didn\'t match', nomatch); - * }); - * ``` - * - * See the [Ionic Deeplinks Demo](https://github.com/ionic-team/ionic2-deeplinks-demo/blob/master/app/app.ts) for an example of how to - * retrieve the `NavController` reference at runtime. - * @interfaces - * DeeplinkMatch - */ -@Plugin({ - pluginName: 'Deeplinks', - plugin: 'ionic-plugin-deeplinks', - pluginRef: 'IonicDeeplink', - repo: 'https://github.com/ionic-team/ionic-plugin-deeplinks', - install: - 'ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/', - installVariables: ['URL_SCHEME', 'DEEPLINK_SCHEME', 'DEEPLINK_HOST', 'ANDROID_PATH_PREFIX'], - platforms: ['Android', 'Browser', 'iOS'], -}) -@Injectable() -export class Deeplinks extends AwesomeCordovaNativePlugin { - /** - * Define a set of paths to match against incoming deeplinks. - * - * @param {paths} paths Define a set of paths to match against incoming deeplinks. - * paths takes an object of the form { 'path': data }. If a deeplink - * matches the path, the resulting path-data pair will be returned in the - * promise result which you can then use to navigate in the app as you see fit. - * @returns {Observable} Returns an Observable that is called each time a deeplink comes through, and - * errors if a deeplink comes through that does not match a given path. - */ - @Cordova({ - observable: true, - }) - route(paths: any): Observable { - return; - } - - /** - * - * This is a convenience version of `route` that takes a reference to a NavController - * from Ionic, or a custom class that conforms to this protocol: - * - * NavController.push = function(View, Params){} - * - * This handler will automatically navigate when a route matches. If you need finer-grained - * control over the behavior of a matching deeplink, use the plain `route` method. - * - * @param {Nav} navController Define a set of paths to match against incoming deeplinks. - * paths takes an object of the form { 'path': data }. If a deeplink - * matches the path, the resulting path-data pair will be returned in the - * promise result which you can then use to navigate in the app as you see fit. - * @param {Object} paths - * @param {DeeplinkOptions} options - * @returns {Observable} Returns an Observable that resolves each time a deeplink comes through, and - * errors if a deeplink comes through that does not match a given path. - */ - @Cordova({ - observable: true, - }) - routeWithNavController(navController: any, paths: any, options?: DeeplinkOptions): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/device-accounts/index.ts b/src/@awesome-cordova-plugins/plugins/device-accounts/index.ts deleted file mode 100644 index 49d19393..00000000 --- a/src/@awesome-cordova-plugins/plugins/device-accounts/index.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface AndroidAccount { - /** Account creator */ - CREATOR: AndroidAccount; - - /** Account name */ - name: string; - - /** Account type */ - type: string; -} - -/** - * @name Device Accounts - * @description - * Gets the Google accounts associated with the Android device - * @usage - * ```typescript - * import { DeviceAccounts } from '@awesome-cordova-plugins/device-accounts/ngx'; - * - * constructor(private deviceAccounts: DeviceAccounts) { } - * - * ... - * - * this.deviceAccounts.get() - * .then(accounts => console.log(accounts)) - * .catch(error => console.error(error)); - * - * ``` - * @interfaces - * AndroidAccount - */ -@Plugin({ - pluginName: 'DeviceAccounts', - plugin: 'cordova-device-accounts-v2', - pluginRef: 'DeviceAccounts', - repo: 'https://github.com/xUnholy/cordova-device-accounts-v2', - platforms: ['Android'], -}) -@Injectable() -export class DeviceAccounts extends AwesomeCordovaNativePlugin { - /** - * Gets all accounts registered on the Android Device - * - * @returns {Promise} - */ - @Cordova() - get(): Promise { - return; - } - - /** - * Get all accounts registered on Android device for requested type - * - * @param {string} type - * @returns {Promise} - */ - @Cordova() - getByType(type: string): Promise { - return; - } - - /** - * Get all emails registered on Android device (accounts with 'com.google' type) - * - * @returns {Promise} - */ - @Cordova() - getEmails(): Promise { - return; - } - - /** - * Get the first email registered on Android device - * - * @returns {Promise} - */ - @Cordova() - getEmail(): Promise { - return; - } - - /** - * Get permissions for access to email registered on Android device 8.0+ - * - * @returns {Promise} - */ - @Cordova() - getPermissions(): Promise { - return; - } - - /** - * Get permissions for access to email registered on Android device 8.0+ for requested type - * - * @param {string} type - * @returns {Promise} - */ - @Cordova() - getPermissionsByType(type: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/device-motion/index.ts b/src/@awesome-cordova-plugins/plugins/device-motion/index.ts deleted file mode 100644 index 833346f2..00000000 --- a/src/@awesome-cordova-plugins/plugins/device-motion/index.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface DeviceMotionAccelerationData { - /** - * Amount of acceleration on the x-axis. (in m/s^2) - */ - x: number; - - /** - * Amount of acceleration on the y-axis. (in m/s^2) - */ - y: number; - - /** - * Amount of acceleration on the z-axis. (in m/s^2) - */ - z: number; - - /** - * Creation timestamp in milliseconds. - */ - timestamp: any; -} - -export interface DeviceMotionAccelerometerOptions { - /** - * Requested period of calls to accelerometerSuccess with acceleration data in Milliseconds. Default: 10000 - */ - frequency?: number; -} - -/** - * @name Device Motion - * @description - * Requires Cordova plugin: `cordova-plugin-device-motion`. For more info, please see the [Device Motion docs](https://github.com/apache/cordova-plugin-device-motion). - * @usage - * ```typescript - * import { DeviceMotion, DeviceMotionAccelerationData } from '@awesome-cordova-plugins/device-motion/ngx'; - * - * constructor(private deviceMotion: DeviceMotion) { } - * - * ... - * - * // Get the device current acceleration - * this.deviceMotion.getCurrentAcceleration().then( - * (acceleration: DeviceMotionAccelerationData) => console.log(acceleration), - * (error: any) => console.log(error) - * ); - * - * // Watch device acceleration - * var subscription = this.deviceMotion.watchAcceleration().subscribe((acceleration: DeviceMotionAccelerationData) => { - * console.log(acceleration); - * }); - * - * // Stop watch - * subscription.unsubscribe(); - * - * ``` - * @interfaces - * DeviceMotionAccelerationData - * DeviceMotionAccelerometerOptions - */ -@Plugin({ - pluginName: 'DeviceMotion', - plugin: 'cordova-plugin-device-motion', - pluginRef: 'navigator.accelerometer', - repo: 'https://github.com/apache/cordova-plugin-device-motion', - platforms: [ - 'Android', - 'BlackBerry 10', - 'Browser', - 'Firefox OS', - 'iOS', - 'Tizen', - 'Ubuntu', - 'Windows', - 'Windows Phone 8', - ], -}) -@Injectable() -export class DeviceMotion extends AwesomeCordovaNativePlugin { - /** - * Get the current acceleration along the x, y, and z axes. - * - * @returns {Promise} Returns object with x, y, z, and timestamp properties - */ - @Cordova() - getCurrentAcceleration(): Promise { - return; - } - - /** - * Watch the device acceleration. Clear the watch by unsubscribing from the observable. - * - * @param {AccelerometerOptions} options list of options for the accelerometer. - * @returns {Observable} Observable returns an observable that you can subscribe to - */ - @Cordova({ - callbackOrder: 'reverse', - observable: true, - clearFunction: 'clearWatch', - }) - watchAcceleration(options?: DeviceMotionAccelerometerOptions): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/device-orientation/index.ts b/src/@awesome-cordova-plugins/plugins/device-orientation/index.ts deleted file mode 100644 index c12db8b0..00000000 --- a/src/@awesome-cordova-plugins/plugins/device-orientation/index.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface DeviceOrientationCompassHeading { - /** - * The heading in degrees from 0-359.99 at a single moment in time. (Number) - */ - magneticHeading: number; - - /** - * The heading relative to the geographic North Pole in degrees 0-359.99 at a single moment in time. A negative value indicates that the true heading can't be determined. (Number) - */ - trueHeading: number; - - /** - * The deviation in degrees between the reported heading and the true heading. (Number) - */ - headingAccuracy: number; - - /** - * The time at which this heading was determined. (DOMTimeStamp) - */ - timestamp: number; -} - -export interface DeviceOrientationCompassOptions { - /** - * How often to retrieve the compass heading in milliseconds. (Number) (Default: 100) - */ - frequency?: number; - - /** - * The change in degrees required to initiate a watchHeading success callback. When this value is set, frequency is ignored. (Number) - */ - filter?: number; -} - -/** - * @name Device Orientation - * @description - * Requires Cordova plugin: `cordova-plugin-device-orientation`. For more info, please see the [Device Orientation docs](https://github.com/apache/cordova-plugin-device-orientation). - * @usage - * ```typescript - * // DeviceOrientationCompassHeading is an interface for compass - * import { DeviceOrientation, DeviceOrientationCompassHeading } from '@awesome-cordova-plugins/device-orientation/ngx'; - * - * constructor(private deviceOrientation: DeviceOrientation) { } - * - * ... - * - * // Get the device current compass heading - * this.deviceOrientation.getCurrentHeading().then( - * (data: DeviceOrientationCompassHeading) => console.log(data), - * (error: any) => console.log(error) - * ); - * - * // Watch the device compass heading change - * var subscription = this.deviceOrientation.watchHeading().subscribe( - * (data: DeviceOrientationCompassHeading) => console.log(data) - * ); - * - * // Stop watching heading change - * subscription.unsubscribe(); - * ``` - * @interfaces - * DeviceOrientationCompassOptions - * DeviceOrientationCompassHeading - */ -@Plugin({ - pluginName: 'DeviceOrientation', - plugin: 'cordova-plugin-device-orientation', - pluginRef: 'navigator.compass', - repo: 'https://github.com/apache/cordova-plugin-device-orientation', - platforms: [ - 'Amazon Fire OS', - 'Android', - 'BlackBerry 10', - 'Browser', - 'Firefox OS', - 'iOS', - 'Tizen', - 'Ubuntu', - 'Windows', - 'Windows Phone', - ], -}) -@Injectable() -export class DeviceOrientation extends AwesomeCordovaNativePlugin { - /** - * Get the current compass heading. - * - * @returns {Promise} - */ - @Cordova() - getCurrentHeading(): Promise { - return; - } - - /** - * Get the device current heading at a regular interval - * - * Stop the watch by unsubscribing from the observable - * - * @param {DeviceOrientationCompassOptions} [options] Options for compass. Frequency and Filter. Optional - * @returns {Observable} Returns an observable that contains the compass heading - */ - @Cordova({ - callbackOrder: 'reverse', - observable: true, - clearFunction: 'clearWatch', - }) - watchHeading(options?: DeviceOrientationCompassOptions): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/device/index.ts b/src/@awesome-cordova-plugins/plugins/device/index.ts deleted file mode 100644 index 02ff61b7..00000000 --- a/src/@awesome-cordova-plugins/plugins/device/index.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { Injectable } from '@angular/core'; -import { CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -declare const window: any; - -/** - * @name Device - * @premier device - * @description - * Access information about the underlying device and platform. - * @usage - * ```typescript - * import { Device } from '@awesome-cordova-plugins/device/ngx'; - * - * constructor(private device: Device) { } - * - * ... - * - * console.log('Device UUID is: ' + this.device.uuid); - * ``` - */ -@Plugin({ - pluginName: 'Device', - plugin: 'cordova-plugin-device', - pluginRef: 'device', - repo: 'https://github.com/apache/cordova-plugin-device', - platforms: ['Android', 'Browser', 'iOS', 'macOS', 'Windows'], -}) -@Injectable() -export class Device extends AwesomeCordovaNativePlugin { - /** Get the version of Cordova running on the device. */ - @CordovaProperty() - cordova: string; - - /** - * The device.model returns the name of the device's model or product. The value is set - * by the device manufacturer and may be different across versions of the same product. - */ - @CordovaProperty() - model: string; - - /** Get the device's operating system name. */ - @CordovaProperty() - platform: string; - - /** Get the device's Universally Unique Identifier (UUID). */ - @CordovaProperty() - uuid: string; - - /** Get the operating system version. */ - @CordovaProperty() - version: string; - - /** Get the device's manufacturer. */ - @CordovaProperty() - manufacturer: string; - - /** Whether the device is running on a simulator. */ - @CordovaProperty() - isVirtual: boolean; - - /** Get the device hardware serial number. */ - @CordovaProperty() - serial: string; - - /** Get the Android device's SDK version. (Android-only) */ - @CordovaProperty() - sdkVersion?: string; - - /** Detect if app is running on a macOS desktop with Apple Silicon. */ - @CordovaProperty() - isiOSAppOnMac: string; -} diff --git a/src/@awesome-cordova-plugins/plugins/dfu-update/index.ts b/src/@awesome-cordova-plugins/plugins/dfu-update/index.ts deleted file mode 100644 index 170df85e..00000000 --- a/src/@awesome-cordova-plugins/plugins/dfu-update/index.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface UpdateOptions { - /** - * A string that contains the identifier for the Bluetooth LE device to update. It will either be a MAC address (on Android) or a UUID (on iOS). - */ - deviceId: string; - - /** - * A string that is the path to the file to use in the update. It can be either in either `cdvfile://` or `file://` format. - */ - fileUrl: string; - - /** - * The PacketReceiptNotificationsValue (Default to 10) - */ - packetReceiptNotificationsValue?: number; -} - -/** - * @name Dfu Update - * @description - * This plugin is a Wrapper to use Nordic Semiconductor's Device Firmware Update (DFU) service to update a Bluetooth LE device. - * @usage - * ```typescript - * import { DfuUpdate } from '@awesome-cordova-plugins/dfu-update/ngx'; - * - * - * constructor(private dfuUpdate: DfuUpdate) { } - * - * ... - * - * - * this.dfuUpdate.updateFirmware('fileURL', 'deviceIdentifier') - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'DfuUpdate', - plugin: 'cordova-plugin-dfu-update', - pluginRef: 'window.DfuUpdate', - repo: 'https://github.com/EinfachHans/cordova-plugin-dfu-update', - install: 'ionic cordova plugin add cordova-plugin-dfu-update --variable ANDROID_NORDIC_VERSION="1.11.0"', - installVariables: ['ANDROID_NORDIC_VERSION'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class DfuUpdate extends AwesomeCordovaNativePlugin { - /** - * Start the Firmware-Update-Process - * - * @param options - Options for the process - * @returns {Observable} Returns a Observable that emits when something happens - */ - @Cordova({ - observable: true, - callbackOrder: 'reverse', - }) - updateFirmware(options: UpdateOptions): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/diagnostic/index.ts b/src/@awesome-cordova-plugins/plugins/diagnostic/index.ts deleted file mode 100644 index 77bb6560..00000000 --- a/src/@awesome-cordova-plugins/plugins/diagnostic/index.ts +++ /dev/null @@ -1,1100 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Diagnostic - * @description - * Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi - * @usage - * ```typescript - * import { Diagnostic } from '@awesome-cordova-plugins/diagnostic/ngx'; - * - * constructor(private diagnostic: Diagnostic) { } - * - * ... - * - * let successCallback = (isAvailable) => { console.log('Is available? ' + isAvailable); } - * let errorCallback = (e) => console.error(e); - * - * this.diagnostic.isCameraAvailable().then(successCallback).catch(errorCallback); - * - * this.diagnostic.isBluetoothAvailable().then(successCallback, errorCallback); - * - * - * this.diagnostic.getBluetoothState() - * .then((state) => { - * if (state == this.diagnostic.bluetoothState.POWERED_ON){ - * // do something - * } else { - * // do something else - * } - * }).catch(e => console.error(e)); - * - * ``` - */ -@Plugin({ - pluginName: 'Diagnostic', - plugin: 'cordova.plugins.diagnostic', - pluginRef: 'cordova.plugins.diagnostic', - repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin', - platforms: ['Android', 'iOS', 'Windows'], -}) -@Injectable() -export class Diagnostic extends AwesomeCordovaNativePlugin { - permission = { - READ_CALENDAR: 'READ_CALENDAR', - WRITE_CALENDAR: 'WRITE_CALENDAR', - CAMERA: 'CAMERA', - READ_CONTACTS: 'READ_CONTACTS', - WRITE_CONTACTS: 'WRITE_CONTACTS', - GET_ACCOUNTS: 'GET_ACCOUNTS', - ACCESS_FINE_LOCATION: 'ACCESS_FINE_LOCATION', - ACCESS_COARSE_LOCATION: 'ACCESS_COARSE_LOCATION', - RECORD_AUDIO: 'RECORD_AUDIO', - READ_PHONE_STATE: 'READ_PHONE_STATE', - CALL_PHONE: 'CALL_PHONE', - ADD_VOICEMAIL: 'ADD_VOICEMAIL', - USE_SIP: 'USE_SIP', - PROCESS_OUTGOING_CALLS: 'PROCESS_OUTGOING_CALLS', - READ_CALL_LOG: 'READ_CALL_LOG', - WRITE_CALL_LOG: 'WRITE_CALL_LOG', - SEND_SMS: 'SEND_SMS', - RECEIVE_SMS: 'RECEIVE_SMS', - READ_SMS: 'READ_SMS', - RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH', - RECEIVE_MMS: 'RECEIVE_MMS', - WRITE_EXTERNAL_STORAGE: 'WRITE_EXTERNAL_STORAGE', - READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE', - BODY_SENSORS: 'BODY_SENSORS', - BLUETOOTH_ADVERTISE: "BLUETOOTH_ADVERTISE", - BLUETOOTH_SCAN: "BLUETOOTH_SCAN", - BLUETOOTH_CONNECT: "BLUETOOTH_CONNECT", - }; - - @CordovaProperty() - permissionStatus: { - GRANTED: string; - /** - * @deprecated cordova.plugins.diagnostic@5.0.0 uses DENIED_ONCE to unify DENIED* statuses across iOS/Android - */ - DENIED: string; - DENIED_ONCE: string; - NOT_REQUESTED: string; - DENIED_ALWAYS: string; - RESTRICTED: string; - GRANTED_WHEN_IN_USE: string; - }; - - locationAuthorizationMode = { - ALWAYS: 'always', - WHEN_IN_USE: 'when_in_use', - }; - - /** - * Location accuracy authorization - */ - locationAccuracyAuthorization = { - FULL: 'full', - REDUCED: 'reduced', - }; - - permissionGroups = { - CALENDAR: ['READ_CALENDAR', 'WRITE_CALENDAR'], - CAMERA: ['CAMERA'], - CONTACTS: ['READ_CONTACTS', 'WRITE_CONTACTS', 'GET_ACCOUNTS'], - LOCATION: ['ACCESS_FINE_LOCATION', 'ACCESS_COARSE_LOCATION'], - MICROPHONE: ['RECORD_AUDIO'], - PHONE: [ - 'READ_PHONE_STATE', - 'CALL_PHONE', - 'ADD_VOICEMAIL', - 'USE_SIP', - 'PROCESS_OUTGOING_CALLS', - 'READ_CALL_LOG', - 'WRITE_CALL_LOG', - ], - SENSORS: ['BODY_SENSORS'], - SMS: ['SEND_SMS', 'RECEIVE_SMS', 'READ_SMS', 'RECEIVE_WAP_PUSH', 'RECEIVE_MMS'], - STORAGE: ['READ_EXTERNAL_STORAGE', 'WRITE_EXTERNAL_STORAGE'], - NEARBY_DEVICES: ["BLUETOOTH_ADVERTISE", "BLUETOOTH_SCAN", "BLUETOOTH_CONNECT"], - }; - - locationMode = { - HIGH_ACCURACY: 'high_accuracy', - DEVICE_ONLY: 'device_only', - BATTERY_SAVING: 'battery_saving', - LOCATION_OFF: 'location_off', - }; - - bluetoothState = { - UNKNOWN: 'unknown', - RESETTING: 'resetting', // iOS - UNSUPPORTED: 'unsupported', // iOS - UNAUTHORIZED: 'unauthorized', // iOS - POWERED_OFF: 'powered_off', - POWERED_ON: 'powered_on', - POWERING_OFF: 'powering_off', - POWERING_ON: 'powering_on', - }; - - @CordovaProperty() - NFCState: { - UNKNOWN: string; - POWERED_OFF: string; - POWERED_ON: string; - POWERING_ON: string; - POWERING_OFF: string; - }; - - @CordovaProperty() - motionStatus: { - NOT_REQUESTED: string; - GRANTED: string; - DENIED: string; - RESTRICTED: string; - NOT_AVAILABLE: string; - NOT_DETERMINED: string; - UNKNOWN: string; - }; - - /** - * Access to the photo library (iOS 14+) - * - * ADD_ONLY - can add to but not read from Photo Library - * READ_WRITE - can both add to and read from Photo Library - * - */ - photoLibraryAccessLevel = { - ADD_ONLY: 'add_only', - READ_WRITE: 'read_write', - }; - - /** - * Checks if app is able to access device location. - * - * @returns {Promise} - */ - @Cordova() - isLocationAvailable(): Promise { - return; - } - - /** - * Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled. - * On Android this requires permission. `` - * - * @returns {Promise} - */ - @Cordova() - isWifiAvailable(): Promise { - return; - } - - /** - * Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the - * application is authorized to use it. - * - * @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission. - * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true. - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse' }) - isCameraAvailable(externalStorage?: boolean): Promise { - return; - } - - /** - * Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile) - * On Android this requires permission - * - * @returns {Promise} - */ - @Cordova() - isBluetoothAvailable(): Promise { - return; - } - - /** - * Displays the device location settings to allow user to enable location services/change location mode. - */ - @Cordova({ sync: true, platforms: ['Android', 'Windows 10', 'iOS'] }) - switchToLocationSettings(): void {} - - /** - * Displays mobile settings to allow user to enable mobile data. - */ - @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] }) - switchToMobileDataSettings(): void {} - - /** - * Displays Bluetooth settings to allow user to enable Bluetooth. - */ - @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] }) - switchToBluetoothSettings(): void {} - - /** - * Displays WiFi settings to allow user to enable WiFi. - */ - @Cordova({ sync: true, platforms: ['Android', 'Windows 10'] }) - switchToWifiSettings(): void {} - - /** - * Returns true if the WiFi setting is set to enabled, and is the same as `isWifiAvailable()` - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'Windows 10'] }) - isWifiEnabled(): Promise { - return; - } - - /** - * Enables/disables WiFi on the device. - * Requires `ACCESS_WIFI_STATE` and `CHANGE_WIFI_STATE` permissions on Android - * - * @param {boolean} state - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] }) - setWifiState(state: boolean): Promise { - return; - } - - /** - * Enables/disables Bluetooth on the device. - * Requires `BLUETOOTH` and `BLUETOOTH_ADMIN` permissions on Android - * - * @param {boolean} state - * @returns {Promise} - */ - @Cordova({ callbackOrder: 'reverse', platforms: ['Android', 'Windows 10'] }) - setBluetoothState(state: boolean): Promise { - return; - } - - // ANDROID AND IOS ONLY - - /** - * Returns true if the device setting for location is on. On Android this returns true if Location Mode is switched on. On iOS this returns true if Location Services is switched on. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - isLocationEnabled(): Promise { - return; - } - - /** - * Checks if the application is authorized to use location. - * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. - * - * @returns {Promise} - */ - @Cordova() - isLocationAuthorized(): Promise { - return; - } - - /** - * Returns the location authorization status for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - getLocationAuthorizationStatus(): Promise { - return; - } - - /** - * Returns the location authorization status for the application. - * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. - * - * @param {string} [mode] location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use". (this.locationAuthorizationMode) - * @param {string} [accuracy] requested location accuracy: "full" or "reduced". If not specified, defaults to "full". (this.locationAccuracyAuthorization) - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) - requestLocationAuthorization(mode?: string, accuracy?: string): Promise { - return; - } - - /** - * Checks if camera hardware is present on device. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - isCameraPresent(): Promise { - return; - } - - /** - * Checks if the application is authorized to use the camera. - * Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time. - * - * @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission. - * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true. - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) - isCameraAuthorized(externalStorage?: boolean): Promise { - return; - } - - /** - * Returns the camera authorization status for the application. - * - * @param {boolean} [externalStorage] Android only: If true, checks permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission. - * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true. - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) - getCameraAuthorizationStatus(externalStorage?: boolean): Promise { - return; - } - - /** - * Requests camera authorization for the application. - * - * @param {boolean} [externalStorage] Android only: If true, requests permission for READ_EXTERNAL_STORAGE in addition to CAMERA run-time permission. - * cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true. - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) - requestCameraAuthorization(externalStorage?: boolean): Promise { - return; - } - - /** - * Checks if the application is authorized to use the microphone. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - isMicrophoneAuthorized(): Promise { - return; - } - - /** - * Returns the microphone authorization status for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - getMicrophoneAuthorizationStatus(): Promise { - return; - } - - /** - * Requests microphone authorization for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - requestMicrophoneAuthorization(): Promise { - return; - } - - /** - * Checks if the application is authorized to use contacts (address book). - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - isContactsAuthorized(): Promise { - return; - } - - /** - * Returns the contacts authorization status for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - getContactsAuthorizationStatus(): Promise { - return; - } - - /** - * Requests contacts authorization for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - requestContactsAuthorization(): Promise { - return; - } - - /** - * Checks if the application is authorized to use the calendar. - * - * Notes for Android: - * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time. - * - * Notes for iOS: - * - This relates to Calendar Events (not Calendar Reminders) - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - isCalendarAuthorized(): Promise { - return; - } - - /** - * Returns the calendar authorization status for the application. - * - * Notes for Android: - * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return `GRANTED` status as permissions are already granted at installation time. - * - * Notes for iOS: - * - This relates to Calendar Events (not Calendar Reminders) - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - getCalendarAuthorizationStatus(): Promise { - return; - } - - /** - * Requests calendar authorization for the application. - * - * Notes for iOS: - * - Should only be called if authorization status is NOT_DETERMINED. Calling it when in any other state will have no effect and just return the current authorization status. - * - This relates to Calendar Events (not Calendar Reminders) - * - * Notes for Android: - * - This is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time. - * - This requests permission for `READ_CALENDAR` run-time permission - * - Required permissions must be added to `AndroidManifest.xml` as appropriate - see Android permissions: `READ_CALENDAR`, `WRITE_CALENDAR` - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - requestCalendarAuthorization(): Promise { - return; - } - - /** - * Opens settings page for this app. - * On Android, this opens the "App Info" page in the Settings app. - * On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - switchToSettings(): Promise { - return; - } - - /** - * Returns the state of Bluetooth on the device. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - getBluetoothState(): Promise { - return; - } - - /** - * Registers a function to be called when a change in Bluetooth state occurs. - * - * @param {Function} handler - */ - @Cordova({ platforms: ['Android', 'iOS'], sync: true }) - registerBluetoothStateChangeHandler(handler: Function): void {} - - /** - * Registers a function to be called when a change in Location state occurs. - * - * @param {Function} handler - */ - @Cordova({ platforms: ['Android', 'iOS'], sync: true }) - registerLocationStateChangeHandler(handler: Function): void {} - - // ANDROID ONLY - - /** - * Checks if high-accuracy locations are available to the app from GPS hardware. - * Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorized to use location. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isGpsLocationAvailable(): Promise { - return; - } - - /** - * Checks if location mode is set to return high-accuracy locations from GPS hardware. - * Returns true if Location mode is enabled and is set to either: - * - Device only = GPS hardware only (high accuracy) - * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isGpsLocationEnabled(): Promise { - return; - } - - /** - * Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points. - * Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorized to use location. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isNetworkLocationAvailable(): Promise { - return; - } - - /** - * Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points. - * Returns true if Location mode is enabled and is set to either: - * - Battery saving = network triangulation and Wifi network IDs (low accuracy) - * - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy) - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isNetworkLocationEnabled(): Promise { - return; - } - - /** - * Returns the current location mode setting for the device. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - getLocationMode(): Promise { - return; - } - - /** - * Returns the current authorization status for a given permission. - * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. - * - * @param permission - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) - getPermissionAuthorizationStatus(permission: any): Promise { - return; - } - - /** - * Returns the current authorization status for multiple permissions. - * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. - * - * @param {any[]} permissions - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) - getPermissionsAuthorizationStatus(permissions: any[]): Promise { - return; - } - - /** - * Requests app to be granted authorization for a runtime permission. - * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will have no effect as the permissions are already granted at installation time. - * - * @param permission - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) - requestRuntimePermission(permission: any): Promise { - return; - } - - /** - * Requests app to be granted authorization for multiple runtime permissions. - * Note: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time. - * - * @param {any[]} permissions - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) - requestRuntimePermissions(permissions: any[]): Promise { - return; - } - - /** - * Indicates if the plugin is currently requesting a runtime permission via the native API. - * Note that only one request can be made concurrently because the native API cannot handle concurrent requests, - * so the plugin will invoke the error callback if attempting to make more than one simultaneous request. - * Multiple permission requests should be grouped into a single call since the native API is setup to handle batch requests of multiple permission groups. - * - * @returns {boolean} - */ - @Cordova({ sync: true }) - isRequestingPermission(): boolean { - return; - } - - /** - * Registers a function to be called when a runtime permission request has completed. - * Pass in a falsy value to de-register the currently registered function. - * - * @param {Function} handler - */ - @Cordova({ sync: true }) - registerPermissionRequestCompleteHandler(handler: Function): void { - return; - } - - /** - * Checks if the device setting for Bluetooth is switched on. - * This requires `BLUETOOTH` permission on Android - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isBluetoothEnabled(): Promise { - return; - } - - /** - * Checks if the device has Bluetooth capabilities. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - hasBluetoothSupport(): Promise { - return; - } - - /** - * Checks if the device has Bluetooth Low Energy (LE) capabilities. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - hasBluetoothLESupport(): Promise { - return; - } - - /** - * Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - hasBluetoothLEPeripheralSupport(): Promise { - return; - } - - /** - * Returns the Bluetooth authorization status of the application on the device. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'] }) - getBluetoothAuthorizationStatus(): Promise { - return; - } - - /** - * Returns the individual authorization status for each Bluetooth run-time permission on Android 12+ / API 31+ - * On Android 11 / API 30 and below, all will be returned as GRANTED if the manifest has BLUETOOTH since they are implicitly granted at build-time. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - getBluetoothAuthorizationStatuses(): Promise { - return; - } - - /** - * Checks if the application is authorized to use external storage. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isExternalStorageAuthorized(): Promise { - return; - } - - /** - * CReturns the external storage authorization status for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - getExternalStorageAuthorizationStatus(): Promise { - return; - } - - /** - * Requests external storage authorization for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - requestExternalStorageAuthorization(): Promise { - return; - } - - /** - * Returns details of external SD card(s): absolute path, is writable, free space. - * - * The intention of this method is to return the location and details of removable external SD cards. - * This differs from the "external directories" returned by cordova-plugin-file which return mount points relating to non-removable (internal) storage. - * - * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getexternalsdcarddetails) - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - getExternalSdCardDetails(): Promise { - return; - } - - /** - * Switches to the wireless settings page in the Settings app. Allows configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks. - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - switchToWirelessSettings(): void {} - - /** - * Displays NFC settings to allow user to enable NFC. - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - switchToNFCSettings(): void {} - - /** - * Checks if NFC hardware is present on device. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isNFCPresent(): Promise { - return; - } - - /** - * Checks if the device setting for NFC is switched on. - * Note: this operation does not require NFC permission in the manifest. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isNFCEnabled(): Promise { - return; - } - - /** - * Checks if NFC is available to the app. Returns true if the device has NFC capabilities AND if NFC setting is switched on. - * Note: this operation does not require NFC permission in the manifest. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isNFCAvailable(): Promise { - return; - } - - /** - * Registers a function to be called when a change in NFC state occurs. Pass in a falsy value to de-register the currently registered function. - * - * @param {Function} hander callback function to be called when NFC state changes - * @param handler - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - sync: true, - }) - registerNFCStateChangeHandler(handler: Function): void {} - - /** - * Checks if the device data roaming setting is enabled. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isDataRoamingEnabled(): Promise { - return; - } - - /** - * Checks if the device setting for ADB(debug) is switched on. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isADBModeEnabled(): Promise { - return; - } - - /** - * Checks if the device is rooted. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['Android'] }) - isDeviceRooted(): Promise { - return; - } - - // IOS ONLY - - /** - * Checks if the application is authorized to use the Camera Roll in Photos app. - * - * @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel` - * Possible values are: - * ADD_ONLY - can add to but not read from Photo Library - * READ_WRITE - can both add to and read from Photo Library - * Defaults to ADD_ONLY if not specified - * Has no effect on iOS 13 or below - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'], callbackOrder: 'reverse' }) - isCameraRollAuthorized(accessLevel?: string): Promise { - return; - } - - /** - * Returns the authorization status for the application to use the Camera Roll in Photos app. - * - * @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel` - * Possible values are: - * ADD_ONLY - can add to but not read from Photo Library - * READ_WRITE - can both add to and read from Photo Library - * Defaults to ADD_ONLY if not specified - * Has no effect on iOS 13 or below - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'], callbackOrder: 'reverse' }) - getCameraRollAuthorizationStatus(accessLevel?: string): Promise { - return; - } - - /** - * Requests camera roll authorization for the application. - * Should only be called if authorization status is NOT_REQUESTED. - * Calling it when in any other state will have no effect. - * - * @param accessLevel - (optional) On iOS 14+, specifies the level of access to the photo library to query as a constant in cordova.plugins.diagnostic.photoLibraryAccessLevel` - * Possible values are: - * ADD_ONLY - can add to but not read from Photo Library - * READ_WRITE - can both add to and read from Photo Library - * Defaults to ADD_ONLY if not specified - * Has no effect on iOS 13 or below - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'], callbackOrder: 'reverse' }) - requestCameraRollAuthorization(accessLevel?: string): Promise { - return; - } - - /** - * Checks if remote (push) notifications are enabled. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS', 'Android'] }) - isRemoteNotificationsEnabled(): Promise { - return; - } - - /** - * Indicates if the app is registered for remote (push) notifications on the device. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - isRegisteredForRemoteNotifications(): Promise { - return; - } - - /** - * Returns the authorization status for the application to use Remote Notifications. - * Note: Works on iOS 10+ only (iOS 9 and below will invoke the error callback). - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - getRemoteNotificationsAuthorizationStatus(): Promise { - return; - } - - /** - * Requests reminders authorization for the application. - * - * @param types - * @param omitRegistration - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - requestRemoteNotificationsAuthorization(types?: string[], omitRegistration?: boolean): Promise { - return; - } - - /** - * Indicates the current setting of notification types for the app in the Settings app. - * Note: on iOS 8+, if "Allow Notifications" switch is OFF, all types will be returned as disabled. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - getRemoteNotificationTypes(): Promise { - return; - } - - /** - * Checks if the application is authorized to use reminders. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - isRemindersAuthorized(): Promise { - return; - } - - /** - * Returns the reminders authorization status for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - getRemindersAuthorizationStatus(): Promise { - return; - } - - /** - * Requests reminders authorization for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - requestRemindersAuthorization(): Promise { - return; - } - - /** - * Checks if the application is authorized for background refresh. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - isBackgroundRefreshAuthorized(): Promise { - return; - } - - /** - * Returns the background refresh authorization status for the application. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - getBackgroundRefreshStatus(): Promise { - return; - } - - /** - * Requests Bluetooth authorization for the application. - * - * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestbluetoothauthorization) - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - requestBluetoothAuthorization(): Promise { - return; - } - - /** - * Checks if motion tracking is available on the current device. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - isMotionAvailable(): Promise { - return; - } - - /** - * Checks if it's possible to determine the outcome of a motion authorization request on the current device. - * There's no direct way to determine if authorization was granted or denied, so the Pedometer API must be used to indirectly determine this: - * therefore, if the device supports motion tracking but not Pedometer Event Tracking, the outcome of requesting motion detection cannot be determined. - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - isMotionRequestOutcomeAvailable(): Promise { - return; - } - - /** - * Requests motion tracking authorization for the application. - * - * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requestmotionauthorization) - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - requestMotionAuthorization(): Promise { - return; - } - - /** - * Checks motion authorization status for the application. - * - * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getmotionauthorizationstatus) - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - getMotionAuthorizationStatus(): Promise { - return; - } - - /** - * Returns the location accuracy authorization for the application on iOS 14+ and Android 12+. Note: calling on iOS <14 or Android <12 will always return cordova.plugins.diagnostic.locationAccuracyAuthorization.FULL - * - * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#getlocationaccuracyauthorization) - * - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS', 'Android'] }) - getLocationAccuracyAuthorization(): Promise { - return; - } - - /** - * Requests temporary access to full location accuracy for the application on iOS 14+. - * - * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#requesttemporaryfullaccuracyauthorization) - * - * @param purpose - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - requestTemporaryFullAccuracyAuthorization(purpose: string): Promise { - return; - } - - /** - * Registers a function to be called when a change in location accuracy authorization occurs on iOS 14+. - * - * Learn more about this method [here](https://github.com/dpa99c/cordova-diagnostic-plugin#registerLocationAccuracyAuthorizationChangeHandler) - * - * @param handler - */ - @Cordova({ platforms: ['iOS'], sync: true }) - registerLocationAccuracyAuthorizationChangeHandler(handler: Function): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/dialogs/index.ts b/src/@awesome-cordova-plugins/plugins/dialogs/index.ts deleted file mode 100644 index fe1dc870..00000000 --- a/src/@awesome-cordova-plugins/plugins/dialogs/index.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface DialogsPromptCallback { - /** - * The index of the pressed button. (Number) Note that the index uses one-based indexing, so the value is 1, 2, 3, etc. - */ - buttonIndex: number; - - /** - * The text entered in the prompt dialog box. (String) - */ - input1: string; -} - -/** - * @name Dialogs - * @premier dialogs - * @description - * This plugin gives you ability to access and customize the device native dialogs. - * - * Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs). - * @usage - * ```typescript - * import { Dialogs } from '@awesome-cordova-plugins/dialogs/ngx'; - * - * constructor(private dialogs: Dialogs) { } - * - * ... - * - * this.dialogs.alert('Hello world') - * .then(() => console.log('Dialog dismissed')) - * .catch(e => console.log('Error displaying dialog', e)); - * - * - * ``` - * @interfaces - * DialogsPromptCallback - */ -@Plugin({ - pluginName: 'Dialogs', - plugin: 'cordova-plugin-dialogs', - pluginRef: 'navigator.notification', - repo: 'https://github.com/apache/cordova-plugin-dialogs', - platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class Dialogs extends AwesomeCordovaNativePlugin { - /** - * Shows a custom alert or dialog box. - * - * @param {string} message Dialog message. - * @param {string} [title] Dialog title. (Optional, defaults to Alert) - * @param {string} [buttonName] Button name. (Optional, defaults to OK) - * @returns {Promise} Returns a blank promise once the user has dismissed the alert. - */ - @Cordova({ - successIndex: 1, - errorIndex: 4, - }) - alert(message: string, title?: string, buttonName?: string): Promise { - return; - } - - /** - * Displays a customizable confirmation dialog box. - * - * @param {string} message Dialog message. - * @param {string} [title] Dialog title. (Optional, defaults to Confirm) - * @param {string[]} [buttonLabels] Array of strings specifying button labels. (Optional, defaults to [OK,Cancel]) - * @returns {Promise} Returns a promise that resolves the button index that was clicked, or 0 if the user has dismissed the dialog by clicking outside the dialog box. Note that the index use one-based indexing. - */ - @Cordova({ - successIndex: 1, - errorIndex: 4, - }) - confirm(message: string, title?: string, buttonLabels?: string[]): Promise { - return; - } - - /** - * Displays a native dialog box that is more customizable than the browser's prompt function. - * - * @param {string} [message] Dialog message. - * @param {string} [title] Dialog title. (Optional, defaults to Prompt) - * @param {string[]} [buttonLabels] Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"]) - * @param {string} [defaultText] Default text box input value. (Optional, Default: empty string) - * @returns {Promise} Returns a promise that resolves an object with the button index clicked and the text entered - */ - @Cordova({ - successIndex: 1, - errorIndex: 5, - }) - prompt( - message?: string, - title?: string, - buttonLabels?: string[], - defaultText?: string - ): Promise { - return; - } - - /** - * The device plays a beep sound. - * - * @param {numbers} times The number of times to repeat the beep. - */ - @Cordova({ - sync: true, - }) - beep(times: number): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/dns/index.ts b/src/@awesome-cordova-plugins/plugins/dns/index.ts deleted file mode 100644 index 30e3c54e..00000000 --- a/src/@awesome-cordova-plugins/plugins/dns/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -/** - * @name DNS - * @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. - * @usage - * ```typescript - * import { DNS } from '@awesome-cordova-plugins/dns/ngx'; - * - * - * constructor(private dns: DNS) { } - * - * ... - * this.dns.resolve(hostname) - * .then( - * address => console.log('Resolved ' + hostname + ' to ' + address), - * error => console.log('Failed to resolve ' + hostname + ': ' + error) - * ); - * - * ``` - */ -@Plugin({ - pluginName: 'DNS', - plugin: 'cordova-plugin-dns', - pluginRef: 'cordova.plugins.dns', - repo: 'https://bitbucket.org/zegeba/cordova-plugin-dns', - platforms: ['Android'], -}) -@Injectable() -export class DNS extends AwesomeCordovaNativePlugin { - /** - * Resolve hostnames into an underlying network address. - * - * @param hostname - * @returns {Promise} Returns a promise that resolves with the resolution. - */ - @Cordova() - resolve(hostname: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/document-picker/index.ts b/src/@awesome-cordova-plugins/plugins/document-picker/index.ts deleted file mode 100644 index 557998f3..00000000 --- a/src/@awesome-cordova-plugins/plugins/document-picker/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name iOS DocumentPicker - * @description - * - * Opens the file picker on iOS for the user to select a file, returns a file URI. - * Allows the user to upload files from iCloud - * @usage - * ```typescript - * import { DocumentPicker } from '@awesome-cordova-plugins/document-picker/ngx'; - * - * constructor(private docPicker: DocumentPicker) { } - * - * ... - * - * this.docPicker.getFile('all') - * .then(uri => console.log(uri)) - * .catch(e => console.log(e)); - * - * ``` - */ -@Plugin({ - pluginName: 'IOSDocumentPicker', - plugin: 'cordova-plugin-documentpicker.DocumentPicker', - pluginRef: 'DocumentPicker', - repo: 'https://github.com/iampossible/Cordova-DocPicker', - platforms: ['iOS'], -}) -@Injectable() -export class DocumentPicker extends AwesomeCordovaNativePlugin { - /** - * Open a file - * - * @param {string} [option] files between 'image', 'pdf' or 'all' - * @returns {Promise} - */ - @Cordova() - getFile(option?: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/document-scanner/index.ts b/src/@awesome-cordova-plugins/plugins/document-scanner/index.ts deleted file mode 100644 index e0fa8023..00000000 --- a/src/@awesome-cordova-plugins/plugins/document-scanner/index.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export enum DocumentScannerSourceType { - /** - * Scan directly from device camera. - * This is the default. - */ - CAMERA = 1, - - /** - * Scan from an image already stored on device. - */ - GALLERY = 0, -} - -export interface DocumentScannerOptions { - /** - * Choose to scan from camera or existing image file. Only valid for Android. - */ - sourceType?: DocumentScannerSourceType; - - /** - * Filename to save scanned image to (minus extension, which is always ".png"). - * Only valid for iOS. Caller is responsible for cleaning up any files created - * if this parameter is set to anything other than the default value, - * which is "image". - */ - fileName?: string; - - /** - * Quality to use when capturing the image, must be a float value - * from 1.0(default - Highest quality) to 5.0(Lowest Quality). Any value - * in between will be accepted. Any value not equal to or not between these values - * will default to the highest quality of 1.0. - */ - quality?: number; - - /** - * If the image should be returned as a base64 encoding instead of as a file URL. - * If true, the plugin will return the scanned image as base64. If false, - * the plugin will return the image URL of the image. - */ - returnBase64?: boolean; -} - -/** - * @name Document Scanner - * @description - * This plugin processes images of documents, compensating for perspective. - * @usage - * ```typescript - * import { DocumentScanner, DocumentScannerOptions } from '@awesome-cordova-plugins/document-scanner/ngx'; - * - * - * constructor(private documentScanner: DocumentScanner) { } - * - * ... - * - * let opts: DocumentScannerOptions = {}; - * this.documentScanner.scanDocument(opts) - * .then((res: string) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - * @interfaces - * DocumentScannerOptions - * @enums - * DocumentScannerSourceType - */ -@Plugin({ - pluginName: 'DocumentScanner', - plugin: 'cordova-plugin-document-scanner', - pluginRef: 'scan', - repo: 'https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class DocumentScanner extends AwesomeCordovaNativePlugin { - /** - * Scan a document - * - * @param opts {DocumentScannerOptions} optional parameter for controlling scanning - * @returns {Promise} file URL of scanned document image - */ - @Cordova({ - callbackOrder: 'reverse', - }) - scanDoc(opts?: DocumentScannerOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/document-viewer/index.ts b/src/@awesome-cordova-plugins/plugins/document-viewer/index.ts deleted file mode 100644 index 14acec1c..00000000 --- a/src/@awesome-cordova-plugins/plugins/document-viewer/index.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -export interface DocumentViewerOptions { - title?: string; - documentView?: { - closeLabel: string; - }; - navigationView?: { - closeLabel: string; - }; - email?: { - enabled: boolean; - }; - print?: { - enabled: boolean; - }; - openWith?: { - enabled: boolean; - }; - bookmarks?: { - enabled: boolean; - }; - search?: { - enabled: boolean; - }; - autoClose?: { - onPause: boolean; - }; -} - -/** - * @name Document Viewer - * @description - * This plugin offers a slim API to view PDF files which are either stored in the apps assets folder (/www/*) or in any other file system directory available via the cordova file plugin. - * @usage - * ```typescript - * import { DocumentViewer } from '@awesome-cordova-plugins/document-viewer/ngx'; - * - * - * constructor(private document: DocumentViewer) { } - * - * ... - * const options: DocumentViewerOptions = { - * title: 'My PDF' - * } - * - * this.document.viewDocument('assets/myFile.pdf', 'application/pdf', options) - * - * ``` - * @interfaces - * DocumentViewerOptions - */ -@Plugin({ - pluginName: 'Document Viewer', - plugin: 'cordova-plugin-document-viewer', - pluginRef: 'SitewaertsDocumentViewer', - repo: 'https://github.com/sitewaerts/cordova-plugin-document-viewer', - platforms: ['Android', 'iOS', 'Windows'], -}) -@Injectable() -export class DocumentViewer extends AwesomeCordovaNativePlugin { - /** - * Displays the email composer pre-filled with data. - * - * @returns {Promise} Resolves promise when the EmailComposer has been opened - */ - @Cordova() - getSupportInfo(): Promise { - return; - } - - /** - * Check if the document can be shown - * - * @param url {string} Url to the file - * @param contentType {string} Content type of the file - * @param options {DocumentViewerOptions} options - * @param [onPossible] {Function} - * @param [onMissingApp] {Function} - * @param [onImpossible] {Function} - * @param [onError] {Function} - */ - @Cordova({ sync: true }) - canViewDocument( - url: string, - contentType: string, - options: DocumentViewerOptions, - onPossible?: Function, - onMissingApp?: Function, - onImpossible?: Function, - onError?: Function - ): void {} - - /** - * Opens the file - * - * @param url {string} Url to the file - * @param contentType {string} Content type of the file - * @param options {DocumentViewerOptions} options - * @param [onShow] {Function} - * @param [onClose] {Function} - * @param [onMissingApp] {Function} - * @param [onError] {Function} - */ - @Cordova({ sync: true }) - viewDocument( - url: string, - contentType: string, - options: DocumentViewerOptions, - onShow?: Function, - onClose?: Function, - onMissingApp?: Function, - onError?: Function - ): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/dynamsoft-barcode-scanner/index.ts b/src/@awesome-cordova-plugins/plugins/dynamsoft-barcode-scanner/index.ts deleted file mode 100755 index 48885670..00000000 --- a/src/@awesome-cordova-plugins/plugins/dynamsoft-barcode-scanner/index.ts +++ /dev/null @@ -1,209 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Plugin, - Cordova, - CordovaProperty, - CordovaInstance, - InstanceProperty, - AwesomeCordovaNativePlugin, -} from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * dceLicense: License of Dynamsoft Camera Enhancer - * resolution: use EnumResolution - * rotate: convert frame to bitmap and rotate it - */ -export interface ScanOptions { - dceLicense?: string; - resolution?: number; - rotate?: boolean; -} - -export interface FrameResult { - frameWidth: number; - frameHeight: number; - frameRotation: number; - results: BarcodeResult[]; -} - -export interface BarcodeResult { - barcodeText: string; - barcodeFormat: string; - barcodeBytesBase64?: string; - x1: number; - x2: number; - x3: number; - x4: number; - y1: number; - y2: number; - y3: number; - y4: number; -} - -export enum EnumResolution { - RESOLUTION_AUTO = 0, - RESOLUTION_480P = 1, - RESOLUTION_720P = 2, - RESOLUTION_1080P = 3, - RESOLUTION_2K = 4, - RESOLUTION_4K = 5, -} - -/** - * @name dynamsoft-barcode-scanner - * @description - * This plugin scans barcodes using Dynamsoft Barcode Reader - * - * @usage - * ```typescript - * import { dynamsoft-barcode-scanner } from '@awesome-cordova-plugins/dynamsoft-barcode-scanner'; - * - * - * constructor(private dynamsoft-barcode-scanner: dynamsoft-barcode-scanner) { } - * - * ... - * - * - * await this.dynamsoft-barcode-scanner.init("license"); - * this.dynamsoft-barcode-scanner.startScanning("license").subscribe(result => { - console.log(result); - }); - * - * ``` - */ -@Plugin({ - pluginName: 'dynamsoft-barcode-scanner', - plugin: 'cordova-plugin-dynamsoft-barcode-reader', - pluginRef: 'cordova.plugins.DBR', - repo: 'https://github.com/xulihang/cordova-plugin-dynamsoft-barcode-reader', - install: '', - installVariables: [], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class BarcodeScanner extends AwesomeCordovaNativePlugin { - /** - * Initialize Dynamsoft Barcode Reader - * @param license {string} - * @return {Promise} Returns a promise that resolves when the initialization is done - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - init(license: string): Promise { - return; - } - - /** - * Set up runtime settings - * @param settings {string} runtime settings template in JSON - * @return {Promise} Returns a promise - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - initRuntimeSettingsWithString(settings?: string): Promise { - return; - } - - /** - * Output runtime settings to JSON string - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - outputSettingsToString(): Promise { - return; - } - - /** - * destroy Dynamsoft Barcode Reader - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - destroy(): Promise { - return; - } - - /** - * start the camera to scan barcodes - * @param options {ScanOptions} - * @return {Observable} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - observable: true, - }) - startScanning(options?: ScanOptions): Observable { - return; - } - - /** - * stop scanning - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - stopScanning(): Promise { - return; - } - - /** - * resume scanning - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - resumeScanning(): Promise { - return; - } - - /** - * pause scanning - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - pauseScanning(): Promise { - return; - } - - /** - * get resolution like: 1280x720 - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - getResolution(): Promise { - return; - } - - /** - * switch torch - * @param desiredStatus {string} on or off - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - switchTorch(desiredStatus: string): Promise { - return; - } - - /** - * set zoom - * @param factor {number} zoom factor - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - setZoom(factor: number): Promise { - return; - } - - /** - * set focus - * @param point focus point - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - setFocus(point: { x: number; y: number }): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/email-composer/index.ts b/src/@awesome-cordova-plugins/plugins/email-composer/index.ts deleted file mode 100644 index c223c774..00000000 --- a/src/@awesome-cordova-plugins/plugins/email-composer/index.ts +++ /dev/null @@ -1,258 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaCheck, AwesomeCordovaNativePlugin, Plugin, getPromise } from '@awesome-cordova-plugins/core'; - -export interface EmailComposerOptions { - /** - * App to send the email with - */ - app?: string; - - /** - * Email address(es) for To field - */ - to?: string | string[]; - - /** - * Email address(es) for CC field - */ - cc?: string | string[]; - - /** - * Email address(es) for BCC field - */ - bcc?: string | string[]; - - /** - * File paths or base64 data streams - */ - attachments?: string[]; - - /** - * Subject of the email - */ - subject?: string; - - /** - * Email body (for HTML, set isHtml to true) - */ - body?: string; - - /** - * Indicates if the body is HTML or plain text - */ - isHtml?: boolean; - - /** - * Content type of the email (Android only) - */ - type?: string; -} - -/** - * @name Email Composer - * @premier email-composer - * @description - * - * Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/hypery2k/cordova-email-plugin). - * @usage - * ```typescript - * import { EmailComposer } from '@awesome-cordova-plugins/email-composer/ngx'; - * - * constructor(private emailComposer: EmailComposer) { } - * - * ... - * - * - * this.emailComposer.getClients().then((apps: []) => { - * // Returns an array of configured email clients for the device - * }); - * - * this.emailComposer.hasClient(app).then((isValid: boolean) => { - * if (isValid) { - * // Now we know we have a valid email client configured - * // Not specifying an app will return true if at least one email client is configured - * } - * }); - * - * this.emailComposer.hasAccount().then((isValid: boolean) => { - * if (isValid) { - * // Now we know we have a valid email account configured - * } - * }); - * - * this.emailComposer.isAvailable(app).then((available: boolean) => { - * if(available) { - * // Now we know we can send an email, calls hasClient and hasAccount - * // Not specifying an app will return true if at least one email client is configured - * } - * }); - * - * let email = { - * to: 'max@mustermann.de', - * cc: 'erika@mustermann.de', - * bcc: ['john@doe.com', 'jane@doe.com'], - * attachments: [ - * 'file://img/logo.png', - * 'res://icon.png', - * 'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...', - * 'file://README.pdf' - * ], - * subject: 'Cordova Icons', - * body: 'How are you? Nice greetings from Leipzig', - * isHtml: true - * } - * - * // Send a text message using default options - * this.emailComposer.open(email); - * ``` - * - * You can also assign aliases to email apps - * ```ts - * // add alias - * this.email.addAlias('gmail', 'com.google.android.gm'); - * - * // then use alias when sending email - * this.email.open({ - * app: 'gmail', - * ... - * }); - * ``` - * @interfaces - * EmailComposerOptions - */ -@Plugin({ - pluginName: 'EmailComposer', - plugin: 'cordova-plugin-email-composer', - pluginRef: 'cordova.plugins.email', - repo: 'https://github.com/katzer/cordova-plugin-email-composer', - platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Windows', 'macOS'], -}) -@Injectable() -export class EmailComposer extends AwesomeCordovaNativePlugin { - /** - * Checks if the app has a permission to access email accounts information - * - * @returns {Promise} returns a promise that resolves with a boolean that indicates if the permission was granted - */ - @Cordova({ - successIndex: 0, - errorIndex: 2, - }) - hasPermission(): Promise { - return; - } - - /** - * Request permission to access email accounts information - * - * @returns {Promise} returns a promise that resolves with a boolean that indicates if the permission was granted - */ - @Cordova({ - successIndex: 0, - errorIndex: 2, - }) - requestPermission(): Promise { - return; - } - - /** - * Verifies if an email account is configured on the device. - * - * @returns {Promise} Resolves if available, rejects if not available - */ - @CordovaCheck() - hasAccount(): Promise { - return getPromise((resolve) => { - EmailComposer.getPlugin().hasAccount((result: boolean) => { - if (result) { - resolve(true); - } else { - resolve(false); - } - }); - }); - } - - /** - * Verifies if a specific email client is installed on the device. - * - * @param {string} [app] App id or uri scheme. - * @returns {Promise} Resolves if available, rejects if not available - */ - - @CordovaCheck() - hasClient(app?: string): Promise { - return getPromise((resolve) => { - if (app) { - EmailComposer.getPlugin().hasClient(app, (result: boolean) => { - if (result) { - resolve(true); - } else { - resolve(false); - } - }); - } else { - EmailComposer.getPlugin().getClients((apps: string[]) => { - resolve(apps && apps.length > 0); - }); - } - }); - } - - /** - * Returns an array of email clients installed on the device. - * - * @returns {Promise} Resolves if available, rejects if not available - */ - @CordovaCheck() - @Cordova({ platforms: ['Android'] }) - getClients(): Promise { - return getPromise((resolve) => { - EmailComposer.getPlugin().getClients((apps: any) => { - if (Object.prototype.toString.call(apps) === '[object String]') { - apps = [apps]; - } - resolve(apps); - }); - }); - } - - /** - * Verifies if sending emails is supported on the device. - * - * @param {string} [app] App id or uri scheme. - * @returns {Promise} Resolves if available, rejects if not available - */ - @CordovaCheck() - isAvailable(app?: string): Promise { - return getPromise((resolve) => { - Promise.all([this.hasAccount, this.hasClient(app)]).then((results) => { - return resolve(results.length === 2 && results[0] && results[1]); - }); - }); - } - - /** - * Displays the email composer pre-filled with data. - * - * @param {EmailComposerOptions} options Email - * @param {any} [scope] Scope for the promise - * @returns {Promise} Resolves promise when the EmailComposer has been opened - */ - @Cordova({ - successIndex: 1, - errorIndex: 3, - }) - open(options: EmailComposerOptions, scope?: any): Promise { - return; - } - - /** - * Adds a new mail app alias. - * - * @param {string} alias The alias name - * @param {string} packageName The package name - */ - @Cordova() - addAlias(alias: string, packageName: string): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/fabric/index.ts b/src/@awesome-cordova-plugins/plugins/fabric/index.ts deleted file mode 100644 index d5e1044e..00000000 --- a/src/@awesome-cordova-plugins/plugins/fabric/index.ts +++ /dev/null @@ -1,441 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface Attributes { - [index: string]: string; -} - -/** - * @name Crashlytics - * @description - * API for interacting with the Crashlytics kit. - * - * https://docs.fabric.io/crashlytics/index.html - * @usage - * ```typescript - * import { Crashlytics } from '@awesome-cordova-plugins/fabric/ngx'; - * - * - * constructor(private crashlytics: Crashlytics) { } - * - * ... - * - * try { - * await this.loadData(); - * } catch (e) { - * this.crashlytics.addLog("Error while loading data"); - * this.crashlytics.sendNonFatalCrash(e.message || e); - * } - * - * ``` - */ -@Plugin({ - pluginName: 'Crashlytics', - plugin: 'cordova-fabric-plugin', - pluginRef: 'window.fabric.Crashlytics', - repo: 'https://www.npmjs.com/package/cordova-fabric-plugin', - install: - 'ionic cordova plugin add cordova-fabric-plugin --variable FABRIC_API_KEY=XXX --variable FABRIC_API_SECRET=xxx', - installVariables: ['FABRIC_API_KEY', 'FABRIC_API_SECRET'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Crashlytics extends AwesomeCordovaNativePlugin { - /** - * Add logging that will be sent with your crash data. This logging will not show up - * in the system.log and will only be visible in your Crashlytics dashboard. - * - * @param message {string} - */ - @Cordova({ sync: true }) - addLog(message: string): void { - return; - } - - /** - * Used to simulate a native platform crash (useful for testing Crashlytics logging). - */ - @Cordova({ sync: true }) - sendCrash(): void { - return; - } - - /** - * Used to log a non-fatal error message (Android only). - * - * @param message - * @param stacktrace - */ - @Cordova({ sync: true }) - sendNonFatalCrash(message: string, stacktrace?: any): void { - return; - } - - /** - * Used to record a non-fatal error message (iOS only). - * - * @param message - * @param code - */ - @Cordova({ sync: true }) - recordError(message: string, code: number): void { - return; - } - - /** - * Sets the user's identifier for logging to Crashlytics backend. - * - * @param userId - */ - @Cordova({ sync: true }) - setUserIdentifier(userId: string): void { - return; - } - - /** - * Sets the user's name for logging to Crashlytics backend. - * - * @param userName - */ - @Cordova({ sync: true }) - setUserName(userName: string): void { - return; - } - - /** - * Sets the user's email address for logging to Crashlytics backend. - * - * @param email - */ - @Cordova({ sync: true }) - setUserEmail(email: string): void { - return; - } - - /** - * Sets a custom key/value pair for logging to Crashlytics backend. - * - * @param value - * @param key - */ - @Cordova({ sync: true }) - setStringValueForKey(value: string, key: string): void { - return; - } - - /** - * Sets a custom key/value pair for logging to Crashlytics backend. - * - * @param value - * @param key - */ - @Cordova({ sync: true }) - setIntValueForKey(value: number, key: string): void { - return; - } - - /** - * Sets a custom key/value pair for logging to Crashlytics backend. - * - * @param value - * @param key - */ - @Cordova({ sync: true }) - setBoolValueForKey(value: boolean, key: string): void { - return; - } - - /** - * Sets a custom key/value pair for logging to Crashlytics backend. - * - * @param value - * @param key - */ - @Cordova({ sync: true }) - setFloatValueForKey(value: number, key: string): void { - return; - } -} - -/** - * @name Answers - * @description - * API for interacting with the Answers kit. - * - * https://docs.fabric.io/crashlytics/index.html - * @usage - * ```typescript - * import { Answers } from '@awesome-cordova-plugins/fabric/ngx'; - * - * - * constructor(private answers: Answers) { } - * - * ... - * - * this.answers.sendCustomEvent('SomeCustomEvent', { some: "attributes" }) - * - * ``` - */ -@Plugin({ - pluginName: 'Answers', - plugin: 'cordova-fabric-plugin', - pluginRef: 'window.fabric.Answers', - repo: 'https://www.npmjs.com/package/cordova-fabric-plugin', - install: - 'ionic cordova plugin add cordova-fabric-plugin --variable FABRIC_API_KEY=XXX --variable FABRIC_API_SECRET=xxx', - installVariables: ['FABRIC_API_KEY', 'FABRIC_API_SECRET'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Answers extends AwesomeCordovaNativePlugin { - /** - * Sends the Purchase tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#purchase - * - * @param itemPrice The item's amount in the currency specified. - * @param currency The ISO4217 currency code. - * @param success Was the purchase completed succesfully? - * @param itemName The human-readable name for the item. - * @param itemType The category the item falls under. - * @param itemId A unique identifier used to track the item. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendPurchase( - itemPrice?: number, - currency?: string, - success?: boolean, - itemName?: string, - itemType?: string, - itemId?: string, - attributes?: Attributes - ): void { - return; - } - - /** - * Sends the Add To Cart tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#add-to-cart - * - * @param itemPrice The item's amount in the currency specified. - * @param currency The ISO4217 currency code. - * @param itemName The human-readable name for the item. - * @param itemType The category the item falls under. - * @param itemId A unique identifier used to track the item. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendAddToCart( - itemPrice?: number, - currency?: string, - itemName?: string, - itemType?: string, - itemId?: string, - attributes?: Attributes - ): void { - return; - } - - /** - * Sends the Start Checkout tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#start-checkout - * - * @param totalPrice The total price of all items in cart in the currency specified. - * @param currency The ISO4217 currency code. - * @param itemCount The count of items in cart. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendStartCheckout(totalPrice?: number, currency?: string, itemCount?: number, attributes?: Attributes): void { - return; - } - - /** - * Sends the Search tracking event. - * - * https://docs.fabric.io/android/answers/answers-events.html#search - * - * @param query What the user is searching for. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendSearch(query: string, attributes?: Attributes): void { - return; - } - - /** - * Sends the Share tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#share - * - * @param method The method used to share content. - * @param contentName The description of the content. - * @param contentType The type or genre of content. - * @param contentId A unique key identifying the content. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendShare( - method?: string, - contentName?: string, - contentType?: string, - contentId?: string, - attributes?: Attributes - ): void { - return; - } - - /** - * Sends the Rated Content tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#rated-content - * - * @param rating An integer rating of the content. - * @param contentName The human-readable name of content. - * @param contentType The category your item falls under. - * @param contentId A unique identifier used to track the item. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendRatedContent( - rating?: number, - contentName?: string, - contentType?: string, - contentId?: string, - attributes?: Attributes - ): void { - return; - } - - /** - * Sends the Sign Up tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#sign-up - * - * @param method An optional description of the sign up method (Twitter, Facebook, etc.); defaults to "Direct". - * @param success An optional flag that indicates sign up success; defaults to true. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendSignUp(method?: string, success?: boolean, attributes?: Attributes): void { - return; - } - - /** - * Sends the Log In tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#log-in - * - * @param method An optional description of the sign in method (Twitter, Facebook, etc.); defaults to "Direct". - * @param success An optional flag that indicates sign in success; defaults to true. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendLogIn(method?: string, success?: boolean, attributes?: Attributes): void { - return; - } - - /** - * Sends the Invite tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#invite - * - * @param method An optional description of the sign in method (Twitter, Facebook, etc.); defaults to "Direct". - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendInvite(method?: string, attributes?: Attributes): void { - return; - } - - /** - * Sends the Level Start tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#level-start - * - * @param levelName String key describing the level. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendLevelStart(levelName?: string, attributes?: Attributes): void { - return; - } - - /** - * Sends the Level End tracking event. - * - * All parameters are optional. - * - * https://docs.fabric.io/android/answers/answers-events.html#level-end - * - * @param levelName String key describing the level. - * @param score The score for this level. - * @param success Completed the level or failed trying. - * @param attributes Any additional user-defined attributes to be logged. - */ - @Cordova({ sync: true }) - sendLevelEnd(levelName?: string, score?: number, success?: boolean, attributes?: Attributes): void { - return; - } - - /** - * Send the Content View tracking event. - * - * https://docs.fabric.io/android/answers/answers-events.html#content-view - * - * @param name - * @param type - * @param id - * @param attributes - */ - @Cordova({ sync: true }) - sendContentView(name: string, type?: string, id?: string, attributes?: Attributes): void { - return; - } - - /** - * Shortcut for sendContentView(...) using type of "Screen". - * - * @param name - * @param id - * @param attributes - */ - @Cordova({ sync: true }) - sendScreenView(name: string, id: string, attributes?: Attributes): void { - return; - } - - /** - * Send a custom tracking event with the given name. - * - * https://docs.fabric.io/android/answers/answers-events.html#custom-event - * - * @param name - * @param attributes - */ - @Cordova({ sync: true }) - sendCustomEvent(name: string, attributes?: Attributes): void { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/facebook/index.ts b/src/@awesome-cordova-plugins/plugins/facebook/index.ts deleted file mode 100644 index 75ebccde..00000000 --- a/src/@awesome-cordova-plugins/plugins/facebook/index.ts +++ /dev/null @@ -1,479 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface FacebookLoginResponse { - status: string; - - authResponse: { - accessToken: string; - - data_access_expiration_time: string; - - expiresIn: number; - - userID: string; - }; -} - -/** - * @name Facebook - * @description - * Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android. - * - * Requires Cordova plugin: `cordova-plugin-facebook-connect`. For more info, please see the [Facebook Connect](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect). - * - * #### Installation - * - * To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal at [https://developers.facebook.com/apps](https://developers.facebook.com/apps). - * - * [![fb-getstarted-1](/img/docs/native/Facebook/1.png)](https://developers.facebook.com/apps/) - * - * Retrieve the `App ID` and `App Name`. - * - * [![fb-getstarted-2](/img/docs/native/Facebook/2.png)](https://developers.facebook.com/apps/) - * - * Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal. - * - * ```bash - * ionic cordova plugin add cordova-plugin-facebook-connect --variable APP_ID="123456789" --variable APP_NAME="myApplication" - * ``` - * - * After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings: - * - * [![fb-getstarted-3](/img/docs/native/Facebook/3.png)](https://developers.facebook.com/apps/) - * - * Click `'Add Platform'`. - * - * [![fb-getstarted-4](/img/docs/native/Facebook/4.png)](https://developers.facebook.com/apps/) - * - * At this point you'll need to open your project's [`config.xml`](https://cordova.apache.org/docs/en/latest/config_ref/index.html) file, found in the root directory of your project. - * - * Take note of the `id` for the next step: - * ```xml - * - * ``` - * - * You can also edit the `id` to whatever you'd like it to be. - * - * #### iOS Install - * Under 'Bundle ID', add the `id` from your `config.xml` file: - * - * [![fb-getstarted-5](/img/docs/native/Facebook/5.png)](https://developers.facebook.com/apps/) - * - * - * #### Android Install - * Under 'Google Play Package Name', add the `id` from your `config.xml` file: - * - * [![fb-getstarted-6](/img/docs/native/Facebook/6.png)](https://developers.facebook.com/apps/) - * - * - * And that's it! You can now make calls to Facebook using the plugin. - * - * ## Events - * - * App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads. - * - * - [iOS] [https://developers.facebook.com/docs/ios/app-events](https://developers.facebook.com/docs/ios/app-events) - * - [Android] [https://developers.facebook.com/docs/android/app-events](https://developers.facebook.com/docs/android/app-events) - * - [JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success - * - * Activation events are automatically tracked for you in the plugin. - * - * Events are listed on the [insights page](https://www.facebook.com/insights/). - * - * For tracking events, see `logEvent` and `logPurchase`. - * @usage - * ```typescript - * import { Facebook, FacebookLoginResponse } from '@awesome-cordova-plugins/facebook/ngx'; - * - * constructor(private fb: Facebook) { } - * - * ... - * - * this.fb.login(['public_profile', 'user_friends', 'email']) - * .then((res: FacebookLoginResponse) => console.log('Logged into Facebook!', res)) - * .catch(e => console.log('Error logging into Facebook', e)); - * - * - * this.fb.logEvent(this.fb.EVENTS.EVENT_NAME_ADDED_TO_CART); - * - * ``` - */ -@Plugin({ - pluginName: 'Facebook', - plugin: 'cordova-plugin-facebook-connect', - pluginRef: 'facebookConnectPlugin', - repo: 'https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect', - install: - 'ionic cordova plugin add cordova-plugin-facebook-connect --variable APP_ID="123456789" --variable APP_NAME="myApplication"', - installVariables: ['APP_ID', 'APP_NAME'], - platforms: ['Android', 'iOS', 'Browser'], -}) -@Injectable() -export class Facebook extends AwesomeCordovaNativePlugin { - EVENTS = { - EVENT_NAME_ACTIVATED_APP: 'fb_mobile_activate_app', - EVENT_NAME_DEACTIVATED_APP: 'fb_mobile_deactivate_app', - EVENT_NAME_SESSION_INTERRUPTIONS: 'fb_mobile_app_interruptions', - EVENT_NAME_TIME_BETWEEN_SESSIONS: 'fb_mobile_time_between_sessions', - EVENT_NAME_COMPLETED_REGISTRATION: 'fb_mobile_complete_registration', - EVENT_NAME_VIEWED_CONTENT: 'fb_mobile_content_view', - EVENT_NAME_SEARCHED: 'fb_mobile_search', - EVENT_NAME_RATED: 'fb_mobile_rate', - EVENT_NAME_COMPLETED_TUTORIAL: 'fb_mobile_tutorial_completion', - EVENT_NAME_PUSH_TOKEN_OBTAINED: 'fb_mobile_obtain_push_token', - EVENT_NAME_ADDED_TO_CART: 'fb_mobile_add_to_cart', - EVENT_NAME_ADDED_TO_WISHLIST: 'fb_mobile_add_to_wishlist', - EVENT_NAME_INITIATED_CHECKOUT: 'fb_mobile_initiated_checkout', - EVENT_NAME_ADDED_PAYMENT_INFO: 'fb_mobile_add_payment_info', - EVENT_NAME_PURCHASED: 'fb_mobile_purchase', - EVENT_NAME_ACHIEVED_LEVEL: 'fb_mobile_level_achieved', - EVENT_NAME_UNLOCKED_ACHIEVEMENT: 'fb_mobile_achievement_unlocked', - EVENT_NAME_SPENT_CREDITS: 'fb_mobile_spent_credits', - EVENT_PARAM_CURRENCY: 'fb_currency', - EVENT_PARAM_REGISTRATION_METHOD: 'fb_registration_method', - EVENT_PARAM_CONTENT_TYPE: 'fb_content_type', - EVENT_PARAM_CONTENT_ID: 'fb_content_id', - EVENT_PARAM_SEARCH_STRING: 'fb_search_string', - EVENT_PARAM_SUCCESS: 'fb_success', - EVENT_PARAM_MAX_RATING_VALUE: 'fb_max_rating_value', - EVENT_PARAM_PAYMENT_INFO_AVAILABLE: 'fb_payment_info_available', - EVENT_PARAM_NUM_ITEMS: 'fb_num_items', - EVENT_PARAM_LEVEL: 'fb_level', - EVENT_PARAM_DESCRIPTION: 'fb_description', - EVENT_PARAM_SOURCE_APPLICATION: 'fb_mobile_launch_source', - EVENT_PARAM_VALUE_YES: '1', - EVENT_PARAM_VALUE_NO: '0', - }; - - /** - * Get the current application ID - * - * @returns {Promise} Returns a Promise that resolves with the current application ID - */ - @Cordova() - getApplicationId(): Promise { - return; - } - - /** - * Set the application ID - * - * @param {string} id application ID - */ - @Cordova() - setApplicationId(id: string): Promise { - return; - } - - /** - * Get the current application name - * - * @returns {Promise} Returns a Promise that resolves with the current application name - */ - @Cordova() - getApplicationName(): Promise { - return; - } - - /** - * Set the application name - * - * @param {string} name application name - */ - @Cordova() - setApplicationName(name: string): Promise { - return; - } - - /** - * Login to Facebook to authenticate this app. - * - * ```typescript - * { - * status: 'connected', - * authResponse: { - * accessToken: 'kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn', - * data_access_expiration_time: '1623680244', - * expiresIn: 5183979, - * userID: '634565435' - * } - * } - * - * ``` - * - * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in. - * @returns {Promise} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. - */ - @Cordova() - login(permissions: string[]): Promise { - return; - } - - /** - * Login to Facebook using Limited Login (iOS Only) - * - * ```typescript - * { - * status: 'connected', - * authResponse: { - * authenticationToken: 'kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn', - * nonce: 'foo', - * userID: '634565435' - * } - * } - * - * ``` - * - * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/limited-login/permissions) this app has upon logging in. - * @returns {Promise} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. - */ - @Cordova() - loginWithLimitedTracking(permissions: string[]): Promise { - return; - } - - /** - * Check if the user has approved all necessary permissions - * - * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) to check for - * @returns {Promise} Returns a Promise that resolves with a success string if all passed permissions are granted, or an error string if any permissions are not granted - */ - @Cordova() - checkHasCorrectPermissions(permissions: string[]): Promise { - return; - } - - /** - * Check if data access has expired for the user - * - * @returns {Promise} Returns a Promise that resolves with a success string if data access is expired, or rejects with an error - */ - @Cordova() - isDataAccessExpired(): Promise { - return; - } - - /** - * Reauthorize data access after it has expired - * - * @returns {Promise} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. - */ - @Cordova() - reauthorizeDataAccess(): Promise { - return; - } - - /** - * Logout of Facebook. - * - * For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout) - * - * @returns {Promise} Returns a Promise that resolves on a successful logout, and rejects if logout fails. - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user: - * - * 1) the user is logged into Facebook and has authenticated your application (connected) - * 2) the user is logged into Facebook but has not authenticated your application (not_authorized) - * 3) the user is either not logged into Facebook or explicitly logged out of your application so it doesn't attempt to connect to Facebook and thus, we don't know if they've authenticated your application or not (unknown) - * - * Resolves with a response like: - * - * ``` - * { - * authResponse: { - * userID: '12345678912345', - * accessToken: 'kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn', - * data_access_expiration_time: '1623680244', - * expiresIn: '5183738' - * }, - * status: 'connected' - * } - * ``` - * - * For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus) - * - * @returns {Promise} Returns a Promise that resolves with a status, or rejects with an error - */ - @Cordova() - getLoginStatus(): Promise { - return; - } - - /** - * Get a Facebook access token for using Facebook services. - * - * @returns {Promise} Returns a Promise that resolves with an access token, or rejects with an error - */ - @Cordova() - getAccessToken(): Promise { - return; - } - - /** - * Get profile information for the currently logged in user - * - * @returns {Promise} Returns a Promise that resolves with success data, or rejects with an error - */ - @Cordova() - getCurrentProfile(): Promise { - return; - } - - /** - * Show one of various Facebook dialogs. Example of options for a Share dialog: - * - * ``` - * { - * method: 'share', - * href: 'http://example.com' - * } - * ``` - * - * For more options see the [Cordova plugin docs](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui) - * - * @param {Object} options The dialog options - * @returns {Promise} Returns a Promise that resolves with success data, or rejects with an error - */ - @Cordova() - showDialog(options: any): Promise { - return; - } - - /** - * Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login. - * - * For more information see: - * - * Calling the Graph API - https://developers.facebook.com/docs/javascript/reference/FB.api - * Graph Explorer - https://developers.facebook.com/tools/explorer - * Graph API - https://developers.facebook.com/docs/graph-api - * - * @param {string} requestPath Graph API endpoint you want to call - * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request. - * @param {string} httpMethod HTTP method for the request, one of "GET", "POST", or "DELETE" (default is "GET") - * @returns {Promise} Returns a Promise that resolves with the result of the request, or rejects with an error - */ - @Cordova() - api(requestPath: string, permissions: string[], httpMethod?: string): Promise { - return; - } - - /** - * Set Data Processing Options for App events. For more information see [Facebook docs](https://developers.facebook.com/docs/app-events/guides/ccpa) - * - * @param {string[]} options List of options, i.e. ["LDU"] - * @param {number} country The numeric identifier for the country - * @param {number} state The numeric identifier for the state - */ - @Cordova() - setDataProcessingOptions(options: string[], country?: number, state?: number): Promise { - return; - } - - /** - * Set user data for Advanced Matching. For more information see [Facebook docs](https://developers.facebook.com/docs/app-events/advanced-matching/) - * - * @param {Object} userData An object containing data about the user - */ - @Cordova() - setUserData(userData: Object): Promise { - return; - } - - /** - * Clear user data. For more information see [Facebook docs](https://developers.facebook.com/docs/app-events/advanced-matching/) - */ - @Cordova() - clearUserData(): Promise { - return; - } - - /** - * Log an event. For more information see the Events section above. - * - * @param {string} name Name of the event - * @param {Object} [params] An object containing extra data to log with the event - * @param {number} [valueToSum] any value to be added to added to a sum on each event - * @returns {Promise} - */ - @Cordova({ - successIndex: 3, - errorIndex: 4, - }) - logEvent(name: string, params?: Object, valueToSum?: number): Promise { - return; - } - - /** - * Enable or disable the auto log app event feature - https://developers.facebook.com/docs/app-events/gdpr-compliance/ - * - * @param {boolean} enabled value to be set - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - setAutoLogAppEventsEnabled(enabled: boolean): Promise { - return; - } - - /** - * Enable or disable collection of advertiser-id - * - * @param {boolean} enabled value to be set - */ - @Cordova() - setAdvertiserIDCollectionEnabled(enabled: boolean): Promise { - return; - } - - /** - * Enable or disable advertiser tracking (iOS Only) - * - * @param {boolean} enabled value to be set - */ - @Cordova() - setAdvertiserTrackingEnabled(enabled: boolean): Promise { - return; - } - - /** - * Log a purchase. For more information see the Events section above. - * - * @param {number} value Value of the purchase. - * @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217) - * @param {Object} params An object containing extra data to log with the event - * @returns {Promise} - */ - @Cordova() - logPurchase(value: number, currency: string, params?: Object): Promise { - return; - } - - /** - * Returns the deferred app link - * - * @returns {Promise} Returns a Promise that resolves with the deep link - */ - @Cordova() - getDeferredApplink(): Promise { - return; - } - - /** - * Manually log activation events - * - * @returns {Promise} - */ - @Cordova() - activateApp(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/fbsdk/index.ts b/src/@awesome-cordova-plugins/plugins/fbsdk/index.ts deleted file mode 100644 index 911e4977..00000000 --- a/src/@awesome-cordova-plugins/plugins/fbsdk/index.ts +++ /dev/null @@ -1,484 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface FbSdkLoginResponse { - status: string; - - authResponse: { - accessToken: string; - - data_access_expiration_time: string; - - expiresIn: number; - - userID: string; - }; -} - -/** - * @name FbSdk - * @description - * Use the Facebook SDK plugin to obtain access to the native FB application on iOS and Android. - * - * Requires Cordova plugin: `cordova-plugin-fbsdk`. For more info, please see the [Facebook SDK](https://github.com/MaximBelov/cordova-plugin-fbsdk). - * - * #### Installation - * - * To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal at [https://developers.facebook.com/apps](https://developers.facebook.com/apps). - * - * [![fb-getstarted-1](/img/docs/native/Facebook/1.png)](https://developers.facebook.com/apps/) - * - * Retrieve the `App ID` and `App Name`. - * - * [![fb-getstarted-2](/img/docs/native/Facebook/2.png)](https://developers.facebook.com/apps/) - * - * Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal. - * - * ```bash - * ionic cordova plugin add cordova-plugin-fbsdk --variable APP_ID="123456789" --variable APP_NAME="myApplication" --variable CLIENT_TOKEN="abcd1234" - * ``` - * - * After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings: - * - * [![fb-getstarted-3](/img/docs/native/Facebook/3.png)](https://developers.facebook.com/apps/) - * - * Click `'Add Platform'`. - * - * [![fb-getstarted-4](/img/docs/native/Facebook/4.png)](https://developers.facebook.com/apps/) - * - * At this point you'll need to open your project's [`config.xml`](https://cordova.apache.org/docs/en/latest/config_ref/index.html) file, found in the root directory of your project. - * - * Take note of the `id` for the next step: - * ``` - * - * ``` - * - * You can also edit the `id` to whatever you'd like it to be. - * - * #### Client Access Tokens - * - * [](https://developers.facebook.com/docs/facebook-login/guides/access-tokens#clienttokens) - * - * - * #### iOS Install - * Under 'Bundle ID', add the `id` from your `config.xml` file: - * - * [![fb-getstarted-5](/img/docs/native/Facebook/5.png)](https://developers.facebook.com/apps/) - * - * - * #### Android Install - * Under 'Google Play Package Name', add the `id` from your `config.xml` file: - * - * [![fb-getstarted-6](/img/docs/native/Facebook/6.png)](https://developers.facebook.com/apps/) - * - * - * And that's it! You can now make calls to Facebook using the plugin. - * - * ## Events - * - * App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads. - * - * - [iOS] [https://developers.facebook.com/docs/ios/app-events](https://developers.facebook.com/docs/ios/app-events) - * - [Android] [https://developers.facebook.com/docs/android/app-events](https://developers.facebook.com/docs/android/app-events) - * - [JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success - * - * Activation events are automatically tracked for you in the plugin. - * - * Events are listed on the [insights page](https://www.facebook.com/insights/). - * - * For tracking events, see `logEvent` and `logPurchase`. - * @usage - * ```typescript - * import { FbSdk, FbSdkLoginResponse } from '@awesome-cordova-plugins/fbsdk/ngx'; - * - * constructor(private fbSdk: FbSdk) { } - * - * ... - * - * this.fbSdk.login(['public_profile', 'user_friends', 'email']) - * .then((res: FbSdkLoginResponse) => console.log('Logged into Facebook!', res)) - * .catch(e => console.log('Error logging into Facebook', e)); - * - * - * this.fb.logEvent(this.fb.EVENTS.EVENT_NAME_ADDED_TO_CART); - * - * ``` - */ -@Plugin({ - pluginName: 'Facebook', - plugin: 'cordova-plugin-fbsdk', - pluginRef: 'facebookConnectPlugin', - repo: 'https://github.com/MaximBelov/cordova-plugin-fbsdk', - install: - 'ionic cordova plugin add cordova-plugin-fbsdk --variable APP_ID="123456789" --variable APP_NAME="myApplication" --variable CLIENT_TOKEN="abcd1234"', - installVariables: ['APP_ID', 'APP_NAME', 'CLIENT_TOKEN'], - platforms: ['Android', 'iOS', 'Browser'], -}) -@Injectable() -export class FbSdk extends AwesomeCordovaNativePlugin { - EVENTS = { - EVENT_NAME_ACTIVATED_APP: 'fb_mobile_activate_app', - EVENT_NAME_DEACTIVATED_APP: 'fb_mobile_deactivate_app', - EVENT_NAME_SESSION_INTERRUPTIONS: 'fb_mobile_app_interruptions', - EVENT_NAME_TIME_BETWEEN_SESSIONS: 'fb_mobile_time_between_sessions', - EVENT_NAME_COMPLETED_REGISTRATION: 'fb_mobile_complete_registration', - EVENT_NAME_VIEWED_CONTENT: 'fb_mobile_content_view', - EVENT_NAME_SEARCHED: 'fb_mobile_search', - EVENT_NAME_RATED: 'fb_mobile_rate', - EVENT_NAME_COMPLETED_TUTORIAL: 'fb_mobile_tutorial_completion', - EVENT_NAME_PUSH_TOKEN_OBTAINED: 'fb_mobile_obtain_push_token', - EVENT_NAME_ADDED_TO_CART: 'fb_mobile_add_to_cart', - EVENT_NAME_ADDED_TO_WISHLIST: 'fb_mobile_add_to_wishlist', - EVENT_NAME_INITIATED_CHECKOUT: 'fb_mobile_initiated_checkout', - EVENT_NAME_ADDED_PAYMENT_INFO: 'fb_mobile_add_payment_info', - EVENT_NAME_PURCHASED: 'fb_mobile_purchase', - EVENT_NAME_ACHIEVED_LEVEL: 'fb_mobile_level_achieved', - EVENT_NAME_UNLOCKED_ACHIEVEMENT: 'fb_mobile_achievement_unlocked', - EVENT_NAME_SPENT_CREDITS: 'fb_mobile_spent_credits', - EVENT_PARAM_CURRENCY: 'fb_currency', - EVENT_PARAM_REGISTRATION_METHOD: 'fb_registration_method', - EVENT_PARAM_CONTENT_TYPE: 'fb_content_type', - EVENT_PARAM_CONTENT_ID: 'fb_content_id', - EVENT_PARAM_SEARCH_STRING: 'fb_search_string', - EVENT_PARAM_SUCCESS: 'fb_success', - EVENT_PARAM_MAX_RATING_VALUE: 'fb_max_rating_value', - EVENT_PARAM_PAYMENT_INFO_AVAILABLE: 'fb_payment_info_available', - EVENT_PARAM_NUM_ITEMS: 'fb_num_items', - EVENT_PARAM_LEVEL: 'fb_level', - EVENT_PARAM_DESCRIPTION: 'fb_description', - EVENT_PARAM_SOURCE_APPLICATION: 'fb_mobile_launch_source', - EVENT_PARAM_VALUE_YES: '1', - EVENT_PARAM_VALUE_NO: '0', - }; - - /** - * Get the current application ID - * - * @returns {Promise} Returns a Promise that resolves with the current application ID - */ - @Cordova() - getApplicationId(): Promise { - return; - } - - /** - * Set the application ID - * - * @param {string} id application ID - */ - @Cordova() - setApplicationId(id: string): Promise { - return; - } - - /** - * Get the current application name - * - * @returns {Promise} Returns a Promise that resolves with the current application name - */ - @Cordova() - getApplicationName(): Promise { - return; - } - - /** - * Set the application name - * - * @param {string} name application name - */ - @Cordova() - setApplicationName(name: string): Promise { - return; - } - - /** - * Login to Facebook to authenticate this app. - * - * ```typescript - * { - * status: 'connected', - * authResponse: { - * accessToken: 'kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn', - * data_access_expiration_time: '1623680244', - * expiresIn: 5183979, - * userID: '634565435' - * } - * } - * - * ``` - * - * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in. - * @returns {Promise} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. - */ - @Cordova() - login(permissions: string[]): Promise { - return; - } - - /** - * Login to Facebook using Limited Login (iOS Only) - * - * ```typescript - * { - * status: 'connected', - * authResponse: { - * authenticationToken: 'kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn', - * nonce: 'foo', - * userID: '634565435' - * } - * } - * - * ``` - * - * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/limited-login/permissions) this app has upon logging in. - * @returns {Promise} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. - */ - @Cordova() - loginWithLimitedTracking(permissions: string[]): Promise { - return; - } - - /** - * Check if the user has approved all necessary permissions - * - * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) to check for - * @returns {Promise} Returns a Promise that resolves with a success string if all passed permissions are granted, or an error string if any permissions are not granted - */ - @Cordova() - checkHasCorrectPermissions(permissions: string[]): Promise { - return; - } - - /** - * Check if data access has expired for the user - * - * @returns {Promise} Returns a Promise that resolves with a success string if data access is expired, or rejects with an error - */ - @Cordova() - isDataAccessExpired(): Promise { - return; - } - - /** - * Reauthorize data access after it has expired - * - * @returns {Promise} Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails. - */ - @Cordova() - reauthorizeDataAccess(): Promise { - return; - } - - /** - * Logout of Facebook. - * - * For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout) - * - * @returns {Promise} Returns a Promise that resolves on a successful logout, and rejects if logout fails. - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user: - * - * 1) the user is logged into Facebook and has authenticated your application (connected) - * 2) the user is logged into Facebook but has not authenticated your application (not_authorized) - * 3) the user is either not logged into Facebook or explicitly logged out of your application so it doesn't attempt to connect to Facebook and thus, we don't know if they've authenticated your application or not (unknown) - * - * Resolves with a response like: - * - * ``` - * { - * authResponse: { - * userID: '12345678912345', - * accessToken: 'kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn', - * data_access_expiration_time: '1623680244', - * expiresIn: '5183738' - * }, - * status: 'connected' - * } - * ``` - * - * For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus) - * - * @returns {Promise} Returns a Promise that resolves with a status, or rejects with an error - */ - @Cordova() - getLoginStatus(): Promise { - return; - } - - /** - * Get a Facebook access token for using Facebook services. - * - * @returns {Promise} Returns a Promise that resolves with an access token, or rejects with an error - */ - @Cordova() - getAccessToken(): Promise { - return; - } - - /** - * Get profile information for the currently logged in user - * - * @returns {Promise} Returns a Promise that resolves with success data, or rejects with an error - */ - @Cordova() - getCurrentProfile(): Promise { - return; - } - - /** - * Show one of various Facebook dialogs. Example of options for a Share dialog: - * - * ``` - * { - * method: 'share', - * href: 'http://example.com' - * } - * ``` - * - * For more options see the [Cordova plugin docs](https://github.com/MaximBelov/cordova-plugin-fbsdk#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui) - * - * @param {Object} options The dialog options - * @returns {Promise} Returns a Promise that resolves with success data, or rejects with an error - */ - @Cordova() - showDialog(options: any): Promise { - return; - } - - /** - * Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login. - * - * For more information see: - * - * Calling the Graph API - https://developers.facebook.com/docs/javascript/reference/FB.api - * Graph Explorer - https://developers.facebook.com/tools/explorer - * Graph API - https://developers.facebook.com/docs/graph-api - * - * @param {string} requestPath Graph API endpoint you want to call - * @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request. - * @param {string} httpMethod HTTP method for the request, one of "GET", "POST", or "DELETE" (default is "GET") - * @returns {Promise} Returns a Promise that resolves with the result of the request, or rejects with an error - */ - @Cordova() - api(requestPath: string, permissions: string[], httpMethod?: string): Promise { - return; - } - - /** - * Set Data Processing Options for App events. For more information see [Facebook docs](https://developers.facebook.com/docs/app-events/guides/ccpa) - * - * @param {string[]} options List of options, i.e. ["LDU"] - * @param {number} country The numeric identifier for the country - * @param {number} state The numeric identifier for the state - */ - @Cordova() - setDataProcessingOptions(options: string[], country?: number, state?: number): Promise { - return; - } - - /** - * Set user data for Advanced Matching. For more information see [Facebook docs](https://developers.facebook.com/docs/app-events/advanced-matching/) - * - * @param {Object} userData An object containing data about the user - */ - @Cordova() - setUserData(userData: Object): Promise { - return; - } - - /** - * Clear user data. For more information see [Facebook docs](https://developers.facebook.com/docs/app-events/advanced-matching/) - */ - @Cordova() - clearUserData(): Promise { - return; - } - - /** - * Log an event. For more information see the Events section above. - * - * @param {string} name Name of the event - * @param {Object} [params] An object containing extra data to log with the event - * @param {number} [valueToSum] any value to be added to added to a sum on each event - * @returns {Promise} - */ - @Cordova({ - successIndex: 3, - errorIndex: 4, - }) - logEvent(name: string, params?: Object, valueToSum?: number): Promise { - return; - } - - /** - * Enable or disable the auto log app event feature - https://developers.facebook.com/docs/app-events/gdpr-compliance/ - * - * @param {boolean} enabled value to be set - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - setAutoLogAppEventsEnabled(enabled: boolean): Promise { - return; - } - - /** - * Enable or disable collection of advertiser-id - * - * @param {boolean} enabled value to be set - */ - @Cordova() - setAdvertiserIDCollectionEnabled(enabled: boolean): Promise { - return; - } - - /** - * Enable or disable advertiser tracking (iOS Only) - * - * @param {boolean} enabled value to be set - */ - @Cordova() - setAdvertiserTrackingEnabled(enabled: boolean): Promise { - return; - } - - /** - * Log a purchase. For more information see the Events section above. - * - * @param {number} value Value of the purchase. - * @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217) - * @param {Object} params An object containing extra data to log with the event - * @returns {Promise} - */ - @Cordova() - logPurchase(value: number, currency: string, params?: Object): Promise { - return; - } - - /** - * Returns the deferred app link - * - * @returns {Promise} Returns a Promise that resolves with the deep link - */ - @Cordova() - getDeferredApplink(): Promise { - return; - } - - /** - * Manually log activation events - * - * @returns {Promise} - */ - @Cordova() - activateApp(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/fcm/index.ts b/src/@awesome-cordova-plugins/plugins/fcm/index.ts deleted file mode 100644 index 50981762..00000000 --- a/src/@awesome-cordova-plugins/plugins/fcm/index.ts +++ /dev/null @@ -1,245 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; - -export interface NotificationData { - /** - * Determines whether the notification was pressed or not - */ - - wasTapped: boolean; - - /** - * Notification data hash item - */ - - [name: string]: any; -} - -export interface IRequestPushPermissionIOSOptions { - /** - * Options exclusive for iOS 9 support - */ - ios9Support?: { - /** - * How long it will wait for a decision from the user before returning `false`, defaults to 10 - */ - timeout?: number; - /** - * How long between each permission verification, defaults to 0.3 - */ - interval?: number; - }; -} - -export interface IChannelConfiguration { - /** - * Channel id, used in the android_channel_id push payload key - */ - id: string; - /** - * Channel name, visible for the user - */ - name: string; - /** - * Channel description, visible for the user - */ - description?: string; - /** - * Importance for notifications of this channel - * https://developer.android.com/guide/topics/ui/notifiers/notifications#importance - */ - importance?: 'none' | 'min' | 'low' | 'default' | 'high'; - /** - * Visibility for notifications of this channel - * https://developer.android.com/training/notify-user/build-notification#lockscreenNotification - */ - visibility?: 'public' | 'private' | 'secret'; - /** - * Default sound resource for notifications of this channel - * The file should located as resources/raw/[resource name].mp3 - */ - sound?: string; - /** - * Enable lights for notifications of this channel - */ - lights?: boolean; - /** - * Enable vibration for notifications of this channel - */ - vibration?: boolean; -} - -/** - * @name FCM - * @capacitorincompatible true - * @description - * Provides basic functionality for Firebase Cloud Messaging - * @usage - * ```typescript - * import { FCM } from '@awesome-cordova-plugins/fcm/ngx'; - * - * constructor(private fcm: FCM) {} - * - * ... - * - * this.fcm.subscribeToTopic('marketing'); - * - * this.fcm.getToken().then(token => { - * backend.registerToken(token); - * }); - * - * this.fcm.onNotification().subscribe(data => { - * if(data.wasTapped){ - * console.log("Received in background"); - * } else { - * console.log("Received in foreground"); - * }; - * }); - * - * this.fcm.onTokenRefresh().subscribe(token => { - * backend.registerToken(token); - * }); - * - * this.fcm.hasPermission().then(hasPermission => { - * if (hasPermission) { - * console.log("Has permission!"); - * } - * }) - * - * this.fcm.clearAllNotifications(); - * - * this.fcm.unsubscribeFromTopic('marketing'); - * - * ``` - * @interfaces - * NotificationData - * IRequestPushPermissionIOSOptions - * IChannelConfiguration - */ -@Plugin({ - pluginName: 'FCM', - plugin: 'cordova-plugin-fcm-with-dependecy-updated', - pluginRef: 'FCMPlugin', - repo: 'https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FCM extends AwesomeCordovaNativePlugin { - /** - * Gets ios device's current APNS token - * - * @returns {Promise} Returns a Promise that resolves with the APNS token - */ - @Cordova() - getAPNSToken(): Promise { - return; - } - - /** - * Gets device's current registration id - * - * @returns {Promise} Returns a Promise that resolves with the registration id token - */ - @Cordova() - getToken(): Promise { - return; - } - - /** - * Event firing on the token refresh - * - * @returns {Observable} Returns an Observable that notifies with the change of device's registration id - */ - @Cordova({ - observable: true, - }) - onTokenRefresh(): Observable { - return; - } - - /** - * Subscribes you to a [topic](https://firebase.google.com/docs/notifications/android/console-topics) - * - * @param {string} topic Topic to be subscribed to - * @returns {Promise} Returns a promise resolving in result of subscribing to a topic - */ - @Cordova() - subscribeToTopic(topic: string): Promise { - return; - } - - /** - * Unsubscribes you from a [topic](https://firebase.google.com/docs/notifications/android/console-topics) - * - * @param {string} topic Topic to be unsubscribed from - * @returns {Promise} Returns a promise resolving in result of unsubscribing from a topic - */ - @Cordova() - unsubscribeFromTopic(topic: string): Promise { - return; - } - - /** - * Checking for permissions on iOS. On android, it always returns `true`. - * - * @returns {Promise} Returns a Promise: - * - true: push was allowed (or platform is android) - * - false: push will not be available - * - null: still not answered, recommended checking again later. - */ - @Cordova() - hasPermission(): Promise { - return; - } - - /** - * Watch for incoming notifications - * - * @returns {Observable} returns an object with data from the notification - */ - @Cordova({ - observable: true, - successIndex: 0, - errorIndex: 2, - }) - onNotification(): Observable { - return; - } - - /** - * Removes existing push notifications from the notifications center - * - * @returns {Promise} - */ - @Cordova() - clearAllNotifications(): void { - return; - } - - /** - * Request push notification permission, alerting the user if it not have yet decided - * - * @param {IRequestPushPermissionIOSOptions} options Options for push request - * @returns {Promise} Returns a Promise that resolves with the permission status - */ - @Cordova() - requestPushPermissionIOS(options?: IRequestPushPermissionIOSOptions): Promise { - return; - } - - /** - * For Android, some notification properties are only defined programmatically. - * - * Channel can define the default behavior for notifications on Android 8.0+. - * - * Once a channel is created, it stays unchangeable until the user uninstalls the app. - * - * @param channelConfig - * @returns {Promise} - */ - @Cordova() - createNotificationChannelAndroid(channelConfig: IChannelConfiguration): void { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/ffmpeg/index.ts b/src/@awesome-cordova-plugins/plugins/ffmpeg/index.ts deleted file mode 100644 index 93af8231..00000000 --- a/src/@awesome-cordova-plugins/plugins/ffmpeg/index.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export interface VideoInformation { - format: { - bit_rate: string; - duration: string; - filename: string; - format_name: string; - nb_programs: string; - nb_streams: string; - probe_score: string; - size: string; - start_time: string; - }; - [key: string]: any; -} - -/** - * @name FFMpeg - * @description - * Simple plugin that binds mobile ffmpeg to execute ffmpeg commands - * - * @usage - * ```typescript - * import { FFMpeg } from '@awesome-cordova-plugins/ffmpeg/ngx'; - * - * - * constructor(private ffMpeg: FFMpeg) { } - * - * ... - * - * - * this.fFMpeg.exec('-i someinput.mp4 -vn -c:a copy out.mp3') - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * - * this.fFMpeg.probe('somefile.mp4"') - * .then((res: VideoInformation) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * - * ``` - */ -@Plugin({ - pluginName: 'FFMpeg', - plugin: 'cordova-plugin-ffmpeg', - pluginRef: 'ffmpeg', - repo: 'https://github.com/MaximBelov/cordova-plugin-ffmpeg', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FFMpeg extends AwesomeCordovaNativePlugin { - /** - * Execute ffmpeg command - * @param cmd {string} command - * @return {Promise} Returns a promise that resolves when execute finished - */ - @Cordova() - exec(cmd: string): Promise { - return; - } - - /** - * Extracts media information for the file specified with path - * @param filePath {string} file path - * @return {Promise} Returns a promise that resolves when media information received - */ - @Cordova() - probe(filePath: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/file-chooser/index.ts b/src/@awesome-cordova-plugins/plugins/file-chooser/index.ts deleted file mode 100644 index 84cf51b7..00000000 --- a/src/@awesome-cordova-plugins/plugins/file-chooser/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable jsdoc/require-returns-check */ -/* eslint-disable jsdoc/check-tag-names */ - -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name FileChooser Plugin - * @description - * Cordova FileChooser Plugin - * @usage - * ```typescript - * import { FileChooser } from '@awesome-cordova-plugins/file-chooser/ngx'; - * - * - * constructor(private fileChooser: FileChooser) { } - * - * ... - * - * - * this.fileChooser.open() - * .then(() => console.log('Success')) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'FileChooser', - plugin: 'cordova-plugin-filechooser', - pluginRef: 'fileChooser', - repo: 'https://github.com/ihadeed/cordova-filechooser', - platforms: ['Android'], -}) -@Injectable() -export class FileChooser extends AwesomeCordovaNativePlugin { - /** - * Launches a chooser dialog. The filter param allows filtering a the mime type - * { "mime": "application/pdf" } - * - * @param {string} [filter] Filter allowing filter by a mime type (text/plain, image/png, image/jpeg, audio/wav etc.) - * @returns {Promise} URI of the selected file - */ - @Cordova() - open(filter?: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/file-md5/index.ts b/src/@awesome-cordova-plugins/plugins/file-md5/index.ts deleted file mode 100644 index 48387071..00000000 --- a/src/@awesome-cordova-plugins/plugins/file-md5/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name File MD5 - * @description - * This plugin reads large files in chunks and build the md5sum incrementally. - * @usage - * ```typescript - * import { FileMD5 } from '@awesome-cordova-plugins/file-md5/nx'; - * - * - * constructor(private fileMD5: FileMD5) { } - * - * ... - * - * - * this.fileMD5.file(fileEntry) - * .then((md5sum: string) => console.log(md5sum)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'FileMD5', - plugin: 'cordova-plugin-file-md5', - pluginRef: 'md5chksum', - repo: 'https://github.com/mramonlopez/cordova-plugin-file-md5', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FileMD5 extends AwesomeCordovaNativePlugin { - /** - * Get MD5 checksum from a file - * - * @param fileEntry {FileEntry} File entry is a org.apache.cordova.file.FileEntry - * @returns {Promise} Promise with md5sum - */ - @Cordova() - file(fileEntry: any): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/file-opener/index.ts b/src/@awesome-cordova-plugins/plugins/file-opener/index.ts deleted file mode 100644 index 46a4f3fd..00000000 --- a/src/@awesome-cordova-plugins/plugins/file-opener/index.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name File Opener - * @description - * This plugin will open a file on your device file system with its default application. - * @usage - * ```typescript - * import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx'; - * - * constructor(private fileOpener: FileOpener) { } - * - * ... - * - * this.fileOpener.open('path/to/file.pdf', 'application/pdf') - * .then(() => console.log('File is opened')) - * .catch(e => console.log('Error opening file', e)); - * - * this.fileOpener.showOpenWithDialog('path/to/file.pdf', 'application/pdf') - * .then(() => console.log('File is opened')) - * .catch(e => console.log('Error opening file', e)); - * - * ``` - */ -@Plugin({ - pluginName: 'FileOpener', - plugin: 'cordova-plugin-file-opener2', - pluginRef: 'cordova.plugins.fileOpener2', - repo: 'https://github.com/pwlin/cordova-plugin-file-opener2', - platforms: ['Android', 'iOS', 'Windows', 'Windows Phone 8'], -}) -@Injectable() -export class FileOpener extends AwesomeCordovaNativePlugin { - /** - * Open an file - * - * @param {string} filePath File Path - * @param {string} fileMIMEType File MIME Type - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'success', - errorName: 'error', - }) - open(filePath: string, fileMIMEType: string): Promise { - return; - } - - /** - * Uninstalls a package - * - * @param {string} packageId Package ID - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'success', - errorName: 'error', - }) - uninstall(packageId: string): Promise { - return; - } - - /** - * Check if an app is already installed - * - * @param {string} packageId Package ID - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'success', - errorName: 'error', - }) - appIsInstalled(packageId: string): Promise { - return; - } - - /** - * Opens with system modal to open file with an already installed app. - * - * @param {string} filePath File Path - * @param {string} fileMIMEType File MIME Type - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'success', - errorName: 'error', - }) - showOpenWithDialog(filePath: string, fileMIMEType: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/file-path/index.ts b/src/@awesome-cordova-plugins/plugins/file-path/index.ts deleted file mode 100644 index cd6fa096..00000000 --- a/src/@awesome-cordova-plugins/plugins/file-path/index.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -declare const window: any; - -/** - * @name File Path - * @premier filesystem - * @description - * - * This plugin allows you to resolve the native filesystem path for Android content URIs and is based on code in the aFileChooser library. - * @usage - * ```typescript - * import { FilePath } from '@awesome-cordova-plugins/file-path/ngx'; - * - * constructor(private filePath: FilePath) { } - * - * ... - * - * this.filePath.resolveNativePath(path) - * .then(filePath => console.log(filePath)) - * .catch(err => console.log(err)); - * - * ``` - */ -@Plugin({ - pluginName: 'FilePath', - plugin: 'cordova-plugin-filepath', - pluginRef: 'window.FilePath', - repo: 'https://github.com/hiddentao/cordova-plugin-filepath', - platforms: ['Android'], -}) -@Injectable() -export class FilePath extends AwesomeCordovaNativePlugin { - /** - * Resolve native path for given content URL/path. - * - * @param {string} path Content URL/path. - * @returns {Promise} - */ - @Cordova() - resolveNativePath(path: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/file-transfer/index.ts b/src/@awesome-cordova-plugins/plugins/file-transfer/index.ts deleted file mode 100644 index 8b4488a8..00000000 --- a/src/@awesome-cordova-plugins/plugins/file-transfer/index.ts +++ /dev/null @@ -1,281 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - CordovaInstance, - InstanceCheck, - AwesomeCordovaNativePlugin, - Plugin, - checkAvailability, -} from '@awesome-cordova-plugins/core'; - -export interface FileUploadOptions { - /** - * The name of the form element. - * Defaults to 'file'. - */ - fileKey?: string; - - /** - * The file name to use when saving the file on the server. - * Defaults to 'image.jpg'. - */ - fileName?: string; - - /** - * The HTTP method to use - either PUT or POST. - * Defaults to POST. - */ - httpMethod?: string; - - /** - * The mime type of the data to upload. - * Defaults to image/jpeg. - */ - mimeType?: string; - - /** - * A set of optional key/value pairs to pass in the HTTP request. - */ - params?: { [s: string]: any }; - - /** - * Whether to upload the data in chunked streaming mode. - * Defaults to true. - */ - chunkedMode?: boolean; - - /** - * A map of header name/header values. Use an array to specify more - * than one value. On iOS, FireOS, and Android, if a header named - * Content-Type is present, multipart form data will NOT be used. - */ - headers?: { [s: string]: any }; -} - -export interface FileUploadResult { - /** - * The number of bytes sent to the server as part of the upload. - */ - bytesSent: number; - - /** - * The HTTP response code returned by the server. - */ - responseCode: number; - - /** - * The HTTP response returned by the server. - */ - response: string; - - /** - * The HTTP response headers by the server. - */ - headers: { [s: string]: any }; -} - -export interface FileTransferError { - /** - * One of the predefined error codes listed below. - */ - code: number; - - /** - * URL to the source. - */ - source: string; - - /** - * URL to the target. - */ - target: string; - - /** - * HTTP status code. This attribute is only available when a response - * code is received from the HTTP connection. - */ - http_status: number; - - /** - * Response body. This attribute is only available when a response is received from the HTTP connection. - */ - body: string; - - /** - * Either e.getMessage or e.toString. - */ - exception: string; -} - -/** - * @name File Transfer - * @description - * This plugin allows you to upload and download files. - * @usage - * ```typescript - * import { FileTransfer, FileUploadOptions, FileTransferObject } from '@awesome-cordova-plugins/file-transfer/ngx'; - * import { File } from '@awesome-cordova-plugins/file'; - * - * constructor(private transfer: FileTransfer, private file: File) { } - * - * ... - * - * const fileTransfer: FileTransferObject = this.transfer.create(); - * - * // Upload a file: - * fileTransfer.upload(..).then(..).catch(..); - * - * // Download a file: - * fileTransfer.download(..).then(..).catch(..); - * - * // Abort active transfer: - * fileTransfer.abort(); - * - * // full example - * upload() { - * let options: FileUploadOptions = { - * fileKey: 'file', - * fileName: 'name.jpg', - * headers: {} - * ..... - * } - * - * fileTransfer.upload('', '', options) - * .then((data) => { - * // success - * }, (err) => { - * // error - * }) - * } - * - * download() { - * const url = 'http://www.example.com/file.pdf'; - * fileTransfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => { - * console.log('download complete: ' + entry.toURL()); - * }, (error) => { - * // handle error - * }); - * } - * - * ``` - * - * To store files in a different/publicly accessible directory, please refer to the following link - * https://github.com/apache/cordova-plugin-file#where-to-store-files - * @interfaces - * FileUploadOptions - * FileUploadResult - * FileTransferError - * @classes - * FileTransferObject - */ -@Plugin({ - pluginName: 'FileTransfer', - plugin: 'cordova-plugin-file-transfer', - pluginRef: 'FileTransfer', - repo: 'https://github.com/apache/cordova-plugin-file-transfer', - platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone'], -}) -@Injectable() -export class FileTransfer extends AwesomeCordovaNativePlugin { - /** - * Error code rejected from upload with FileTransferError - * Defined in FileTransferError. - * FILE_NOT_FOUND_ERR: 1 Return when file was not found - * INVALID_URL_ERR: 2, Return when url was invalid - * CONNECTION_ERR: 3, Return on connection error - * ABORT_ERR: 4, Return on aborting - * NOT_MODIFIED_ERR: 5 Return on '304 Not Modified' HTTP response - * - * @enum {number} - */ - FileTransferErrorCode = { - FILE_NOT_FOUND_ERR: 1, - INVALID_URL_ERR: 2, - CONNECTION_ERR: 3, - ABORT_ERR: 4, - NOT_MODIFIED_ERR: 5, - }; - - /** - * Creates a new FileTransfer object - * - * @returns {FileTransferObject} - */ - create(): FileTransferObject { - return new FileTransferObject(); - } -} - -/** - * @hidden - */ -@Plugin({ - plugin: 'cordova-plugin-file-transfer', - pluginName: 'FileTransfer', -}) -export class FileTransferObject { - private _objectInstance: any; - - constructor() { - if (checkAvailability(FileTransfer.getPluginRef(), null, FileTransfer.getPluginName()) === true) { - this._objectInstance = new (FileTransfer.getPlugin())(); - } - } - - /** - * Sends a file to a server. - * - * @param {string} fileUrl Filesystem URL representing the file on the device or a data URI. For backwards compatibility, this can also be the full path of the file on the device. - * @param {string} url URL of the server to receive the file, as encoded by encodeURI(). - * @param {FileUploadOptions} [options] Optional parameters. - * @param {boolean} [trustAllHosts] Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS. - * @returns {Promise} Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError. - */ - @CordovaInstance({ - successIndex: 2, - errorIndex: 3, - }) - upload( - fileUrl: string, - url: string, - options?: FileUploadOptions, - trustAllHosts?: boolean - ): Promise { - return; - } - - /** - * Downloads a file from server. - * - * @param {string} source URL of the server to download the file, as encoded by encodeURI(). - * @param {string} target Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device. - * @param {boolean} [trustAllHosts] Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS. - * @param {object} [Optional] parameters, currently only supports headers (such as Authorization (Basic Authentication), etc). - * @returns {Promise} Returns a Promise that resolves to a FileEntry object. - */ - @CordovaInstance({ - successIndex: 2, - errorIndex: 3, - }) - download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any }): Promise { - return; - } - - /** - * Registers a listener that gets called whenever a new chunk of data is transferred. - * - * @param {Function} listener Listener that takes a progress event. - */ - @InstanceCheck({ sync: true }) - onProgress(listener: (event: ProgressEvent) => any): void { - this._objectInstance.onprogress = listener; - } - - /** - * Aborts an in-progress transfer. The onerror callback is passed a FileTransferError - * object which has an error code of FileTransferError.ABORT_ERR. - */ - @CordovaInstance({ - sync: true, - }) - abort(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/file/index.ts b/src/@awesome-cordova-plugins/plugins/file/index.ts deleted file mode 100644 index fcd08f0c..00000000 --- a/src/@awesome-cordova-plugins/plugins/file/index.ts +++ /dev/null @@ -1,1539 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - CordovaCheck, - CordovaProperty, - AwesomeCordovaNativePlugin, - Plugin, - getPromise, -} from '@awesome-cordova-plugins/core'; - -export interface IFile extends Blob { - /** - * Name of the file, without path information - */ - name: string; - /** - * Last modified date - */ - lastModified: number; - /** - * Last modified date - */ - lastModifiedDate: number; - /** - * Size in bytes - */ - size: number; - /** - * File mime type - */ - type: string; - localURL: string; - start: number; - end: number; - - /** - * Returns a "slice" of the file. Since Cordova Files don't contain the actual - * content, this really returns a File with adjusted start and end. - * Slices of slices are supported. - * - * @param start {Number} The index at which to start the slice (inclusive). - * @param end {Number} The index at which to end the slice (exclusive). - */ - slice(start: number, end: number): Blob; -} - -export interface LocalFileSystem { - /** - * Used for storage with no guarantee of persistence. - */ - TEMPORARY: number; - - /** - * Used for storage that should not be removed by the user agent without application or user permission. - */ - PERSISTENT: number; - - /** - * Requests a filesystem in which to store application data. - * - * @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or - * PERSISTENT. - * @param size This is an indicator of how much storage space, in bytes, the application expects to need. - * @param successCallback The callback that is called when the user agent provides a filesystem. - * @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is - * denied. - */ - requestFileSystem( - type: number, - size: number, - successCallback: FileSystemCallback, - errorCallback?: ErrorCallback - ): void; - - /** - * Allows the user to look up the Entry for a file or directory referred to by a local URL. - * - * @param url A URL referring to a local file in a filesystem accessable via this API. - * @param successCallback A callback that is called to report the FileEntry to which the supplied URL refers. - * @param errorCallback A callback that is called when errors happen, or when the request to obtain the Entry is - * denied. - */ - resolveLocalFileSystemURL(url: string, successCallback: FileEntryCallback, errorCallback?: ErrorCallback): void; - - /** - * see requestFileSystem. - */ - webkitRequestFileSystem( - type: number, - size: number, - successCallback: FileSystemCallback, - errorCallback?: ErrorCallback - ): void; -} - -export interface Metadata { - /** - * This is the time at which the file or directory was last modified. - * - * @readonly - */ - modificationTime: Date; - - /** - * The size of the file, in bytes. This must return 0 for directories. - * - * @readonly - */ - size: number; -} - -export interface Flags { - /** - * Used to indicate that the user wants to create a file or directory if it was not previously there. - */ - create?: boolean; - - /** - * By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the - * target path already exists. - */ - exclusive?: boolean; -} - -/** - * This export interface represents a file system. - */ -export interface FileSystem { - /** - * This is the name of the file system. The specifics of naming filesystems is unspecified, but a name must be unique - * across the list of exposed file systems. - * - * @readonly - */ - name: string; - - /** - * The root directory of the file system. - * - * @readonly - */ - root: DirectoryEntry; - - toJSON(): string; - - encodeURIPath(path: string): string; -} - -export interface Entry { - /** - * Entry is a file. - */ - isFile: boolean; - - /** - * Entry is a directory. - */ - isDirectory: boolean; - - /** - * Look up metadata about this entry. - * - * @param successCallback A callback that is called with the time of the last modification. - * @param errorCallback ErrorCallback A callback that is called when errors happen. - */ - getMetadata(successCallback: MetadataCallback, errorCallback?: ErrorCallback): void; - - /** - * Set the metadata of the entry. - * - * @param successCallback {Function} is called with a Metadata object - * @param errorCallback {Function} is called with a FileError - * @param metadataObject {Metadata} keys and values to set - */ - setMetadata(successCallback: MetadataCallback, errorCallback: ErrorCallback, metadataObject: Metadata): void; - - /** - * The name of the entry, excluding the path leading to it. - */ - name: string; - /** - * The full absolute path from the root to the entry. - */ - fullPath: string; - /** - * The file system on which the entry resides. - */ - filesystem: FileSystem; - /** - * an alternate URL which can be used by native webview controls, for example media players. - */ - nativeURL: string; - - /** - * Move an entry to a different location on the file system. It is an error to try to: - * - * - *
  • move a directory inside itself or to any child at any depth;
  • - *
  • move an entry into its parent if a name different from its current one isn't provided;
  • - *
  • move a file to a path occupied by a directory;
  • - *
  • move a directory to a path occupied by a file;
  • - *
  • move any element to a path occupied by a directory which is not empty.
  • - *
      - * - * A move of a file on top of an existing file must attempt to delete and replace that file. - * A move of a directory on top of an existing empty directory must attempt to delete and replace that directory. - */ - moveTo( - parent: DirectoryEntry, - newName?: string, - successCallback?: EntryCallback, - errorCallback?: ErrorCallback - ): void; - - /** - * Copy an entry to a different location on the file system. It is an error to try to: - * - *
        - *
      • copy a directory inside itself or to any child at any depth;
      • - *
      • copy an entry into its parent if a name different from its current one isn't provided;
      • - *
      • copy a file to a path occupied by a directory;
      • - *
      • copy a directory to a path occupied by a file;
      • - *
      • copy any element to a path occupied by a directory which is not empty.
      • - *
      • A copy of a file on top of an existing file must attempt to delete and replace that file.
      • - *
      • A copy of a directory on top of an existing empty directory must attempt to delete and replace that - * directory.
      • - *
      - * - * Directory copies are always recursive--that is, they copy all contents of the directory. - */ - copyTo( - parent: DirectoryEntry, - newName?: string, - successCallback?: EntryCallback, - errorCallback?: ErrorCallback - ): void; - - /** - * Returns a URL that can be used to identify this entry. Unlike the URN defined in [FILE-API-ED], it has no specific - * expiration; as it describes a location on disk, it should be valid at least as long as that location exists. - */ - toURL(): string; - - /** - * Return a URL that can be passed across the bridge to identify this entry. - * - * @returns string URL that can be passed across the bridge to identify this entry - */ - toInternalURL(): string; - - /** - * Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to - * attempt to delete the root directory of a filesystem. - * - * @param successCallback A callback that is called on success. - * @param errorCallback A callback that is called when errors happen. - */ - remove(successCallback: VoidCallback, errorCallback?: ErrorCallback): void; - - /** - * Look up the parent DirectoryEntry containing this Entry. If this Entry is the root of its filesystem, its parent - * is itself. - * - * @param successCallback A callback that is called to return the parent Entry. - * @param errorCallback A callback that is called when errors happen. - */ - getParent(successCallback: DirectoryEntryCallback, errorCallback?: ErrorCallback): void; -} - -/** - * This export interface represents a directory on a file system. - */ -export interface DirectoryEntry extends Entry { - /** - * Creates a new DirectoryReader to read Entries from this Directory. - */ - createReader(): DirectoryReader; - - /** - * Creates or looks up a file. - * - * @param path Either an absolute path or a relative path from this DirectoryEntry to the file to be looked up or - * created. It is an error to attempt to create a file whose immediate parent does not yet exist. - * @param options - *
        - *
      • If create and exclusive are both true, and the path already exists, getFile must fail.
      • - *
      • If create is true, the path doesn't exist, and no other error occurs, getFile must create it as a - * zero-length file and return a corresponding FileEntry.
      • - *
      • If create is not true and the path doesn't exist, getFile must fail.
      • - *
      • If create is not true and the path exists, but is a directory, getFile must fail.
      • - *
      • Otherwise, if no other error occurs, getFile must return a FileEntry corresponding to path.
      • - *
      - * @param successCallback A callback that is called to return the File selected or created. - * @param errorCallback A callback that is called when errors happen. - */ - getFile(path: string, options?: Flags, successCallback?: FileEntryCallback, errorCallback?: ErrorCallback): void; - - /** - * Creates or looks up a directory. - * - * @param path Either an absolute path or a relative path from this DirectoryEntry to the directory to be looked up - * or created. It is an error to attempt to create a directory whose immediate parent does not yet exist. - * @param options - *
        - *
      • If create and exclusive are both true and the path already exists, getDirectory must fail.
      • - *
      • If create is true, the path doesn't exist, and no other error occurs, getDirectory must create and return - * a corresponding DirectoryEntry.
      • - *
      • If create is not true and the path doesn't exist, getDirectory must fail.
      • - *
      • If create is not true and the path exists, but is a file, getDirectory must fail.
      • - *
      • Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry corresponding to path.
      • - *
      - * @param successCallback A callback that is called to return the DirectoryEntry selected or created. - * @param errorCallback A callback that is called when errors happen. - */ - getDirectory( - path: string, - options?: Flags, - successCallback?: DirectoryEntryCallback, - errorCallback?: ErrorCallback - ): void; - - /** - * Deletes a directory and all of its contents, if any. In the event of an error [e.g. trying to delete a directory - * that contains a file that cannot be removed], some of the contents of the directory may be deleted. It is an error - * to attempt to delete the root directory of a filesystem. - * - * @param successCallback A callback that is called on success. - * @param errorCallback A callback that is called when errors happen. - */ - removeRecursively(successCallback: VoidCallback, errorCallback?: ErrorCallback): void; -} - -/** - * This export interface lets a user list files and directories in a directory. If there are no additions to or - * deletions from a directory between the first and last call to readEntries, and no errors occur, then: - *
        - *
      • A series of calls to readEntries must return each entry in the directory exactly once.
      • - *
      • Once all entries have been returned, the next call to readEntries must produce an empty array.
      • - *
      • If not all entries have been returned, the array produced by readEntries must not be empty.
      • - *
      • The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].
      • - *
      - */ -export interface DirectoryReader { - localURL: string; - hasReadEntries: boolean; - - /** - * Read the next block of entries from this directory. - * - * @param successCallback Called once per successful call to readEntries to deliver the next previously-unreported - * set of Entries in the associated Directory. If all Entries have already been returned from previous invocations - * of readEntries, successCallback must be called with a zero-length array as an argument. - * @param errorCallback A callback indicating that there was an error reading from the Directory. - */ - readEntries(successCallback: EntriesCallback, errorCallback?: ErrorCallback): void; -} - -/** - * This export interface represents a file on a file system. - */ -export interface FileEntry extends Entry { - /** - * Creates a new FileWriter associated with the file that this FileEntry represents. - * - * @param successCallback A callback that is called with the new FileWriter. - * @param errorCallback A callback that is called when errors happen. - */ - createWriter(successCallback: FileWriterCallback, errorCallback?: ErrorCallback): void; - - /** - * Returns a File that represents the current state of the file that this FileEntry represents. - * - * @param successCallback A callback that is called with the File. - * @param errorCallback A callback that is called when errors happen. - */ - file(successCallback: FileCallback, errorCallback?: ErrorCallback): void; -} - -/** - * When requestFileSystem() succeeds, the following callback is made. - */ -export type FileSystemCallback = (filesystem: FileSystem) => void; - -/** - * This export interface is the callback used to look up Entry objects. - */ -export type EntryCallback = (entry: Entry) => void; - -/** - * This export interface is the callback used to look up FileEntry objects. - */ -export type FileEntryCallback = (entry: FileEntry) => void; - -/** - * This export interface is the callback used to look up DirectoryEntry objects. - */ -export type DirectoryEntryCallback = (entry: DirectoryEntry) => void; - -/** - * When readEntries() succeeds, the following callback is made. - */ -export type EntriesCallback = (entries: Entry[]) => void; - -/** - * This export interface is the callback used to look up file and directory metadata. - */ -export type MetadataCallback = (metadata: Metadata) => void; - -/** - * This export interface is the callback used to create a FileWriter. - */ -export type FileWriterCallback = (fileWriter: FileWriter) => void; - -/** - * This export interface is the callback used to obtain a File. - */ -export type FileCallback = (file: IFile) => void; - -/** - * This export interface is the generic callback used to indicate success of an asynchronous method. - */ -export type VoidCallback = () => void; - -/** - * When an error occurs, the following callback is made. - */ -export type ErrorCallback = (err: FileError) => void; - -export interface RemoveResult { - success: boolean; - fileRemoved: Entry; -} - -/** @hidden */ -export declare class FileSaver extends EventTarget { - /** - * When the FileSaver constructor is called, the user agent must return a new FileSaver object with readyState set to - * INIT. This constructor must be visible when the script's global object is either a Window object or an object - * implementing the WorkerUtils interface. - */ - constructor(data: Blob); - - /** - * When the abort method is called, user agents must run the steps below: - *
        - *
      1. If readyState == DONE or readyState == INIT, terminate this overall series of steps without doing anything - * else.
      2. - *
      3. Set readyState to DONE.
      4. - *
      5. If there are any tasks from the object's FileSaver task source in one of the task queues, then remove those - * tasks.
      6. - *
      7. Terminate the write algorithm being processed.
      8. - *
      9. Set the error attribute to a DOMError object of type "AbortError".
      10. - *
      11. Fire a progress event called abort
      12. - *
      13. Fire a progress event called write end
      14. - *
      15. Terminate this algorithm.
      16. - *
      - */ - abort(): void; - - /** - * The blob is being written. - * - * @readonly - */ - INIT: number; - /** - * The object has been constructed, but there is no pending write. - * - * @readonly - */ - WRITING: number; - /** - * The entire Blob has been written to the file, an error occurred during the write, or the write was aborted using - * abort(). The FileSaver is no longer writing the blob. - * - * @readonly - */ - DONE: number; - /** - * The FileSaver object can be in one of 3 states. The readyState attribute, on getting, must return the current - * state, which must be one of the following values: - *
        - *
      • INIT
      • - *
      • WRITING
      • - *
      • DONE
      • - *
          - * - * @readonly - */ - readyState: number; - /** - * The last error that occurred on the FileSaver. - * - * @readonly - */ - error: Error; - /** - * Handler for write start events - */ - onwritestart: (event: ProgressEvent) => void; - /** - * Handler for progress events. - */ - onprogress: (event: ProgressEvent) => void; - /** - * Handler for write events. - */ - onwrite: (event: ProgressEvent) => void; - /** - * Handler for abort events. - */ - onabort: (event: ProgressEvent) => void; - /** - * Handler for error events. - */ - onerror: (event: ProgressEvent) => void; - /** - * Handler for write end events. - */ - onwriteend: (event: ProgressEvent) => void; -} - -/** - * @hidden - * This interface expands on the FileSaver interface to allow for multiple write actions, rather than just saving a - * single Blob. - */ -export declare class FileWriter extends FileSaver { - /** - * The byte offset at which the next write to the file will occur. This must be no greater than length. - * A newly-created FileWriter must have position set to 0. - */ - position: number; - - /** - * The length of the file. If the user does not have read access to the file, this must be the highest byte offset at - * which the user has written. - */ - length: number; - - /** - * Write the supplied data to the file at position. - * - * @param data The blob to write. - */ - write(data: ArrayBuffer | Blob | string): void; - - /** - * Seek sets the file position at which the next write will occur. - * - * @param offset If nonnegative, an absolute byte offset into the file. If negative, an offset back from the end of - * the file. - */ - seek(offset: number): void; - - /** - * Changes the length of the file to that specified. If shortening the file, data beyond the new length must be - * discarded. If extending the file, the existing data must be zero-padded up to the new length. - * - * @param size The size to which the length of the file is to be adjusted, measured in bytes. - */ - truncate(size: number): void; -} - -export interface IWriteOptions { - replace?: boolean; - append?: boolean; - truncate?: number; // if present, number of bytes to truncate file to before writing -} - -/** @hidden */ -export declare class FileError { - static NOT_FOUND_ERR: number; - static SECURITY_ERR: number; - static ABORT_ERR: number; - static NOT_READABLE_ERR: number; - static ENCODING_ERR: number; - static NO_MODIFICATION_ALLOWED_ERR: number; - static INVALID_STATE_ERR: number; - static SYNTAX_ERR: number; - static INVALID_MODIFICATION_ERR: number; - static QUOTA_EXCEEDED_ERR: number; - static TYPE_MISMATCH_ERR: number; - static PATH_EXISTS_ERR: number; - /** Error code */ - code: number; - message: string; - - constructor(code: number); -} - -/** @hidden */ -export declare class FileReader { - static EMPTY: number; - static LOADING: number; - static DONE: number; - static READ_CHUNK_SIZE: number; - - readyState: number; // see constants in var declaration below - error: Error; - result: string | ArrayBuffer; // type depends on readAsXXX() call type - - onloadstart: (evt: ProgressEvent) => void; - onprogress: (evt: ProgressEvent) => void; - onload: (evt: ProgressEvent) => void; - onerror: (evt: ProgressEvent) => void; - onloadend: (evt: ProgressEvent) => void; - onabort: (evt: ProgressEvent) => void; - - abort(): void; - - readAsText(fe: IFile, encoding?: string): void; - - readAsDataURL(fe: IFile): void; - - readAsBinaryString(fe: IFile): void; - - readAsArrayBuffer(fe: IFile): void; - - /** - * @hidden - */ - [key: string]: any; -} - -type Window = LocalFileSystem; - -declare const window: Window; - -/** - * @name File - * @premier filesystem - * @description - * This plugin implements a File API allowing read/write access to files residing on the device. - * - * The File class implements static convenience functions to access files and directories. - * - * Example: - * ``` - * import { File } from '@awesome-cordova-plugins/file/ngx'; - * - * constructor(private file: File) { } - * - * ... - * - * this.file.checkDir(this.file.dataDirectory, 'mydir').then(_ => console.log('Directory exists')).catch(err => - * console.log('Directory doesn't exist')); - * - * ``` - * - * This plugin is based on several specs, including : The HTML5 File API http: //www.w3.org/TR/FileAPI/ - * The (now-defunct) Directories and System extensions Latest: http: //www.w3.org/TR/2012/WD-file-system-api-20120417/ - * Although most of the plugin code was written when an earlier spec was current: http: - * //www.w3.org/TR/2011/WD-file-system-api-20110419/ It also implements the FileWriter spec : http: - * //dev.w3.org/2009/dap/file-system/file-writer.html - * @interfaces - * IFile - * Entry - * DirectoryEntry - * DirectoryReader - * FileSystem - */ -@Plugin({ - pluginName: 'File', - plugin: 'cordova-plugin-file', - pluginRef: 'cordova.file', - repo: 'https://github.com/apache/cordova-plugin-file', - platforms: ['Android', 'Browser', 'iOS', 'macOS', 'Windows'], -}) -@Injectable() -export class File extends AwesomeCordovaNativePlugin { - /** - * Read-only directory where the application is installed. - */ - @CordovaProperty() applicationDirectory: string; - - /** - * Read-only directory where the application is installed. - */ - @CordovaProperty() applicationStorageDirectory: string; - - /** - * Where to put app-specific data files. - */ - @CordovaProperty() dataDirectory: string; - - /** - * Cached files that should survive app restarts. - * Apps should not rely on the OS to delete files in here. - */ - @CordovaProperty() cacheDirectory: string; - - /** - * Android: the application space on external storage. - */ - @CordovaProperty() externalApplicationStorageDirectory: string; - - /** - * Android: Where to put app-specific data files on external storage. - */ - @CordovaProperty() externalDataDirectory: string; - - /** - * Android: the application cache on external storage. - */ - @CordovaProperty() externalCacheDirectory: string; - - /** - * Android: the external storage (SD card) root. - */ - @CordovaProperty() externalRootDirectory: string; - - /** - * iOS: Temp directory that the OS can clear at will. - */ - @CordovaProperty() tempDirectory: string; - - /** - * iOS: Holds app-specific files that should be synced (e.g. to iCloud). - */ - @CordovaProperty() syncedDataDirectory: string; - - /** - * iOS: Files private to the app, but that are meaningful to other applications (e.g. Office files) - */ - @CordovaProperty() documentsDirectory: string; - - /** - * BlackBerry10: Files globally available to all apps - */ - @CordovaProperty() sharedDirectory: string; - - cordovaFileError: any = { - 1: 'NOT_FOUND_ERR', - 2: 'SECURITY_ERR', - 3: 'ABORT_ERR', - 4: 'NOT_READABLE_ERR', - 5: 'ENCODING_ERR', - 6: 'NO_MODIFICATION_ALLOWED_ERR', - 7: 'INVALID_STATE_ERR', - 8: 'SYNTAX_ERR', - 9: 'INVALID_MODIFICATION_ERR', - 10: 'QUOTA_EXCEEDED_ERR', - 11: 'TYPE_MISMATCH_ERR', - 12: 'PATH_EXISTS_ERR', - 13: 'WRONG_ENTRY_TYPE', - 14: 'DIR_READ_ERR', - }; - - /** - * Get free disk space in Bytes - * - * @returns {Promise} Returns a promise that resolves with the remaining free disk space in Bytes - */ - @CordovaCheck() - getFreeDiskSpace(): Promise { - return getPromise((resolve, reject) => { - cordova.exec(resolve as (data: any) => any, reject as (data: any) => any, 'File', 'getFreeDiskSpace', []); - }); - } - - /** - * Check if a directory exists in a certain path, directory. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} dir Name of directory to check - * @returns {Promise} Returns a Promise that resolves to true if the directory exists or rejects with an - * error. - */ - @CordovaCheck() - checkDir(path: string, dir: string): Promise { - if (/^\//.test(dir)) { - const err = new FileError(5); - err.message = 'directory cannot start with /'; - return Promise.reject(err); - } - - const fullPath = path + dir; - return this.resolveDirectoryUrl(fullPath).then(() => { - return true; - }); - } - - /** - * Creates a new directory in the specific path. - * The replace boolean value determines whether to replace an existing directory with the same name. - * If an existing directory exists and the replace value is false, the promise will fail and return an error. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} dirName Name of directory to create - * @param {boolean} replace If true, replaces file with same name. If false returns error - * @returns {Promise} Returns a Promise that resolves with a DirectoryEntry or rejects with an error. - */ - @CordovaCheck() - createDir(path: string, dirName: string, replace: boolean): Promise { - if (/^\//.test(dirName)) { - const err = new FileError(5); - err.message = 'directory cannot start with /'; - return Promise.reject(err); - } - - const options: Flags = { - create: true, - }; - - if (!replace) { - options.exclusive = true; - } - - return this.resolveDirectoryUrl(path).then((fse) => { - return this.getDirectory(fse, dirName, options); - }); - } - - /** - * Remove a directory at a given path. - * - * @param {string} path The path to the directory - * @param {string} dirName The directory name - * @returns {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. - */ - @CordovaCheck() - removeDir(path: string, dirName: string): Promise { - if (/^\//.test(dirName)) { - const err = new FileError(5); - err.message = 'directory cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getDirectory(fse, dirName, { create: false }); - }) - .then((de) => { - return this.remove(de); - }); - } - - /** - * Move a directory to a given path. - * - * @param {string} path The source path to the directory - * @param {string} dirName The source directory name - * @param {string} newPath The destination path to the directory - * @param {string} newDirName The destination directory name - * @returns {Promise} Returns a Promise that resolves to the new DirectoryEntry object or - * rejects with an error. - */ - @CordovaCheck() - moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { - newDirName = newDirName || dirName; - - if (/^\//.test(newDirName)) { - const err = new FileError(5); - err.message = 'directory cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getDirectory(fse, dirName, { create: false }); - }) - .then((srcde) => { - return this.resolveDirectoryUrl(newPath).then((destenation) => { - return this.move(srcde, destenation, newDirName); - }); - }); - } - - /** - * Copy a directory in various methods. If destination directory exists, will fail to copy. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above - * @param {string} dirName Name of directory to copy - * @param {string} newPath Base FileSystem of new location - * @param {string} newDirName New name of directory to copy to (leave blank to remain the same) - * @returns {Promise} Returns a Promise that resolves to the new Entry object or rejects with an error. - */ - @CordovaCheck() - copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { - if (/^\//.test(newDirName)) { - const err = new FileError(5); - err.message = 'directory cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getDirectory(fse, dirName, { create: false }); - }) - .then((srcde) => { - return this.resolveDirectoryUrl(newPath).then((deste) => { - return this.copy(srcde, deste, newDirName); - }); - }); - } - - /** - * List files and directory from a given path. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above - * @param {string} dirName Name of directory - * @returns {Promise} Returns a Promise that resolves to an array of Entry objects or rejects with an error. - */ - @CordovaCheck() - listDir(path: string, dirName: string): Promise { - if (/^\//.test(dirName)) { - const err = new FileError(5); - err.message = 'directory cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getDirectory(fse, dirName, { - create: false, - exclusive: false, - }); - }) - .then((de) => { - const reader = de.createReader(); - return this.readEntries(reader); - }); - } - - /** - * Removes all files and the directory from a desired location. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} dirName Name of directory - * @returns {Promise} Returns a Promise that resolves with a RemoveResult or rejects with an error. - */ - @CordovaCheck() - removeRecursively(path: string, dirName: string): Promise { - if (/^\//.test(dirName)) { - const err = new FileError(5); - err.message = 'directory cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getDirectory(fse, dirName, { create: false }); - }) - .then((de) => { - return this.rimraf(de); - }); - } - - /** - * Check if a file exists in a certain path, directory. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} file Name of file to check - * @returns {Promise} Returns a Promise that resolves with a boolean or rejects with an error. - */ - @CordovaCheck() - checkFile(path: string, file: string): Promise { - if (/^\//.test(file)) { - const err = new FileError(5); - err.message = 'file cannot start with /'; - return Promise.reject(err); - } - - return this.resolveLocalFilesystemUrl(path + file).then((fse) => { - if (fse.isFile) { - return true; - } else { - const err = new FileError(13); - err.message = 'input is not a file'; - return Promise.reject(err); - } - }); - } - - /** - * Creates a new file in the specific path. - * The replace boolean value determines whether to replace an existing file with the same name. - * If an existing file exists and the replace value is false, the promise will fail and return an error. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} fileName Name of file to create - * @param {boolean} replace If true, replaces file with same name. If false returns error - * @returns {Promise} Returns a Promise that resolves to a FileEntry or rejects with an error. - */ - @CordovaCheck() - createFile(path: string, fileName: string, replace: boolean): Promise { - if (/^\//.test(fileName)) { - const err = new FileError(5); - err.message = 'file-name cannot start with /'; - return Promise.reject(err); - } - - const options: Flags = { - create: true, - }; - - if (!replace) { - options.exclusive = true; - } - - return this.resolveDirectoryUrl(path).then((fse) => { - return this.getFile(fse, fileName, options); - }); - } - - /** - * Removes a file from a desired location. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} fileName Name of file to remove - * @returns {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. - */ - @CordovaCheck() - removeFile(path: string, fileName: string): Promise { - if (/^\//.test(fileName)) { - const err = new FileError(5); - err.message = 'file-name cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getFile(fse, fileName, { create: false }); - }) - .then((fe) => { - return this.remove(fe); - }); - } - - /** - * Write a new file to the desired location. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} fileName path relative to base path - * @param {string | Blob | ArrayBuffer} text content, blob or ArrayBuffer to write - * @param {IWriteOptions} whether to replace/append to an existing file. See IWriteOptions for more information. - * @param options - * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. - */ - @CordovaCheck() - writeFile( - path: string, - fileName: string, - text: string | Blob | ArrayBuffer, - options: IWriteOptions = {} - ): Promise { - if (/^\//.test(fileName)) { - const err = new FileError(5); - err.message = 'file-name cannot start with /'; - return Promise.reject(err); - } - - const getFileOpts: Flags = { - create: !options.append, - exclusive: !options.replace, - }; - - return this.resolveDirectoryUrl(path) - .then((directoryEntry: DirectoryEntry) => { - return this.getFile(directoryEntry, fileName, getFileOpts); - }) - .then((fileEntry: FileEntry) => { - return this.writeFileEntry(fileEntry, text, options); - }); - } - - /** - * Write content to FileEntry. - * - * @hidden - * Write to an existing file. - * @param {FileEntry} fe file entry object - * @param {string | Blob | ArrayBuffer} text text content or blob to write - * @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information. - * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. - */ - private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: IWriteOptions) { - return this.createWriter(fe) - .then((writer) => { - if (options.append) { - writer.seek(writer.length); - } - - if (options.truncate) { - writer.truncate(options.truncate); - } - - return this.write(writer, text); - }) - .then(() => fe); - } - - /** - * Write to an existing file. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} fileName path relative to base path - * @param {string | Blob} text content or blob to write - * @returns {Promise} Returns a Promise that resolves or rejects with an error. - */ - @CordovaCheck() - writeExistingFile(path: string, fileName: string, text: string | Blob): Promise { - return this.writeFile(path, fileName, text, { replace: true }); - } - - /** - * Read the contents of a file as text. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} file Name of file, relative to path. - * @returns {Promise} Returns a Promise that resolves with the contents of the file as string or rejects with - * an error. - */ - @CordovaCheck() - readAsText(path: string, file: string): Promise { - return this.readFile(path, file, 'Text'); - } - - /** - * Read file and return data as a base64 encoded data url. - * A data url is of the form: - * data: [][;base64], - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} file Name of file, relative to path. - * @returns {Promise} Returns a Promise that resolves with the contents of the file as data URL or rejects - * with an error. - */ - @CordovaCheck() - readAsDataURL(path: string, file: string): Promise { - return this.readFile(path, file, 'DataURL'); - } - - /** - * Read file and return data as a binary data. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} file Name of file, relative to path. - * @returns {Promise} Returns a Promise that resolves with the contents of the file as string rejects with an - * error. - */ - @CordovaCheck() - readAsBinaryString(path: string, file: string): Promise { - return this.readFile(path, file, 'BinaryString'); - } - - /** - * Read file and return data as an ArrayBuffer. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} file Name of file, relative to path. - * @returns {Promise} Returns a Promise that resolves with the contents of the file as ArrayBuffer or - * rejects with an error. - */ - @CordovaCheck() - readAsArrayBuffer(path: string, file: string): Promise { - return this.readFile(path, file, 'ArrayBuffer'); - } - - /** - * Move a file to a given path. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} fileName Name of file to move - * @param {string} newPath Base FileSystem of new location - * @param {string} newFileName New name of file to move to (leave blank to remain the same) - * @returns {Promise} Returns a Promise that resolves to the new Entry or rejects with an error. - */ - @CordovaCheck() - moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { - newFileName = newFileName || fileName; - - if (/^\//.test(newFileName)) { - const err = new FileError(5); - err.message = 'file name cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getFile(fse, fileName, { create: false }); - }) - .then((srcfe) => { - return this.resolveDirectoryUrl(newPath).then((deste) => { - return this.move(srcfe, deste, newFileName); - }); - }); - } - - /** - * Copy a file in various methods. If file exists, will fail to copy. - * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystem above - * @param {string} fileName Name of file to copy - * @param {string} newPath Base FileSystem of new location - * @param {string} newFileName New name of file to copy to (leave blank to remain the same) - * @returns {Promise} Returns a Promise that resolves to an Entry or rejects with an error. - */ - @CordovaCheck() - copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { - newFileName = newFileName || fileName; - - if (/^\//.test(newFileName)) { - const err = new FileError(5); - err.message = 'file name cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((fse) => { - return this.getFile(fse, fileName, { create: false }); - }) - .then((srcfe) => { - return this.resolveDirectoryUrl(newPath).then((deste) => { - return this.copy(srcfe, deste, newFileName); - }); - }); - } - - /** - * @param err - * @hidden - */ - private fillErrorMessage(err: FileError): void { - try { - err.message = this.cordovaFileError[err.code]; - } catch (e) {} - } - - /** - * Resolves a local file system URL - * - * @param fileUrl {string} file system url - * @returns {Promise} - */ - @CordovaCheck() - resolveLocalFilesystemUrl(fileUrl: string): Promise { - return getPromise((resolve, reject) => { - try { - window.resolveLocalFileSystemURL( - fileUrl, - (entry: Entry) => { - resolve(entry); - }, - (err) => { - this.fillErrorMessage(err); - reject(err); - } - ); - } catch (xc) { - this.fillErrorMessage(xc); - reject(xc); - } - }); - } - - /** - * Resolves a local directory url - * - * @param directoryUrl {string} directory system url - * @returns {Promise} - */ - @CordovaCheck() - resolveDirectoryUrl(directoryUrl: string): Promise { - return this.resolveLocalFilesystemUrl(directoryUrl).then((de) => { - if (de.isDirectory) { - return de as DirectoryEntry; - } else { - const err = new FileError(13); - err.message = 'input is not a directory'; - return Promise.reject(err); - } - }); - } - - /** - * Get a directory - * - * @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method - * @param directoryName {string} Directory name - * @param flags {Flags} Options - * @returns {Promise} - */ - @CordovaCheck() - getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise { - return new Promise((resolve, reject) => { - try { - directoryEntry.getDirectory( - directoryName, - flags, - (de) => { - resolve(de); - }, - (err) => { - this.fillErrorMessage(err); - reject(err); - } - ); - } catch (xc) { - this.fillErrorMessage(xc); - reject(xc); - } - }); - } - - /** - * Get a file - * - * @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method - * @param fileName {string} File name - * @param flags {Flags} Options - * @returns {Promise} - */ - @CordovaCheck() - getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise { - return new Promise((resolve, reject) => { - try { - directoryEntry.getFile(fileName, flags, resolve, (err) => { - this.fillErrorMessage(err); - reject(err); - }); - } catch (xc) { - this.fillErrorMessage(xc); - reject(xc); - } - }); - } - - private readFile( - path: string, - file: string, - readAs: 'ArrayBuffer' | 'BinaryString' | 'DataURL' | 'Text' - ): Promise { - if (/^\//.test(file)) { - const err = new FileError(5); - err.message = 'file-name cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((directoryEntry: DirectoryEntry) => { - return this.getFile(directoryEntry, file, { create: false }); - }) - .then((fileEntry: FileEntry) => { - const reader = new FileReader(); - return getPromise((resolve, reject) => { - reader.onloadend = () => { - if (reader.result !== undefined || reader.result !== null) { - resolve(reader.result as any as T); - } else if (reader.error !== undefined || reader.error !== null) { - reject(reader.error); - } else { - reject({ code: null, message: 'READER_ONLOADEND_ERR' }); - } - }; - - fileEntry.file( - (file) => { - reader[`readAs${readAs}`].call(reader, file); - }, - (error) => { - reject(error); - } - ); - }); - }); - } - - /** - * @param fe - * @hidden - */ - private remove(fe: Entry): Promise { - return new Promise((resolve, reject) => { - fe.remove( - () => { - resolve({ success: true, fileRemoved: fe }); - }, - (err) => { - this.fillErrorMessage(err); - reject(err); - } - ); - }); - } - - /** - * @param srce - * @param destdir - * @param newName - * @hidden - */ - private move(srce: Entry, destdir: DirectoryEntry, newName: string): Promise { - return new Promise((resolve, reject) => { - srce.moveTo( - destdir, - newName, - (deste) => { - resolve(deste); - }, - (err) => { - this.fillErrorMessage(err); - reject(err); - } - ); - }); - } - - /** - * @param srce - * @param destdir - * @param newName - * @hidden - */ - private copy(srce: Entry, destdir: DirectoryEntry, newName: string): Promise { - return new Promise((resolve, reject) => { - srce.copyTo( - destdir, - newName, - (deste) => { - resolve(deste); - }, - (err) => { - this.fillErrorMessage(err); - reject(err); - } - ); - }); - } - - /** - * @param dr - * @hidden - */ - private readEntries(dr: DirectoryReader): Promise { - return new Promise((resolve, reject) => { - dr.readEntries( - (entries) => { - resolve(entries); - }, - (err) => { - this.fillErrorMessage(err); - reject(err); - } - ); - }); - } - - /** - * @param de - * @hidden - */ - private rimraf(de: DirectoryEntry): Promise { - return new Promise((resolve, reject) => { - de.removeRecursively( - () => { - resolve({ success: true, fileRemoved: de }); - }, - (err) => { - this.fillErrorMessage(err); - reject(err); - } - ); - }); - } - - /** - * @param fe - * @hidden - */ - private createWriter(fe: FileEntry): Promise { - return new Promise((resolve, reject) => { - fe.createWriter( - (writer) => { - resolve(writer); - }, - (err) => { - this.fillErrorMessage(err); - reject(err); - } - ); - }); - } - - /** - * @param writer - * @param gu - * @hidden - */ - private write(writer: FileWriter, gu: string | Blob | ArrayBuffer): Promise { - if (gu instanceof Blob) { - return this.writeFileInChunks(writer, gu); - } - - return new Promise((resolve, reject) => { - writer.onwriteend = (evt) => { - if (writer.error) { - reject(writer.error); - } else { - resolve(evt); - } - }; - writer.write(gu); - }); - } - - /** - * @param writer - * @param file - * @hidden - */ - private writeFileInChunks(writer: FileWriter, file: Blob) { - const BLOCK_SIZE = 1024 * 1024; - let writtenSize = 0; - - /** - * - */ - function writeNextChunk() { - const size = Math.min(BLOCK_SIZE, file.size - writtenSize); - const chunk = file.slice(writtenSize, writtenSize + size); - - writtenSize += size; - writer.write(chunk); - } - - return getPromise((resolve, reject) => { - writer.onerror = reject as (event: ProgressEvent) => void; - writer.onwrite = () => { - if (writtenSize < file.size) { - writeNextChunk(); - } else { - resolve(); - } - }; - writeNextChunk(); - }); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/fingerprint-aio/index.ts b/src/@awesome-cordova-plugins/plugins/fingerprint-aio/index.ts deleted file mode 100644 index c7859810..00000000 --- a/src/@awesome-cordova-plugins/plugins/fingerprint-aio/index.ts +++ /dev/null @@ -1,266 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -// Biometric type -export type BIOMETRIC_TYPE = 'finger' | 'face' | 'biometric'; - -export enum BIOMETRIC_ERRORS { - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_UNKNOWN_ERROR = -100, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_UNAVAILABLE = -101, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_AUTHENTICATION_FAILED = -102, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_SDK_NOT_SUPPORTED = -103, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_HARDWARE_NOT_SUPPORTED = -104, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_PERMISSION_NOT_GRANTED = -105, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_NOT_ENROLLED = -106, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_INTERNAL_PLUGIN_ERROR = -107, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_DISMISSED = -108, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_PIN_OR_PATTERN_DISMISSED = -109, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_SCREEN_GUARD_UNSECURED = -110, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_LOCKED_OUT = -111, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_LOCKED_OUT_PERMANENT = -112, - /** - * Convenience constant - * - * @type {number} - */ - BIOMETRIC_SECRET_NOT_FOUND = -113 -} - -export interface FingerprintOptions { - /** - * Title in biometric prompt (android only) - * - * @default {APP_NAME} Biometric Sign On - */ - title?: string; - - /** - * Subtitle in biometric Prompt (android only) - * - * @default null - */ - subtitle?: string; - - /** - * Description in biometric Prompt - * - * @default null - */ - description?: string; - - /** - * Title of fallback button. - * - * @default "Use Pin" - */ - fallbackButtonTitle?: string; - - /** - * Title for cancel button on Android - * - * @default "Cancel" - */ - cancelButtonTitle?: string; - - /** - * Disable 'use backup' option. - * - * @default false - */ - disableBackup?: boolean; - - /** - * (Android): If false user confirmation is NOT required after a biometric has been authenticated. - * - * @default true. - * See https://developer.android.com/training/sign-in/biometric-auth#no-explicit-user-action - */ - confirmationRequired?: boolean; -} - -export interface FingerprintSecretOptions extends FingerprintOptions { - /** - * String secret to encrypt and save, use simple strings matching the regex [a-zA-Z0-9\-]+ - */ - secret: string; - - /** - * If `true` secret will be deleted when biometry items are deleted or enrolled - * - * @default false - */ - invalidateOnEnrollment?: boolean; -} - -/** - * @name Fingerprint AIO - * @description - * Use simple fingerprint authentication on Android and iOS. - * Requires Cordova plugin: cordova-plugin-fingerprint-aio. For more info about plugin, vist: https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio - * @usage - * ```typescript - * import { FingerprintAIO } from '@awesome-cordova-plugins/fingerprint-aio/ngx'; - * - * constructor(private faio: FingerprintAIO) { } - * - * ... - * - * this.faio.show().then((result: any) => console.log(result)).catch((error: any) => console.log(error)); - * - * OR with options... - * - * this.faio.show({ - * title: 'Biometric Authentication', // (Android Only) | optional | Default: " Biometric Sign On" - * subtitle: 'Coolest Plugin ever' // (Android Only) | optional | Default: null - * description: 'Please authenticate' // optional | Default: null - * fallbackButtonTitle: 'Use Backup', // optional | When disableBackup is false defaults to "Use Pin". - * // When disableBackup is true defaults to "Cancel" - * disableBackup:true, // optional | default: false - * }) - * .then((result: any) => console.log(result)) - * .catch((error: any) => console.log(error)); - * - * ... - * - * this.faio.registerBiometricSecret({ - * description: "Some biometric description", // optional | Default: null - * secret: "my-super-secret", // mandatory - * invalidateOnEnrollment: true, // optional | Default: false - * disableBackup: true, // (Android Only) | optional | always `true` on Android - * }) - * .then((result: any) => console.log(result)) - * .catch((error: any) => console.log(error)); - * - * ... - * - * this.faio.loadBiometricSecret({ - * description: "Some biometric description", // optional | Default: null - * disableBackup: true, // always disabled on Android - * }) - * .then((result: string) => console.log(result)) - * .catch((error: any) => console.log(error)); - * - * ``` - * @interfaces - * FingerprintOptions - * FingerprintSecretOptions - */ -@Plugin({ - pluginName: 'FingerprintAIO', - plugin: 'cordova-plugin-fingerprint-aio', - pluginRef: 'Fingerprint', - repo: 'https://github.com/NiklasMerz/cordova-plugin-fingerprint-aio', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FingerprintAIO extends AwesomeCordovaNativePlugin { - - /** - * Check if fingerprint authentication is available - * - * @returns {Promise} Returns a promise with result which depends on device and os. - * iPhone X will return 'face' other Android or iOS devices will return 'finger' Android P+ will return 'biometric' - */ - @Cordova() - isAvailable(): Promise { - return; - } - - /** - * Show authentication dialogue and register secret - * - * @param {FingerprintSecretOptions} options Options for platform specific fingerprint API - * @returns {Promise} Returns a promise that resolves when authentication was successful - */ - @Cordova() - registerBiometricSecret(options: FingerprintSecretOptions): Promise { - return; - } - - /** - * Show authentication dialogue and load secret - * - * @param {FingerprintOptions} options Options for platform specific fingerprint API - * @returns {Promise} Returns a promise that resolves when authentication was successful - */ - @Cordova() - loadBiometricSecret(options: FingerprintOptions): Promise { - return; - } - - /** - * Show authentication dialogue - * - * @param {FingerprintOptions} options Options for platform specific fingerprint API - * @returns {Promise} Returns a promise that resolves when authentication was successful - */ - @Cordova() - show(options: FingerprintOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase-analytics/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-analytics/index.ts deleted file mode 100644 index e41050e7..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase-analytics/index.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @beta - * @name Firebase Analytics - * @description - * Cordova plugin for Firebase Analytics - * - * Go to firebase console and export google-services.json and GoogleService-Info.plist. Put those files into the root of your cordova app folder. - * - * NOTE: on iOS in order to collect demographic, age, gender data etc. you should additionally include AdSupport.framework into your project. - * - * ## Using capacitor? - * For Android you'll have to add in __android/app/src/main/AndroidManifest.xml__ under `` - * ``` - * - * - * - * ``` - * - * And in the same file, you'll have to add `xmlns:tools="http://schemas.android.com/tools"` to your _manifest_ tag. - * @usage - * ```typescript - * import { FirebaseAnalytics } from '@awesome-cordova-plugins/firebase-analytics/ngx'; - * - * - * constructor(private firebaseAnalytics: FirebaseAnalytics) { } - * - * ... - * - * this.firebaseAnalytics.logEvent('page_view', {page: "dashboard"}) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'FirebaseAnalytics', - plugin: 'cordova-plugin-firebase-analytics', - pluginRef: 'cordova.plugins.firebase.analytics', - repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-analytics', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FirebaseAnalytics extends AwesomeCordovaNativePlugin { - /** - * Logs an app event. - * Be aware of automatically collected events. - * - * @param {string} name The name of the event - * @param {any} params Some param to configure something - * @returns {Promise} Returns a promise - */ - @Cordova({ sync: true }) - logEvent(name: string, params: any): Promise { - return; - } - - /** - * Sets the user ID property. - * This feature must be used in accordance with Google's Privacy Policy. - * - * @param {string} id The user ID - * @returns {Promise} Returns a promise - */ - @Cordova({ sync: true }) - setUserId(id: string): Promise { - return; - } - - /** - * This feature must be used in accordance with Google's Privacy Policy. - * Be aware of automatically collected user properties. - * - * @param {string} name The property name - * @param {string} value The property value - * @returns {Promise} Returns a promise - */ - @Cordova({ sync: true }) - setUserProperty(name: string, value: string): Promise { - return; - } - - /** - * Sets whether analytics collection is enabled for this app on this device. - * - * @param {boolean} enabled - * @returns {Promise} Returns a promise - */ - @Cordova({ sync: true }) - setEnabled(enabled: boolean): Promise { - return; - } - - /** - * Sets the current screen name, which specifies the current visual context in your app. - * This helps identify the areas in your app where users spend their time and how they interact with your app. - * - * @param {string} name The name of the screen - * @returns {Promise} Returns a promise - */ - @Cordova({ sync: true }) - setCurrentScreen(name: string): Promise { - return; - } - - /** - * Clears all analytics data for this instance from the device and resets the app instance ID - * - * @returns {Promise} Returns a promise - */ - @Cordova({ sync: true }) - resetAnalyticsData(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase-authentication/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-authentication/index.ts deleted file mode 100644 index 8541a810..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase-authentication/index.ts +++ /dev/null @@ -1,214 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name Firebase Authentication - * @description - * Cordova plugin for Firebase Authentication - * @usage - * ```typescript - * import { FirebaseAuthentication } from '@awesome-cordova-plugins/firebase-authentication/ngx'; - * - * - * constructor(private firebaseAuthentication: FirebaseAuthentication) { } - * - * ... - * - * - * this.firebaseAuthentication.createUserWithEmailAndPassword('test@gmail.com', '123') - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'FirebaseAuthentication', - plugin: 'cordova-plugin-firebase-authentication', - pluginRef: 'cordova.plugins.firebase.auth', - repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-authentication', - install: 'ionic cordova plugin add cordova-plugin-firebase-authentication --variable FIREBASE_AUTH_VERSION=version', - installVariables: ['FIREBASE_AUTH_VERSION'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FirebaseAuthentication extends AwesomeCordovaNativePlugin { - /** - * Returns the current user logged in Firebase service - * - * @returns {Promise} Returns the user info - */ - @Cordova({ sync: true }) - getCurrentUser(): Promise { - return; - } - - /** - * Returns a JWT token used to identify the user to a Firebase service. - * - * @param forceRefresh {boolean} Force Refresh - * @returns {Promise} Returns the id token - */ - @Cordova({ sync: true }) - getIdToken(forceRefresh: boolean): Promise { - return; - } - - /** - * Tries to create a new user account with the given email address and password. - * - * @param email Email - * @param password Password - */ - @Cordova({ sync: true }) - createUserWithEmailAndPassword(email: string, password: string): Promise { - return; - } - - /** - * Initiates email verification for the current user. - */ - @Cordova({ sync: true }) - sendEmailVerification(): Promise { - return; - } - - /** - * Triggers the Firebase Authentication backend to send a password-reset email to the given email address, - * which must correspond to an existing user of your app. - * - * @param email Email - */ - @Cordova({ sync: true }) - sendPasswordResetEmail(email: string): Promise { - return; - } - - /** - * Asynchronously signs in using an email and password. - * - * @param email Email - * @param password Password - */ - @Cordova({ sync: true }) - signInWithEmailAndPassword(email: string, password: string): Promise { - return; - } - - /** - * Starts the phone number verification process for the given phone number. - * NOTE: Android supports auto-verify and instant device verification. - * Therefore in that cases it doesn't make sense to ask for sms code. - * It's recommended to register onAuthStateChanged callback to be notified on auto sign-in. - * timeout [milliseconds] is the maximum amount of time you are willing to wait for SMS auto-retrieval - * to be completed by the library. Maximum allowed value is 2 minutes. Use 0 to disable SMS-auto-retrieval. - * If you specify a positive value less than 30 seconds, library will default to 30 seconds. - * - * @param phoneNumber Phone number - * @param timeout {number} Timeout - */ - @Cordova({ sync: true }) - verifyPhoneNumber(phoneNumber: string, timeout: number): Promise { - return; - } - - /** - * Asynchronously signs in using verificationId and 6-digit SMS code. - * - * @param verificationId Verification ID - * @param smsCode SMS code - */ - @Cordova({ sync: true }) - signInWithVerificationId(verificationId: string, smsCode: string): Promise { - return; - } - - /** - * Create and use temporary anonymous account to authenticate with Firebase. - */ - @Cordova({ sync: true }) - signInAnonymously(): Promise { - return; - } - - /** - * Uses Google's idToken and accessToken to sign-in into firebase account. In order to retrieve those tokens follow instructions for Android and iOS - * - * @param idToken ID Token - * @param accessToken Access Token - */ - @Cordova({ sync: true }) - signInWithGoogle(idToken: string, accessToken: string): Promise { - return; - } - - /** - * Uses Apples's idToken and rawNonce (optional) to sign-in into firebase account. In order to retrieve those tokens follow instructions for Android and iOS - * - * @param idToken ID Token - * @param identityToken - * @param rawNonce Access Token - */ - @Cordova({ sync: true }) - signInWithApple(identityToken: string, rawNonce?: string): Promise { - return; - } - - /** - * Uses Facebook's accessToken to sign-in into firebase account. In order to retrieve those tokens follow instructions for Android and iOS. - * - * @param accessToken Access Token - */ - @Cordova({ sync: true }) - signInWithFacebook(accessToken: string): Promise { - return; - } - - /** - * Uses Twitter's token and secret to sign-in into firebase account. In order to retrieve those tokens follow instructions for Android and iOS. - * - * @param token Token - * @param secret Secret - */ - @Cordova({ sync: true }) - signInWithTwitter(token: string, secret: string): Promise { - return; - } - - /** - * Registers a block as an auth state did change listener. To be invoked when: - * - The block is registered as a listener, - * - A user with a different UID from the current user has signed in, or - * - The current user has signed out. - */ - @Cordova({ observable: true, callbackOrder: 'reverse' }) - onAuthStateChanged(): Observable { - return; - } - - /** - * Set's the current user language code. The string used to set this property must be a language code that follows BCP 47. - * - * @param languageCode Language Code - */ - @Cordova({ sync: true }) - setLanguageCode(languageCode: string): Promise { - return; - } - - /** - * Sets languageCode to the app’s current language. - */ - @Cordova({ sync: true }) - useAppLanguage(): Promise { - return; - } - - /** - * Signs out the current user and clears it from the disk cache. - */ - @Cordova({ sync: true }) - signOut(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase-config/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-config/index.ts deleted file mode 100644 index 16b28265..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase-config/index.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @beta - * @name Firebase Config - * @description - * Cordova plugin for Firebase Config - * @usage - * ```typescript - * import { FirebaseConfig } from '@awesome-cordova-plugins/firebase-config/ngx'; - * - * - * constructor(private firebaseConfig: FirebaseConfig) { } - * - * ... - * - * - * this.firebaseConfig.getBoolean('my_key') - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'FirebaseConfig', - plugin: 'cordova-plugin-firebase-config', - pluginRef: 'cordova.plugins.firebase.config', - repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-config', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FirebaseConfig extends AwesomeCordovaNativePlugin { - /** - * Starts fetching configs, adhering to the specified minimum fetch interval. - * - * @param {number} expirationDuration - * @returns {Promise} - */ - @Cordova({ sync: true }) - fetch(expirationDuration?: number): Promise { - return; - } - - /** - * Asynchronously activates the most recently fetched configs, so that the fetched key value pairs take effect. - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - activate(): Promise { - return; - } - - /** - * Asynchronously fetches and then activates the fetched configs. - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - fetchAndActivate(): Promise { - return; - } - - /** - * Fetches a boolean configuration value from RemoteConfig - * - * @param {string} key - * @returns {Promise} - */ - @Cordova({ sync: true }) - getBoolean(key: string): Promise { - return; - } - - /** - * Fetches a string configuration value from RemoteConfig - * - * @param {string} key - * @returns {Promise} - */ - @Cordova({ sync: true }) - getString(key: string): Promise { - return; - } - - /** - * Fetches a numeric configuration value from RemoteConfig - * - * @param {string} key - * @returns {Promise} - */ - @Cordova({ sync: true }) - getNumber(key: string): Promise { - return; - } - - /** - * Fetches an array of bytes configuration value from RemoteConfig - * - * @param {string} key - * @returns {Promise} - */ - @Cordova({ sync: true }) - getBytes(key: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase-crash/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-crash/index.ts deleted file mode 100644 index 1bb3b4cb..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase-crash/index.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name FirebaseCrash - * @description - * This plugin brings crash reporting from Google Firebase to your Cordova project! Android and iOS supported. - * @usage - * ```typescript - * import { FirebaseCrash } from '@awesome-cordova-plugins/firebase-crash'; - * - * constructor(private firebaseCrash: FirebaseCrash) { } - * - * ... - * - * this.firebaseCrash.setUserId('123456789'); - * this.firebaseCrash.log('message'); - * this.firebaseCrash.logError('non fatal exception'); - * - * ``` - */ -@Plugin({ - pluginName: 'FirebaseCrash', - plugin: 'cordova-plugin-firebase-crash', - pluginRef: 'cordova.plugins.firebase.crashlytics', - repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-crash', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FirebaseCrash extends AwesomeCordovaNativePlugin { - /** - * Add logging that will be sent with your crash data in case of app crash. - * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#add_custom_logs - * - * @param {string} message - * @returns {Promise} - */ - @Cordova({ sync: true }) - log(message: string): Promise { - return; - } - - /** - * Log non-fatal exceptions in addition to automatically reported app crashes. - * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#log_non-fatal_exceptions - * - * @param {string} message - * @returns {Promise} - */ - @Cordova({ sync: true }) - logError(message: string): Promise { - return; - } - - /** - * Sets the user identifier property for crashlytics reporting. - * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#set_user_ids - * - * @param {string} userId value to set the userId - * @returns {Promise} - */ - @Cordova({ sync: true }) - setUserId(userId: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase-crashlytics/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-crashlytics/index.ts deleted file mode 100644 index 990d664a..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase-crashlytics/index.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Firebase Crashlytics - * @description - * A Google Firebase Crashlytics plugin to enable capture of crash reports. - * @usage - * ```typescript - * import { FirebaseCrashlytics } from '@awesome-cordova-plugins/firebase-crashlytics/ngx'; - * - * - * constructor(private firebaseCrashlytics: FirebaseCrashlytics) { } - * - * ... - * - * - * const crashlytics = this.firebaseCrashlytics.initialise(); - * crashlytics.logException('my caught exception'); - * - * ``` - */ -@Plugin({ - pluginName: 'FirebaseCrashlytics', - plugin: 'cordova-plugin-firebase-crashlytics', - pluginRef: 'FirebaseCrashlytics', - repo: 'https://github.com/ReallySmallSoftware/cordova-plugin-firebase-crashlytics', - install: - 'ionic cordova plugin add cordova-plugin-firebase-crashlytics --variable ANDROID_FIREBASE_CORE_VERSION=16.0.0', - installVariables: ['ANDROID_FIREBASE_CORE_VERSION'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FirebaseCrashlytics extends AwesomeCordovaNativePlugin { - /** - * Simply add the plugin to get the default Crashlytics functionality. Note that crashes and logged exceptions will only be reported when the application restarts. In order to log caught exceptions the following can be used: - * - * @returns {void} - */ - @Cordova({ - sync: true, - }) - initialise(): any { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Generate a forced crash. Visible in console after restart of application. - * - * @returns {void} - */ - @Cordova({ - sync: true, - }) - crash(): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Log a priority message. Will only be logged in the event of a crash. - * - * @param {number} priority - * @param {string} tag - * @param {string} message - * @returns {void} - */ - @Cordova({ - sync: true, - }) - logPriority(priority: number, tag: string, message: string): void { - return; - } - - /** - * Log a message. Will only be logged in the event of a crash. - * - * @param {string} message - * @returns {void} - */ - @Cordova({ - sync: true, - }) - log(message: string): void { - return; - } - - /** - * Log when a handled exception has happened. Visible in console after restart of application. - * - * @param {string} message - * @returns {void} - */ - @Cordova({ - sync: true, - }) - logException(message: string): void { - return; - } - - /** - * Set extra key/value string value. Will only be logged in the event of a crash. - * - * @param {string} key - * @param {string} value - * @returns {void} - */ - @Cordova({ - sync: true, - }) - setString(key: string, value: string): void { - return; - } - - /** - * Set extra key/value bool value. Will only be logged in the event of a crash. - * - * @param {string} key - * @param {boolean} value - * @returns {void} - */ - @Cordova({ - sync: true, - }) - setBool(key: string, value: boolean): void { - return; - } - - /** - * Set extra key/value double value. Will only be logged in the event of a crash. - * - * @param {string} key - * @param {number} value - * @returns {void} - */ - @Cordova({ - sync: true, - }) - setDouble(key: string, value: number): void { - return; - } - - /** - * Set extra key/value float value. Will only be logged in the event of a crash. - * - * @param {string} key - * @param {number} value - * @returns {void} - */ - @Cordova({ - sync: true, - }) - setFloat(key: string, value: number): void { - return; - } - - /** - * Set extra key/value integer value. Will only be logged in the event of a crash. - * - * @param {string} key - * @param {number} value - * @returns {void} - */ - @Cordova({ - sync: true, - }) - setInt(key: string, value: number): void { - return; - } - - /** - * Set the identifier for the user. Take care when using this method and ensure you privacy policy is updated accordingly. - * - * @param {string} identifier - * @returns {void} - */ - @Cordova({ - sync: true, - }) - setUserIdentifier(identifier: string): void { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase-dynamic-links/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-dynamic-links/index.ts deleted file mode 100644 index b341e929..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase-dynamic-links/index.ts +++ /dev/null @@ -1,165 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface IDynamicLink { - matchType: 'Weak' | 'Strong'; - deepLink: string; -} - -export interface ILinkOptions { - domainUriPrefix?: string; - link?: string; - androidInfo?: { - androidPackageName?: string; - androidFallbackLink?: string; - androidMinPackageVersionCode?: number; - }; - iosInfo?: { - iosBundleId?: string; - iosFallbackLink?: string; - iosIpadFallbackLink?: string; - iosIpadBundleId?: string; - iosAppStoreId?: string; - }; - navigationInfo?: { - enableForcedRedirect?: boolean; - }; - analyticsInfo?: { - googlePlayAnalytics?: { - utmSource?: string; - utmMedium?: string; - utmCampaign?: string; - utmTerm?: string; - utmContent?: string; - }; - itunesConnectAnalytics?: { - at?: string; - ct?: string; - pt?: string; - }; - }; - socialMetaTagInfo?: { - socialTitle?: string; - socialDescription?: string; - socialImageLink?: string; - }; -} - -/** - * @beta - * @name Firebase Dynamic Links - * @description - * Cordova plugin for Firebase Dynamic Links - * - * Variables APP_DOMAIN and APP_PATH specify web URL where your app will start an activity to handle the link. They also used to setup support for App Indexing. - * Go to firebase console and export google-services.json and GoogleService-Info.plist. Put those files into the root of your cordova app folder. - * - * Preferences: - * - * Preferences GoogleIOSClientId and GoogleAndroidClientId are used to setup dynamic links when you have an app for several platforms. - * You can find values at your GoogleService-Info.plist (key ANDROID_CLIENT_ID) and google-services.json (key client[0].oauth_client[0].client_id). - * - * config.xml: - * ```xml - * - * - * - * - * - * - * ``` - * @usage - * ```typescript - * import { FirebaseDynamicLinks } from '@awesome-cordova-plugins/firebase-dynamic-links/ngx'; - * - * - * constructor(private firebaseDynamicLinks: FirebaseDynamicLinks) { } - * - * ... - * // Handle the logic here after opening the app with the Dynamic link - * this.firebaseDynamicLinks.onDynamicLink() - * .subscribe((res: any) => console.log(res), (error:any) => console.log(error)); - * ``` - * @interfaces - * DynamicLinksOptions - */ -@Plugin({ - pluginName: 'FirebaseDynamicLinks', - plugin: ' cordova-plugin-firebase-dynamiclinks', - pluginRef: 'cordova.plugins.firebase.dynamiclinks', - repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-dynamiclinks', - install: - 'ionic cordova plugin add cordova-plugin-firebase-dynamiclinks --save --variable APP_DOMAIN="example.com" --variable APP_PATH="/"', - installVariables: ['APP_DOMAIN', 'APP_PATH'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FirebaseDynamicLinks extends AwesomeCordovaNativePlugin { - /** - * Determines if the app has a pending dynamic link and provides access to the dynamic link parameters. - * - * @returns {Promise} Returns a promise - */ - @Cordova({ - otherPromise: true, - }) - getDynamicLink(): Promise { - return; - } - - /** - * Registers callback that is triggered on each dynamic link click. - * - * @returns {Observable} Returns an observable - */ - @Cordova({ - callbackOrder: 'reverse', - observable: true, - }) - onDynamicLink(): Observable { - return; - } - - /** - * Creates a Dynamic Link from the parameters. Returns a promise fulfilled with the new dynamic link url. - * - * @param {ILinkOptions} opt [Dynamic Link Parameters](https://github.com/chemerisuk/cordova-plugin-firebase-dynamiclinks#dynamic-link-parameters) - * @param opts - * @returns {Promise} Returns a promise with the url - */ - @Cordova({ - otherPromise: true, - }) - createDynamicLink(opts: ILinkOptions): Promise { - return; - } - - /** - * Creates a shortened Dynamic Link from the parameters. Shorten the path to a string that is only as long as needed to be unique, with a minimum length of 4 characters. Use this method if sensitive information would not be exposed if a short Dynamic Link URL were guessed. - * - * @param {ILinkOptions} opt [Dynamic Link Parameters](https://github.com/chemerisuk/cordova-plugin-firebase-dynamiclinks#dynamic-link-parameters) - * @param opts - * @returns {Promise} Returns a promise with the url - */ - @Cordova({ - otherPromise: true, - }) - createShortDynamicLink(opts: ILinkOptions): Promise { - return; - } - - /** - * Creates a Dynamic Link from the parameters. Shorten the path to an unguessable string. Such strings are created by base62-encoding randomly generated 96-bit numbers, and consist of 17 alphanumeric characters. Use unguessable strings to prevent your Dynamic Links from being crawled, which can potentially expose sensitive information. - * - * @param {ILinkOptions} opt [Dynamic Link Parameters](https://github.com/chemerisuk/cordova-plugin-firebase-dynamiclinks#dynamic-link-parameters) - * @param opts - * @returns {Promise} Returns a promise with the url - */ - @Cordova({ - otherPromise: true, - }) - createUnguessableDynamicLink(opts: ILinkOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase-messaging/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-messaging/index.ts deleted file mode 100644 index 595ffb3a..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase-messaging/index.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface IFirebaseGCMMessage { - gcm: { - body: string; - title: string; - sound: string; - icon: string; - tag: string; - color: string; - clickAction: string; - }; - 'google.message_id': string; - 'google.sent_time': number; - [key: string]: any; -} - -export interface IFirebaseAPSMessage { - aps: { - alert: { - title: string; - body: string; - }; - badge?: number; - }; - 'gcm.message_id': 'string'; - [key: string]: any; -} - -export type IFirebaseMessage = IFirebaseAPSMessage | IFirebaseGCMMessage; - -export interface IRequestPermissionOptions { - forceShow?: boolean; -} - -export type FirebaseMessagingTokenType = 'apns-buffer' | 'apns-string'; - -/** - * @beta - * @name Firebase Messaging - * @description - * Cordova plugin for Firebase Messaging - * @usage - * ```typescript - * import { FirebaseMessaging } from '@awesome-cordova-plugins/firebase-messaging/ngx'; - * - * - * constructor(private firebaseMessaging: FirebaseMessaging) { } - * - * ... - * - * - * this.firebaseMessaging.logEvent('page_view', {page: "dashboard"}) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - * @interfaces - * IFirebaseMessage - */ -@Plugin({ - pluginName: 'FirebaseMessaging', - plugin: 'cordova-plugin-firebase-messaging', - pluginRef: 'cordova.plugins.firebase.messaging', - repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-messaging', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FirebaseMessaging extends AwesomeCordovaNativePlugin { - /** - * Called when a push message received while app is in foreground. - * - * @returns {Observable} - */ - @Cordova({ observable: true, callbackOrder: 'reverse' }) - onMessage(): Observable { - return; - } - - /** - * Called when a push message received while app is in background. - * - * @returns {Observable} - */ - @Cordova({ observable: true, callbackOrder: 'reverse' }) - onBackgroundMessage(): Observable { - return; - } - - /** - * Grant permission to receive push notifications (will trigger prompt on iOS). - * - * @param {IRequestPermissionOptions} [options] - * @param options.forceShow - * @returns {Promise} - */ - @Cordova({ sync: true }) - requestPermission(options?: { forceShow?: boolean }): Promise { - return; - } - - /** - * Returns a promise thaf fulfills with the device instance ID - */ - @Cordova({ sync: true }) - getInstanceId(): Promise { - return; - } - - /** - * Returns a promise that fulfills with the current FCM token - * - * This method also accepts optional argument type. - * Currently iOS implementation supports values "apns-buffer" and "apns-string" that defines presentation of resolved APNS token. - * - * @param {FirebaseMessagingTokenType} [type] iOS only. Defines presentation of resolved APNS token - * @returns {Promise} - */ - @Cordova({ sync: true }) - getToken(type?: FirebaseMessagingTokenType): Promise { - return; - } - - /** - * Triggers every time when FCM token updated. - * You should usually call getToken to get an updated token and send it to server. - * - * @returns {Observable} - */ - @Cordova({ observable: true, callbackOrder: 'reverse' }) - onTokenRefresh(): Observable { - return; - } - - /** - * Subscribe to topic in background. - * - * @param {string} topic - * @returns {Promise} - */ - @Cordova({ sync: true }) - subscribe(topic: string): Promise { - return; - } - - /** - * Unsubscribe from topic in background. - * - * @param {string} topic - * @returns {Promise} - */ - @Cordova({ sync: true }) - unsubscribe(topic: string): Promise { - return; - } - - /** - * Reads current badge number (if supported). - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - getBadge(): Promise { - return; - } - - /** - * Sets current badge number (if supported). - * - * @param {number} value - * @returns {Promise} - */ - @Cordova({ sync: true }) - setBadge(value: number): Promise { - return; - } - - /** - * Revoke the current FCM token. - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - deleteToken(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase-vision/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-vision/index.ts deleted file mode 100644 index 21382b42..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase-vision/index.ts +++ /dev/null @@ -1,291 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export interface Text { - text: string; - blocks: TextLine[]; - imageHeight: number; - imageWidth: number; -} - -export interface TextLine extends TextBlock { - lines: TextElement[]; -} - -export interface TextElement extends TextBlock { - elements: TextBlock[]; -} - -export interface TextBlock { - text: string; - cornerPoints: TextPoint[]; - frame: TextFrame; - recognizedLanguages: string; -} - -export interface TextPoint { - x: number; - y: number; -} - -export interface TextFrame { - x: number; - y: number; - width: number; - height: number; -} - -export enum BarcodeFormat { - UNKNOWN = -1, - ALL_FORMATS = 0, - CODE_128 = 1, - CODE_39 = 2, - CODE_93 = 4, - CODABAR = 8, - DATA_MATRIX = 16, - EAN_13 = 32, - EAN_8 = 64, - ITF = 128, - QR_CODE = 256, - UPC_A = 512, - UPC_E = 1024, - PDF417 = 2048, - AZTEC = 4096, -} - -export enum BarcodeValueType { - /** Unknown Barcode value types. */ - Unknown, - /** Barcode value type for contact info. */ - ContactInfo, - /** Barcode value type for email addresses. */ - Email, - /** Barcode value type for ISBNs. */ - ISBN, - /** Barcode value type for phone numbers. */ - Phone, - /** Barcode value type for product codes. */ - Product, - /** Barcode value type for SMS details. */ - SMS, - /** Barcode value type for plain text. */ - Text, - /** Barcode value type for URLs/bookmarks. */ - URL, - /** Barcode value type for Wi-Fi access point details. */ - WiFi, - /** Barcode value type for geographic coordinates. */ - GeographicCoordinates, - /** Barcode value type for calendar events. */ - CalendarEvent, - /** Barcode value type for driver's license data. */ - DriversLicense, -} - -export enum BarcodeEmailType { - /** Unknown email type. */ - Unknown, - /** Barcode work email type. */ - Work, - /** Barcode home email type. */ - Home, -} - -export enum BarcodePhoneType { - /** Unknown phone type. */ - Unknown, - /** Barcode work phone type. */ - Work, - /** Barcode home phone type. */ - Home, - /** Barcode fax phone type. */ - Fax, - /** Barcode mobile phone type. */ - Mobile, -} - -export enum BarcodeWiFiEncryptionType { - /** Barcode unknown Wi-Fi encryption type. */ - Unknown, - /** Barcode open Wi-Fi encryption type. */ - Open, - /** Barcode WPA Wi-Fi encryption type. */ - WPA, - /** Barcode WEP Wi-Fi encryption type. */ - WEP, -} - -export enum BarcodeAddressType { - /** Barcode unknown address type. */ - Unknown, - /** Barcode work address type. */ - Work, - /** Barcode home address type. */ - Home, -} - -export interface Barcode { - valueType: BarcodeValueType; - format: BarcodeFormat; - rawValue: string; - displayValue: string; - cornerPoints: any; - imageHeight: number; - imageWidth: number; - email: BarcodeEmail; - phone: BarcodePhone; - sms: BarcodeSms; - url: BarcodeUrl; - wifi: BarcodeWifi; - geoPoint: BarcodeGeoPoint; - calendarEvent: BarcodeCalendarEvent; - contactInfo: BarcodeContactInfo; - driverLicense: BarcodeDriverLicense; -} - -export interface BarcodeEmail { - address: string; - body: string; - subject: string; - type: BarcodeEmailType; -} - -export interface BarcodePhone { - number: string; - type: BarcodePhoneType; -} - -export interface BarcodeSms { - phoneNumber: string; - message: string; -} - -export interface BarcodeUrl { - title: string; - url: string; -} -export interface BarcodeWifi { - ssid: string; - password: string; - type: BarcodeWiFiEncryptionType; -} -export interface BarcodeGeoPoint { - latitude: number; - longitude: number; -} - -export interface BarcodeCalendarEvent { - eventDescription: string; - location: string; - organizer: string; - status: string; - summary: string; - start: any; - end: any; -} - -export interface BarcodeContactInfo { - title: string; - name: string; - addresses: BarcodeAddress[]; - phones: BarcodePhone[]; - emails: BarcodeEmail[]; - organization: string; - urls: string; -} - -export interface BarcodeAddress { - addressLine: string; - type: BarcodeAddressType; -} - -export interface BarcodeDriverLicense { - firstName: string; - middleName: string; - lastName: string; - gender: string; - addressCity: string; - addressState: string; - addressStreet: string; - addressZip: string; - birthDate: string; - documentType: string; - licenseNumber: string; - expiryDate: string; - issuingDate: string; - issuingCountry: string; -} - -export interface ImageLabel { - index: number; - confidence: number; - text: string; -} -/** - * @name Firebase Vision - * @description - * Cordova plugin for Firebase MLKit Vision - * @usage - * ```typescript - * import { FirebaseVision } from '@awesome-cordova-plugins/firebase-vision/ngx'; - * - * - * constructor(private firebaseVision: FirebaseVision) { } - * - * ... - * - * - * this.firebaseVision.onDeviceTextRecognizer(FILE_URI) - * .then((res: string) => console.log(res)) - * .catch((error: string) => console.error(error)); - * - * this.firebaseVision.barcodeDetector(FILE_URI) - * .then((res: Barcode[]) => console.log(res)) - * .catch((error: string) => console.error(error)); - * - * this.firebaseVision.imageLabeler(FILE_URI) - * .then((res: ImageLabel[]) => console.log(res)) - * .catch((error: string) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'FirebaseVision', - plugin: 'cordova-plugin-firebase-mlvision', - pluginRef: 'FirebaseVisionPlugin', - repo: 'https://github.com/alon22/cordova-plugin-firebase-mlvision', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FirebaseVision extends AwesomeCordovaNativePlugin { - /** - * Recognize text in image - * - * @param file_uri {string} Image URI - * @returns {Promise} Returns a promise that fulfills with the text in the image - */ - @Cordova() - onDeviceTextRecognizer(file_uri: string): Promise { - return; - } - /** - * Read data from Barcode - * - * @param file_uri {string} Image URI - * @returns {Promise} Returns a promise that fulfills with the data in barcode - */ - @Cordova() - barcodeDetector(file_uri: string): Promise { - return; - } - /** - * Recognize object in image - * - * @param file_uri {string} Image URI - * @returns {Promise} Returns a promise that fulfills with the information about entities in an image - */ - @Cordova() - imageLabeler(file_uri: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase-x/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-x/index.ts deleted file mode 100644 index 95014fad..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase-x/index.ts +++ /dev/null @@ -1,1004 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface IChannelOptions { - /** - * Channel ID - must be unique per app package - */ - id: string; - - /** - * Channel name. Default: empty string - */ - name?: string; - - /** - * Channel description. Default: empty string - */ - description?: string; - - /** - * The sound to play once a push comes. Default value: 'default' - * Values allowed: - * 'default' - plays the default notification sound - * 'ringtone' - plays the currently set ringtone - * 'false' - silent; don't play any sound - * filename - the filename of the sound file located in '/res/raw' without file extension (mysound.mp3 -> mysound) - */ - sound?: string; - - /** - * Vibrate on new notification. Default value: true - * Possible values: - * Boolean - vibrate or not - * Array - vibration pattern - e.g. [500, 200, 500] - milliseconds vibrate, milliseconds pause, vibrate, pause, etc. - */ - vibration?: boolean | number[]; - - /** - * Whether to blink the LED - */ - light?: boolean; - - /** - * LED color in ARGB format - this example BLUE color. If set to -1, light color will be default. Default value: -1. - */ - lightColor?: string; - - /** - * Importance - integer from 0 to 4. Default value: 4 - * 0 - none - no sound, does not show in the shade - * 1 - min - no sound, only shows in the shade, below the fold - * 2 - low - no sound, shows in the shade, and potentially in the status bar - * 3 - default - shows everywhere, makes noise, but does not visually intrude - * 4 - high - shows everywhere, makes noise and peeks - */ - importance?: 0 | 1 | 2 | 3 | 4; - - /** - * Show badge over app icon when non handled pushes are present. Default value: true - */ - badge?: boolean; - - /** - * Show message on locked screen. Default value: 1 - * Possible values (default 1): - * -1 - secret - Do not reveal any part of the notification on a secure lockscreen. - * 0 - private - Show the notification on all lockscreens, but conceal sensitive or private information on secure lockscreens. - * 1 - public - Show the notification in its entirety on all lockscreens. - */ - visibility?: -1 | 0 | 1; -} - -export interface FirebaseUser { - /** - * ID token - */ - idToken?: string; - - /** - * Provider ID - */ - providerId?: string; - - /** - * UID - */ - uid?: string; - - /** - * photo url - */ - photoUrl?: string; - - /** - * phone number - */ - phoneNumber?: string; - - /** - * is email verified - */ - emailIsVerified?: boolean; - - /** - * email - */ - email?: string; - - /** - * name - */ - name?: string; -} -export interface MessagePayloadAps { - alert?: { - title: string; - body: string; - } -} -export interface MessagePayload { - title?: string; - body?: string; - collapse_key?: string; - from?: string; - id?: string; - messageType?: string; - notification_foreground?: string; - sent_time?: string; - show_notification?: string; - ttl?: string; - tap?: 'background' | 'foreground'; - aps?: MessagePayloadAps; -} -/** - * @name Firebase X - * @description - * This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported. - * It is a maintained fork from unmaintained ionic-navite plugin called Firebase. - * @usage - * ```typescript - * import { FirebaseX } from '@awesome-cordova-plugins/firebase-x/ngx'; - * - * - * constructor(private firebaseX: FirebaseX) { } - * - * ... - * - * - * this.firebaseX.getToken() - * .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device - * .catch(error => console.error('Error getting token', error)); - * - * this.firebaseX.onMessageReceived() - * .subscribe(data => console.log(`User opened a notification ${data}`)); - * - * this.firebaseX.onTokenRefresh() - * .subscribe((token: string) => console.log(`Got a new token ${token}`)); - * ``` - * @interfaces - * IChannelOptions - */ -@Plugin({ - pluginName: 'FirebaseX', - plugin: 'cordova-plugin-firebasex', - pluginRef: 'FirebasePlugin', - repo: 'https://github.com/dpa99c/cordova-plugin-firebasex', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FirebaseX extends AwesomeCordovaNativePlugin { - /** - * Get the current FCM token. - * - * @returns {Promise} Note that token will be null if it has not been established yet - */ - @Cordova() - getToken(): Promise { - return; - } - - /** - * Get the app instance ID (an constant ID which persists as long as the app is not uninstalled/reinstalled) - * - * @returns {Promise} Note that ID will be null if it has not been established yet - */ - @Cordova() - getId(): Promise { - return; - } - - /** - * Get the current FCM user. - * - * @returns {Promise} - */ - @Cordova() - getCurrentUser(): Promise { - return; - } - - /** - * Reload the current FCM user. - * - * @returns {Promise} - */ - @Cordova() - reloadCurrentUser(): Promise { - return; - } - - /** - * Get notified when a token is refreshed. - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - onTokenRefresh(): Observable { - return; - } - - /** - * iOS only. - * Get the APNS token allocated for this app install. - * - * @returns {Promise} Note that token will be null if it has not been established yet - */ - @Cordova() - getAPNSToken(): Promise { - return; - } - - /** - * iOS only. - * Registers a handler to call when the APNS token is allocated. - * This will be called once when remote notifications permission has been granted by the user at runtime. - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - onApnsTokenReceived(): Observable { - return; - } - - /** - * Registers a callback function to invoke when: - * - a notification or data message is received by the app - * - a system notification is tapped by the user - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - onMessageReceived(): Observable { - return; - } - - /** - * Grant permission to receive push notifications (will trigger prompt) and return hasPermission: true. iOS only (Android will always return true). - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - grantPermission(): Promise { - return; - } - - /** - * Check permission to receive push notifications and return hasPermission: true. iOS only (Android will always return true). - * - * @returns {Promise} - */ - @Cordova() - hasPermission(): Promise { - return; - } - - /** - * Unregister from firebase, used to stop receiving push notifications. Call this when you logout user from your app. - */ - @Cordova() - unregister(): Promise { - return; - } - - /** - * Set a number on the icon badge. Set 0 to clear the badge - * - * @param {number} badgeNumber - * @returns {Promise} - */ - @Cordova() - setBadgeNumber(badgeNumber: number): Promise { - return; - } - - /** - * Get icon badge number. - * - * @returns {Promise} - */ - @Cordova() - getBadgeNumber(): Promise { - return; - } - - /** - * Clear all pending notifications from the drawer. - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - clearAllNotifications(): Promise { - return; - } - - /** - * Subscribe to a topic. Topic messaging allows you to send a message to multiple devices that have opted in to a particular topic. - * - * @param {string} topic - * @returns {Promise} - */ - @Cordova() - subscribe(topic: string): Promise { - return; - } - - /** - * Unsubscribe from a topic. This will stop you receiving messages for that topic. - * - * @param {string} topic - * @returns {Promise} - */ - @Cordova() - unsubscribe(topic: string): Promise { - return; - } - - /** - * Indicates whether autoinit is currently enabled. If so, new FCM tokens will be automatically generated. - */ - @Cordova() - isAutoInitEnabled(): Promise { - return; - } - - /** - * Sets whether to autoinit new FCM tokens. By default, a new token will be generated as soon as the old one is removed. - * To prevent a new token being generated, by sure to disable autoinit using setAutoInitEnabled() before calling unregister(). - * - * @param enabled - */ - @Cordova() - setAutoInitEnabled(enabled: boolean): Promise { - return; - } - - /** - * Android 8+ only. Creates a custom channel to be used by notification messages which have the channel property set in the message payload to the id of the created channel: - * - for background (system) notifications: android.notification.channel_id - * - for foreground/data notifications: data.notification_android_channel_id - * - * Calling on Android 7 or below or another platform will have no effect. - * - * @param {IChannelOptions} channelOptions - * @returns {Promise} - */ - @Cordova() - createChannel(channelOptions: IChannelOptions): Promise { - return; - } - - /** - * Android 8+ only. Overrides the properties for the default channel. - * The default channel is used if no other channel exists or is specified in the notification. - * Any options not specified will not be overridden. Should be called as soon as possible (on app start) so default notifications will work as expected. - * Calling on Android 7 or below or another platform will have no effect. - * - * @param {IChannelOptions} channelOptions - * @returns {Promise} - */ - @Cordova() - setDefaultChannel(channelOptions: IChannelOptions): Promise { - return; - } - - /** - * Android 8+ only. Removes a previously defined channel. - * Calling on Android 7 or below or another platform will have no effect. - * - * @param {string} channelID - * @returns {Promise} - */ - @Cordova() - deleteChannel(channelID: string): Promise { - return; - } - - /** - * Android 8+ only. Gets a list of all channels. - * Calling on Android 7 or below or another platform will have no effect. - * - * @returns {Promise} - */ - @Cordova() - listChannels(): Promise { - return; - } - - /** - * Enable/disable analytics collection (useful for GDPR/privacy settings). - * - * @param {boolean} enabled - * @returns {Promise} - */ - @Cordova() - setAnalyticsCollectionEnabled(enabled: boolean): Promise { - return; - } - - /** - * Enable/disable Crashlytics collection. - * - * @param {boolean} enabled - * @returns {Promise} - */ - @Cordova() - setCrashlyticsCollectionEnabled(enabled: boolean): Promise { - return; - } - - /** - * Enable/disable performance collection. - * - * @param {boolean} enabled - * @returns {Promise} - */ - @Cordova() - setPerformanceCollectionEnabled(enabled: boolean): Promise { - return; - } - - /** - * Log an event using Analytics - * - * @param {string} type - * @param {Object} data - * @returns {Promise} - */ - @Cordova() - logEvent(type: string, data: any): Promise { - return; - } - - /** - * Set the name of the current screen in Analytics - * - * @param {string} name Screen name - * @returns {Promise} - */ - @Cordova() - setScreenName(name: string): Promise { - return; - } - - /** - * Set a user id for use in Analytics - * - * @param {string} userId - * @returns {Promise} - */ - @Cordova() - setUserId(userId: string): Promise { - return; - } - - /** - * Set a user property for use in Analytics - * - * @param {string} name - * @param {string} value - * @returns {Promise} - */ - @Cordova() - setUserProperty(name: string, value: string): Promise { - return; - } - - /** - * Set Crashlytics user identifier. - * To diagnose an issue, it’s often helpful to know which of your users experienced a given crash. - * Crashlytics includes a way to anonymously identify users in your crash reports. - * To add user IDs to your reports, assign each user a unique identifier in the form of an ID number, token, or hashed value. - * - * More info https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#set_user_ids - * - * @param {string} userId - * @returns {Promise} - */ - @Cordova() - setCrashlyticsUserId(userId: string): Promise { - return; - } - - /** - * Simulates (causes) a fatal native crash which causes a crash event to be sent to Crashlytics (useful for testing). - * See the Firebase documentation regarding crash testing. - * Crashes will appear under Event type = "Crashes" in the Crashlytics console. - * - * @returns {Promise} - */ - @Cordova() - sendCrash(): Promise { - return; - } - - /** - * Sends a crash-related log message that will appear in the Logs section of the next native crash event. - * Note: if you don't then crash, the message won't be sent! Also logs the message to the native device console. - * - * @param {string} message - * @returns {Promise} - */ - @Cordova() - logMessage(message: string): Promise { - return; - } - - /** - * Sends a non-fatal error event to Crashlytics. In a Cordova app, you may use this to log unhandled Javascript exceptions, for example. - * The event will appear under Event type = "Non-fatals" in the Crashlytics console. - * The error message will appear in the Logs section of the non-fatal error event. - * Also logs the error message to the native device console. - * - * @param {string} error - * @param {object} (optional) a stack trace generated by stacktrace.js - * @param stackTrace - * @returns {Promise} - */ - @Cordova() - logError(error: string, stackTrace?: object): Promise { - return; - } - - /** - * Requests verification of a phone number in order to authenticate a user and sign then into Firebase in your app. - * - * NOTE: This will only work on physical devices with a SIM card (not iOS Simulator or Android Emulator) - * - * In response to your request, you'll receive a verification ID which you can use in conjunction with the verification code - * to sign the user in. - * - * On iOS and some Android devices, the user will receive and SMS containing the verification code which they must manually enter - * into your app. - * - * Some Android devices support "instant verfication", in which case an SMS will not be send and you will be returned - * the verification code along with the verification ID. In this case, the user doesn't need to do anything in order for you - * to sign them in. - * - * @param {string} phoneNumber - phone number to verify - * @param {integer} timeOutDuration - time to wait in seconds before timing out - * @param {string} fakeVerificationCode - (optional) to test instant verification on Android ,specify a fake verification code to return for whitelisted phone numbers. - * - * The success callback will be passed a credential object with the following properties: - * instantVerification {boolean} - true if the Android device supports instant verification, in which case the verification code will be included in the credential object. If this is false, the device will be sent an SMS containing the verification code for the user to manually enter into your app. Always false on iOS. - * verificationId {string} - the verification ID you'll need to pass along with the verification code to sign the user in. Always returned on both Android & iOS. - * code {string} - verification code. Will only be present if instantVerification is true. Always undefined on iOS. - */ - @Cordova({ - callbackOrder: 'reverse', - }) - verifyPhoneNumber(phoneNumber: string, timeOutDuration: number, fakeVerificationCode?: string): Promise { - return; - } - - /** - * Switch current authentification system language, for example, the phone sms code. - * - * @param lang - language to change, ex: 'fr' for french - */ - @Cordova() - setLanguageCode(lang: string): Promise { - return; - } - - /** - * Signs the user into Firebase with credentials obtained using verifyPhoneNumber(). - * See the Android- and iOS-specific Firebase documentation for more info. - * - * @param {object} credential - a credential object returned by the success callback of an authentication method - */ - @Cordova() - signInWithCredential(credential: object): Promise { - return; - } - - /** - * Creates a new email/password-based user account. If account creation is successful, user will be automatically signed in. - * - * @param email - * @param password - */ - @Cordova() - createUserWithEmailAndPassword(email: string, password: string): Promise { - return; - } - - /** - * Signs in to an email/password-based user account. - * - * @param email - * @param password - */ - @Cordova() - signInUserWithEmailAndPassword(email: string, password: string): Promise { - return; - } - - /** - * Signs in user with custom token. - * - * @param customToken - */ - @Cordova() - signInUserWithCustomToken(customToken: string): Promise { - return; - } - - /** - * Signs in user anonymously. - */ - @Cordova() - signInUserAnonymously(): Promise { - return; - } - - /** - * Authenticates the user with a Google account to obtain a credential that can be used to sign the user in/link to an existing user account/reauthenticate the user. - * - * @param clientId - */ - @Cordova() - authenticateUserWithGoogle(clientId: string): Promise { - return; - } - - /** - * Authenticates the user with an Apple account using Sign In with Apple to obtain a credential that can be used to sign the user in/link to an existing user account/reauthenticate the user. - * - * @param locale - */ - @Cordova({ - callbackOrder: 'reverse', - }) - authenticateUserWithApple(locale?: string): Promise { - return; - } - - /** - * Links the user account to an existing Firebase user account with credentials obtained using verifyPhoneNumber(). - * See the Android- and iOS-specific Firebase documentation for more info. - * - * @param {object} credential - a credential object returned by the success callback of an authentication method - * @param {Function} success - callback function to call on successful sign-in using credentials - * @param {Function} error - callback function which will be passed a {string} error message as an argument - */ - @Cordova() - linkUserWithCredential(credential: object, success: () => void, error: (err: string) => void): Promise { - return; - } - - /** - * Reauthenticates the currently signed in user with credentials obtained via an authentication method such as verifyPhoneNumber() or authenticateUserWithGoogle(). - * - * @param {Object} credential - a credential object returned by the success callback of an authentication method - * @param {Function} success - callback function to call on successful sign-in using credentials - * @param {Function} error - callback function which will be passed a {string} error message as an argument - */ - @Cordova() - reauthenticateWithCredential(credential: any, success: () => void, error: (err: string) => void): Promise { - return; - } - - /** - * Checks if there is a current Firebase user signed into the app. - */ - @Cordova() - isUserSignedIn(): Promise { - return; - } - - /** - * Signs current Firebase user out of the app. - */ - @Cordova() - signOutUser(): Promise { - return; - } - - /** - * Updates the display name and/or photo URL of the current Firebase user signed into the app. - * - * @param profile - * @param profile.name - * @param profile.photoUri - */ - @Cordova() - updateUserProfile(profile: { name: string; photoUri: string }): Promise { - return; - } - - /** - * Updates/sets the email address of the current Firebase user signed into the app. - * - * @param email - */ - @Cordova() - updateUserEmail(email: string): Promise { - return; - } - - /** - * Sends a verification email to the currently configured email address of the current Firebase user signed into the app. - * When the user opens the contained link, their email address will have been verified. - */ - @Cordova() - sendUserEmailVerification(): Promise { - return; - } - - /** - * Updates/sets the account password for the current Firebase user signed into the app. - * - * @param password - */ - @Cordova() - updateUserPassword(password: string): Promise { - return; - } - - /** - * Sends a password reset email to the specified user email address. - * Note: doesn't require the Firebase user to be signed in to the app. - * - * @param email - */ - @Cordova() - sendUserPasswordResetEmail(email: string): Promise { - return; - } - - /** - * Deletes the account of the current Firebase user signed into the app. - */ - @Cordova() - deleteUser(): Promise { - return; - } - - /** - * Registers a Javascript function to invoke when Firebase Authentication state changes between user signed in/signed out. - * - * @param {Function} fn - callback function to invoke when authentication state changes - */ - @Cordova() - registerAuthStateChangeListener(fn: any): Promise { - return; - } - - /** - * Fetch Remote Config parameter values for your app. - * - * @param {number} cacheExpirationSeconds specify the cacheExpirationSeconds - * @returns {Promise} - */ - @Cordova() - fetch(cacheExpirationSeconds?: number): Promise { - return; - } - - /** - * Activate the Remote Config fetched config. - * - * @returns {Promise} - */ - @Cordova() - activateFetched(): Promise { - return; - } - - /** - * Retrieve a Remote Config value. - * - * @param {string} key - * @returns {Promise} - */ - @Cordova() - getValue(key: string): Promise { - return; - } - - /** - * Android only. Retrieve a Remote Config byte array. - * - * @param {string} key - * @returns {Promise} - */ - @Cordova() - getByteArray(key: string): Promise { - return; - } - - /** - * Android only. Get the current state of the FirebaseRemoteConfig singleton object. - * - * @returns {Promise} - */ - @Cordova() - getInfo(): Promise { - return; - } - - /** - * Android only. Change the settings for the FirebaseRemoteConfig object's operations. - * - * @param {Object} settings - * @returns {Promise} - */ - @Cordova() - setConfigSettings(settings: any): Promise { - return; - } - - /** - * Android only. Set defaults in the Remote Config. - * - * @param {Object} settings - * @returns {Promise} - */ - @Cordova() - setDefaults(settings: any): Promise { - return; - } - - /** - * Start a trace. - * - * @param {string} name - * @returns {Promise} - */ - @Cordova() - startTrace(name: string): Promise { - return; - } - - /** - * To count the performance-related events that occur in your app (such as cache hits or retries), - * add a line of code similar to the following whenever the event occurs, - * using a string other than retry to name that event if you are counting a different type of event. - * - * @param {string} name - * @param {string} counterName - * @returns {Promise} - */ - @Cordova() - incrementCounter(name: string, counterName: string): Promise { - return; - } - - /** - * Stop the trace. - * - * @param {string} name - * @returns {Promise} - */ - @Cordova() - stopTrace(name: string): Promise { - return; - } - - /** - * Adds a new document to a Firestore collection, which will be allocated an auto-generated document ID. - * - * @param {object} document - document object to add to collection - * @param {string} collection - name of top-level collection to add document to. - * @param {Function} success - callback function to call on successfully adding the document. Will be passed a {string} argument containing the auto-generated document ID that the document was stored against. - * @param {Function} error - callback function which will be passed a {string} error message as an argument. - */ - @Cordova() - addDocumentToFirestoreCollection( - document: object, - collection: string, - success: (id: string) => void, - error: (err: string) => void - ): Promise { - return; - } - - /** - * Sets (adds/replaces) a document with the given ID in a Firestore collection. - * - * @param {string} documentId - document ID to use when setting document in the collection. - * @param {object} document - document object to set in collection. - * @param {string} collection - name of top-level collection to set document in. - * @param {Function} success - callback function to call on successfully setting the document. - * @param {Function} error - callback function which will be passed a {string} error message as an argument. - */ - @Cordova() - setDocumentInFirestoreCollection( - documentId: string, - document: object, - collection: string, - success: () => void, - error: (err: string) => void - ): Promise { - return; - } - - /** - * Updates an existing document with the given ID in a Firestore collection. This is a non-destructive update that will only - * overwrite existing keys in the existing document or add new ones if they don't already exist. If the no document with the - * specified ID exists in the collection, an error will be raised. - * - * @param {string} documentId - document ID of the document to update. - * @param {object} document - entire document or document fragment to update existing document with. - * @param {string} collection - name of top-level collection to update document in. - * @param {Function} success - callback function to call on successfully updating the document. - * @param {Function} error - callback function which will be passed a {string} error message as an argument. - */ - @Cordova() - updateDocumentInFirestoreCollection( - documentId: string, - document: object, - collection: string, - success: () => void, - error: (err: string) => void - ): Promise { - return; - } - - /** - * Deletes an existing document with the given ID in a Firestore collection. - * - Note: If the no document with the specified ID exists in the collection, the Firebase SDK will still return a successful outcome. - * - * @param {string} documentId - document ID of the document to delete. - * @param {string} collection - name of top-level collection to delete document in. - * @param {Function} success - callback function to call on successfully deleting the document. - * @param {Function} error - callback function which will be passed a {string} error message as an argument. - */ - @Cordova() - deleteDocumentFromFirestoreCollection( - documentId: string, - collection: string, - success: () => void, - error: (err: string) => void - ): Promise { - return; - } - - /** - * Fetches an existing document with the given ID from a Firestore collection. - * -Note: If the no document with the specified ID exists in the collection, the error callback will be invoked. - * - * @param {string} documentId - document ID of the document to fetch. - * @param {string} collection - name of top-level collection to fetch document from. - * @param {Function} success - callback function to call on successfully fetching the document. Will be passed an {object} contain the document contents. - * @param {Function} error - callback function which will be passed a {string} error message as an argument. - */ - @Cordova() - fetchDocumentInFirestoreCollection( - documentId: string, - collection: string, - success: (doc: any) => void, - error: (err: string) => void - ): Promise { - return; - } - - /** - * Fetches all the documents in the specific collection. - * - * @param {string} collection - name of top-level collection to fetch. - * @param {Function} success - callback function to call on successfully deleting the document. Will be passed an {object} containing all the documents in the collection, - * indexed by document ID. If a Firebase collection with that name does not exist or it contains no documents, the object will be empty. - * @param {Function} error - callback function which will be passed a {string} error message as an argument. - */ - @Cordova() - fetchFirestoreCollection( - collection: string, - success: (docs: any) => void, - error: (err: string) => void - ): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/firebase/index.ts b/src/@awesome-cordova-plugins/plugins/firebase/index.ts deleted file mode 100644 index 8c910756..00000000 --- a/src/@awesome-cordova-plugins/plugins/firebase/index.ts +++ /dev/null @@ -1,377 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name Firebase - * @capacitorincompatible true - * @description - * This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported (including iOS 10). - * @usage - * ```typescript - * import { Firebase } from '@awesome-cordova-plugins/firebase/ngx'; - * - * constructor(private firebase: Firebase) { } - * - * ... - * - * this.firebase.getToken() - * .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device - * .catch(error => console.error('Error getting token', error)); - * - * this.firebase.onNotificationOpen() - * .subscribe(data => console.log(`User opened a notification ${data}`)); - * - * this.firebase.onTokenRefresh() - * .subscribe((token: string) => console.log(`Got a new token ${token}`)); - * - * ``` - */ -@Plugin({ - pluginName: 'Firebase', - plugin: 'cordova-plugin-firebase', - pluginRef: 'FirebasePlugin', - repo: 'https://github.com/arnesson/cordova-plugin-firebase', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Firebase extends AwesomeCordovaNativePlugin { - /** - * Get the device token - * - * @returns {Promise} Note that token will be null if it has not been established yet - */ - @Cordova() - getToken(): Promise { - return; - } - - /** - * Get notified when a token is refreshed - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - onTokenRefresh(): Observable { - return; - } - - /** - * Get notified when the user opens a notification - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - onNotificationOpen(): Observable { - return; - } - - /** - * Grant permission to receive push notifications - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - grantPermission(): Promise { - return; - } - - /** - * Check permission to receive push notifications - * - * @returns {Promise<{isEnabled: boolean}>} - */ - @Cordova() - hasPermission(): Promise<{ isEnabled: boolean }> { - return; - } - - /** - * Set icon badge number. Set to 0 to clear the badge. - * - * @param {number} badgeNumber - * @returns {Promise} - */ - @Cordova() - setBadgeNumber(badgeNumber: number): Promise { - return; - } - - /** - * Get icon badge number - * - * @returns {Promise} - */ - @Cordova() - getBadgeNumber(): Promise { - return; - } - - /** - * Subscribe to a topic - * - * @param {string} topic - * @returns {Promise} - */ - @Cordova() - subscribe(topic: string): Promise { - return; - } - - /** - * Unsubscribe from a topic - * - * @param {string} topic - * @returns {Promise} - */ - @Cordova() - unsubscribe(topic: string): Promise { - return; - } - - /** - * Unregister from firebase, used to stop receiving push notifications. - * Call this when you logout user from your app. - */ - @Cordova() - unregister(): Promise { - return; - } - - /** - * Log an event using Analytics - * - * @param {string} type - * @param {Object} data - * @returns {Promise} - */ - @Cordova() - logEvent(type: string, data: any): Promise { - return; - } - - /** - * Log an Error using FirebaseCrash - * - * @param {string} message - * @returns {Promise} - */ - @Cordova() - logError(message: string): Promise { - return; - } - - /** - * Set the name of the current screen in Analytics - * - * @param {string} name Screen name - * @returns {Promise} - */ - @Cordova() - setScreenName(name: string): Promise { - return; - } - - /** - * Set a user id for use in Analytics - * - * @param {string} userId - * @returns {Promise} - */ - @Cordova() - setUserId(userId: string): Promise { - return; - } - - /** - * Set a user property for use in Analytics - * - * @param {string} name - * @param {string} value - * @returns {Promise} - */ - @Cordova() - setUserProperty(name: string, value: string): Promise { - return; - } - - /** - * Fetch Remote Config parameter values for your app - * - * @param {number} [cacheExpirationSeconds] - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - fetch(cacheExpirationSeconds?: number): Promise { - return; - } - - /** - * Activate the Remote Config fetched config - * - * @returns {Promise} - */ - @Cordova() - activateFetched(): Promise { - return; - } - - /** - * Retrieve a Remote Config value - * - * @param {string} key - * @param {string} [namespace] - * @returns {Promise} - */ - @Cordova({ - successIndex: 2, - errorIndex: 3, - }) - getValue(key: string, namespace?: string): Promise { - return; - } - - /** - * Retrieve a Remote Config byte array - * - * @param {string} key - * @param {string} [namespace] - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - getByteArray(key: string, namespace?: string): Promise { - return; - } - - /** - * Get the current state of the FirebaseRemoteConfig singleton object - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - getInfo(): Promise { - return; - } - - /** - * Change the settings for the FirebaseRemoteConfig object's operations - * - * @param {Object} settings - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - setConfigSettings(settings: any): Promise { - return; - } - - /** - * Set defaults in the Remote Config - * - * @param {Object} defaults - * @param {string} [namespace] - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - setDefaults(defaults: any, namespace?: string): Promise { - return; - } - - /** - * Start a trace. - * - * @param {string} trace Trace name - */ - @Cordova() - startTrace(trace: string): Promise { - return; - } - - /** - * To count the performance-related events that occur in your app (such as cache hits or retries), add a line of code - * similar to the following whenever the event occurs, using a string other than retry to name that event if you are - * counting a different type of event: - * - * @param {string} trace Trace name - * @param {string} counter Counter - */ - @Cordova() - incrementCounter(trace: string, counter: string): Promise { - return; - } - - /** - * Stop the trace - * - * @param {string} trace Trace name - */ - @Cordova() - stopTrace(trace: string): void {} - - /** - * Allows the user to enable/disable analytics collection - * - * @param {boolean} enabled value to set collection - * @returns {Promise} - */ - @Cordova() - setAnalyticsCollectionEnabled(enabled: boolean): Promise { - return; - } - - /** - * Allows the user to set User Identifier for crashlytics reporting - * https://firebase.google.com/docs/crashlytics/customize-crash-reports?authuser=0#set_user_ids - * - * @param {string} userId value to set the userId - * @returns {Promise} - */ - @Cordova() - setCrashlyticsUserId(userId: string): Promise { - return; - } - - /** - * Sends an SMS to the user with the SMS verification code and returns the Verification ID required to sign in using phone authentication - * - * @param {string} phoneNumber The phone number, including '+' and country code - * @param {number} timeoutDuration (Android only) The timeout in sec - no more SMS will be sent to this number until this timeout expires - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android', 'iOS'], - successIndex: 2, - errorIndex: 3, - }) - verifyPhoneNumber(phoneNumber: string, timeoutDuration = 0): Promise { - return; - } - - /** - * Clear all pending notifications from the drawer - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - clearAllNotifications(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/flashlight/index.ts b/src/@awesome-cordova-plugins/plugins/flashlight/index.ts deleted file mode 100644 index 3aa7f8f2..00000000 --- a/src/@awesome-cordova-plugins/plugins/flashlight/index.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Flashlight - * @description This plugin allows you to switch the flashlight / torch of the device on and off. - * - * Requires Cordova plugin: `cordova-plugin-flashlight`. For more info, please see the [Flashlight plugin docs](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin). - * @usage - * ```typescript - * import { Flashlight } from '@awesome-cordova-plugins/flashlight/ngx'; - * - * constructor(private flashlight: Flashlight) { } - * - * ... - * - * this.flashlight.switchOn(); - * - * ``` - */ -@Plugin({ - pluginName: 'Flashlight', - plugin: 'cordova-plugin-flashlight', - pluginRef: 'window.plugins.flashlight', - repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin', - platforms: ['Android', 'iOS', 'Windows Phone 8'], -}) -@Injectable() -export class Flashlight extends AwesomeCordovaNativePlugin { - /** - * Checks if the flashlight is available - * - * @returns {Promise} Returns a promise that resolves with a boolean stating if the flashlight is available. - */ - @Cordova() - available(): Promise { - return; - } - - /** - * Switches the flashlight on - * - * @returns {Promise} - */ - @Cordova() - switchOn(): Promise { - return; - } - - /** - * Switches the flashlight off - * - * @returns {Promise} - */ - @Cordova() - switchOff(): Promise { - return; - } - - /** - * Toggles the flashlight - * - * @returns {Promise} - */ - @Cordova() - toggle(): Promise { - return; - } - - /** - * Checks if the flashlight is turned on. - * - * @returns {boolean} - */ - @Cordova({ - sync: true, - }) - isSwitchedOn(): boolean { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/foreground-service/index.ts b/src/@awesome-cordova-plugins/plugins/foreground-service/index.ts deleted file mode 100644 index c9acc2ad..00000000 --- a/src/@awesome-cordova-plugins/plugins/foreground-service/index.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Foreground Service - * @description - * This plugin allows for android devices to continue running services in the background, using a - * foreground ongoing notification. This is targeted towards use with plugins such as - * 'cordova-geolocation' that will not run while the app is in the background on android API 26+. - * - * For android API 28+, the following xml snippet should be inserted into ```config.xml```: - * - * ``` - * ... - * - * - * - * - * ... - * ``` - * @usage - * ```typescript - * import { ForegroundService } from '@awesome-cordova-plugins/foreground-service/ngx'; - * - * - * constructor(public foregroundService: ForegroundService) { } - * - * ... - * - * startService() { - * // Notification importance is optional, the default is 1 - Low (no sound or vibration) - * this.foregroundService.start('GPS Running', 'Background Service', 'drawable/fsicon'); - * } - * - * stopService() { - * // Disable the foreground service - * this.foregroundService.stop(); - * } - * - * ``` - */ -@Plugin({ - pluginName: 'ForegroundService', - plugin: 'cordova-plugin-foreground-service', - pluginRef: 'cordova.plugins.foregroundService', - repo: 'https://github.com/DavidBriglio/cordova-plugin-foreground-service', - platforms: ['Android'], -}) -@Injectable() -export class ForegroundService extends AwesomeCordovaNativePlugin { - /** - * Enables the foreground service - * - * @param {string} title (content title) A brief headline for the notification - * @param {string} text (content text) Supporting information - * @param {string} icon The drawable icon can be any drawable image that exists in the resource folder. This means you must copy the icon you want to use into the platforms/android/app/src/main/res/drawable folder set. If no icon can be found using the icon name parameter, a default star icon will be used. - * - * For an example, if the `fsicon.png` (see xml below) resides here: ```src/assets/icon/fsicon.png```. Then ```icon``` parameter value would be ```'drawable/fsicon'```. In order for this example to work, the following xml snippet must be in ```config.xml```. - * - * ``` - * - * - * ... - * ``` - * @param {number} importance Notification importance dictates how the notification is initially presented: - * - * Value | Importance | Description | Examples - * --- | --- | --- | --- - * 1|IMPORTANCE_LOW|Does not make a sound or heads-up display (plugin's default)|New content the user has subscribed to, social network invitations - * 2|IMPORTANCE_DEFAULT|Makes a sound, but no heads-up display|Traffic alerts, task reminders - * 3|IMPORTANCE_HIGH|Makes a sound and heads-up display|Text messages, alarms, phone calls - * @param {number} id The notification id is a customizable integer that is used to reference the notification that will be launched. This is customizable to avoid conflicting with any other notifications. If this is not included, a [*unique*] default id will be used. - * @see https://material.io/design/platform-guidance/android-notifications.html - */ - @Cordova({ - sync: true, - }) - start(title: string, text: string, icon?: string, importance: 1 | 2 | 3 = 1, id = 0): void { - return; - } - - /** - * Disables the foreground service - */ - @Cordova({ - sync: true, - }) - stop(): void { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/ftp/index.ts b/src/@awesome-cordova-plugins/plugins/ftp/index.ts deleted file mode 100644 index e1ff6180..00000000 --- a/src/@awesome-cordova-plugins/plugins/ftp/index.ts +++ /dev/null @@ -1,154 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name FTP - * @description - * This cordova plugin is created to use ftp (client) in web/js. - * @usage - * ```typescript - * import { FTP } from '@awesome-cordova-plugins/ftp/ngx'; - * - * - * constructor(private fTP: FTP) { } - * - * ... - * - * - * this.fTP.connect('ftp_host', 'ftp_user', 'ftp_password') - * .then((res: any) => console.log('Login successful', res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'FTP', - plugin: 'cordova-plugin-ftp', - pluginRef: 'cordova.plugin.ftp', - repo: 'https://github.com/xfally/cordova-plugin-ftp', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class FTP extends AwesomeCordovaNativePlugin { - /** - * Connect to one ftp server. - * - * Just need to init the connection once. If success, you can do any ftp actions later. - * - * @param {string} hostname The ftp server url. Like ip without protocol prefix, e.g. "192.168.1.1". - * @param {string} username The ftp login username. If it and `password` are all blank/undefined, the default username "anonymous" is used. - * @param {string} password The ftp login password. If it and `username` are all blank/undefined, the default password "anonymous@" is used. - * @returns {Promise} The success callback. Notice: For iOS, if triggered, means `init` success, but NOT means the later action, e.g. `ls`... `download` will success! - */ - @Cordova() - connect(hostname: string, username: string, password: string): Promise { - return; - } - - /** - * List files (with info of `name`, `type`, `link`, `size`, `modifiedDate`) under one directory on the ftp server. - * You can get one file's name using `fileList[x].name` (`x` is the location in array). - * - * Explain key: - * - name: file name (utf-8). - * - type: file type. number `0` means regular file, `1` means directory, `2` means symbolic link, `-1` means unknown type (maybe block dev, char dev...). - * - link: if the file is a symbolic link, then this field store symbolic link information (utf-8), else it's a blank string. - * - size: file size in bytes. - * - modifiedDate: modified date of this file. date format is `yyyy-MM-dd HH:mm:ss zzz`, e.g "2015-12-01 20:45:00 GMT+8". - * - * @param {string} path The path on the ftp server. e.g. "/adf/123/". - * @returns {Promise} Returns a promise - */ - @Cordova() - ls(path: string): Promise { - return; - } - - /** - * Create one directory on the ftp server. - * - * @param {string} path The path on the ftp server. e.g. "/adf/123/". - * @returns {Promise} Returns a promise - */ - @Cordova() - mkdir(path: string): Promise { - return; - } - - /** - * Delete one directory on the ftp server. - * - * Tip: As many ftp server could not rm dir when it's not empty, so rm all files under the dir at first is recommended. - * - * @param {string} path The file (with full path) you want to delete. e.g. "/adf/123/newDir/myFile". - * @returns {Promise} Returns a promise - */ - @Cordova() - rmdir(path: string): Promise { - return; - } - - /** - * Delete one file on the ftp server. - * - * @param {string} file The file (with full path) you want to delete. e.g. "/adf/123/newDir/myFile". - * @returns {Promise} Returns a promise - */ - @Cordova() - rm(file: string): Promise { - return; - } - - /** - * Upload one local file to the ftp server. - * - * @param {string} localFile The file (with full path) you want to upload. e.g. "/local/path/to/localFile". - * @param {string} remoteFile The file (with full path) you want to located on the ftp server. e.g. "/adf/123/newDir/remoteFile". - * @returns {Observable} Returns an observable. - * It will be triggered many times according the file's size. - * The arg `0`, `0.1xx`, `0.2xx` ... `1` means the upload percent. When it reach `1`, means success. - */ - @Cordova({ - observable: true, - }) - upload(localFile: string, remoteFile: string): Observable { - return; - } - - /** - * Download one remote file on the ftp server to local path. - * - * @param {string} localFile The file (with full path) you want to upload. e.g. "/local/path/to/localFile". - * @param {string} remoteFile The file (with full path) you want to located on the ftp server. e.g. "/adf/123/newDir/remoteFile". - * @returns {Observable} Returns an observable. - * It will be triggered many times according the file's size. - * The arg `0`, `0.1xx`, `0.2xx` ... `1` means the upload percent. When it reach `1`, means success. - */ - @Cordova({ - observable: true, - }) - download(localFile: string, remoteFile: string): Observable { - return; - } - - /** - * Cancel all requests. Always success. - * - * @returns {Promise} Returns a promise - */ - @Cordova() - cancel(): Promise { - return; - } - - /** - * Disconnect from ftp server. - * - * @returns {Promise} Returns a promise - */ - @Cordova() - disconnect(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/gao-de-location/index.ts b/src/@awesome-cordova-plugins/plugins/gao-de-location/index.ts deleted file mode 100644 index 787605dd..00000000 --- a/src/@awesome-cordova-plugins/plugins/gao-de-location/index.ts +++ /dev/null @@ -1,353 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name Gao De Location - * @description - * Because the original GPS positioning uses Google Browser positioning, and Google withdraws from China, resulting in GPS Android positioning can not be positioned. - * Gaode location can directly return address informationGaode location can directly return address information - * @usage - * ```typescript - * import { GaoDeLocation } from '@awesome-cordova-plugins/gao-de-location/ngx'; - * - * - * constructor(private gaoDeLocation: GaoDeLocation) { } - * - * - * const positionOptions: PositionOptions = { - * androidOption: { - * locationMode: LocationModeEnum.Hight_Accuracy, - * gpsFirst: false, - * HttpTimeOut: 30000, - * interval: 2000, - * needAddress: true, - * onceLocation: false, - * onceLocationLatest: false, - * locationProtocol: LocationProtocolEnum.HTTP, - * sensorEnable: false, - * wifiScan: true, - * locationCacheEnable: true - * }, iosOption: { - * desiredAccuracy: DesiredAccuracyEnum.kCLLocationAccuracyBest, - * pausesLocationUpdatesAutomatically: 'YES', - * allowsBackgroundLocationUpdates: 'NO', - * locationTimeout: 10, - * reGeocodeTimeout: 5, - * } - * }; - * const positionRes: PositionRes = await this.gaoDeLocation.getCurrentPosition(positionOptions).catch((e: any) => { - * console.log(e); - * }) || null; - * console.log(JSON.stringify(positionRes)); - * - * - * this.gaoDeLocation.startSerialLocation(positionOptions).subscribe((positionRes: PositionRes) => { - * console.log(JSON.stringify(positionRes)); - * }); - * - * const positionRes: any = this.gaoDeLocation.stopSerialLocation().catch((e) => { - * console.log(e); - * }) || null; - * console.log(JSON.stringify(positionRes)); - * - * ``` - */ -@Plugin({ - pluginName: 'GaoDeLocation', - plugin: 'cordova-plugin-gaodelocation-chenyu', - pluginRef: 'GaoDe', - repo: 'https://github.com/waliu/cordova-plugin-gaodelocation-chenyu.git', - install: - 'ionic cordova plugin add cordova-plugin-gaodelocation-chenyu --variable ANDROID_API_KEY=your android key --variable IOS_API_KEY=your ios key', - installVariables: ['ANDROID_API_KEY', 'IOS_API_KEY'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class GaoDeLocation extends AwesomeCordovaNativePlugin { - /** - * Single location - * - * @param positionOptions - * @returns Promise - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getCurrentPosition(positionOptions: PositionOptions): Promise { - return; - } - - /** - * Start serial location - * - * @param positionOptions - * @returns Promise - */ - @Cordova({ - callbackOrder: 'reverse', - observable: true, - }) - startSerialLocation(positionOptions: PositionOptions): Observable { - return; - } - - /** - * Stop Serial Location - * - * @returns Promise - */ - @Cordova({ - callbackOrder: 'reverse', - }) - stopSerialLocation(): Promise { - return; - } -} - -/** - * Location parameter - */ -export interface PositionOptions { - /** - * android options - */ - androidOption: AndroidOptions; - /** - * ios options - */ - iosOption: IosOptions; -} - -/** - * android positioning accuracy - */ -export interface AndroidOptions { - /** - * location mode - */ - locationMode: LocationModeEnum; - /** - * gps first - */ - gpsFirst: boolean; - /** - * Http timeOut - */ - HttpTimeOut: number; - /** - * Location interval - */ - interval: number; - /** - * Open reverse address - */ - needAddress: boolean; - /** - * once location - */ - onceLocation: boolean; - /** - * once location latest - */ - onceLocationLatest: boolean; - /** - * location protocol - */ - locationProtocol: LocationProtocolEnum; - /** - * sensor enable - */ - sensorEnable: boolean; - /** - * wifi scan - */ - wifiScan: boolean; - /** - * location cache enable - */ - locationCacheEnable: boolean; -} - -/** - * - * IOS positioning parameters - * - */ -export interface IosOptions { - /** - * desired accuracy - */ - desiredAccuracy?: DesiredAccuracyEnum; - /** - * pauses location updates automatically - */ - pausesLocationUpdatesAutomatically: IosBoolean; - /** - * allows background location updates - */ - allowsBackgroundLocationUpdates: IosBoolean; - /** - * location timeout - */ - locationTimeout: number; - /** - * re geocode timeout - */ - reGeocodeTimeout?: number; - /** - * locating with re geocode - */ - locatingWithReGeocode?: IosBoolean; -} - -/** - * ios positioning accuracy - * https://developer.apple.com/documentation/corelocation/kcllocationaccuracybestfornavigation - */ -export enum DesiredAccuracyEnum { - /** - * The highest possible accuracy that uses additional sensor data to facilitate navigation apps. - */ - kCLLocationAccuracyBestForNavigation = 1, - /** - * The best level of accuracy available. - */ - kCLLocationAccuracyBest = 2, - /** - * Accurate to within ten meters of the desired target. - */ - kCLLocationAccuracyNearestTenMeters = 3, - /** - * Accurate to within one hundred meters. - */ - kCLLocationAccuracyHundredMeters = 4, - /** - * Accurate to the nearest kilometer. - */ - kCLLocationAccuracyKilometer = 5, - /** - * Accurate to the nearest three kilometers. - */ - kCLLocationAccuracyThreeKilometers = 6, -} - -/** - * locationModeEnum - */ -export enum LocationModeEnum { - Hight_Accuracy = 1, - Battery_Saving = 2, - Device_Sensors = 3, -} - -/** - * locationProtocolEnum - */ -export enum LocationProtocolEnum { - HTTP = 1, - HTTPS = 2, -} - -/** - * ios boolean - */ -export declare type IosBoolean = 'YES' | 'NO'; - -/** - * Positioning return result - */ -export interface PositionRes { - /** - * Status code - */ - code: number; - /** - * latitude - */ - latitude: string; - /** - * longitude - */ - longitude: string; - /** - * accuracy - */ - accuracy: string; - /** - * address - */ - formattedAddress: string; - /** - * country - */ - country: string; - /** - * province - */ - province: string; - /** - * city - */ - city: string; - /** - * district - */ - district: string; - /** - * citycode - */ - citycode: string; - /** - * adcode - */ - adcode: string; - /** - * street - */ - street: string; - /** - * Street number information - */ - number: string; - /** - * POI name - */ - POIName: string; - /** - * AOI Name - */ - AOIName: string; - /** - * altitude - */ - altitude?: string; - /** - * speed - */ - speed?: string; - /** - * bearing - */ - bearing?: string; - /** - * building id - */ - buildingId?: string; - /** - * floor - */ - floor?: string; - /** - * gps accuracy status - */ - gpsAccuracyStatus?: string; - /** - * Get location result source - */ - locationType?: string; - /** - * Location detail - */ - locationDetail?: string; -} diff --git a/src/@awesome-cordova-plugins/plugins/gcdwebserver/index.ts b/src/@awesome-cordova-plugins/plugins/gcdwebserver/index.ts deleted file mode 100755 index ba0012a7..00000000 --- a/src/@awesome-cordova-plugins/plugins/gcdwebserver/index.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Plugin, - Cordova, - CordovaProperty, - CordovaInstance, - InstanceProperty, - AwesomeCordovaNativePlugin, -} from '@awesome-cordova-plugins/core'; - -export interface ServerOptions { - port?: number; - folder?: string; -} - -/** - * @name gcdwebserver - * @description - * This plugin can start an HTTP server using GCDWebServer - * - * @usage - * ```typescript - * import { GCDWebServer } from '@awesome-cordova-plugins/gcdwebserver'; - * - * - * constructor(private gcdwebserver: GCDWebServer) { } - * - * ... - * - * - * await this.gcdwebserver.startServer({}); - * - * - * ``` - */ -@Plugin({ - pluginName: 'gcdwebserver', - plugin: 'cordova-plugin-gcdwebserver', - pluginRef: 'cordova.plugins.GCDServer', - repo: 'https://github.com/xulihang/cordova-plugin-gcdwebserver', - install: '', - installVariables: [], - platforms: ['iOS'], -}) -@Injectable() -export class GCDWebServer extends AwesomeCordovaNativePlugin { - /** - * start the server - * @param options {ServerOptions} - * @return {Promise} Returns a promise - */ - @Cordova({ - successIndex: 1, - errorIndex: 2 - }) - startServer(options: ServerOptions): Promise { - return; - } - - /** - * stop the server - * @return {Promise} Returns a promise - */ - @Cordova({ successIndex: 1, errorIndex: 2 }) - stopServer(): Promise { - return; - } - -} diff --git a/src/@awesome-cordova-plugins/plugins/ge-tui-sdk-plugin/index.ts b/src/@awesome-cordova-plugins/plugins/ge-tui-sdk-plugin/index.ts deleted file mode 100644 index 26388a7f..00000000 --- a/src/@awesome-cordova-plugins/plugins/ge-tui-sdk-plugin/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Ge Tui Sdk Plugin - * @description - * This plugin does something - * @usage - * ```typescript - * import { GeTuiSdkPlugin } from '@awesome-cordova-plugins/ge-tui-sdk-plugin'; - * - * - * constructor(private geTuiSdkPlugin: GeTuiSdkPlugin) { } - * - * this.geTuiSdkPlugin.callback_init((res) => { console.log(res)}); - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * this.geTuiSdkPlugin.initialize(); - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * this.geTuiSdkPlugin.getClientId(); - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * this.geTuiSdkPlugin.getVersion(); - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'GeTuiSdkPlugin', - plugin: 'cordova-plugin-getuisdk', - pluginRef: 'GeTuiSdkPlugin', - repo: 'git@github.com:GetuiLaboratory/cordova-plugin-getuisdk.git', - install: - 'cordova plugin add cordova-plugin-getuisdk --variable PUSH_APPID=your appid --variable PUSH_APPKEY=your appkey --variable PUSH_APPSECRET=your appsecret', - installVariables: ['PUSH_APPID', 'PUSH_APPKEY', 'PUSH_APPSECRET'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class GeTuiSdkPlugin extends AwesomeCordovaNativePlugin { - @Cordova() - callback_init(callback: Function): Promise { - return; - } - - @Cordova({ - sync: true, - }) - initialize() { - return; - } - - @Cordova() - getClientId(): Promise { - return; - } - - @Cordova() - getVersion(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/geolocation/index.ts b/src/@awesome-cordova-plugins/plugins/geolocation/index.ts deleted file mode 100644 index b6e304b2..00000000 --- a/src/@awesome-cordova-plugins/plugins/geolocation/index.ts +++ /dev/null @@ -1,206 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -declare const navigator: any; - -export interface Coordinates { - /** - * a double representing the position's latitude in decimal degrees. - */ - latitude: number; - - /** - * A double representing the position's longitude in decimal degrees. - */ - longitude: number; - - /** - * A double representing the accuracy of the latitude and longitude properties, - * expressed in meters. - */ - accuracy: number; - - /** - * A double representing the position's altitude in metres, relative to sea - * level. This value can be null if the implementation cannot provide the data. - */ - altitude: number; - - /** - * A double representing the accuracy of the altitude expressed in meters. - * This value can be null. - */ - altitudeAccuracy: number; - - /** - * A double representing the direction in which the device is traveling. This - * value, specified in degrees, indicates how far off from heading true north - * the device is. 0 degrees represents true north, and the direction is - * determined clockwise (which means that east is 90 degrees and west is 270 - * degrees). If speed is 0, heading is NaN. If the device is unable to provide - * heading information, this value is null. - */ - heading: number; - - /** - * A double representing the velocity of the device in meters per second. - * This value can be null. - */ - speed: number; -} - -export interface Geoposition { - /** - * A Coordinates object defining the current location - */ - coords: Coordinates; - - /** - * A timestamp representing the time at which the location was retrieved. - */ - timestamp: number; -} - -export interface PositionError { - /** - * A code that indicates the error that occurred - */ - code: number; - - /** - * A message that can describe the error that occurred - */ - message: string; -} - -export interface GeolocationOptions { - /** - * Is a positive long value indicating the maximum age in milliseconds of a - * possible cached position that is acceptable to return. If set to 0, it - * means that the device cannot use a cached position and must attempt to - * retrieve the real current position. If set to Infinity the device must - * return a cached position regardless of its age. Default: 0. - */ - maximumAge?: number; - - /** - * Is a positive long value representing the maximum length of time - * (in milliseconds) the device is allowed to take in order to return a - * position. The default value is Infinity, meaning that getCurrentPosition() - * won't return until the position is available. - */ - timeout?: number; - - /** - * Indicates the application would like to receive the best possible results. - * If true and if the device is able to provide a more accurate position, it - * will do so. Note that this can result in slower response times or increased - * power consumption (with a GPS chip on a mobile device for example). On the - * other hand, if false, the device can take the liberty to save resources by - * responding more quickly and/or using less power. Default: false. - * - * @type {boolean} - */ - enableHighAccuracy?: boolean; -} - -/** - * @name Geolocation - * @premier geolocation - * @description - * This plugin provides information about the device's location, such as latitude and longitude. Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs. - * - * This API is based on the W3C Geolocation API Specification, and only executes on devices that don't already provide an implementation. - * - * For iOS you have to add this configuration to your configuration.xml file - * ```xml - * - * We use your location for full functionality of certain app features. - * - * ``` - * @usage - * - * ```typescript - * import { Geolocation } from '@awesome-cordova-plugins/geolocation/ngx'; - * - * ... - * - * constructor(private geolocation: Geolocation) {} - * - * ... - * - * this.geolocation.getCurrentPosition().then((resp) => { - * // resp.coords.latitude - * // resp.coords.longitude - * }).catch((error) => { - * console.log('Error getting location', error); - * }); - * - * let watch = this.geolocation.watchPosition(); - * watch.subscribe((data) => { - * // data can be a set of coordinates, or an error (if an error occurred). - * // data.coords.latitude - * // data.coords.longitude - * }); - * ``` - * @interfaces - * Coordinates - * Geoposition - * PositionError - * GeolocationOptions - */ -@Plugin({ - pluginName: 'Geolocation', - plugin: 'cordova-plugin-geolocation', - pluginRef: 'navigator.geolocation', - repo: 'https://github.com/apache/cordova-plugin-geolocation', - install: - 'ionic cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="To locate you"', - installVariables: ['GEOLOCATION_USAGE_DESCRIPTION'], - platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class Geolocation extends AwesomeCordovaNativePlugin { - /** - * Get the device's current position. - * - * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions). - * @returns {Promise} Returns a Promise that resolves with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or rejects with an error. - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getCurrentPosition(options?: GeolocationOptions): Promise { - return; - } - - /** - * Watch the current device's position. Clear the watch by unsubscribing from - * Observable changes. - * - * ```typescript - * const subscription = this.geolocation.watchPosition() - * .filter((p) => p.coords !== undefined) //Filter Out Errors - * .subscribe(position => { - * console.log(position.coords.longitude + ' ' + position.coords.latitude); - * }); - * - * // To stop notifications - * subscription.unsubscribe(); - * ``` - * - * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions). - * @returns {Observable} Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors. - */ - watchPosition(options?: GeolocationOptions): Observable { - return new Observable((observer: any) => { - const watchId = navigator.geolocation.watchPosition( - observer.next.bind(observer), - observer.next.bind(observer), - options - ); - return () => navigator.geolocation.clearWatch(watchId); - }); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/globalization/index.ts b/src/@awesome-cordova-plugins/plugins/globalization/index.ts deleted file mode 100644 index 118d19e7..00000000 --- a/src/@awesome-cordova-plugins/plugins/globalization/index.ts +++ /dev/null @@ -1,231 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface GlobalizationOptions { - formatLength: string; - selector: string; -} - -/** - * @name Globalization - * @premier globalization - * @description - * This plugin obtains information and performs operations specific to the user's locale, language, and timezone. - * @deprecated - * With the [ECMA Internationalization API](https://www.ecma-international.org/ecma-402/1.0/) now supported on iOS, Android and Windows devices, this plugin is not required any more. - * Migrating from this plugin to the [ECMA Internationalization API](https://www.ecma-international.org/ecma-402/1.0/) is explained in this [Cordova blog post](https://cordova.apache.org/news/2017/11/20/migrate-from-cordova-globalization-plugin.html). - * @usage - * ```typescript - * import { Globalization } from '@awesome-cordova-plugins/globalization/ngx'; - * - * constructor(private globalization: Globalization) { } - * - * - * ... - * - * - * this.globalization.getPreferredLanguage() - * .then(res => console.log(res)) - * .catch(e => console.log(e)); - * - * - * ``` - * @interfaces - * GlobalizationOptions - */ -@Plugin({ - pluginName: 'Globalization', - plugin: 'cordova-plugin-globalization', - pluginRef: 'navigator.globalization', - repo: 'https://github.com/apache/cordova-plugin-globalization', - platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class Globalization extends AwesomeCordovaNativePlugin { - /** - * Returns the BCP-47 compliant language identifier tag to the successCallback with a properties object as a parameter. That object should have a value property with a String value. - * - * @returns {Promise<{value: string}>} - */ - @Cordova() - getPreferredLanguage(): Promise<{ value: string }> { - return; - } - - /** - * Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter. - * - * @returns {Promise<{value: string}>} - */ - @Cordova() - getLocaleName(): Promise<{ value: string }> { - return; - } - - /** - * Converts date to string - * - * @param {Date} date Date you wish to convert - * @param options Options for the converted date. Length, selector. - * @returns {Promise<{value: string}>} Returns a promise when the date has been converted. - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - dateToString(date: Date, options: GlobalizationOptions): Promise<{ value: string }> { - return; - } - - /** - * Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object. - * - * @param {string} dateString Date as a string to be converted - * @param options Options for the converted date. Length, selector. - * @returns {Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }>} Returns a promise when the date has been converted. - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - stringToDate( - dateString: string, - options: GlobalizationOptions - ): Promise<{ - year: number; - month: number; - day: number; - hour: number; - minute: number; - second: number; - millisecond: number; - }> { - return; - } - - /** - * Returns a pattern string to format and parse dates according to the client's user preferences. - * - * @param options Object with the format length and selector - * @returns {Promise<{ pattern: string, timezone: string, utc_offset: number, dst_offset: number }>} Returns a promise. - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getDatePattern(options: GlobalizationOptions): Promise<{ - pattern: string; - timezone: string; - iana_timezone: string; - utc_offset: number; - dst_offset: number; - }> { - return; - } - - /** - * Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar. - * - * @param options Object with type (narrow or wide) and item (month or days). - * @param options.type - * @param options.item - * @returns {Promise<{value: string[]}>} Returns a promise. - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getDateNames(options: { type: string; item: string }): Promise<{ value: string[] }> { - return; - } - - /** - * Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar. - * - * @param {data} date Date to process - * @returns {Promise<{dst: string}>} reutrns a promise with the value - */ - @Cordova() - isDayLightSavingsTime(date: Date): Promise<{ dst: string }> { - return; - } - - /** - * Returns the first day of the week according to the client's user preferences and calendar. - * - * @returns {Promise<{value: string}>} returns a promise with the value - */ - @Cordova() - getFirstDayOfWeek(): Promise<{ value: string }> { - return; - } - - /** - * Returns a number formatted as a string according to the client's user preferences. - * - * @param numberToConvert {Number} The number to convert - * @param options {Object} Object with property `type` that can be set to: decimal, percent, or currency. - * @param options.type - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - numberToString(numberToConvert: number, options: { type: string }): Promise<{ value: string }> { - return; - } - - /** - * - * @param {string} stringToConvert String you want to conver to a number - * @param options The type of number you want to return. Can be decimal, percent, or currency. - * @param options.type - * @returns {Promise<{ value: number | string }>} Returns a promise with the value. - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - stringToNumber(stringToConvert: string, options: { type: string }): Promise<{ value: number | string }> { - return; - } - - /** - * Returns a pattern string to format and parse numbers according to the client's user preferences. - * - * @param options Can be decimal, percent, or currency. - * @param options.type - * @returns {Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }>} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getNumberPattern(options: { type: string }): Promise<{ - pattern: string; - symbol: string; - fraction: number; - rounding: number; - positive: string; - negative: string; - decimal: string; - grouping: string; - }> { - return; - } - - /** - * Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code. - * - * @param {string} currencyCode Currency Code.A - * @returns {Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }>} - */ - @Cordova() - getCurrencyPattern(currencyCode: string): Promise<{ - pattern: string; - code: string; - fraction: number; - rounding: number; - decimal: number; - grouping: string; - }> { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/google-analytics/index.ts b/src/@awesome-cordova-plugins/plugins/google-analytics/index.ts deleted file mode 100644 index c1d499b5..00000000 --- a/src/@awesome-cordova-plugins/plugins/google-analytics/index.ts +++ /dev/null @@ -1,309 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Google Analytics - * @description - * This plugin connects to Google's native Universal Analytics SDK - * Prerequisites: - * - A Cordova 3.0+ project for iOS and/or Android - * - A Mobile App property through the Google Analytics Admin Console - * - (Android) Google Play Services SDK installed via [Android SDK Manager](https://developer.android.com/sdk/installing/adding-packages.html) - * @usage - * ```typescript - * import { GoogleAnalytics } from '@awesome-cordova-plugins/google-analytics/ngx'; - * - * constructor(private ga: GoogleAnalytics) { } - * - * ... - * - * this.ga.startTrackerWithId('YOUR_TRACKER_ID') - * .then(() => { - * console.log('Google analytics is ready now'); - * this.ga.trackView('test'); - * // Tracker is ready - * // You can now track pages or set additional information such as AppVersion or UserId - * }) - * .catch(e => console.log('Error starting GoogleAnalytics', e)); - * - * - * ``` - */ -@Plugin({ - pluginName: 'GoogleAnalytics', - plugin: 'cordova-plugin-google-analytics', - pluginRef: 'ga', - repo: 'https://github.com/danwilson/google-analytics-plugin', - platforms: ['Android', 'Browser', 'iOS', 'Windows Phone 8'], -}) -@Injectable() -export class GoogleAnalytics extends AwesomeCordovaNativePlugin { - /** - * In your 'deviceready' handler, set up your Analytics tracker. - * https://developers.google.com/analytics/devguides/collection/analyticsjs/ - * - * @param {string} id Your Google Analytics Mobile App property - * @param {number} interval Optional dispatch period in seconds. Defaults to 30. - * @returns {Promise} - */ - @Cordova({ - successIndex: 2, - errorIndex: 3, - }) - startTrackerWithId(id: string, interval?: number): Promise { - return; - } - - /** - * Enabling Advertising Features in Google Analytics allows you to take advantage of Remarketing, Demographics & Interests reports, and more - * - * @param allow {boolean} - * @returns {Promise} - */ - @Cordova() - setAllowIDFACollection(allow: boolean): Promise { - return; - } - - /** - * Set a UserId - * https://developers.google.com/analytics/devguides/collection/analyticsjs/user-id - * - * @param {string} id User ID - * @returns {Promise} - */ - @Cordova() - setUserId(id: string): Promise { - return; - } - - /** - * Set a anonymize Ip address - * - * @param anonymize {boolean} Set to true to anonymize the IP Address - * @returns {Promise} - */ - @Cordova() - setAnonymizeIp(anonymize: boolean): Promise { - return; - } - - /** - * Set the app version - * - * @param appVersion {string} App version - * @returns {Promise} - */ - @Cordova() - setAppVersion(appVersion: string): Promise { - return; - } - - /** - * Get a variable - * - * @param key {string} Variable - * @returns {Promise} - */ - @Cordova() - getVar(key: string): Promise { - return; - } - - /** - * Set a variable - * - * @param key {string} Variable - * @param value {string} Parameter - * @returns {Promise} - */ - @Cordova() - setVar(key: string, value: string): Promise { - return; - } - - /** - * Set OptOut - * - * @param optout {boolean} - * @returns {Promise} - */ - @Cordova() - setOptOut(optout: boolean): Promise { - return; - } - - /** - * Enable verbose logging - * - * @returns {Promise} - */ - @Cordova() - debugMode(): Promise { - return; - } - - /** - * Track custom metric - * - * @param key {number} - * @param value {any} - * @returns {Promise} - */ - @Cordova({ - successIndex: 2, - errorIndex: 3, - }) - trackMetric(key: number, value?: number): Promise { - return; - } - - /** - * Track a screen - * https://developers.google.com/analytics/devguides/collection/analyticsjs/screens - * - * @param title {string} Screen title - * @param campaignUrl {string} Campaign url for measuring referrals - * @param newSession {boolean} Set to true to create a new session - * @returns {Promise} - */ - @Cordova({ - successIndex: 3, - errorIndex: 4, - }) - trackView(title: string, campaignUrl?: string, newSession?: boolean): Promise { - return; - } - - /** - * Add a Custom Dimension - * https://developers.google.com/analytics/devguides/platform/customdimsmets - * - * @param key {number} - * @param value {string} - * @returns {Promise} - */ - @Cordova() - addCustomDimension(key: number, value: string): Promise { - return; - } - - /** - * Track an event - * https://developers.google.com/analytics/devguides/collection/analyticsjs/events - * - * @param category {string} - * @param action {string} - * @param label {string} - * @param value {number} - * @param newSession {boolean} Set to true to create a new session - * @returns {Promise} - */ - @Cordova({ - successIndex: 5, - errorIndex: 6, - }) - trackEvent(category: string, action: string, label?: string, value?: number, newSession?: boolean): Promise { - return; - } - - /** - * Track an exception - * - * @param description {string} - * @param fatal {boolean} - * @returns {Promise} - */ - @Cordova() - trackException(description: string, fatal: boolean): Promise { - return; - } - - /** - * Track User Timing (App Speed) - * - * @param category {string} - * @param intervalInMilliseconds {number} - * @param variable {string} - * @param label {string} - * @returns {Promise} - */ - @Cordova() - trackTiming(category: string, intervalInMilliseconds: number, variable: string, label: string): Promise { - return; - } - - /** - * Add a Transaction (Ecommerce) - * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addTrans - * - * @param id {string} - * @param affiliation {string} - * @param revenue {number} - * @param tax {number} - * @param shipping {number} - * @param currencyCode {string} - * @returns {Promise} - */ - @Cordova() - addTransaction( - id: string, - affiliation: string, - revenue: number, - tax: number, - shipping: number, - currencyCode: string - ): Promise { - return; - } - - /** - * Add a Transaction Item (Ecommerce) - * https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#addItem - * - * @param {string} id - * @param {string} name - * @param {string} sku - * @param {string} category - * @param {number} price - * @param {number} quantity - * @param {string} currencyCode - * @returns {Promise} - */ - @Cordova() - addTransactionItem( - id: string, - name: string, - sku: string, - category: string, - price: number, - quantity: number, - currencyCode: string - ): Promise { - return; - } - - /** - * Enable/disable automatic reporting of uncaught exceptions - * - * @param shouldEnable {boolean} - * @returns {Promise} - */ - @Cordova() - enableUncaughtExceptionReporting(shouldEnable: boolean): Promise { - return; - } - - /** - * Manually dispatch any data - * - * @returns {Promise} - * @platform - */ - @Cordova({ - platforms: ['Android', 'iOS', 'Windows'], - }) - dispatch(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/google-nearby/index.ts b/src/@awesome-cordova-plugins/plugins/google-nearby/index.ts deleted file mode 100644 index 9022a4f8..00000000 --- a/src/@awesome-cordova-plugins/plugins/google-nearby/index.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name Google Nearby - * @description - * This plugin adds support for the Google Nearby Messages API. - * @usage - * ```typescript - * import { GoogleNearby } from '@awesome-cordova-plugins/google-nearby/ngx'; - * - * - * constructor(private googleNearby: GoogleNearby) { } - * - * this.googleNearby.publish('Hello') - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * this.googleNearby.subscribe() - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * ``` - */ -@Plugin({ - pluginName: 'GoogleNearby', - plugin: 'cordova-plugin-google-nearby', - pluginRef: 'window.nearby', - repo: 'https://github.com/hahahannes/cordova-plugin-google-nearby', - install: 'ionic cordova plugin add cordova-plugin-google-nearby --variable API_KEY="123456789"', - installVariables: ['API_KEY'], - platforms: ['Android'], -}) -@Injectable() -export class GoogleNearby extends AwesomeCordovaNativePlugin { - /** - * Publish a message - * - * @param message {string} Message to publish - * @returns {Promise} Returns a promise that resolves when the message got published - */ - @Cordova() - publish(message: string): Promise { - return; - } - - /** - * Subscribe to receive messages - * - * @returns {Observable} Returns an observable that emits received messages - */ - @Cordova({ - observable: true, - clearFunction: 'unsubscribe', - }) - subscribe(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/google-plus/index.ts b/src/@awesome-cordova-plugins/plugins/google-plus/index.ts deleted file mode 100644 index 9401d956..00000000 --- a/src/@awesome-cordova-plugins/plugins/google-plus/index.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Google Plus - * @description - * @usage - * ```typescript - * import { GooglePlus } from '@awesome-cordova-plugins/google-plus/ngx'; - * - * constructor(private googlePlus: GooglePlus) { } - * - * ... - * - * this.googlePlus.login({}) - * .then(res => console.log(res)) - * .catch(err => console.error(err)); - * - * ``` - */ -@Plugin({ - pluginName: 'GooglePlus', - plugin: 'cordova-plugin-googleplus', - pluginRef: 'window.plugins.googleplus', - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-googleplus', - install: 'ionic cordova plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=myreversedclientid', - installVariables: ['REVERSED_CLIENT_ID'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class GooglePlus extends AwesomeCordovaNativePlugin { - /** - * The login function walks the user through the Google Auth process. - * - * @param options - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - login(options: any): Promise { - return; - } - - /** - * You can call trySilentLogin to check if they're already signed in to the app and sign them in silently if they are. - * - * @param options - * @returns {Promise} - */ - @Cordova() - trySilentLogin(options?: any): Promise { - return; - } - - /** - * This will clear the OAuth2 token. - * - * @returns {Promise} - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * This will clear the OAuth2 token, forget which account was used to login, and disconnect that account from the app. This will require the user to allow the app access again next time they sign in. Be aware that this effect is not always instantaneous. It can take time to completely disconnect. - * - * @returns {Promise} - */ - @Cordova() - disconnect(): Promise { - return; - } - - /** - * This will retrieve the Android signing certificate fingerprint which is required in the Google Developer Console. - * - * @returns {Promise} - */ - @Cordova() - getSigningCertificateFingerprint(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/header-color/index.ts b/src/@awesome-cordova-plugins/plugins/header-color/index.ts deleted file mode 100644 index c37cd5d9..00000000 --- a/src/@awesome-cordova-plugins/plugins/header-color/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Header Color - * @description - * Cordova plugin to change color of header in Android Multitask View - * @usage - * ```typescript - * import { HeaderColor } from '@awesome-cordova-plugins/header-color/ngx'; - * - * constructor(private headerColor: HeaderColor) { } - * - * ... - * - * this.headerColor.tint('#becb29'); - * ``` - */ -@Plugin({ - pluginName: 'HeaderColor', - plugin: 'cordova-plugin-headercolor', - pluginRef: 'plugins.headerColor', - repo: 'https://github.com/tomloprod/cordova-plugin-headercolor', - platforms: ['Android'], -}) -@Injectable() -export class HeaderColor extends AwesomeCordovaNativePlugin { - /** - * Set a color to the task header - * - * @param color {string} The hex value of the color - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'success', - errorName: 'failure', - }) - tint(color: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/health-kit/index.ts b/src/@awesome-cordova-plugins/plugins/health-kit/index.ts deleted file mode 100644 index c4ec61f4..00000000 --- a/src/@awesome-cordova-plugins/plugins/health-kit/index.ts +++ /dev/null @@ -1,323 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface HealthKitOptions { - /** - * HKWorkoutActivityType constant - * Read more here: https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HKWorkout_Class/#//apple_ref/c/tdef/HKWorkoutActivityType - */ - activityType?: string; - - /** - * 'hour', 'week', 'year' or 'day', default 'day' - */ - aggregation?: string; - - amount?: number; - - /** - * specifies if the data returned by querySampleType() should be sorted by - * end date in ascending order, default is false - */ - ascending?: boolean; - - correlationType?: string; - - date?: any; - - distance?: number; - - /** - * probably useful with the former param - */ - distanceUnit?: string; - - /** - * in seconds, optional, use either this or endDate - */ - duration?: number; - - endDate?: any; - - energy?: number; - - /** - * J|cal|kcal - */ - energyUnit?: string; - - extraData?: any; - - /** - * limits the maximum number of records returned by querySampleType() - */ - limit?: number; - - metadata?: any; - - quantityType?: string; - - type?: string; - - readTypes?: any; - - requestWritePermission?: boolean; - - samples?: any; - - sampleType?: string; - - startDate?: any; - - /** - * m|cm|mm|in|ft - */ - unit?: string; - - requestReadPermission?: boolean; - - writeTypes?: any; -} - -/** - * @name Health Kit - * @description - * The HealthKit plugin allows you to read data from and write data to the iOS 8+ HealthKit framework. - * Any data saved shows up in the iOS Health app and is available for other iOS apps. - * @usage - * ```typescript - * import { HealthKit } from '@awesome-cordova-plugins/health-kit/ngx'; - * - * - * constructor(private healthKit: HealthKit) { } - * - * ... - * ``` - * @interfaces - * HealthKitOptions - */ -@Plugin({ - pluginName: 'HealthKit', - plugin: 'com.telerik.plugins.healthkit', - pluginRef: 'window.plugins.healthkit', - repo: 'https://github.com/Telerik-Verified-Plugins/HealthKit', - platforms: ['iOS'], -}) -@Injectable() -export class HealthKit extends AwesomeCordovaNativePlugin { - /** - * Check if HealthKit is supported (iOS8+, not on iPad) - * - * @returns {Promise} - */ - @Cordova() - available(): Promise { - return; - } - - /** - * Pass in a type and get back on of undetermined | denied | authorized - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - checkAuthStatus(options: HealthKitOptions): Promise { - return; - } - - /** - * Ask some or all permissions up front - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - requestAuthorization(options: HealthKitOptions): Promise { - return; - } - - /** - * Formatted as yyyy-MM-dd - * - * @returns {Promise} - */ - @Cordova() - readDateOfBirth(): Promise { - return; - } - - /** - * Output = male|female|other|unknown - * - * @returns {Promise} - */ - @Cordova() - readGender(): Promise { - return; - } - - /** - * Output = A+|A-|B+|B-|AB+|AB-|O+|O-|unknown - * - * @returns {Promise} - */ - @Cordova() - readBloodType(): Promise { - return; - } - - /** - * Output = I|II|III|IV|V|VI|unknown - * - * @returns {Promise} - */ - @Cordova() - readFitzpatrickSkinType(): Promise { - return; - } - - /** - * Pass in unit (g=gram, kg=kilogram, oz=ounce, lb=pound, st=stone) and amount - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - saveWeight(options: HealthKitOptions): Promise { - return; - } - - /** - * Pass in unit (g=gram, kg=kilogram, oz=ounce, lb=pound, st=stone) - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - readWeight(options: HealthKitOptions): Promise { - return; - } - - /** - * Pass in unit (mm=millimeter, cm=centimeter, m=meter, in=inch, ft=foot) and amount - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - saveHeight(options: HealthKitOptions): Promise { - return; - } - - /** - * Pass in unit (mm=millimeter, cm=centimeter, m=meter, in=inch, ft=foot) - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - readHeight(options: HealthKitOptions): Promise { - return; - } - - /** - * no params yet, so this will return all workouts ever of any type - * - * @returns {Promise} - */ - @Cordova() - findWorkouts(): Promise { - return; - } - - /** - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - saveWorkout(options: HealthKitOptions): Promise { - return; - } - - /** - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - querySampleType(options: HealthKitOptions): Promise { - return; - } - - /** - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - querySampleTypeAggregated(options: HealthKitOptions): Promise { - return; - } - - /** - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - deleteSamples(options: HealthKitOptions): Promise { - return; - } - - /** - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - monitorSampleType(options: HealthKitOptions): Promise { - return; - } - - /** - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - sumQuantityType(options: HealthKitOptions): Promise { - return; - } - - /** - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - saveQuantitySample(options: HealthKitOptions): Promise { - return; - } - - /** - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - saveCorrelation(options: HealthKitOptions): Promise { - return; - } - - /** - * - * @param options {HealthKitOptions} - * @returns {Promise} - */ - @Cordova() - queryCorrelationType(options: HealthKitOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/health/index.ts b/src/@awesome-cordova-plugins/plugins/health/index.ts deleted file mode 100644 index c243a2f7..00000000 --- a/src/@awesome-cordova-plugins/plugins/health/index.ts +++ /dev/null @@ -1,359 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -/** - * @hidden - */ -export interface HealthDataType { - /** - * Read only date types (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types) - */ - read?: string[]; - - /** - * Write only date types (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types) - */ - write?: string[]; -} - -/** - * @hidden - */ -export interface HealthQueryOptions { - /** - * Start date from which to get data - */ - startDate: Date; - - /** - * End date from which to get data - */ - endDate: Date; - - /** - * Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types) - */ - dataType: string; - - /** - * Optional limit the number of values returned. Defaults to 1000 - */ - limit?: number; - - /** - * Optional indicator to sort values ascending or descending - */ - ascending?: boolean; - - /** - * In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app. - * In the latter case the query object must contain the field filtered: true. - */ - filtered?: boolean; -} - -/** - * @hidden - */ -export interface HealthQueryOptionsAggregated { - /** - * Start date from which to get data - */ - startDate: Date; - - /** - * End date from which to get data - */ - endDate: Date; - - /** - * Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types) - */ - dataType: string; - - /** - * if specified, aggregation is grouped an array of "buckets" (windows of time), - * supported values are: 'hour', 'day', 'week', 'month', 'year'. - */ - bucket?: string; - - /** - * In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app. - * In the latter case the query object must contain the field filtered: true. - */ - filtered?: boolean; -} - -/** - * @hidden - */ -export interface HealthStoreOptions { - /** - * Start date from which to get data - */ - startDate: Date; - - /** - * End date from which to get data - */ - endDate: Date; - - /** - * Datatype to be queried (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types) - */ - dataType: string; - - /** - * Value of corresponding Datatype (see "Overview of valid datatypes") - */ - value: string; - - /** - * The source that produced this data. In iOS this is ignored and - * set automatically to the name of your app. - */ - sourceName: string; - - /** - * The complete package of the source that produced this data. - * In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and - * set automatically to the bunde id of the app. - */ - sourceBundleId: string; -} - -/** - * @hidden - */ -export interface HealthData { - /** - * Start date from which to get data - */ - startDate: Date; - - /** - * End date from which to get data - */ - endDate: Date; - - /** - * Value of corresponding Datatype (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types) - */ - value: string; - - /** - * Unit of corresponding value of Datatype (see https://github.com/dariosalvi78/cordova-plugin-health#supported-data-types) - */ - unit: string; - - /** - * The source that produced this data. In iOS this is ignored and - * set automatically to the name of your app. - */ - sourceName: string; - - /** - * The complete package of the source that produced this data. - * In Android, if not specified, it's assigned to the package of the App. In iOS this is ignored and - * set automatically to the bunde id of the app. - */ - sourceBundleId: string; -} - -/** - * @name Health - * @description - * A plugin that abstracts fitness and health repositories like Apple HealthKit or Google Fit. - * @usage - * ```typescript - * import { Health } from '@awesome-cordova-plugins/health/ngx'; - * - * - * constructor(private health: Health) { } - * - * ... - * - * this.health.isAvailable() - * .then((available:boolean) => { - * console.log(available); - * this.health.requestAuthorization([ - * 'distance', 'nutrition', //read and write permissions - * { - * read: ['steps'], //read only permission - * write: ['height', 'weight'] //write only permission - * } - * ]) - * .then(res => console.log(res)) - * .catch(e => console.log(e)); - * }) - * .catch(e => console.log(e)); - * - * ``` - * See description at https://github.com/dariosalvi78/cordova-plugin-health for a full list of Datatypes and see examples. - * @interfaces - * HealthQueryOptions - * HealthQueryOptionsAggregated - * HealthStoreOptions - * HealthData - */ -@Plugin({ - pluginName: 'Health', - plugin: 'cordova-plugin-health', - pluginRef: 'navigator.health', - repo: 'https://github.com/dariosalvi78/cordova-plugin-health', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Health extends AwesomeCordovaNativePlugin { - /** - * Tells if either Google Fit or HealthKit are available. - * - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - isAvailable(): Promise { - return; - } - - /** - * Checks if recent Google Play Services and Google Fit are installed. If the play services are not installed, - * or are obsolete, it will show a pop-up suggesting to download them. If Google Fit is not installed, - * it will open the Play Store at the location of the Google Fit app. - * The plugin does not wait until the missing packages are installed, it will return immediately. - * If both Play Services and Google Fit are available, this function just returns without any visible effect. - * - * This function is only available on Android. - * - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - promptInstallFit(): Promise { - return; - } - - /** - * Requests read and/or write access to a set of data types. It is recommendable to always explain why the app - * needs access to the data before asking the user to authorize it. - * This function must be called before using the query and store functions, even if the authorization has already - * been given at some point in the past. - * - * Quirks of requestAuthorization() - * - * In Android, it will try to get authorization from the Google Fit APIs. - * It is necessary that the app's package name and the signing key are registered in the Google API console. - * In Android, be aware that if the activity is destroyed (e.g. after a rotation) or is put in background, - * the connection to Google Fit may be lost without any callback. Going through the authorization will ensure that - * the app is connected again. - * In Android 6 and over, this function will also ask for some dynamic permissions if needed - * (e.g. in the case of "distance", it will need access to ACCESS_FINE_LOCATION). - * - * @param {string[] | HealthDataType[]} datatypes a list of data types you want to be granted access to. - * @returns {Promise} - */ - @Cordova() - requestAuthorization(datatypes: (string | HealthDataType)[]): Promise { - return; - } - - /** - * Check if the app has authorization to read/write a set of datatypes. - * - * Quirks of isAuthorized() - * - * In iOS, this function will only check authorization status for writable data. - * Read-only data will always be considered as not authorized. This is an intended behaviour of HealthKit. - * - * @param {string[] | HealthDataType[]} datatypes a list of data types you want to check access of, same as in requestAuthorization - * @returns {Promise} Returns a promise that resolves with a boolean that indicates the authorization status - */ - @Cordova() - isAuthorized(datatypes: (string | HealthDataType)[]): Promise { - return; - } - - /** - * Gets all the data points of a certain data type within a certain time window. - * Warning: if the time span is big, it can generate long arrays! - * - * Quirks of query() - * - * In iOS, the amount of datapoints is limited to 1000 by default. - * You can override this by adding a limit: xxx to your query object. - * In iOS, datapoints are ordered in an descending fashion (from newer to older). - * You can revert this behaviour by adding ascending: true to your query object. - * In Android, it is possible to query for "raw" steps or to select those as filtered by the Google Fit app. - * In the latter case the query object must contain the field filtered: true. - * In Google Fit, calories.basal is returned as an average per day, and usually is not available in all days. - * In Google Fit, calories.active is computed by subtracting the basal calories from the total. - * As basal energy expenditure, an average is computed from the week before endDate. - * While Google Fit calculates basal and active calories automatically, - * HealthKit needs an explicit input from some app. - * When querying for activities, Google Fit is able to determine some activities automatically - * (still, walking, running, biking, in vehicle), while HealthKit only relies on the input of - * the user or of some external app. - * When querying for activities, calories and distance are also provided in HealthKit (units are kcal and meters) and - * never in Google Fit. - * When querying for nutrition, Google Fit always returns all the nutrition elements it has, - * while HealthKit returns only those that are stored as correlation. To be sure to get all stored the quantities - * (regardless of they are stored as correlation or not), it's better to query single nutrients. - * nutrition.vitamin_a is given in micrograms in HealthKit and International Unit in Google Fit. - * Automatic conversion is not trivial and depends on the actual substance. - * - * @param {HealthQueryOptions} queryOptions - * @returns {Promise} - */ - @Cordova() - query(queryOptions: HealthQueryOptions): Promise { - return; - } - - /** - * Gets aggregated data in a certain time window. Usually the sum is returned for the given quantity. - * - * Quirks of queryAggregated() - * In Android, to query for steps as filtered by the Google Fit app, the flag filtered: - * true must be added into the query object. - * When querying for activities, calories and distance are provided - * when available in HealthKit and never in Google Fit. - * In Android, the start and end dates returned are the date of the first and the last available samples. - * If no samples are found, start and end may not be set. - * When bucketing, buckets will include the whole hour / day / month / week / year where start and end times - * fall into. For example, if your start time is 2016-10-21 10:53:34, - * the first daily bucket will start at 2016-10-21 00:00:00. - * Weeks start on Monday. - * When querying for nutrition, HealthKit returns only those that are stored as correlation. - * To be sure to get all the stored quantities, it's better to query single nutrients. - * nutrition.vitamin_a is given in micrograms in HealthKit and International Unit in Google Fit. - * - * @param {HealthQueryOptionsAggregated} queryOptionsAggregated - * @returns {Promise} - */ - @Cordova() - queryAggregated(queryOptionsAggregated: HealthQueryOptionsAggregated): Promise { - return; - } - - /** - * Stores a data point. - * - * Quirks of store() - * - * Google Fit doesn't allow you to overwrite data points that overlap with others already stored of the same type (see here). At the moment there is no support for update nor delete. - * In iOS you cannot store the total calories, you need to specify either basal or active. If you use total calories, the active ones will be stored. - * In Android you can only store active calories, as the basal are estimated automatically. If you store total calories, these will be treated as active. - * In iOS distance is assumed to be of type WalkingRunning, if you want to explicitly set it to Cycling you need to add the field cycling: true. - * In iOS storing the sleep activities is not supported at the moment. - * Storing of nutrients is not supported at the moment. - * - * @param storeOptions - * @returns {Promise} - */ - @Cordova() - store(storeOptions: HealthStoreOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/http/index.ts b/src/@awesome-cordova-plugins/plugins/http/index.ts deleted file mode 100644 index dc9bc480..00000000 --- a/src/@awesome-cordova-plugins/plugins/http/index.ts +++ /dev/null @@ -1,678 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface HTTPResponse { - /** - * The HTTP status number of the response or a negative internal error code. - */ - status: number; - /** - * The headers of the response. - */ - headers: { [key: string]: string }; - /** - * The URL of the response. This property will be the final URL obtained after any redirects. - */ - url: string; - /** - * The data that is in the response. This property usually exists when a promise returned by a request method resolves. - */ - data?: any; - /** - * Error response from the server. This property usually exists when a promise returned by a request method rejects. - */ - error?: string; -} - -interface AbortedResponse { - aborted: boolean; -} - -/** - * @name HTTP - * @description - * Cordova / Phonegap plugin for communicating with HTTP servers. Supports iOS and Android. - * - * Advantages over Javascript requests: - * - SSL / TLS Pinning - * - CORS restrictions do not apply - * - Handling of HTTP code 401 - read more at [Issue CB-2415](https://issues.apache.org/jira/browse/CB-2415) - * @usage - * ```typescript - * import { HTTP } from '@awesome-cordova-plugins/http/ngx'; - * - * constructor(private http: HTTP) {} - * - * ... - * - * this.http.get('http://ionic.io', {}, {}) - * .then(data => { - * - * console.log(data.status); - * console.log(data.data); // data received by server - * console.log(data.headers); - * - * }) - * .catch(error => { - * - * console.log(error.status); - * console.log(error.error); // error message as string - * console.log(error.headers); - * - * }); - * - * ``` - * @interfaces - * HTTPResponse - */ -@Plugin({ - pluginName: 'HTTP', - plugin: 'cordova-plugin-advanced-http', - pluginRef: 'cordova.plugin.http', - repo: 'https://github.com/silkimen/cordova-plugin-advanced-http', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class HTTP extends AwesomeCordovaNativePlugin { - /** - * This enum represents the internal error codes which can be returned in a HTTPResponse object. - * - * @readonly - */ - @CordovaProperty() - readonly ErrorCode: { - GENERIC: number; - SSL_EXCEPTION: number; - SERVER_NOT_FOUND: number; - TIMEOUT: number; - UNSUPPORTED_URL: number; - NOT_CONNECTED: number; - POST_PROCESSING_FAILED: number; - ABORTED: number; - }; - - /** - * This returns an object representing a basic HTTP Authorization header of the form. - * - * @param username {string} Username - * @param password {string} Password - * @returns {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64EncodedUsernameAndPassword'} - */ - @Cordova({ sync: true }) - getBasicAuthHeader(username: string, password: string): { Authorization: string } { - return; - } - - /** - * This sets up all future requests to use Basic HTTP authentication with the given username and password. - * - * @param username {string} Username - * @param password {string} Password - */ - @Cordova({ sync: true }) - useBasicAuth(username: string, password: string): void {} - - /** - * Get all headers defined for a given hostname. - * - * @param host {string} The hostname - * @returns {string} return all headers defined for the hostname - */ - @Cordova({ sync: true }) - getHeaders(host: string): string { - return; - } - - /** - * Set a header for all future requests. Takes a hostname, a header and a value. - * - * @param host {string} The hostname to be used for scoping this header - * @param header {string} The name of the header - * @param value {string} The value of the header - */ - @Cordova({ sync: true }) - setHeader(host: string, header: string, value: string): void {} - - /** - * Get the name of the data serializer which will be used for all future POST and PUT requests. - * - * @returns {string} returns the name of the configured data serializer - */ - @Cordova({ sync: true }) - getDataSerializer(): string { - return; - } - - /** - * Set the data serializer which will be used for all future POST, PUT and PATCH requests. Takes a string representing the name of the serializer. - * - * @param serializer {string} The name of the serializer. - * @see https://github.com/silkimen/cordova-plugin-advanced-http#setdataserializer - */ - @Cordova({ sync: true }) - setDataSerializer(serializer: 'urlencoded' | 'json' | 'utf8' | 'multipart' | 'raw'): void {} - - /** - * Add a custom cookie. - * - * @param url {string} Scope of the cookie - * @param cookie {string} RFC compliant cookie string - */ - @Cordova({ sync: true }) - setCookie(url: string, cookie: string): void {} - - /** - * Clear all cookies. - */ - @Cordova({ sync: true }) - clearCookies(): void {} - - /** - * Remove cookies for given URL. - * - * @param url {string} - * @param cb - */ - @Cordova({ sync: true }) - removeCookies(url: string, cb: () => void): void {} - - /** - * Resolve cookie string for given URL. - * - * @param url {string} - */ - @Cordova({ sync: true }) - getCookieString(url: string): string { - return; - } - - /** - * Get global request timeout value in seconds. - * - * @returns {number} returns the global request timeout value - */ - @Cordova({ sync: true }) - getRequestTimeout(): number { - return; - } - - /** - * Set global request timeout value in seconds. - * - * @param timeout {number} The timeout in seconds. Default 60 - */ - @Cordova({ sync: true }) - setRequestTimeout(timeout: number): void {} - - /** - * Resolve if it should follow redirects automatically. - * - * @returns {boolean} returns true if it is configured to follow redirects automatically - */ - @Cordova({ sync: true }) - getFollowRedirect(): boolean { - return; - } - - /** - * Configure if it should follow redirects automatically. - * - * @param follow {boolean} Set to false to disable following redirects automatically - */ - @Cordova({ sync: true }) - setFollowRedirect(follow: boolean): void {} - - /** - * Set server trust mode, being one of the following values: - * default: default SSL trustship and hostname verification handling using system's CA certs; - * legacy: use legacy default behavior (< 2.0.3), excluding user installed CA certs (only for Android); - * nocheck: disable SSL certificate checking and hostname verification, trusting all certs (meant to be used only for testing purposes); - * pinned: trust only provided certificates; - * - * @see https://github.com/silkimen/cordova-plugin-advanced-http#setservertrustmode - * @param {string} mode server trust mode - */ - @Cordova() - setServerTrustMode(mode: 'default' | 'legacy' | 'nocheck' | 'pinned'): Promise { - return; - } - - /** - * Configure X.509 client certificate authentication. Takes mode and options. mode being one of following values: - * none: disable client certificate authentication - * systemstore (only on Android): use client certificate installed in the Android system store; user will be presented with a list of all installed certificates - * buffer: use given client certificate; you will need to provide an options object - * - * @see https://github.com/silkimen/cordova-plugin-advanced-http#setclientauthmode - * @param {string} mode auth mode - * @param {object} options useful for buffer mode - * @param {ArrayBuffer} options.rawPkcs ArrayBuffer containing raw PKCS12 container with client certificate and private key - * @param {string} options.pkcsPassword password of the PKCS container - */ - @Cordova() - setClientAuthMode( - mode: 'none' | 'systemstore ' | 'buffer', - options?: { rawPkcs: ArrayBuffer; pkcsPassword: string } - ): Promise { - return; - } - - /** - * Make a POST request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - post(url: string, body: any, headers: any): Promise { - return; - } - - /** - * Make a sync POST request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'post', - sync: true, - }) - postSync( - url: string, - body: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a GET request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - get(url: string, parameters: any, headers: any): Promise { - return; - } - - /** - * Make a sync GET request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'get', - sync: true, - }) - getSync( - url: string, - parameters: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a PUT request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - put(url: string, body: any, headers: any): Promise { - return; - } - - /** - * Make a sync PUT request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'put', - sync: true, - }) - putSync( - url: string, - body: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a PATCH request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - patch(url: string, body: any, headers: any): Promise { - return; - } - - /** - * Make a sync PATCH request - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'patch', - sync: true, - }) - patchSync( - url: string, - body: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a DELETE request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - delete(url: string, parameters: any, headers: any): Promise { - return; - } - - /** - * Make a sync DELETE request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'delete', - sync: true, - }) - deleteSync( - url: string, - parameters: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make a HEAD request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - head(url: string, parameters: any, headers: any): Promise { - return; - } - - /** - * Make a sync HEAD request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'head', - sync: true, - }) - headSync( - url: string, - parameters: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * Make an OPTIONS request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - options(url: string, parameters: any, headers: any): Promise { - return; - } - - /** - * Make an sync OPTIONS request - * - * @param url {string} The url to send the request to - * @param parameters {Object} Parameters to send with the request - * @param headers {Object} The headers to set for this request - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'options', - sync: true, - }) - optionsSync( - url: string, - parameters: any, - headers: any, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param filePath {string} The local path(s) of the file(s) to upload - * @param name {string} The name(s) of the parameter to pass the file(s) along as - * @returns {Promise} returns a FileEntry promise that will resolve on success, and reject on failure - */ - @Cordova() - uploadFile(url: string, body: any, headers: any, filePath: string | string[], name: string | string[]): Promise { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param filePath {string} The local path(s) of the file(s) to upload - * @param name {string} The name(s) of the parameter to pass the file(s) along as - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'uploadFile', - sync: true, - }) - uploadFileSync( - url: string, - body: any, - headers: any, - filePath: string | string[], - name: string | string[], - success: (result: any) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param filePath {string} The path to download the file to, including the file name. - * @returns {Promise} returns a FileEntry promise that will resolve on success, and reject on failure - */ - @Cordova() - downloadFile(url: string, body: any, headers: any, filePath: string): Promise { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param body {Object} The body of the request - * @param headers {Object} The headers to set for this request - * @param filePath {string} The path to download the file to, including the file name. - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'downloadFile', - sync: true, - }) - downloadFileSync( - url: string, - body: any, - headers: any, - filePath: string, - success: (result: any) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param options {Object} options for individual request - * @param options.method {string} request method - * @param options.data {Object} payload to be send to the server (only applicable on post, put or patch methods) - * @param options.params {Object} query params to be appended to the URL (only applicable on get, head, delete, upload or download methods) - * @param options.serializer {string} data serializer to be used (only applicable on post, put or patch methods), defaults to global serializer value, see setDataSerializer for supported values - * @param options.timeout {number} timeout value for the request in seconds, defaults to global timeout value - * @param options.headers {Object} headers object (key value pair), will be merged with global values - * @param options.filePath {string} file path(s) to be used during upload and download see uploadFile and downloadFile for detailed information - * @param options.name {string} name(s) to be used during upload see uploadFile for detailed information - * @param options.responseType {string} response type, defaults to text - * @returns {Promise} returns a promise that will resolve on success, and reject on failure - */ - @Cordova() - sendRequest( - url: string, - options: { - method: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'options' | 'upload' | 'download'; - data?: { [index: string]: any }; - params?: { [index: string]: string | number }; - serializer?: 'json' | 'urlencoded' | 'utf8' | 'multipart' | 'raw'; - timeout?: number; - headers?: { [index: string]: string }; - filePath?: string | string[]; - name?: string | string[]; - responseType?: 'text' | 'arraybuffer' | 'blob' | 'json'; - } - ): Promise { - return; - } - - /** - * - * @param url {string} The url to send the request to - * @param options {Object} options for individual request - * @param options.method {string} request method - * @param options.data {Object} payload to be send to the server (only applicable on post, put or patch methods) - * @param options.params {Object} query params to be appended to the URL (only applicable on get, head, delete, upload or download methods) - * @param options.serializer {string} data serializer to be used (only applicable on post, put or patch methods), defaults to global serializer value, see setDataSerializer for supported values - * @param options.timeout {number} timeout value for the request in seconds, defaults to global timeout value - * @param options.headers {Object} headers object (key value pair), will be merged with global values - * @param options.filePath {string} file path(s) to be used during upload and download see uploadFile and downloadFile for detailed information - * @param options.name {string} name(s) to be used during upload see uploadFile for detailed information - * @param options.responseType {string} response type, defaults to text - * @param success {function} A callback that is called when the request succeed - * @param failure {function} A callback that is called when the request failed - * @returns {string} returns a string that represents the requestId - */ - @Cordova({ - methodName: 'sendRequest', - sync: true, - }) - sendRequestSync( - url: string, - options: { - method: 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'options' | 'upload' | 'download'; - data?: { [index: string]: any }; - params?: { [index: string]: string | number }; - serializer?: 'json' | 'urlencoded' | 'utf8' | 'multipart'; - timeout?: number; - headers?: { [index: string]: string }; - filePath?: string | string[]; - name?: string | string[]; - responseType?: 'text' | 'arraybuffer' | 'blob' | 'json'; - }, - success: (result: HTTPResponse) => void, - failure: (error: any) => void - ): string { - return; - } - - /** - * @param requestId {string} The RequestId of the request to abort - */ - @Cordova() - abort(requestId: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/hyper-track/index.ts b/src/@awesome-cordova-plugins/plugins/hyper-track/index.ts deleted file mode 100644 index 398c4384..00000000 --- a/src/@awesome-cordova-plugins/plugins/hyper-track/index.ts +++ /dev/null @@ -1,380 +0,0 @@ -import { Injectable } from '@angular/core'; -import { AwesomeCordovaNativePlugin, Cordova, Plugin } from '@awesome-cordova-plugins/core'; - -const hypertrackIonicPluginVersion = "0.2.0" -// Minimal cordova-plugin-hypertrack-v3 version: 0.5.0 -@Plugin({ - pluginName: 'cordova-plugin-hypertrack-v3', - plugin: 'cordova-plugin-hypertrack-v3', - pluginRef: 'hypertrack', - repo: 'https://github.com/hypertrack/cordova-plugin-hypertrack.git', - platforms: ['Android, iOS'], -}) -@Injectable() -export class HyperTrackPlugin extends AwesomeCordovaNativePlugin { - @Cordova() - initialize(publishableKey: string): Promise { - return; - } - - @Cordova() - getBlockers(): Promise> { - return; - } - - @Cordova() - enableDebugLogging(): Promise { - return; - } -} - -// Interfaces for Cordova Plugin callbacks -interface DeviceIdReceiver { - (deviceId: string): any; -} -interface TrackingStateReceiver { - (isRunning: boolean): any; -} -interface FailureHandler { - (error: Error): any; -} -interface SuccessHandler { - (): any; -} -interface LocationReceiver { - (location: CordovaLatestLocationResult): any; -} - -// SDK instance that exposed from Cordova utilizes usage of callbacks, so we -// wrap it with adapter to avoid mix of callbacks and Promises -interface HyperTrackCordova { - getDeviceId(success: DeviceIdReceiver, error: FailureHandler): void; - isRunning(success: TrackingStateReceiver, error: FailureHandler): void; - setDeviceName(name: string, success: SuccessHandler, error: FailureHandler): void; - setDeviceMetadata(metadata: Object, success: SuccessHandler, error: FailureHandler): void; - setTrackingNotificationProperties( - title: string, - message: string, - success: SuccessHandler, - error: FailureHandler - ): void; - addGeoTag( - geotagData: Object, - expectedLocation: Coordinates | undefined, - success: SuccessHandler, - error: FailureHandler - ): void; - requestPermissionsIfNecessary(success: SuccessHandler, error: FailureHandler): void; - allowMockLocations(success: SuccessHandler, error: FailureHandler): void; - syncDeviceSettings(success: SuccessHandler, error: FailureHandler): void; - start(success: SuccessHandler, error: FailureHandler): void; - stop(success: SuccessHandler, error: FailureHandler): void; - getLatestLocation(success: LocationReceiver, error: FailureHandler): void; - getCurrentLocation(success: LocationReceiver, error: FailureHandler): void; -} - -export class CoordinatesValidationError extends Error {} - -/** Wrapper class for passing spatial geoposition as a geotag's expected location */ -export class Coordinates { - constructor(public latitude: number, public longitude: number) { - if (latitude < -90.0 || latitude > 90.0 || longitude < -180.0 || longitude > 180.0) { - throw new CoordinatesValidationError('latitude and longitude should be of correct values'); - } - } - - public toString = (): string => { - return JSON.stringify(this); - } -} - -/** A blocker is an obstacle that needs to be resolved to achieve reliable tracking. */ -export interface Blocker { - /** Recommended name for a user action, that needs to be performed to resolve the blocker. */ - userActionTitle: string; - /** Recommended name for a button, that will navigate user to the place where he can resolve the blocker */ - userActionCTA: string; - /** User action explanation */ - userActionExplanation: string; - /** An action that navigates user to the dedicated settings menu. */ - resolve: () => void; -} - -export type CordovaLatestLocationResult = { - type: "location", - location: Coordinates, -} | { - type: "outage", - outage: { - code: number, - name: keyof typeof Outage - } -} - -export type LocationResult = { - type: LocationResultType.LOCATION, - value: Coordinates -} | -{ - type: LocationResultType.OUTAGE, - value: Outage -} - -export enum LocationResultType { - LOCATION, OUTAGE -} - -export enum Outage { - MISSING_LOCATION_PERMISSION, - MISSING_ACTIVITY_PERMISSION, - LOCATION_SERVICE_DISABLED, - NOT_TRACKING, - START_HAS_NOT_FINISHED, - NO_GPS_SIGNAL, - RESTART_REQUIRED -} - -/** - * @usage - * ```typescript - * import { HyperTrack } from '@awesome-cordova-plugins/hyper-track'; - * - * initializeHypertrack() { - * HyperTrack.enableDebugLogging(); - * HyperTrack.initialize('YOUR_PUBLISHING_KEY') - * .then( this.onSdkInstanceReceived ) - * .catch( (err) => console.error("HyperTrack init failed with error " + err) ); - * } - * onSdkInstanceReceived(sdkInstance: HyperTrack) { - * sdkInstance.getDeviceId() - * .then((id) => console.log("Got device id " + id)) - * .then(() => sdkInstance.setDeviceName("Elvis Ionic")) - * .then(() => console.log("Device name was changed")) - * .then(() => sdkInstance.setDeviceMetadata({platform: "Ionic Android"})) - * .then(() => console.log("Device metadata was changed")) - * .then(() => sdkInstance.setTrackingNotificationProperties("Tracking On", "Ionic SDK is tracking")) - * .then(() => console.log("Notification properties were changed")) - * .catch((err) => console.error("Got error in HyperTrack " + err)); - * } - * - * ``` - */ -export class HyperTrack { - /** Enables debug log in native HyperTrack SDK. */ - static enableDebugLogging(): void { - new HyperTrackPlugin().enableDebugLogging(); - } - - /** - * Entry point into SDK. - * - * Initializes SDK. Also resolves SDK instance that could be used to query deviceId or set - * various data. - * - * @param publishableKey account-specific secret from the HyperTrack dashborad. - * @see {@link https://dashboard.hypertrack.com/setup}. - */ - static initialize(publishableKey: string): Promise { - console.log(`Hypertrack Ionic plugin version ${hypertrackIonicPluginVersion}`) - return new Promise((resolve, reject) => { - new HyperTrackPlugin() - .initialize(publishableKey) - .then((cordovaInstance: HyperTrackCordova) => { - resolve(new HyperTrack(cordovaInstance)); - }) - .catch((err: Error) => reject(err)); - }); - } - - /** - * Get the list of blockers that needs to be resolved for reliable tracking. - * - * @see {Blocker} - */ - static getBlockers(): Promise> { - return new HyperTrackPlugin().getBlockers(); - } - - /** Resolves device ID that could be used to identify the device. */ - getDeviceId(): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.getDeviceId( - (deviceId) => resolve(deviceId), - (err) => reject(err) - ); - }); - } - - /** Resolves to true if tracking service is running and false otherwise */ - isRunning(): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.isRunning( - (isRunning) => resolve(isRunning), - (err) => reject(err) - ); - }); - } - - /** - * Sets device name that could be used to identify the device in HyperTrack dashboard - * - * @param name - */ - setDeviceName(name: string): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.setDeviceName( - name, - () => resolve(), - (err) => reject(err) - ); - }); - } - - /** - * Use this to set additional properties, like segments, teams etc. - * - * @param metadata key-value pais of properties. - */ - setDeviceMetadata(metadata: Object): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.setDeviceMetadata( - metadata, - () => resolve(), - (err) => reject(err) - ); - }); - } - - /** - * Updates title and text in persistent notification, that appears when tracking is active. - * - * @param title - * @param message - */ - setTrackingNotificationProperties(title: string, message: string): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.setTrackingNotificationProperties( - title, - message, - () => resolve(), - (err) => reject(err) - ); - }); - } - - /** - * Adds special marker-like object to device timeline. - * - * @param geotagData - * @param expectedLocation - */ - addGeotag(geotagData: Object, expectedLocation?: Coordinates): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.addGeoTag( - geotagData, - expectedLocation, - () => resolve(), - (err) => reject(err) - ); - }); - } - - /** Pops up permission request dialog, if permissions weren't granted before or does nothing otherwise. */ - requestPermissionsIfNecessary(): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.requestPermissionsIfNecessary( - () => resolve(), - (err) => reject(err) - ); - }); - } - - /** Allows injecting false locations into the SDK, which ignores them by default. */ - allowMockLocations(): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.allowMockLocations( - () => resolve(), - (err) => reject(err) - ); - }); - } - - /** - * Synchronizes tracking state with platform model. This method is used to - * harden platform2device communication channel. - */ - syncDeviceSettings(): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.syncDeviceSettings( - () => resolve(), - (err) => reject(err) - ); - }); - } - - /** Start tracking. */ - start(): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.start( - () => resolve(), - (err) => reject(err) - ); - }); - } - - /** Stop tracking. */ - stop(): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.stop( - () => resolve(), - (err) => reject(err) - ); - }); - } - - /** - * Resolves latest device location that was sent by the SDK. - * Only available for Android platform. - * */ - getLatestLocation(): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.getLatestLocation( - locationResult => resolve(this.handleLocationResult(locationResult)), - err => reject(err) - ); - }); - } - - /** - * Resolves latest device location from system location provider. - * Only available for Android platform. - * */ - getCurrentLocation(): Promise { - return new Promise((resolve, reject) => { - this.cordovaInstanceHandle.getCurrentLocation( - locationResult => resolve(this.handleLocationResult(locationResult)), - err => reject(err) - ); - }); - } - - private handleLocationResult(locationResult: CordovaLatestLocationResult): LocationResult { - switch (locationResult.type) { - case "location": { - return { - type: LocationResultType.LOCATION, - value: locationResult.location - } - } - case "outage": { - const outage = Outage[locationResult.outage.name] - return { - type: LocationResultType.OUTAGE, - value: outage - } - } - } - } - - private constructor(private cordovaInstanceHandle: HyperTrackCordova) {} -} diff --git a/src/@awesome-cordova-plugins/plugins/iamport-cordova/index.ts b/src/@awesome-cordova-plugins/plugins/iamport-cordova/index.ts deleted file mode 100644 index 0c246d47..00000000 --- a/src/@awesome-cordova-plugins/plugins/iamport-cordova/index.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -declare const cordova: Cordova & { plugins: any }; - -export interface PaymentObject { - title?: TitleData; // webview title data - userCode: string; // user identification code - data: PaymentData; // payment data - callback: any; // callback function after payment -} - -export interface CertificationObject { - title?: TitleData; // webview title data - userCode: string; // user identification code - data: CertificationData; // certification data - callback: any; // callback function after certification -} - -export interface TitleData { - name?: string; // webview title name - color?: string; // webview title background color -} - -export interface PaymentData { - pg?: string; // payment gateway type - pay_method?: string; // payment method - name: string; // name of order - merchant_uid?: string; // unique merchant id - amount: string; // payment amount - buyer_name?: string; // buyer name - buyer_tel?: string; // buyer contact - buyer_email?: string; // buyer email address - buyer_addr?: string; // buyer address - buyer_postcode?: string; // buyer postcode - app_scheme: string; // custom app url scheme - custom_data?: any; // custom data - notice_url?: string; // notification url - escrow?: boolean; // whether the type of this order is escrow - digital?: boolean; // whether this order is for real products or contents - display?: { - card_quota?: number[]; // credit card installment setting value - }; - currency?: string; // payment currency - customer_uid?: string; // unique customer id for subscription payments - tax_free?: string; // tax amount - language?: string; // language type - vbank_due?: string; // vbank due date - biz_num?: string; // business number -} - -export interface CertificationData { - company?: string; // company name - phone?: string; // cell phone number - name?: string; // name - carrier?: string; // carrier code - birth?: string; // birth date - merchant_uid?: string; // unique merchant id - min_age?: string; // minimum age to allow certification - popup?: boolean; // whether the webview is popup -} - -/** - * @name Iamport Cordova - * @description - * This plugin does something - * @usage - * ```typescript - * import { IamportCordova } from '@awesome-cordova-plugins/iamport-cordova/ngx'; - * - * - * constructor(private iamportCordova: IamportCordova) { } - * - * ... - * - * - * this.iamportCordova.functionName('Hello', 123) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'IamportCordova', - plugin: 'iamport-cordova', - pluginRef: 'cordova.plugins.IamportCordova', - repo: 'https://github.com/iamport/iamport-cordova', - platforms: ['ios', 'android'], -}) -@Injectable() -export class IamportCordova extends AwesomeCordovaNativePlugin { - /** - * This function is to load a webview of a payment gateway to pay for something - * - * @param paymentObject {PaymentObject} Payment data to set the payment webview - * @returns {Promise} A callback function of the payment data is triggered when the webview is closed - */ - @Cordova() - payment(paymentObject: PaymentObject): Promise { - return cordova.plugins.IamportCordova.payment(paymentObject); - } - - /** - * This function is to load a webview for identification with carrier type(like Verizon), name and phone number - * - * @param certificationObject {CertificationObject} Certification data to set the certification webview - * @returns {Promise} A callback function of the certification data is triggered when the webview is closed - */ - @Cordova() - certification(certificationObject: CertificationObject): Promise { - return cordova.plugins.IamportCordova.certification(certificationObject); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/ibeacon/index.ts b/src/@awesome-cordova-plugins/plugins/ibeacon/index.ts deleted file mode 100644 index d16a8490..00000000 --- a/src/@awesome-cordova-plugins/plugins/ibeacon/index.ts +++ /dev/null @@ -1,760 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaCheck, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -declare const cordova: any; - -export interface Beacon { - /** - * The physical device's identifier. - */ - uuid: string; - - /** - * The beacon's major identifier number. - */ - major: number; - - /** - * The beacon's minor identifier number. - */ - minor: number; - - /** - * The proximity of the beacon relative to the phone. - * - * Possible options are: - * ProximityImmediate - * ProximityNear - * ProximityFar - * ProximityUnknown - */ - proximity: 'ProximityImmediate' | 'ProximityNear' | 'ProximityFar' | 'ProximityUnknown'; - - /** - * Transmission Power of the beacon. A constant emitted by the beacon which indicates what's the expected RSSI at a distance of 1 meter to the beacon. - */ - tx: number; - - /** - * Received Signal Strength Indicator. The strength of the beacon's signal when it reaches the device. - * RSSI ranges from aprox -26 (a few inches) to -100 (40-50 m distance). - */ - rssi: number; - - /** - * The accuracy of the ranging. - */ - accuracy: number; -} - -export interface BeaconRegion { - /** - * A unique identifier for this region. - */ - identifier: string; - - /** - * The the beacon identifier the device will "watch" for. Many beacons can share the same uuid. - */ - uuid: string; - - /** - * The beacon's major identifier number. Optional, of nothing is supplied - * the plugin will treat it as a wildcard. - */ - major?: number; - - /** - * The beacon's minor identifier number. Optional, of nothing is supplied - * the plugin will treat it as a wildcard. - */ - minor?: number; - - /** - * If set to true the device will scan for beacons and determine region state anytime - * the device's screen is turned on or off. Useful for debugging. - */ - notifyEntryStateOnDisplay?: boolean; -} - -export interface CircularRegion { - /** - * A unique identifier for this region. - */ - identifier: string; - - /** - * The latitude of this region. - */ - latitude: number; - - /** - * The longitude of this region. - */ - longitude: number; - - /** - * The radius of the geofence for this region. - */ - radius: number; -} - -export type Region = BeaconRegion | CircularRegion; - -export interface IBeaconPluginResult { - /** - * The name of the delegate function that produced the PluginResult object. - */ - eventType: string; - - /** - * The region that triggered the event. - */ - region: Region; - - /** - * An array of beacon objects - */ - beacons: Beacon[]; - - /** - * The status of the location permission for iOS. - */ - authorizationStatus: string; - - /** - * The state of the phone in relation to the region. Inside/outside for example. - */ - state: 'CLRegionStateInside' | 'CLRegionStateOutside'; - - /** - * Error message, used only with monitoringDidFailForRegionWithError delegate. - */ - error: string; -} - -export interface IBeaconDelegate { - /** - * An observable that publishes information about the location permission authorization status. - * - * @returns {Observable} Returns a string. - */ - didChangeAuthorizationStatus(): Observable; - - /** - * An Observable that publishes event data to it's subscribers - * when the native layer is able to determine the device's state. - * - * This event is called when the phone begins starts monitoring, - * when requestStateForRegion is called, etc. - * - * @returns {Observable} Returns a IBeaconPluginResult object with information about the event, region, and beacon(s). - */ - didDetermineStateForRegion(): Observable; - - /** - * An Observable that publishes event data to it's subscribers - * when the phone enters a region that it was asked to monitor. - * - * If the user has given the app Always-Location permission, this function - * will be called even when the app is not running on iOS. - * The app will run silently in the background for a small amount of time. - * - * @returns {Observable} Returns a IBeaconPluginResult object with information about the event, region, and beacon(s). - */ - didEnterRegion(): Observable; - - /** - * An Observable that publishes event data to it's subscribers - * when the phone exits a region that it was asked to monitor. - * - * If the user has given the app Always-Location permission, this function - * will be called even when the app is not running on iOS. - * The app will run silently in the background for a small amount of time. - * - * @returns {Observable} Returns a IBeaconPluginResult object with information about the event, region, and beacon(s). - */ - didExitRegion(): Observable; - - /** - * An Observable that publishes event data to it's subscribers - * each time that the device ranges beacons. Modern Android and iOS devices range - * aproximately once per second. - * - * @returns {Observable} Returns a IBeaconPluginResult object with information about the event, region, and beacon(s). - */ - didRangeBeaconsInRegion(): Observable; - - /** - * An Observable that publishes event data to it's subscribers - * when the device begins monitoring a region. - * - * @returns {Observable} Returns a IBeaconPluginResult object with information about the event, region, and beacon(s). - */ - didStartMonitoringForRegion(): Observable; - - /** - * An Observable that publishes event data to it's subscribers - * when the device fails to monitor a region. - * - * @returns {Observable} Returns a IBeaconPluginResult object with information about the event, region, and beacon(s). - */ - monitoringDidFailForRegionWithError(): Observable; - - /** - * An Observable that publishes event data to it's subscribers - * when the device begins advertising as an iBeacon. - * - * @returns {Observable} Returns a IBeaconPluginResult object with information about the event, region, and beacon(s). - */ - peripheralManagerDidStartAdvertising(): Observable; - - /** - * An Observable that publishes event data to it's subscribers - * when the state of the peripheral manager's state updates. - * - * - * @returns {Observable} Returns a IBeaconPluginResult object with information about the event, region, and beacon(s). - */ - peripheralManagerDidUpdateState(): Observable; -} - -/** - * @name IBeacon - * @description - * This plugin provides functions for working with iBeacons. - * - * The plugin's API closely mimics the one exposed through the [CLLocationManager](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html) introduced in iOS 7. - * @usage - * - * ```typescript - * import { IBeacon } from '@awesome-cordova-plugins/ibeacon/ngx'; - * - * constructor(private ibeacon: IBeacon) { } - * - * ... - * - * - * // Request permission to use location on iOS - * this.ibeacon.requestAlwaysAuthorization(); - * // create a new delegate and register it with the native layer - * let delegate = this.ibeacon.Delegate(); - * - * // Subscribe to some of the delegate's event handlers - * delegate.didRangeBeaconsInRegion() - * .subscribe( - * data => console.log('didRangeBeaconsInRegion: ', data), - * error => console.error() - * ); - * delegate.didStartMonitoringForRegion() - * .subscribe( - * data => console.log('didStartMonitoringForRegion: ', data), - * error => console.error() - * ); - * delegate.didEnterRegion() - * .subscribe( - * data => { - * console.log('didEnterRegion: ', data); - * } - * ); - * - * let beaconRegion = this.ibeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E'); - * - * this.ibeacon.startMonitoringForRegion(beaconRegion) - * .then( - * () => console.log('Native layer received the request to monitoring'), - * error => console.error('Native layer failed to begin monitoring: ', error) - * ); - * ``` - * @interfaces - * Beacon - * BeaconRegion - * CircularRegion - * IBeaconPluginResult - * IBeaconDelegate - */ -@Plugin({ - pluginName: 'IBeacon', - plugin: 'cordova-plugin-ibeacon', - pluginRef: 'cordova.plugins.locationManager', - repo: 'https://github.com/petermetz/cordova-plugin-ibeacon', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class IBeacon extends AwesomeCordovaNativePlugin { - /** - * Instances of this class are delegates between the {@link LocationManager} and - * the code that consumes the messages generated on in the native layer. - * - * @returns {IBeaconDelegate} An instance of the type {@type Delegate}. - */ - @CordovaCheck({ sync: true }) - Delegate(): IBeaconDelegate { - const delegate = new window.cordova.plugins.locationManager.Delegate(); - - delegate.didChangeAuthorizationStatus = (pluginResult?: IBeaconPluginResult) => { - return new Observable((observer: any) => { - const cb = (data: IBeaconPluginResult) => observer.next(data); - return (delegate.didChangeAuthorizationStatus = cb); - }); - }; - - delegate.didDetermineStateForRegion = (pluginResult?: IBeaconPluginResult) => { - return new Observable((observer: any) => { - const cb = (data: IBeaconPluginResult) => observer.next(data); - return (delegate.didDetermineStateForRegion = cb); - }); - }; - - delegate.didEnterRegion = (pluginResult?: IBeaconPluginResult) => { - return new Observable((observer: any) => { - const cb = (data: IBeaconPluginResult) => observer.next(data); - return (delegate.didEnterRegion = cb); - }); - }; - - delegate.didExitRegion = (pluginResult?: IBeaconPluginResult) => { - return new Observable((observer: any) => { - const cb = (data: IBeaconPluginResult) => observer.next(data); - return (delegate.didExitRegion = cb); - }); - }; - - delegate.didRangeBeaconsInRegion = (pluginResult?: IBeaconPluginResult) => { - return new Observable((observer: any) => { - const cb = (data: IBeaconPluginResult) => observer.next(data); - return (delegate.didRangeBeaconsInRegion = cb); - }); - }; - - delegate.didStartMonitoringForRegion = (pluginResult?: IBeaconPluginResult) => { - return new Observable((observer: any) => { - const cb = (data: IBeaconPluginResult) => observer.next(data); - return (delegate.didStartMonitoringForRegion = cb); - }); - }; - - delegate.monitoringDidFailForRegionWithError = (pluginResult?: IBeaconPluginResult) => { - return new Observable((observer: any) => { - const cb = (data: IBeaconPluginResult) => observer.next(data); - return (delegate.monitoringDidFailForRegionWithError = cb); - }); - }; - - delegate.peripheralManagerDidStartAdvertising = (pluginResult?: IBeaconPluginResult) => { - return new Observable((observer: any) => { - const cb = (data: IBeaconPluginResult) => observer.next(data); - return (delegate.peripheralManagerDidStartAdvertising = cb); - }); - }; - - delegate.peripheralManagerDidUpdateState = (pluginResult?: IBeaconPluginResult) => { - return new Observable((observer: any) => { - const cb = (data: IBeaconPluginResult) => observer.next(data); - return (delegate.peripheralManagerDidUpdateState = cb); - }); - }; - - window.cordova.plugins.locationManager.setDelegate(delegate); - return delegate; - } - - /** - * Creates a new BeaconRegion - * - * @param {string} identifier @see {CLRegion} - * @param identifer - * @param {string} uuid The proximity ID of the beacon being targeted. - * This value must not be blank nor invalid as a UUID. - * @param {number} major The major value that you use to identify one or more beacons. - * @param {number} minor The minor value that you use to identify a specific beacon. - * @param {BOOL} notifyEntryStateOnDisplay - * @returns {BeaconRegion} Returns the BeaconRegion that was created - */ - @CordovaCheck({ sync: true }) - BeaconRegion( - identifer: string, - uuid: string, - major?: number, - minor?: number, - notifyEntryStateOnDisplay?: boolean - ): BeaconRegion { - return new window.cordova.plugins.locationManager.BeaconRegion( - identifer, - uuid, - major, - minor, - notifyEntryStateOnDisplay - ); - } - - /** - * @returns {IBeaconDelegate} Returns the IBeaconDelegate - */ - @Cordova() - getDelegate(): IBeaconDelegate { - return; - } - - /** - * @param {IBeaconDelegate} delegate An instance of a delegate to register with the native layer. - * @returns {IBeaconDelegate} Returns the IBeaconDelegate - */ - @Cordova() - setDelegate(delegate: IBeaconDelegate): IBeaconDelegate { - return; - } - - /** - * Signals the native layer that the client side is ready to consume messages. - * Readiness here means that it has a {IBeaconDelegate} set by the consumer javascript - * code. - * - * The {LocationManager.setDelegate()} will implicitly call this method as well, - * therefore the only case when you have to call this manually is if you don't - * wish to specify a {IBeaconDelegate} of yours. - * - * The purpose of this signaling mechanism is to make the events work when the - * app is being woken up by the Operating System to give it a chance to handle - * region monitoring events for example. - * - * If you don't set a {IBeaconDelegate} and don't call this method manually, an error - * message get emitted in the native runtime and the DOM as well after a certain - * period of time. - * - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer acknowledged the request and started to send events. - */ - @Cordova({ otherPromise: true }) - onDomDelegateReady(): Promise { - return; - } - - /** - * Determines if bluetooth is switched on, according to the native layer. - * - * @returns {Promise} Returns a promise which is resolved with a {Boolean} - * indicating whether bluetooth is active. - */ - @Cordova({ otherPromise: true }) - isBluetoothEnabled(): Promise { - return; - } - - /** - * Enables Bluetooth using the native Layer. (ANDROID ONLY) - * - * @returns {Promise} Returns a promise which is resolved when Bluetooth - * could be enabled. If not, the promise will be rejected with an error. - */ - @Cordova({ otherPromise: true }) - enableBluetooth(): Promise { - return; - } - - /** - * Disables Bluetooth using the native Layer. (ANDROID ONLY) - * - * @returns {Promise} Returns a promise which is resolved when Bluetooth - * could be enabled. If not, the promise will be rejected with an error. - */ - @Cordova({ otherPromise: true }) - disableBluetooth(): Promise { - return; - } - - /** - * Start monitoring the specified region. - * - * If a region of the same type with the same identifier is already being - * monitored for this application, - * it will be removed from monitoring. For circular regions, the region - * monitoring service will prioritize - * regions by their size, favoring smaller regions over larger regions. - * - * This is done asynchronously and may not be immediately reflected in monitoredRegions. - * - * @param {Region} region An instance of {Region} which will be monitored - * by the operating system. - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer acknowledged the dispatch of the monitoring request. - */ - @Cordova({ otherPromise: true }) - startMonitoringForRegion(region: Region): Promise { - return; - } - - /** - * Stop monitoring the specified region. It is valid to call - * stopMonitoringForRegion: for a region that was registered for monitoring - * with a different location manager object, during this or previous - * launches of your application. - * - * This is done asynchronously and may not be immediately reflected in monitoredRegions. - * - * @param {Region} region An instance of {Region} which will be monitored - * by the operating system. - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer acknowledged the dispatch of the request to stop monitoring. - */ - @Cordova({ otherPromise: true }) - stopMonitoringForRegion(region: Region): Promise { - return; - } - - /** - * Request state the for specified region. When result is ready - * didDetermineStateForRegion is triggered. This can be any region, - * also those which is not currently monitored. - * - * This is done asynchronously and may not be immediately reflected in monitoredRegions. - * - * @param {Region} region An instance of {Region} which will be monitored - * by the operating system. - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer acknowledged the dispatch of the request to stop monitoring. - */ - @Cordova({ otherPromise: true }) - requestStateForRegion(region: Region): Promise { - return; - } - - /** - * Start ranging the specified beacon region. - * - * If a region of the same type with the same identifier is already being - * monitored for this application, it will be removed from monitoring. - * - * This is done asynchronously and may not be immediately reflected in rangedRegions. - * - * @param {Region} region An instance of {BeaconRegion} which will be monitored - * by the operating system. - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer acknowledged the dispatch of the monitoring request. - */ - @Cordova({ otherPromise: true }) - startRangingBeaconsInRegion(region: Region): Promise { - return; - } - - /** - * Stop ranging the specified region. It is valid to call - * stopMonitoringForRegion: for a region that was registered for ranging - * with a different location manager object, during this or previous - * launches of your application. - * - * This is done asynchronously and may not be immediately reflected in rangedRegions. - * - * @param {Region} region An instance of {BeaconRegion} which will be monitored - * by the operating system. - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer acknowledged the dispatch of the request to stop monitoring. - */ - @Cordova({ otherPromise: true }) - stopRangingBeaconsInRegion(region: Region): Promise { - return; - } - - /** - * Queries the native layer to determine the current authorization in effect. - * - * @returns {Promise} Returns a promise which is resolved with the - * requested authorization status. - */ - @Cordova({ otherPromise: true }) - getAuthorizationStatus(): Promise { - return; - } - - /** - * For iOS 8 and above only. The permission model has changed by Apple in iOS 8, making it necessary for apps to - * explicitly request permissions via methods like these: - * requestWhenInUseAuthorization - * requestAlwaysAuthorization - * - * If you are using this plugin on Android devices only, you will never have to use this, nor {@code requestAlwaysAuthorization} - * - * @returns {Promise} Returns a promise that is resolved when the request dialog is shown. - */ - @Cordova({ otherPromise: true }) - requestWhenInUseAuthorization(): Promise { - return; - } - - /** - * See the documentation of {@code requestWhenInUseAuthorization} for further details. - * - * @returns {Promise} Returns a promise which is resolved when the native layer - * shows the request dialog. - */ - @Cordova({ otherPromise: true }) - requestAlwaysAuthorization(): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise which is resolved with an {Array} - * of {Region} instances that are being monitored by the native layer. - */ - @Cordova({ otherPromise: true }) - getMonitoredRegions(): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise which is resolved with an {Array} - * of {Region} instances that are being ranged by the native layer. - */ - @Cordova({ otherPromise: true }) - getRangedRegions(): Promise { - return; - } - - /** - * Determines if ranging is available or not, according to the native layer. - * - * @returns {Promise} Returns a promise which is resolved with a {Boolean} - * indicating whether ranging is available or not. - */ - @Cordova({ otherPromise: true }) - isRangingAvailable(): Promise { - return; - } - - /** - * Determines if region type is supported or not, according to the native layer. - * - * @param {Region} region An instance of {Region} which will be checked - * by the operating system. - * @returns {Promise} Returns a promise which is resolved with a {Boolean} - * indicating whether the region type is supported or not. - */ - @Cordova({ otherPromise: true }) - isMonitoringAvailableForClass(region: Region): Promise { - return; - } - - /** - * Start advertising the specified region. - * - * If a region a different identifier is already being advertised for - * this application, it will be replaced with the new identifier. - * - * This call will accept a valid beacon even when no BlueTooth is available, - * and will start when BlueTooth is powered on. See {IBeaconDelegate.} - * - * @param {Region} region An instance of {Region} which will be advertised - * by the operating system. - * @param {Integer} measuredPower: Optional parameter, if left empty, the device will - * use it's own default value. - * @param measuredPower - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer acknowledged the dispatch of the advertising request. - */ - @Cordova({ otherPromise: true }) - startAdvertising(region: Region, measuredPower?: number): Promise { - return; - } - - /** - * Stop advertising as a beacon. - * - * This is done asynchronously and may not be immediately reflected in isAdvertising. - * - * @param region - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer acknowledged the dispatch of the request to stop advertising. - */ - @Cordova({ otherPromise: true }) - stopAdvertising(region: Region): Promise { - return; - } - - /** - * Determines if advertising is available or not, according to the native layer. - * - * @returns {Promise} Returns a promise which is resolved with a {Boolean} - * indicating whether advertising is available or not. - */ - @Cordova({ otherPromise: true }) - isAdvertisingAvailable(): Promise { - return; - } - - /** - * Determines if advertising is currently active, according to the native layer. - * - * @returns {Promise} Returns a promise which is resolved with a {Boolean} - * indicating whether advertising is active. - */ - @Cordova({ otherPromise: true }) - isAdvertising(): Promise { - return; - } - - /** - * Disables debug logging in the native layer. Use this method if you want - * to prevent this plugin from writing to the device logs. - * - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer has set the logging level accordingly. - */ - @Cordova({ otherPromise: true }) - disableDebugLogs(): Promise { - return; - } - - /** - * Enables the posting of debug notifications in the native layer. Use this method if you want - * to allow the plugin the posting local notifications. - * This can be very helpful when debugging how to apps behave when launched into the background. - * - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer has set the flag to enabled. - */ - @Cordova({ otherPromise: true }) - enableDebugNotifications(): Promise { - return; - } - - /** - * Disables the posting of debug notifications in the native layer. Use this method if you want - * to prevent the plugin from posting local notifications. - * - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer has set the flag to disabled. - */ - @Cordova({ otherPromise: true }) - disableDebugNotifications(): Promise { - return; - } - - /** - * Enables debug logging in the native layer. Use this method if you want - * a debug the inner workings of this plugin. - * - * @returns {Promise} Returns a promise which is resolved as soon as the - * native layer has set the logging level accordingly. - */ - @Cordova({ otherPromise: true }) - enableDebugLogs(): Promise { - return; - } - - /** - * Appends the provided [message] to the device logs. - * Note: If debug logging is turned off, this won't do anything. - * - * @param {string} message The message to append to the device logs. - * @returns {Promise} Returns a promise which is resolved with the log - * message received by the native layer for appending. The returned message - * is expected to be equivalent to the one provided in the original call. - */ - @Cordova({ otherPromise: true }) - appendToDeviceLog(message: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/image-picker/index.ts b/src/@awesome-cordova-plugins/plugins/image-picker/index.ts deleted file mode 100644 index dfe10817..00000000 --- a/src/@awesome-cordova-plugins/plugins/image-picker/index.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface ImagePickerOptions { - /** - * max images to be selected, defaults to 15. If this is set to 1, upon selection of a single image, the plugin will return it. (Android only) - */ - maximumImagesCount?: number; - - /** - * Max width to allow images to be - */ - width?: number; - - /** - * Max height to allow images to be - */ - height?: number; - - /** - * Quality of images, defaults to 100 - */ - quality?: number; - - /** - * Videos allowed? - */ - allow_video?: boolean; - - /** - * the default is the message of the old plugin impl - */ - title?: string; - - /** - * the old plugin impl didn't have it, so passing null by default - */ - message?: string; - - /** - * Choose the format of the return value. - * Defined in ImagePicker.OutputType. Default is FILE_URI. - * FILE_URI : 0, Return image file URI, - * DATA_URL : 1, Return image as base64-encoded string - */ - outputType?: number; - - /** - * Disable the iOS popover as seen on iPad - */ - disable_popover?: boolean; -} - -export enum OutputType { - FILE_URL = 0, - DATA_URL, -} - -/** - * @name Image Picker - * @description - * Cordova Plugin For Multiple Image Selection - * - * Requires Cordova plugin: `cordova-plugin-image-picker`. - * For more info, please see the https://github.com/Telerik-Verified-Plugins/ImagePicker - * @usage - * ```typescript - * import { ImagePicker } from '@awesome-cordova-plugins/image-picker/ngx'; - * - * - * constructor(private imagePicker: ImagePicker) { } - * - * ... - * - * this.imagePicker.getPictures(options).then((results) => { - * for (var i = 0; i < results.length; i++) { - * console.log('Image URI: ' + results[i]); - * } - * }, (err) => { }); - * - * ``` - * @interfaces - * ImagePickerOptions - */ -@Plugin({ - pluginName: 'ImagePicker', - plugin: 'cordova-plugin-telerik-imagepicker', - pluginRef: 'window.imagePicker', - repo: 'https://github.com/Telerik-Verified-Plugins/ImagePicker', - install: - 'ionic cordova plugin add cordova-plugin-telerik-imagepicker --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"', - installVariables: ['PHOTO_LIBRARY_USAGE_DESCRIPTION'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class ImagePicker extends AwesomeCordovaNativePlugin { - /** - * Pick pictures from the library. - * - * @param {ImagePickerOptions} options - * @returns {Promise} Returns a Promise that resolves the image file URI - * otherwise rejects with an error. - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getPictures(options: ImagePickerOptions): Promise { - return; - } - - /** - * Check if we have permission to read images - * - * @returns {Promise} Returns a promise that resolves with a boolean that indicates whether we have permission - */ - @Cordova({ - platforms: ['Android'], - }) - hasReadPermission(): Promise { - return; - } - - /** - * Request permission to read images - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['Android'], - }) - requestReadPermission(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/image-resizer/index.ts b/src/@awesome-cordova-plugins/plugins/image-resizer/index.ts deleted file mode 100644 index e46d764c..00000000 --- a/src/@awesome-cordova-plugins/plugins/image-resizer/index.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* eslint-disable jsdoc/require-param-type */ -/* eslint-disable jsdoc/check-tag-names */ - -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export interface ImageResizerOptions { - /** - * The URI for the image on the device to get scaled - */ - uri: string; - /** - * The name of the folder the image should be put - * (Android only) - */ - folderName?: string; - /** - * A custom name for the file. Default name is a timestamp. You have to set this value on iOS - */ - fileName?: string; - /** - * - * Quality given as Number for the quality of the new image - * (Android and iOS only) - */ - quality?: number; - /** - * The width of the new image - */ - width: number; - /** - * The height of the new image - */ - height: number; - /** - * Whether or not to return a base64 encoded image string instead of the path to the resized image. - * iOS only - */ - base64?: boolean; -} - -/** - * @name ImageResizer - * @description - * Cordova Plugin For Image Resize - * @usage - * ```typescript - * import { ImageResizer, ImageResizerOptions } from '@awesome-cordova-plugins/image-resizer/ngx'; - * - * constructor(private imageResizer: ImageResizer) { } - * - * ... - * - * let options = { - * uri: uri, - * folderName: 'Protonet', - * quality: 90, - * width: 1280, - * height: 1280 - * } as ImageResizerOptions; - * - * this.imageResizer - * .resize(options) - * .then((filePath: string) => console.log('FilePath', filePath)) - * .catch(e => console.log(e)); - * - * ``` - */ -@Plugin({ - pluginName: 'ImageResizer', - plugin: 'cordova-plugin-image-resizer', // npm package name, example: cordova-plugin-camera - pluginRef: 'ImageResizer', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/JoschkaSchulz/cordova-plugin-image-resizer', // the github repository URL for the plugin - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class ImageResizer extends AwesomeCordovaNativePlugin { - /** - * This function resizes the image based on the options provided - * - * @param options {ImageResizerOptions} image resize options - * @return {Promise} Returns a Promise that resolves the resized image file URI - * otherwise rejects with an error. - */ - @Cordova() - resize(options: ImageResizerOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/imap/index.ts b/src/@awesome-cordova-plugins/plugins/imap/index.ts deleted file mode 100644 index 72541d40..00000000 --- a/src/@awesome-cordova-plugins/plugins/imap/index.ts +++ /dev/null @@ -1,620 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export interface Config { - /** - * Hostname or IP address of the IMAP service, for example: imap.gmail.com, imap-mail.outlook.com.... - */ - host: string; - /** - * Optional parameter. Port of the IMAP server to connect. - * Default set to: 993 - */ - port?: number; - /** - * iOS ONLY - * Optional parameter. Encryption type to use. - * Default set to: TLS/SSL - */ - connectionType?: ConnectionType; - /** - * Username or email address for authentication. - */ - user: string; - /** - * Password for authentication. - */ - password: string; -} - -export interface Connection { - /** - * Connection Status: true or false, "true" means connected successfully; "false" means failed to connect. - */ - status: boolean; - /** - * Optional parameter. A connection string, returned as a confirmation for successful connection. - */ - connection?: string; - /** - * Optional parameter. Error, returned if the connecting process has failed. - */ - exception?: string; -} - -export interface MessageHeaders { - /** - * Message consecutive number. - */ - messageNumber: number; - /** - * The name of the folder where the message is contained. - */ - folder: string; - /** - * Sender's data. - */ - from: Address[]; - /** - * TO recipients data. - */ - toRecipients: Address[]; - /** - * CC recipients data. - */ - ccRecipients: Address[]; - /** - * BCC recipients data. - */ - bccRecipients: Address[]; - /** - * The date when the message was received. - */ - receivedDate: string; - /** - * Message's subject header. - */ - subject: string; - /** - * Message's active flags. - */ - flags: string[]; -} - -export interface Message { - /** - * Message consecutive number. - */ - messageNumber: number; - /** - * The name of the folder where the message is contained. - */ - folder: string; - /** - * Sender's data. - */ - from: Address[]; - /** - * All recipients data. - */ - allRecipients: Address[]; - /** - * TO recipients data. - */ - toRecipients: Address[]; - /** - * CC recipients data. - */ - ccRecipients: Address[]; - /** - * BCC recipients data. - */ - bccRecipients: Address[]; - /** - * Reply data. - */ - replyTo: Address[]; - /** - * Date when the message was sent. - */ - sentDate: string; - /** - * The date when the message was received. - */ - receivedDate: string; - /** - * Message's subject header. - */ - subject: string; - /** - * Android ONLY - * Optional. Short description for the message. - */ - description?: string; - /** - * - */ - fileName: string; - /** - * Android ONLY - * Optional. - */ - disposition?: string; - /** - * Message's active flags. - */ - flags: string[]; - /** - * Android ONLY - * Optional. - */ - lineCount?: number; - /** - * Android ONLY - * Optional. All Headers available on a message. - */ - allMessageHeaders?: object; - /** - * Android ONLY - * Optional. Type of message's content. - */ - contentType?: string; - /** - * Message's body with its content and attachments. - */ - bodyContent: Content[]; - /** - * Message's memory size. - */ - size: number; -} - -export interface Address { - /** - * Email address. - */ - address: string; - /** - * Optional. Name of the email address's owner. - */ - personal?: string; - /** - * Android ONLY - * Optional. Data type. - */ - type?: string; -} - -export interface Content { - /** - * Content data type. - */ - type: string; - /** - * Optional. The name of the file. - */ - fileName?: string; - /** - * Message's content. - */ - content: string; -} - -export interface ModificationResult { - /** - * Status of the applied changes. "True" success; "False" failure - */ - status: boolean; - /** - * Array with consecutive numbers of modified messages. - */ - modifiedMessages: number[]; -} - -export enum ConnectionType { - /** - * Clear-text connection for the protocol. - */ - Clear = 'Clear', - /** - * Starts with clear-text connection at the beginning, then switch to encrypted connection using TLS/SSL. - */ - StartTLS = 'StartTLS', - /** - * Encrypted connection using TLS/SSL. - */ - TLSSSL = 'TLS/SSL', -} - -export enum Comparison { - /** - * Android ONLY - * The less than or equal to operator. - */ - LE = 'LE', - /** - * The less than operator. - */ - LT = 'LT', - /** - * The equality operator. - */ - EQ = 'EQ', - /** - * The not equal to operator. - */ - NE = 'NE', - /** - * Android ONLY - * The greater than operator. - */ - GT = 'GT', - /** - * The greater than or equal to operator. - */ - GE = 'GE', -} - -/** - * All available message flags. Set or remove flag using "setFlag()". - */ -export enum FlagEnum { - /** - * "ANSWERED" message flag - */ - ANSWERED = 'ANSWERED', - /** - * "DRAFT" message flag - */ - DRAFT = 'DRAFT', - /** - * "FLAGGED" message flag - */ - FLAGGED = 'FLAGGED', - /** - * Android ONLY - * "RECENT" message flag - */ - RECENT = 'RECENT', - /** - * "SEEN" message flag - */ - SEEN = 'SEEN', - /** - * Android ONLY - * "USER" message flag - */ - USER = 'USER', - /** - * "DELETED" message flag. Note: Add this flag to delete the message from the mailbox - */ - DELETED = 'DELETED', - /** - * iOS ONLY - * "SENT" message flag. - */ - SENT = 'Sent', - /** - * iOS ONLY - * "FORWARDED" message flag. - */ - FORWARDED = 'Forwarded', - /** - * iOS ONLY - * "SubmitPending" message flag. - */ - SubmitPending = 'SubmitPending', - /** - * iOS ONLY - * "SUBMITTED" message flag. - */ - SUBMITTED = 'Submitted', -} - -/** - * @name Imap - * @description - * This plugin will enable a Cordova application to use the IMAP (Internet Message Access Protocol) features - * The plugin offers support for Android and iOS. - * To enable the IMAP features on Android, this plugin uses the framework [Java Mail API](https://javaee.github.io/javamail/) and for iOS, it uses the [MailCore 2](http://libmailcore.com/) library. - * - * - * @usage - * ```typescript - * import { Imap } from '@awesome-cordova-plugins/imap/ngx'; - * - * - * constructor(private imap: Imap) { } - * - * ... - * - * - * this.imap.connect({ - * host: 'imap.gmail.com', - * port: 993, - * connectionType: ConnectionType.TLSSSL // (iOS ONLY) Encryption type to use. Default set to: TLS/SSL - * user: 'my_email@gmail.com', - * password: 'my-pass' - * }) - * .then((res: Connection) => console.log(res)) - * .catch((error) => console.error(error)); - * - * - * - * this.imap.disconnect() - * .then((res: boolean) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * - * - * this.imap.isConnected() - * .then((res: boolean) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * // Note: Connected to an IMAP service is REQUIRED to be able to get data from the below functions. - * - * - * // listMailFolders('*') using a '*' pattern will return all folder names - * // listMailFolders('INBOX*') using a pattern with a folder name will list all the subfolder names of that folder that match the pattern - * - * this.imap.listMailFolders('*') - * .then((res: boolean) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * - * this.imap.getMessageCountByFolderName('INBOX') - * .then((res: number) => { - * // Returns the count of the messages in the folder as a result - * console.log(res) - * }) - * .catch((error: any) => { - * console.error(error) - * }); - * - * - * - * this.imap.searchMessagesByDatePeriod('INBOX', 1601503200000, Comparison.GE) - * .then((res: number[]) => { - * // Returns array with messages' consecutive numbers - * // ex. [1207, 1208, 1209] - * console.log(res) - * }) - * .catch((error: any) => { - * console.error(error) - * }); - * - * - * this.imap.listMessagesHeadersByConsecutiveNumber('INBOX', 1200, 1280) - * .then((res: MessageHeaders[]) => { - * // Returns array with messages' headers data - * console.log(res) - * }) - * .catch((error: any) => { - * console.error(error) - * }); - * - * - * this.imap.listMessagesHeadersByDate('INBOX', 1601503200000, Comparison.GE) - * .then((res: MessageHeaders[]) => { - * // Returns array with messages' headers data - * console.log(res) - * }) - * .catch((error: any) => { - * console.error(error) - * }); - * - * - * this.imap.getFullMessageData('INBOX', 1205) - * .then((res: Message) => { - * // Returns "Message" object with the full message data including attachments. - * console.log(res) - * }) - * .catch((error: any) => { - * console.error(error) - * }); - * - * - * this.imap.getFullMessageDataOnNewSession({ - * host: 'imap.gmail.com', - * port: 993, - * connectionType: ConnectionType.TLSSSL // (iOS ONLY) Encryption type to use. Default set to: TLS/SSL - * user: 'my_email@gmail.com', - * password: 'my-pass' - * }, 'INBOX', 1205) - * .then((res: Message) => { - * // Returns "Message" object with the full message data including attachments. - * console.log(res) - * }) - * .catch((error: any) => { - * console.error(error) - * }); - * - * - * this.imap.copyToFolder('INBOX', 'Spam', [1204, 1205, 1206, 1207]) - * .then((res: boolean) => { - * // Returns "true" if the process is successful, else returns "false". - * console.log(res) - * }) - * .catch((error: any) => { - * console.error(error) - * }); - * - * - * * Sets a flag on a message - * * "setFlag()" can be used for deleting messages setting the Delete flag to "FlagEnum.DELETED" - * this.imap.setFlag('INBOX', [1206, 1205, 1204], FlagEnum.SEEN, true) - * .then((res: ModificationResult) => { - * - * // res.status - return true or false based on the deletion success - * - * //res.modifiedMessages - for ex.[1206, 1205, 1204]; - * - * }) - * .catch((error: any) => { - * console.error(error) - * }); - * - * ``` - */ -@Plugin({ - pluginName: 'Imap', - plugin: 'cordova-plugin-imap', - pluginRef: 'imap', - repo: 'https://github.com/aleksandar888/cordova-plugin-imap.git', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Imap extends AwesomeCordovaNativePlugin { - /** - * This function "connect(clientData: Config)" tries to connect and authenticate with the IMAP server. - * @param clientData {Config} Connection configuration - * @return {Promise} Returns a promise with the connection data - */ - @Cordova() - connect(clientData: Config): Promise { - return; - } - - /** - * "disconnect()" Closes the connection with the server. - * @return {Promise} Returns a promise status. - */ - @Cordova() - disconnect(): Promise { - return; - } - - /** - * "isConnected()" Checks the current state of the connection. - * @return {Promise} Returns a promise with connection status - */ - @Cordova() - isConnected(): Promise { - return; - } - - /** Note: Connected to an IMAP service is REQUIRED to be able to get data from the below functions. */ - - /** - * Returns an array of Folder names based on a regular expression pattern. - * - * Example: - * - * listMailFolders('*') using a '*' pattern will return all folder names - * listMailFolders('INBOX*') using a pattern with a folder name will list all the subfolder names that match the pattern - * - * - * "listMailFolders(pattern: string)" Lists the name of mail folders in the mailbox. - * @param pattern {string} Regular expression pattern. - * @return {Promise} Returns array of folder names matching the pattern. - */ - @Cordova() - listMailFolders(pattern: string): Promise { - return; - } - - /** - * "getMessageCountByFolderName(folderName: string)" Gets the count of the messages in the folder. - * @param folderName {string} The name of the desired folder. - * @return {Promise} Returns the consecutive number of the last message. - */ - @Cordova() - getMessageCountByFolderName(folderName: string): Promise { - return; - } - - /** - * "searchMessagesByDatePeriod(folderName: string, dateInMilliseconds: number, comparison: Comparison)" Returns the messages' consecutive number. - * @param folderName {string} The name of the desired folder - * @param dateInMilliseconds {number} Date in milliseconds - * @param comparison {Comparison} A comparison operator - * @return {Promise} Returns array with the messages' consecutive numbers. - */ - @Cordova() - searchMessagesByDatePeriod( - folderName: string, - dateInMilliseconds: number, - comparison: Comparison - ): Promise { - return; - } - - /** - * "listMessagesHeadersByConsecutiveNumber(folderName: string, start: number, end: number)" Returns messages' headers data based on a "start" and "end" message consecutive number. - * @param folderName {string} The name of the desired folder - * @param start {number} Consecutive number of the first message. - * @param end {number} Consecutive number of the last message - * @return {Promise} Returns array with the messages' headers data. - */ - @Cordova() - listMessagesHeadersByConsecutiveNumber(folderName: string, start: number, end: number): Promise { - return; - } - - /** - * "listMessagesHeadersByDate(folderName: string, dateInMilliseconds: number, comparison: Comparison)" Returns messages' headers data based on a date. - * @param folderName {string} The name of the desired folder - * @param dateInMilliseconds {number} Date in milliseconds. - * @param comparison {Comparison} A comparison operator - * @return {Promise} Returns array messages' headers data. - */ - @Cordova() - listMessagesHeadersByDate( - folderName: string, - dateInMilliseconds: number, - comparison: Comparison - ): Promise { - return; - } - - /** - * "getFullMessageData(folderName: string, messageNumber: number)" Returns the full message data including its attachments. - * @param folderName {string} The name the message's folder. - * @param messageNumber {number} Message's consecutive number. - * @return {Promise} Returns "Message" object with full message data. - */ - @Cordova() - getFullMessageData(folderName: string, messageNumber: number): Promise { - return; - } - - /** - * - * This function "getFullMessageDataOnNewSession(clientData: Config, folderName: string, messageNumber: number)" downloads the full message data using a - * separate session with the server. It is suitable for downloading message data while the app is already connected to a third server. - * "getFullMessageDataOnNewSession(clientData: Config, folderName: string, messageNumber: number)" Returns the full message data including its attachments. - * @param clientData {Config} Connection configuration. - * @param folderName {string} The name the message's folder. - * @param messageNumber {number} Message's consecutive number. - * @return {Promise} Returns "Message" object with full message data. - */ - @Cordova() - getFullMessageDataOnNewSession(clientData: Config, folderName: string, messageNumber: number): Promise { - return; - } - - /** - * "copyToFolder(sourceFolder: string, destinationFolder: string, messageNums: number[])" Copy messages to a desired folder. - * @param sourceFolder {string} The name of the source folder. - * @param destinationFolder {string} The name of the destination folder. - * @param messageNums {number[]} Array with messages' consecutive numbers or array with single message consecutive number. - * @return {Promise} Returns boolean status of the process. - */ - @Cordova() - copyToFolder(sourceFolder: string, destinationFolder: string, messageNums: number[]): Promise { - return; - } - - /** - * "setFlag(folderName: string, messageNums: number[], flag: FlagEnum, status: boolean)" Set or remove flag from a message - * @param folderName {string} The name of the source folder where the messages are contained. - * @param messageNums {number[]} Array with messages' consecutive numbers or array with single message consecutive number - * @param flag {FlagEnum} Desired message flag. - * @param status {boolean} Set status to "true" to set the flag on a message; or to "false" to remove the flag from the message - * @return {Promise} Returns object with status and array with messages' consecutive numbers of the modified messages - */ - @Cordova() - setFlag(folderName: string, messageNums: number[], flag: FlagEnum, status: boolean): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/in-app-browser/index.ts b/src/@awesome-cordova-plugins/plugins/in-app-browser/index.ts deleted file mode 100644 index c723ea38..00000000 --- a/src/@awesome-cordova-plugins/plugins/in-app-browser/index.ts +++ /dev/null @@ -1,317 +0,0 @@ -import { Injectable } from '@angular/core'; -import { CordovaInstance, InstanceCheck, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable, Observer } from 'rxjs'; - -declare const cordova: Cordova & { InAppBrowser: any }; - -export interface InAppBrowserOptions { - /** - * (iOS Only) Set to yes or no to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. - * The HTML's video element must also include the webkit-playsinline attribute (defaults to no) - */ - allowInlineMediaPlayback?: 'yes' | 'no'; - /** - * set to enable the beforeload event to modify which pages are actually loaded in the browser. Accepted values are get to - * intercept only GET requests, post to intercept on POST requests or yes to intercept both GET & POST requests. - * Note that POST requests are not currently supported and will be ignored (if you set beforeload=post it will raise an error). - */ - beforeload?: 'yes' | 'get' | 'post'; - /** Set to yes to have the browser's cookie cache cleared before the new window is opened. */ - clearcache?: 'yes' | 'no'; - /** set to yes to have the browser's entire local storage cleared (cookies, HTML5 local storage, IndexedDB, etc.) before the new window is opened */ - cleardata?: 'yes' | 'no'; - /** - * Set to yes to have the session cookie cache cleared before the new window is opened. - * For WKWebView, requires iOS 11+ on target device. - */ - clearsessioncache?: 'yes' | 'no'; - /** - * (Android) Set to a string to use as the close button's caption instead of a X. Note that you need to localize this value yourself. - * (iOS) Set to a string to use as the Done button's caption. Note that you need to localize this value yourself. - */ - closebuttoncaption?: string; - /** - * (Android) Set to a valid hex color string, for example: #00ff00, and it will change the close button color from default, regardless of being a text or default X. Only has effect if user has location set to yes. - * (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default Done button's color. Only applicable if toolbar is not disabled. - */ - closebuttoncolor?: string; - /** (iOS Only) Set to yes or no (default is no). Turns on/off the UIWebViewBounce property. */ - disallowoverscroll?: 'yes' | 'no'; - /** (iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). */ - enableViewportScale?: 'yes' | 'no'; - /** (Android Only) Set to yes to show a close button in the footer similar to the iOS Done button. The close button will appear the same as for the header hence use closebuttoncaption and closebuttoncolor to set its properties */ - footer?: 'yes' | 'no'; - /** (Android Only) Set to a valid hex color string, for example #00ff00 or #CC00ff00 (#aarrggbb), and it will change the footer color from default. Only has effect if user has footer set to yes */ - footercolor?: string; - /** - * (Windows only) Set to yes to create the browser control without a border around it. - * Please note that if location=no is also specified, there will be no control presented to user to close IAB window. - */ - fullscreen?: 'yes' | 'no'; - /** - * (Android & Windows Only) Set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history. - * If there is no previous page, the InAppBrowser will close. The default value is yes, so you must set it to no if you want the back button to simply close the InAppBrowser. - */ - hardwareback?: 'yes' | 'no'; - /** - * Set to yes to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. - * Omit or set to no (default) to have the browser open and load normally. - */ - hidden?: 'yes' | 'no'; - /** - * (Android) Set to yes to hide the navigation buttons on the location toolbar, only has effect if user has location set to yes. The default value is no. - * (iOS) Set to yes or no to turn the toolbar navigation buttons on or off (defaults to no). Only applicable if toolbar is not disabled. - */ - hidenavigationbuttons?: 'yes' | 'no'; - /** - * (iOS Only) Set to yes or no to change the visibility of the loading indicator (defaults to no). - */ - hidespinner?: 'yes' | 'no'; - /** (Android) Set to yes to hide the url bar on the location toolbar, only has effect if user has location set to yes. The default value is no. */ - hideurlbar?: 'yes' | 'no'; - /** (iOS Only) Set to yes or no to open the keyboard when form elements receive focus via JavaScript's focus() call (defaults to yes). */ - keyboardDisplayRequiresUserAction?: 'yes' | 'no'; - /** - * (Android) Set to yes to swap positions of the navigation buttons and the close button. Specifically, navigation buttons go to the left and close button to the right. - * (iOS) Set to yes to swap positions of the navigation buttons and the close button. Specifically, close button goes to the right and navigation buttons to the left. - */ - lefttoright?: 'yes' | 'no'; - /** Set to yes or no to turn the InAppBrowser's location bar on or off. */ - location?: 'yes' | 'no'; - /** - * Set to yes to prevent HTML5 audio or video from autoplaying (defaults to no). - */ - mediaPlaybackRequiresUserAction?: 'yes' | 'no'; - /** - * (Android) Set to a valid hex color string, for example: #00ff00, and it will change the color of both navigation buttons from default. Only has effect if user has location set to yes and not hidenavigationbuttons set to yes. - * (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default color. Only applicable if navigation buttons are visible. - */ - navigationbuttoncolor?: string; - /** (iOS Only) Set to pagesheet, formsheet or fullscreen to set the presentation style (defaults to fullscreen). */ - presentationstyle?: 'pagesheet' | 'formsheet' | 'fullscreen'; - /** (Android Only) Set to yes to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues) */ - shouldPauseOnSuspend?: 'yes' | 'no'; - /** (iOS Only) Set to yes or no to wait until all new view content is received before being rendered (defaults to no). */ - suppressesIncrementalRendering?: 'yes' | 'no'; - /** (iOS Only) Set to yes or no to turn the toolbar on or off for the InAppBrowser (defaults to yes) */ - toolbar?: 'yes' | 'no'; - /** - * (Android) Set to a valid hex color string, for example: #00ff00, and it will change the color the toolbar from default. Only has effect if user has location set to yes. - * (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default color of the toolbar. Only applicable if toolbar is not disabled. - */ - toolbarcolor?: string; - /** (iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window. */ - toolbarposition?: 'top' | 'bottom'; - /** (iOS Only) Set to yes or no to make the toolbar translucent(semi-transparent) (defaults to yes). Only applicable if toolbar is not disabled. */ - toolbartranslucent?: 'yes' | 'no'; - /** (iOS Only) Set to fliphorizontal, crossdissolve or coververtical to set the transition style (defaults to coververtical). */ - transitionstyle?: 'fliphorizontal' | 'crossdissolve' | 'coververtical'; - /** (Android Only) Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is no, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is yes and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used. (defaults to yes). */ - useWideViewPort?: 'yes' | 'no'; - /** (iOS Only) Set to yes to use WKWebView engine for the InappBrowser. Omit or set to no (default) to use UIWebView. */ - usewkwebview?: 'yes' | 'no'; - /** (Android Only) Set to yes to show Android browser's zoom controls, set to no to hide them. Default value is yes. */ - zoom?: 'yes' | 'no'; - /** - * @hidden - */ - [key: string]: any; -} - -export type InAppBrowserEventType = - | 'loadstart' - | 'loadstop' - | 'loaderror' - | 'exit' - | 'beforeload' - | 'message' - | 'customscheme'; - -export interface InAppBrowserEvent extends Event { - /** the event name */ - type: string; - /** the URL that was loaded. */ - url: string; - /** the error code, only in the case of loaderror. */ - code: number; - /** the error message, only in the case of loaderror. */ - message: string; - /** the postMessage data, only in the case of message. */ - data: any; -} - -/** - * @hidden - */ -export class InAppBrowserObject { - private _objectInstance: any; - - /** - * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. - * - * @param {string} url The URL to load. - * @param {string} [target="self"] The target in which to load the URL, an optional parameter that defaults to _self. - * _self: Opens in the WebView if the URL is in the white list, otherwise it opens in the InAppBrowser. - * _blank: Opens in the InAppBrowser. - * _system: Opens in the system's web browser. - * @param {string | InAppBrowserOptions} [options] Options for the InAppBrowser. Optional, defaulting to: location=yes. - * The options string must not contain any blank space, and each feature's - * name/value pairs must be separated by a comma. Feature names are case insensitive. - */ - constructor(url: string, target?: string, options?: string | InAppBrowserOptions) { - try { - if (options && typeof options !== 'string') { - options = Object.keys(options) - .map((key: string) => `${key}=${(options as InAppBrowserOptions)[key]}`) - .join(','); - } - - this._objectInstance = cordova.InAppBrowser.open(url, target, options); - } catch (e) { - if (typeof window !== 'undefined') { - window.open(url, target); - } - console.warn( - 'Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.' - ); - } - } - - /** - * Method to be called after the "beforeload" event to continue the script - * - * @param strUrl {String} The URL the InAppBrowser should navigate to. - */ - @CordovaInstance({ sync: true }) - _loadAfterBeforeload(strUrl: string): void {} - - /** - * Displays an InAppBrowser window that was opened hidden. Calling this has no effect - * if the InAppBrowser was already visible. - */ - @CordovaInstance({ sync: true }) - show(): void {} - - /** - * Closes the InAppBrowser window. - */ - @CordovaInstance({ sync: true }) - close(): void {} - - /** - * Hides an InAppBrowser window that is currently shown. Calling this has no effect - * if the InAppBrowser was already hidden. - */ - @CordovaInstance({ sync: true }) - hide(): void {} - - /** - * Injects JavaScript code into the InAppBrowser window. - * - * @param script {Object} Details of the script to run, specifying either a file or code key. - * @param script.file - * @param script.code - * @returns {Promise} - */ - @CordovaInstance() - executeScript(script: { file?: string; code?: string }): Promise { - return; - } - - /** - * Injects CSS into the InAppBrowser window. - * - * @param css {Object} Details of the script to run, specifying either a file or code key. - * @param css.file - * @param css.code - * @returns {Promise} - */ - @CordovaInstance() - insertCSS(css: { file?: string; code?: string }): Promise { - return; - } - - /** - * A method that allows you to listen to events happening in the browser. - * - * @param event {InAppBrowserEventType} Name of the event - * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. - */ - @InstanceCheck() - on(event: InAppBrowserEventType): Observable { - return new Observable((observer: Observer) => { - this._objectInstance.addEventListener(event, observer.next.bind(observer)); - return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); - }); - } - - /** - * A method that allows you to listen to events happening in the browser. - * - * @param event {string} Name of the event - * @returns {Observable} Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe. - */ - @InstanceCheck() - on(event: string): Observable { - return new Observable((observer: Observer) => { - this._objectInstance.addEventListener(event, observer.next.bind(observer)); - return () => this._objectInstance.removeEventListener(event, observer.next.bind(observer)); - }); - } -} - -/** - * @name In App Browser - * @premier inappbrowser - * @description Launches in app Browser - * @usage - * ```typescript - * import { InAppBrowser } from '@awesome-cordova-plugins/in-app-browser/ngx'; - * - * constructor(private iab: InAppBrowser) { } - * - * - * ... - * - * - * const browser = this.iab.create('https://ionicframework.com/'); - * - * browser.executeScript(...); - * - * browser.insertCSS(...); - * browser.on('loadstop').subscribe(event => { - * browser.insertCSS({ code: "body{color: red;" }); - * }); - * - * browser.close(); - * - * ``` - * @classes - * InAppBrowserObject - * @interfaces - * InAppBrowserEvent - * InAppBrowserOptions - */ -@Plugin({ - pluginName: 'InAppBrowser', - plugin: 'cordova-plugin-inappbrowser', - pluginRef: 'cordova.InAppBrowser', - repo: 'https://github.com/apache/cordova-plugin-inappbrowser', - platforms: ['AmazonFire OS', 'Android', 'Browser', 'iOS', 'macOS', 'Windows'], -}) -@Injectable() -export class InAppBrowser extends AwesomeCordovaNativePlugin { - /** - * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. - * - * @param url {string} The URL to load. - * @param target {string} The target in which to load the URL, an optional parameter that defaults to _self. - * @param options {string} Options for the InAppBrowser. Optional, defaulting to: location=yes. - * The options string must not contain any blank space, and each feature's - * name/value pairs must be separated by a comma. Feature names are case insensitive. - * @returns {InAppBrowserObject} - */ - create(url: string, target?: string, options?: string | InAppBrowserOptions): InAppBrowserObject { - return new InAppBrowserObject(url, target, options); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/in-app-purchase-2/index.ts b/src/@awesome-cordova-plugins/plugins/in-app-purchase-2/index.ts deleted file mode 100644 index 184fcc5a..00000000 --- a/src/@awesome-cordova-plugins/plugins/in-app-purchase-2/index.ts +++ /dev/null @@ -1,931 +0,0 @@ -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -export interface IAPProductOptions { - id: string; - alias?: string; - type: string; -} - -export interface IRefeshResult { - cancelled(fn: () => void): void; - failed(fn: () => void): void; - completed(fn: () => void): void; - finished(fn: () => void): void; -} - -export type IAPProducts = IAPProduct[] & { - /** - * Get product by ID - */ - byId: { [id: string]: IAPProduct }; - /** - * Get product by alias - */ - byAlias: { [alias: string]: IAPProduct }; - /** - * Remove all products (for testing only). - */ - reset: () => {}; -}; - -export type IAPQueryCallback = ((product: IAPProduct) => void) | ((error: IAPError) => void); - -export interface IAPProduct { - id: string; - - alias?: string; - - type: string; - - state: string; - - title: string; - - description: string; - - priceMicros: number; - - price: string; - - currency: string; - - loaded: boolean; - - valid: boolean; - - canPurchase: boolean; - - owned: boolean; - - downloading?: boolean; - - downloaded?: boolean; - - lastRenewalDate?: Date; - - expiryDate?: Date; - - introPrice?: string; - - introPriceMicros?: number; - - introPriceNumberOfPeriods?: number; - - introPriceSubscriptionPeriod?: string; - - introPricePaymentMode?: string; - - ineligibleForIntroPrice?: boolean; - - billingPeriod?: number; - - billingPeriodUnit?: string; - - trialPeriod?: number; - - trialPeriodUnit?: string; - - additionalData?: any; - - transaction?: PlayStoreReceipt | AppStoreReceipt; - - /** - * Call `product.finish()` to confirm to the store that an approved order has been delivered. - * - * This will change the product state from `APPROVED` to `FINISHED` (see product life-cycle). - * - * As long as you keep the product in state `APPROVED`: - * - * - the money may not be in your account (i.e. user isn't charged) - * - you will receive the `approved` event each time the application starts, - * where you should try again to finish the pending transaction. - * - * example use** - * - * ```js - * store.when("product.id").approved(function(product){ - * // synchronous - * app.unlockFeature(); - * product.finish(); - * }); - * ``` - * - * ```js - * store.when("product.id").approved(function(product){ - * // asynchronous - * app.downloadFeature(function() { - * product.finish(); - * }); - * }); - * ``` - */ - finish(): void; - - /** - * Initiate purchase validation as defined by the `store.validator` attribute. - * - * return value** - * - * A Promise with the following methods: - * - * - `done(function(product){})` - * - called whether verification failed or succeeded. - * - `expired(function(product){})` - * - called if the purchase expired. - * - `success(function(product, purchaseData){})` - * - called if the purchase is valid and verified. - * - `purchaseData` is the device dependent transaction details - * returned by the validator, which you can most probably ignore. - * - `error(function(err){})` - * - validation failed, either because of expiry or communication - * failure. - * - `err` is a store.Error object, with a code expected to be - * `store.ERR_PAYMENT_EXPIRED` or `store.ERR_VERIFICATION_FAILED`. - */ - verify(): any; - - set(key: string, value: any): void; - - stateChanged(): void; - - on(event: string, callback: Function): void; - - once(event: string, callback: Function): void; - - off(callback: Function): void; - - trigger(action: string, args: any): void; -} - -export interface IAPProductEvents { - /** Called when product data is loaded from the store. */ - loaded: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when any change occured to a product. */ - updated: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when an order failed. The `err` parameter is an IAPError object. */ - error: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when a product order is approved. */ - approved: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when a non-consumable product or subscription is owned. */ - owned: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when a product order is cancelled by the user. */ - cancelled: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when an order is refunded by the user. */ - refunded: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when product has just been registered. */ - registered: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when the product details have been successfully loaded. */ - valid: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when the product cannot be loaded from the store. */ - invalid: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when an order has just been requested. */ - requested: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when the purchase process has been initiated. */ - initiated: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when the purchase process has completed. */ - finished: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when receipt validation successful. */ - verified: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when receipt verification failed. */ - unverified: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when validation find a subscription to be expired. */ - expired: (callback: IAPQueryCallback) => IAPProductEvents; - /** Called when content download is started. */ - downloading: (product: IAPProduct, progress: any, time_remaining: any) => IAPProductEvents; - /** Called when content download has successfully completed. */ - downloaded: (callback: IAPQueryCallback) => IAPProductEvents; -} - -export type PlayStoreReceipt = { - id: string; - purchaseState: number; - purchaseToken: string; - receipt: string; - signature: string; - type: 'android-playstore'; -}; - -export type AppStoreReceipt = { - id: string; - appStoreReceipt: string; - original_transaction_id: string; - type: 'ios-appstore'; -}; - -/** - * @hidden - */ -export class IAPError { - code: number; - message: string; -} - -/** - * @name In App Purchase 2 - * @description - * In-App Purchase on iOS, Android, Windows, macOS and XBox. - * - * ## Features - * - * | | ios | android | win-8 | win-10/uwp | mac | - * |--|--|--|--|--|--| - * | consumables | ✅ | ✅ | ✅ | ✅ | ✅ | - * | non consumables | ✅ | ✅ | ✅ | ✅ | ✅ | - * | subscriptions | ✅ | ✅ | ✅ | ✅ | ✅ | - * | restore purchases | ✅ | ✅ | ✅ | ✅ | ✅ | - * | receipt validations | ✅ | ✅ | | ✅ | ✅ | - * | downloadable content | ✅ | | | | ✅ | - * | introductory prices | ✅ | ✅ | | ✅ | ✅ | - * - * Supports: - * - * - **iOS** version 7.0 or higher. - * - **Android** version 2.2 (API level 8) or higher - * - with Google Play client version 3.9.16 or higher - * - **Windows** Store/Phone 8.1 or higher - * - **Windows 10 Mobile** - * - **macOS** version 10 - * - **Xbox One** - * - (and any platform supporting Microsoft's UWP) - * @usage - * ```typescript - * import { InAppPurchase2 } from '@awesome-cordova-plugins/in-app-purchase-2/ngx'; - * - * constructor(public platform: Platform, private store: InAppPurchase2) { - * platform.ready().then(() => { - * this.store.register({ - * id: "my_product_id", - * type: this.store.NON_RENEWING_SUBSCRIPTION, - * }); - * this.store.when("my_product_id") - * .approved(p => p.verify()) - * .verified(p => p.finish()); - * this.store.refresh(); - * }); - * } - * - * ... - * - * this.store.order("my_product_id"); - * - * ``` - * - * ## Full example - * - * ```typescript - * // After platform ready - * this.store.verbosity = this.store.DEBUG; - * this.store.register({ - * id: "my_product_id", - * type: this.store.PAID_SUBSCRIPTION, - * }); - * - * // Register event handlers for the specific product - * this.store.when("my_product_id").registered( (product: IAPProduct) => { - * console.log('Registered: ' + JSON.stringify(product)); - * }); - * - * // Updated - * this.store.when("my_product_id").updated( (product: IAPProduct) => { - * console.log('Updated' + JSON.stringify(product)); - * }); - * - * // User closed the native purchase dialog - * this.store.when("my_product_id").cancelled( (product) => { - * console.error('Purchase was Cancelled'); - * }); - * - * // Track all store errors - * this.store.error( (err) => { - * console.error('Store Error ' + JSON.stringify(err)); - * }); - * - * // Run some code only when the store is ready to be used - * this.store.ready(() => { - * console.log('Store is ready'); - * console.log('Products: ' + JSON.stringify(this.store.products)); - * console.log(JSON.stringify(this.store.get("my_product_id"))); - * }); - * - * // Refresh the status of in-app products - * this.store.refresh(); - * - * ... - * - * // To make a purchase - * this.store.order("my_product_id"); - * - * ``` - * - * ## Philosophy - * - * The API is mostly events based. As a user of this plugin, - * you will have to register listeners to changes happening to the products - * you register. - * - * The core of the listening mechanism is the `when()` method. It allows you to - * be notified of changes to one or a set of products using a query mechanism: - * ```typescript - * this.store.when("product").updated(refreshScreen); // match any product - * this.store.when("full_version").owned(unlockApp); // match a specific product - * this.store.when("subscription").approved(serverCheck); // match all subscriptions - * this.store.when("downloadable content").downloaded(showContent); - * ``` - * - * The `updated` event is fired whenever one of the fields of a product is - * changed (its `owned` status for instance). - * - * This event provides a generic way to track the statuses of your purchases, - * to unlock features when needed and to refresh your views accordingly. - * - * ## Registering products - * - * The store needs to know the type and identifiers of your products before you - * can use them in your code. - * - * Use `store.register()` to define them before your first call to `store.refresh()`. - * - * Once registered, you can use `store.get()` to retrieve an `IAPProduct` object. - * - * ```typescript - * this.store.register({ - * id: "my_consumable1", - * type: this.store.CONSUMABLE - * }); - * ... - * const p = this.store.get("my_consumable1"); - * ``` - * - * The product `id` and `type` have to match products defined in your - * Apple, Google or Microsoft developer consoles. - * - * Learn more about it [from the wiki](https://github.com/j3k0/cordova-plugin-purchase/wiki). - * - * ## Displaying products - * - * Right after you registered your products, nothing much is known about them - * except their `id`, `type` and an optional `alias`. - * - * When you perform the initial call to `store.refresh()`, the platforms' server will - * be contacted to load informations about the registered products: human - * readable `title` and `description`, `price`, etc. - * - * This isn't an optional step, store owners require you - * to display information about a product exactly as retrieved from their server: no - * hard-coding of price and title allowed! This is also convenient for you - * as you can change the price of your items knowing that it'll be reflected instantly - * on your clients' devices. - * - * Note that the information may not be available when the first view that needs - * them appears on screen. For you, the best option is to have your view monitor - * changes made to the product. - * - * ## Purchasing - * - * #### initiate a purchase - * - * Purchases are initiated using the `store.order("some_product_id")` method. - * - * The store will manage the internal purchase flow. It'll end: - * - * - with an `approved` event. The product enters the `APPROVED` state. - * - with a `cancelled` event. The product gets back to the `VALID` state. - * - with an `error` event. The product gets back to the `VALID` state. - * - * See the product life-cycle section for details about product states. - * - * #### finish a purchase - * - * Once the transaction is approved, the product still isn't owned: the store needs - * confirmation that the purchase was delivered before closing the transaction. - * - * To confirm delivery, you'll use the `product.finish()` method. - * - * #### example usage - * - * During initialization: - * ```typescript - * this.store.when("extra_chapter").approved((product: IAPProduct) => { - * // download the feature - * app.downloadExtraChapter() - * .then(() => product.finish()); - * }); - * ``` - * - * When the purchase button is clicked: - * ```typescript - * this.store.order("extra_chapter"); - * ``` - * - * #### un-finished purchases - * - * If your app wasn't able to deliver the content, `product.finish()` won't be called. - * - * Don't worry: the `approved` event will be re-triggered the next time you - * call `store.refresh()`, which can very well be the next time - * the application starts. Pending transactions are persistant. - * - * #### simple case - * - * In the most simple case, where: - * - * - delivery of purchases is only local ; - * - you don't want (or need) to implement receipt validation ; - * - * You may just want to finish all purchases automatically. You can do it this way: - * ```js - * this.store.when("product").approved((p: IAPProduct) => p.finish()); - * ``` - * - * NOTE: the "product" query will match any purchases (see "queries" to learn more details about queries). - * - * ## Receipt validation - * - * To get the most up-to-date information about purchases (in case a purchase have been canceled, or a subscription renewed), - * you should implement server side receipt validation. - * - * This also protects you against fake "purchases", made by some users using - * "free in-app purchase" apps on their devices. - * - * When a purchase has been approved by the store, it's enriched with - * transaction information (see `product.transaction` attribute). - * - * To verify a purchase you'll have to do three things: - * - * - configure the validator. - * - call `product.verify()` from the `approved` event, before finishing the transaction. - * - finish the transaction when transaction is `verified`. - * - * Shameless Plug**: this is a feature many users struggle with, so as the author of this plugin, we can provide it to you as-a-service: https://billing.fovea.cc/ - * (which is free until you start making serious money) - * - * #### example using a validation URL - * - * ```js - * this.store.validator = "https://billing.fovea.cc/"; - * - * this.store.when("my stuff") - * .approved((p: IAPProduct) => p.verify()) - * .verified((p: IAPProduct) => p.finish()); - * ``` - * - * ## Subscriptions - * - * For subscription, you MUST implement remote receipt validation. - * - * When the receipt validator returns a `store.PURCHASE_EXPIRED` error code, the subscription will - * automatically loose its `owned` status. - * - * Typically, you'll enable and disable access to your content this way. - * ```typescript - * this.store.when("my_subcription").updated((product: IAPProduct) => { - * if (product.owned) - * app.subscriberMode(); - * else - * app.guestMode(); - * }); - * ``` - * - * ## Product life-cycle - * - * A product will change state during the application execution. - * - * Find below a diagram of the different states a product can pass by. - * - * ``` - * REGISTERED +--> INVALID - * | - * +--> VALID +--> REQUESTED +--> INITIATED +-+ - * | - * ^ +------------------------------+ - * | | - * | | +--> DOWNLOADING +--> DOWNLOADED + - * | | | | - * | +--> APPROVED +--------------------------------+--> FINISHED +--> OWNED - * | | - * +-------------------------------------------------------------+ - * ``` - * - * #### Notes - * - * - When finished, a consumable product will get back to the `VALID` state, while other will enter the `OWNED` state. - * - Any error in the purchase process will bring a product back to the `VALID` state. - * - During application startup, products may go instantly from `REGISTERED` to `APPROVED` or `OWNED`, for example if they are purchased non-consumables or non-expired subscriptions. - * - Non-Renewing Subscriptions are iOS products only. Please see the [iOS Non Renewing Subscriptions documentation](https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/ios.md#non-renewing) for a detailed explanation. - * - * ## events - * - * - `loaded(IAPProduct)` - * - Called when product data is loaded from the store. - * - `updated(IAPProduct)` - * - Called when any change occured to a product. - * - `error(err)` - * - Called when an order failed. - * - The `err` parameter is an error object - * - `approved(IAPProduct)` - * - Called when a product order is approved. - * - `owned(IAPProduct)` - * - Called when a non-consumable product or subscription is owned. - * - `cancelled(IAPProduct)` - * - Called when a product order is cancelled by the user. - * - `refunded(IAPProduct)` - * - Called when an order is refunded by the user. - * - Actually, all other product states have their promise - * - `registered`, `valid`, `invalid`, `requested`, - * `initiated` and `finished` - * - `verified(IAPProduct)` - * - Called when receipt validation successful - * - `unverified(IAPProduct)` - * - Called when receipt verification failed - * - `expired(IAPProduct)` - * - Called when validation find a subscription to be expired - * - `downloading(IAPProduct, progress, time_remaining)` - * - Called when content download is started - * - `downloaded(IAPProduct)` - * - Called when content download has successfully completed - * - * ## Learn More - * - * - [GitHub](https://github.com/j3k0/cordova-plugin-purchase) - * - [GitBook](https://purchase.cordova.fovea.cc/) - * - [Wiki](https://github.com/j3k0/cordova-plugin-purchase/wiki) - * - [API reference](https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md) - * - * ## Technical Support or Questions - * - * If you have questions or need help integrating In-App Purchase, [Open an Issue on GitHub](https://github.com/j3k0/cordova-plugin-purchase/issues) or email us at _support@fovea.cc_. - * - * @interfaces - * IAPProduct - * IAPProductOptions - * IAPProductEvents - * ``` - */ -@Plugin({ - pluginName: 'InAppPurchase2', - plugin: 'cordova-plugin-purchase', - pluginRef: 'store', - repo: 'https://github.com/j3k0/cordova-plugin-purchase', - platforms: ['iOS', 'Android', 'Windows'], - install: 'ionic cordova plugin add cordova-plugin-purchase --variable BILLING_KEY=""', -}) -@Injectable() -export class InAppPurchase2 extends AwesomeCordovaNativePlugin { - @CordovaProperty() - QUIET: number; - - @CordovaProperty() - ERROR: number; - - @CordovaProperty() - WARNING: number; - - @CordovaProperty() - INFO: number; - - @CordovaProperty() - DEBUG: number; - - /** - * Debug level. Use QUIET, ERROR, WARNING, INFO or DEBUG constants - */ - @CordovaProperty() - verbosity: number; - - /** - * Set to true to clear the transaction queue. Not recommended for production. - * https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md#random-tips - */ - @CordovaProperty() - autoFinishTransactions: boolean; - - /** - * Set to true to invoke the platform purchase sandbox. (Windows only) - */ - @CordovaProperty() - sandbox: boolean; - - /** - * Set to true to disable downloading of hosted content. (Apple only). - * Useful in development or when migrating your app away from Apple Hosted Content. - */ - @CordovaProperty() - disableHostedContent: boolean; - - @CordovaProperty() - FREE_SUBSCRIPTION: string; - - @CordovaProperty() - PAID_SUBSCRIPTION: string; - - @CordovaProperty() - NON_RENEWING_SUBSCRIPTION: string; - - @CordovaProperty() - CONSUMABLE: string; - - @CordovaProperty() - NON_CONSUMABLE: string; - - @CordovaProperty() - ERR_SETUP: number; - - @CordovaProperty() - ERR_LOAD: number; - - @CordovaProperty() - ERR_PURCHASE: number; - - @CordovaProperty() - ERR_LOAD_RECEIPTS: number; - - @CordovaProperty() - ERR_CLIENT_INVALID: number; - - @CordovaProperty() - ERR_PAYMENT_CANCELLED: number; - - @CordovaProperty() - ERR_PAYMENT_INVALID: number; - - @CordovaProperty() - ERR_PAYMENT_NOT_ALLOWED: number; - - @CordovaProperty() - ERR_UNKNOWN: number; - - @CordovaProperty() - ERR_REFRESH_RECEIPTS: number; - - @CordovaProperty() - ERR_INVALID_PRODUCT_ID: number; - - @CordovaProperty() - ERR_FINISH: number; - - @CordovaProperty() - ERR_COMMUNICATION: number; - - @CordovaProperty() - ERR_SUBSCRIPTIONS_NOT_AVAILABLE: number; - - @CordovaProperty() - ERR_MISSING_TOKEN: number; - - @CordovaProperty() - ERR_VERIFICATION_FAILED: number; - - @CordovaProperty() - ERR_BAD_RESPONSE: number; - - @CordovaProperty() - ERR_REFRESH: number; - - @CordovaProperty() - ERR_PAYMENT_EXPIRED: number; - - @CordovaProperty() - ERR_DOWNLOAD: number; - - @CordovaProperty() - ERR_SUBSCRIPTION_UPDATE_NOT_AVAILABLE: number; - - @CordovaProperty() - REGISTERED: string; - - @CordovaProperty() - INVALID: string; - - @CordovaProperty() - VALID: string; - - @CordovaProperty() - REQUESTED: string; - - @CordovaProperty() - INITIATED: string; - - @CordovaProperty() - APPROVED: string; - - @CordovaProperty() - FINISHED: string; - - @CordovaProperty() - OWNED: string; - - @CordovaProperty() - DOWNLOADING: string; - - @CordovaProperty() - DOWNLOADED: string; - - /* validation error codes */ - - @CordovaProperty() - INVALID_PAYLOAD: number; - - @CordovaProperty() - CONNECTION_FAILED: number; - - @CordovaProperty() - PURCHASE_EXPIRED: number; - - @CordovaProperty() - PURCHASE_CONSUMED: number; - - @CordovaProperty() - INTERNAL_ERROR: number; - - @CordovaProperty() - NEED_MORE_DATA: number; - - @CordovaProperty() - products: IAPProducts; - - @CordovaProperty() - validator: - | string - | ((url: string | IAPProduct, callback: Function) => void) - | { - url: string; - headers?: { [token: string]: string }; - }; - - @CordovaProperty() - applicationUsername: string | (() => string); - - @Cordova({ sync: true }) - getApplicationUsername(): string { - return; - } - - @CordovaProperty() - log: { - error: (message: string) => void; - warn: (message: string) => void; - info: (message: string) => void; - debug: (message: string) => void; - }; - - /** - * Get product by id or alias - * - * @param idOrAlias - */ - @Cordova({ sync: true }) - get(idOrAlias: string): IAPProduct { - return; - } - - /** - * Register error handler - * - * @param onError {Function} function to call on error - */ - @Cordova({ sync: true }) - error(onError: Function): void {} - - /** - * Add or register a product - * - * @param product {IAPProductOptions} - */ - @Cordova({ sync: true }) - register(product: IAPProductOptions | IAPProductOptions[]): void {} - - /** - * - * @param query - * @param event - * @param callback - * @returns {IAPProductEvents} - */ - @Cordova({ sync: true }) - when(query: string | IAPProduct, event?: string, callback?: IAPQueryCallback): IAPProductEvents { - return; - } - - /** - * Identical to `when`, but the callback will be called only once. After being called, the callback will be unregistered. - * - * @param query {string | IAPProduct} - * @param [event] {event} - * @param [callback] {IAPQueryCallback} - * @returns {IAPProductEvents} - */ - @Cordova({ sync: true }) - once(query: string | IAPProduct, event?: string, callback?: IAPQueryCallback): IAPProductEvents { - return; - } - - /** - * Unregister a callback. Works for callbacks registered with ready, when, once and error. - * - * @param callback {Function} - */ - @Cordova({ sync: true }) - off(callback: Function): void {} - - /** - * Initiate the purchase of a product. - * - * The `product` argument can be either: - * - * - the `IAPProduct` object - * - the product `id` - * - the product `alias` - * - * The `additionalData` argument is an optional object with attributes: - * - `oldPurchasedSkus`: a string array with the old subscription to upgrade/downgrade on Android. See: [android developer](https://developer.android.com/google/play/billing/billing_reference.html#upgrade-getBuyIntentToReplaceSkus) for more info - * - `developerPayload`: string representing the developer payload as described in [billing best practices](https://developer.android.com/google/play/billing/billing_best_practices.html) - * - `applicationUsername`: the identifier of the user in your application. - * - * See the "Purchasing section" to learn more about the purchase process. - * - * return value** - * - * `store.order()` returns a Promise with the following methods: - * - * - `then` - called when the order was successfully initiated. - * - `error` - called if the order couldn't be initiated. - * - * @param product - * @param additionalData - */ - @Cordova({ sync: true }) - order(product: string | IAPProduct, additionalData?: any): { then: Function; error: Function } { - return; - } - - @Cordova() - ready(callback: Function): void { - return; - } - /** - * After you're done registering your store's product and events handlers, - * time to call `store.refresh()`. - * - * This will initiate all the complex behind-the-scene work, to load product - * data from the servers and restore whatever already have been - * purchased by the user. - * - * Note that you can call this method again later during the application - * execution to re-trigger all that hard-work. It's kind of expensive in term of - * processing, so you'd better consider it twice. - * - * One good way of doing it is to add a "Refresh Purchases" button in your - * applications settings. This way, if delivery of a purchase failed or - * if a user wants to restore purchases he made from another device, he'll - * have a way to do just that. - * - * example usage** - * - * ```typescript - * // ... - * // register products and events handlers here - * // ... - * // - * // then and only then, call refresh. - * this.store.refresh(); - * ``` - * - * restore purchases** - * - * Add a "Refresh Purchases" button to call the `store.refresh()` method, like: - * - * `` - * - * To make the restore purchases work as expected, please make sure that - * the "approved" event listener had be registered properly, - * and in the callback `product.finish()` should be called. - */ - @Cordova({ sync: true }) - refresh(): IRefeshResult { - return; - } - - /** Lightweight method like refresh but do not relogin user */ - @Cordova({ sync: true }) - update(): void {} - - /** Opens the Manage Subscription page (AppStore, Play, Microsoft, ...). */ - @Cordova({ sync: true }) - manageSubscriptions(): void {} - - /** Opens the Code Redemption Sheet on iOS. (AppStore). */ - @Cordova({ sync: true }) - redeem(): void {} - - /** Opens the Manage Billing page (AppStore, Play, Microsoft, ...), where the user can update his/her payment methods. */ - @Cordova({ sync: true }) - manageBilling(): void {} - - /** Open the subscription price change notification workflow. (Play) See: https://developer.android.com/google/play/billing/subscriptions#price-change-communicate */ - @Cordova({ sync: true }) - launchPriceChangeConfirmationFlow( - productId: string, - callback: (status: 'OK' | 'UnknownProduct' | 'UserCanceled') => void - ): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/in-app-review/index.ts b/src/@awesome-cordova-plugins/plugins/in-app-review/index.ts deleted file mode 100644 index aaabc307..00000000 --- a/src/@awesome-cordova-plugins/plugins/in-app-review/index.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -/* tslint:disable */ -/** - * @name In App Review - * @description - * This plugin does use the iOS class SKStore​Review​Controller to open the inApp review popup available since iOS 10.3 - * - * This functionality only works on iOS devices - * @usage - * ```typescript - * import { InAppReview } from '@awesome-cordova-plugins/in-app-review/ngx'; - * - * - * constructor(private inAppReview: InAppReview) { } - * - * ... - * - * - * this.inAppReview.requestReview() - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -/* tslint:enable */ -@Plugin({ - pluginName: 'InAppReview', - plugin: 'com.omarben.inappreview', - pluginRef: 'inappreview', - repo: 'https://github.com/omaxlive/com.omarben.inappreview', - platforms: ['iOS'], -}) -@Injectable() -export class InAppReview extends AwesomeCordovaNativePlugin { - /** - * Open the inApp review popup - * - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - requestReview(): Promise { - return; // We add return; here to avoid any IDE / Compiler errors - } -} diff --git a/src/@awesome-cordova-plugins/plugins/in-app-update/index.ts b/src/@awesome-cordova-plugins/plugins/in-app-update/index.ts deleted file mode 100644 index 6f0201b1..00000000 --- a/src/@awesome-cordova-plugins/plugins/in-app-update/index.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Plugin, - Cordova, - CordovaProperty, - CordovaInstance, - InstanceProperty, - AwesomeCordovaNativePlugin, -} from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -enum UpdateType { - FLEXIBLE, - IMMEDIATE, -} - -enum InstallStatus { - CANCELED, - DOWNLOADED, - DOWNLOADING, - FAILED, - INSTALLED, - INSTALLING, - PENDING, - UNKNOWN, -} - -enum UpdateAvailability { - DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS, - UNKNOWN, - UPDATE_AVAILABLE, - UPDATE_NOT_AVAILABLE, -} - -class AppUpdateInfo { - updateType: UpdateType; - installStatus: InstallStatus; - availableVersionCode: number; - bytesDownloaded: number; - totalBytesToDownload: number; - clientVersionStalenessDays: number; - packageName: string; - updateAvailability: UpdateAvailability; - installErrorCode: string; -} - -/** - * @name In App Update - * @description - * This pluging enabels In app update For cordova. - */ -@Plugin({ - pluginName: 'InAppUpdate', - plugin: 'cordova-in-app-update', // npm package name, example: cordova-plugin-camera - pluginRef: 'window.plugins.InAppUpdate', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/itsLucario/cordova-app-update-plugin', // the github repository URL for the plugin - platforms: ['Android'], // Array of platforms supported, example: ['Android', 'iOS'] -}) -@Injectable() -export class InAppUpdate extends AwesomeCordovaNativePlugin { - /** - * If you want the user to be prompted about new version information before initiating the update, you can use `check` to retrive the new app version information. - * - * @returns {Promise} Returns a promise that resolves with new app version update details - */ - @Cordova() - check(): Promise { - return; - } - - /** - * Initiate Update Flow with "FLEXIBLE" | "IMMEDIATE" updateType - * - * @param config - * @param config.updateType - * @returns {Observable} Returns a Observable can be subscribed to get update install state - */ - @Cordova({ observable: true }) - update(config: { updateType: 'FLEXIBLE' | 'IMMEDIATE' }): Observable { - return; - } - - /** - * Flexible updates provide background download. Once flexible update completes the download in background, completion of upgrade can be initiated by calling `completeFlexibleUpdate`. - * - * @returns Returns empty response, fire and forget - */ - @Cordova() - completeFlexibleUpdate(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/insomnia/index.ts b/src/@awesome-cordova-plugins/plugins/insomnia/index.ts deleted file mode 100644 index 964b8cd9..00000000 --- a/src/@awesome-cordova-plugins/plugins/insomnia/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Insomnia - * @description - * Prevent the screen of the mobile device from falling asleep. - * @usage - * ```typescript - * import { Insomnia } from '@awesome-cordova-plugins/insomnia/ngx'; - * - * constructor(private insomnia: Insomnia) { } - * - * ... - * - * this.insomnia.keepAwake() - * .then( - * () => console.log('success'), - * () => console.log('error') - * ); - * - * this.insomnia.allowSleepAgain() - * .then( - * () => console.log('success'), - * () => console.log('error') - * ); - * ``` - */ -@Plugin({ - pluginName: 'Insomnia', - plugin: 'cordova-plugin-insomnia', - pluginRef: 'plugins.insomnia', - repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin', - platforms: ['Android', 'Browser', 'Firefox OS', 'iOS', 'Windows', 'Windows Phone 8'], -}) -@Injectable() -export class Insomnia extends AwesomeCordovaNativePlugin { - /** - * Keeps awake the application - * - * @returns {Promise} - */ - @Cordova() - keepAwake(): Promise { - return; - } - - /** - * Allows the application to sleep again - * - * @returns {Promise} - */ - @Cordova() - allowSleepAgain(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/instagram/index.ts b/src/@awesome-cordova-plugins/plugins/instagram/index.ts deleted file mode 100644 index 86f24e13..00000000 --- a/src/@awesome-cordova-plugins/plugins/instagram/index.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Instagram - * @description Share a photo with the instagram app - * @usage - * ```typescript - * import { Instagram } from '@awesome-cordova-plugins/instagram/ngx'; - * - * constructor(private instagram: Instagram) { } - * - * ... - * - * this.instagram.share('data:image/png;uhduhf3hfif33', 'Caption') - * .then(() => console.log('Shared!')) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'Instagram', - plugin: 'cordova-instagram-plugin', - pluginRef: 'Instagram', - repo: 'https://github.com/vstirbu/InstagramPlugin', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Instagram extends AwesomeCordovaNativePlugin { - /** - * Detect if the Instagram application is installed on the device. - * - * @returns {Promise} Returns a promise that returns a boolean value if installed, or the app version on android - */ - @Cordova({ - callbackStyle: 'node', - }) - isInstalled(): Promise { - return; - } - - /** - * Share an image on Instagram - * 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. - * - * @param canvasIdOrDataUrl The canvas element id or the dataURL of the image to share - * @param caption The caption of the image - * @returns {Promise} Returns a promise that resolves if the image was shared - */ - @Cordova({ - callbackStyle: 'node', - }) - share(canvasIdOrDataUrl: string, caption?: string): Promise { - return; - } - - /** - * Share a library asset or video - * - * @param assetLocalIdentifier A local fileURI - * @returns {Promise} Returns a promise that resolves if the image was shared - */ - @Cordova({ - callbackOrder: 'reverse', - }) - shareAsset(assetLocalIdentifier: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/intercom/index.ts b/src/@awesome-cordova-plugins/plugins/intercom/index.ts deleted file mode 100644 index 8a301c11..00000000 --- a/src/@awesome-cordova-plugins/plugins/intercom/index.ts +++ /dev/null @@ -1,259 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -/** - * @name Intercom - * @description - * This is a plugin that allows your Ionic app to use Intercom for iOS and/or Intercom for Android. - * Follow the offical documentation to setup this plugin correctly: https://developers.intercom.com/docs/cordova-phonegap-configuration - * @usage - * ```typescript - * import { Intercom } from '@awesome-cordova-plugins/intercom/ngx'; - * - * - * constructor(private intercom: Intercom) { } - * - * ... - * - * this.intercom.registerUnidentifiedUser(); - * ... - * this.intercom.registerForPush(); - * - * ``` - */ -@Plugin({ - pluginName: 'Intercom', - plugin: 'cordova-plugin-intercom', - pluginRef: 'intercom', - repo: 'https://github.com/intercom/intercom-cordova', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Intercom extends AwesomeCordovaNativePlugin { - /** - * Register a identified user - * - * @param options {any} Options - * @returns {Promise} Returns a promise - */ - @Cordova() - registerIdentifiedUser(options: any): Promise { - return; - } - - /** - * Register a unidentified user - * - * @param options {any} Options - * @returns {Promise} Returns a promise - */ - @Cordova() - registerUnidentifiedUser(options: any): Promise { - return; - } - - /** - * This resets the Intercom integration's cache of your user's identity and wipes the slate clean. - * - * @returns {Promise} Returns a promise - */ - @Cordova() - reset(): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * - * @param secureHash {string} - * @param secureData {any} - * @returns {Promise} Returns a promise - * @deprecated Use setUserHash instead as of Intercom Cordova 4.0.0 and higher https://github.com/intercom/intercom-cordova/blob/master/CHANGELOG.md#400-2017-08-29 - */ - @Cordova() - setSecureMode(secureHash: string, secureData: any): Promise { - return; - } - - /** - * - * @param secureHash {string} - * @returns {Promise} Returns a promise - */ - @Cordova() - setUserHash(secureHash: string): Promise { - return; - } - - /** - * - * @param attributes {any} - * @returns {Promise} Returns a promise - */ - @Cordova() - updateUser(attributes: any): Promise { - return; - } - - /** - * - * @param eventName {string} - * @param metaData {any} - * @returns {Promise} Returns a promise - */ - @Cordova() - logEvent(eventName: string, metaData: any): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise - */ - @Cordova() - displayMessenger(): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise - */ - @Cordova() - displayMessageComposer(): Promise { - return; - } - - /** - * - * @param initialMessage {string} - * @returns {Promise} Returns a promise - */ - @Cordova() - displayMessageComposerWithInitialMessage(initialMessage: string): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise - */ - @Cordova() - displayConversationsList(): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise - */ - @Cordova() - displayHelpCenter(): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise - */ - @Cordova() - unreadConversationCount(): Promise { - return; - } - - /** - * - * @param visibility {string} - * @returns {Promise} Returns a promise - */ - @Cordova() - setLauncherVisibility(visibility: string): Promise { - return; - } - - /** - * - * @param visibility {string} - * @returns {Promise} Returns a promise - */ - @Cordova() - setInAppMessageVisibility(visibility: string): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise - */ - @Cordova() - hideMessenger(): Promise { - return; - } - - /** - * - * @returns {Promise} Returns a promise - */ - @Cordova() - registerForPush(): Promise { - return; - } - - /** - * - * @param token {string} - * @returns {Promise} Returns a promise - */ - @Cordova() - sendPushTokenToIntercom(token: string): Promise { - return; - } - - /** - * - * @param carouselId {string} - * @returns {Promise} Returns a promise - */ - @Cordova() - displayCarousel(carouselId: string): Promise { - return; - } - - /** - * - * @param articleId {string} - * @returns {Promise} Returns a promise - */ - @Cordova() - displayArticle(articleId: string): Promise { - return; - } - - /** - * - * @param bottomPadding {string | number} - * @returns {Promise} Returns a promise - */ - @Cordova() - setBottomPadding(bottomPadding: string | number): Promise { - return; - } - - /** - * Programmatically display a Survey - * @param surveyId {string} - * @returns {Promise} Returns a promise - */ - @Cordova() - displaySurvey(surveyId: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/ionic-webview/index.ts b/src/@awesome-cordova-plugins/plugins/ionic-webview/index.ts deleted file mode 100644 index 6219429d..00000000 --- a/src/@awesome-cordova-plugins/plugins/ionic-webview/index.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Injectable } from '@angular/core'; -import { CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Ionic Webview - * @capacitorincompatible true - * @description - * Access Web View utilities. - * - * 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. - * @usage - * ```typescript - * import { WebView } from '@awesome-cordova-plugins/ionic-webview/ngx'; - * - * - * constructor(private webview: WebView) { } - * - * ... - * - * img = this.webview.convertFileSrc('file:///Users/dan/camera-image-12345.png') - * - * ``` - */ -@Plugin({ - pluginName: 'WebView', - plugin: 'cordova-plugin-ionic-webview', - pluginRef: 'window.Ionic.WebView', - repo: 'https://github.com/ionic-team/cordova-plugin-ionic-webview', - platforms: ['Android', 'iOS'], - install: 'ionic cordova plugin add cordova-plugin-ionic-webview', -}) -@Injectable() -export class WebView extends AwesomeCordovaNativePlugin { - /** - * Convert a `file://` URL to a URL that is compatible with the local web server in the Web View plugin. - */ - @CordovaProperty() - convertFileSrc: (url: string) => string; -} diff --git a/src/@awesome-cordova-plugins/plugins/ios-aswebauthenticationsession-api/index.ts b/src/@awesome-cordova-plugins/plugins/ios-aswebauthenticationsession-api/index.ts deleted file mode 100644 index abdd65a3..00000000 --- a/src/@awesome-cordova-plugins/plugins/ios-aswebauthenticationsession-api/index.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name ios-aswebauthenticationsession-api - * @description - * Plugin for iOS 12 ASWebAuthenticationSession API - * @usage - * ```typescript - * import { IosASWebauthenticationSession } from '@awesome-cordova-plugins/ios-aswebauthenticationsession-api/ngx'; - * - * - * constructor(private IosASWebauthenticationSession: ios-aswebauthenticationsession-api) { } - * - * ... - * - * - * this.IosASWebauthenticationSession.start(callbackUrl, authorizeURL) - * .then((redirectUrl: string) => console.log(redirectUrl)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ - -@Plugin({ - pluginName: 'IosASWebauthenticationSession', - plugin: 'cordova-plugin-ios-aswebauthenticationsession-api', - pluginRef: 'plugins.ASWebAuthSession', - repo: 'https://github.com/jwelker110/cordova-plugin-ios-aswebauthenticationsession-api', - platforms: ['iOS'], -}) -@Injectable() -export class IosASWebauthenticationSession extends AwesomeCordovaNativePlugin { - /** - * This function start an authentication flow in ASWebauthenticationSession - * - * @param callbackUrl {string} Callback URL of your App - * @param authorizeURL {number} Authorization URL - * @returns {Promise} Returns a promise that resolves a string containing the redirect URL after finishing ASWebauthenticationSession - */ - @Cordova() - start(callbackUrl: string, authorizeURL: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/is-debug/index.ts b/src/@awesome-cordova-plugins/plugins/is-debug/index.ts deleted file mode 100644 index 072a9816..00000000 --- a/src/@awesome-cordova-plugins/plugins/is-debug/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Is Debug - * @description - * Detect if the app is running in debug mode or not. - * 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. - * @usage - * ```typescript - * import { IsDebug } from '@awesome-cordova-plugins/is-debug/ngx'; - * - * constructor(private isDebug: IsDebug) { } - * - * ... - * - * this.isDebug.getIsDebug() - * .then(isDebug => console.log('Is debug:', isDebug)) - * .catch(err => console.error(err)); - * - * ``` - */ -@Plugin({ - pluginName: 'IsDebug', - plugin: 'cordova-plugin-is-debug', - pluginRef: 'cordova.plugins.IsDebug', - repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class IsDebug extends AwesomeCordovaNativePlugin { - /** - * Determine if an app was installed via xcode / eclipse / the ionic CLI etc - * - * @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. - */ - @Cordova() - getIsDebug(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/keyboard/index.ts b/src/@awesome-cordova-plugins/plugins/keyboard/index.ts deleted file mode 100644 index b0acb2cc..00000000 --- a/src/@awesome-cordova-plugins/plugins/keyboard/index.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, CordovaProperty, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export enum KeyboardStyle { - Light = 'light', - Dark = 'dark', -} - -export enum KeyboardResizeMode { - Native = 'native', - Ionic = 'ionic', - Body = 'body', - None = 'none', -} - -/** - * @name Keyboard - * @premier keyboard - * @capacitorincompatible true - * @description - * Keyboard plugin for Cordova. - * - * Requires Cordova plugin: `cordova-plugin-ionic-keyboard`. For more info, please see the [Keyboard plugin docs](https://github.com/ionic-team/cordova-plugin-ionic-keyboard). - * @usage - * ```typescript - * import { Keyboard } from '@awesome-cordova-plugins/keyboard/ngx'; - * - * constructor(private keyboard: Keyboard) { } - * - * ... - * - * this.keyboard.show(); - * - * this.keyboard.hide(); - * - * ``` - */ -@Plugin({ - pluginName: 'Keyboard', - plugin: 'cordova-plugin-ionic-keyboard', - pluginRef: 'window.Keyboard', - repo: 'https://github.com/ionic-team/cordova-plugin-ionic-keyboard', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Keyboard extends AwesomeCordovaNativePlugin { - /** - * Check keyboard status visible or not. - * - * @returns {boolean} - */ - @CordovaProperty() - isVisible: boolean; - - /** - * Hide the keyboard accessory bar with the next, previous and done buttons. - * - * @param hide {boolean} - */ - @Cordova({ - sync: true, - platforms: ['iOS'], - }) - hideFormAccessoryBar(hide: boolean): void {} - - /** - * Hide the keyboard if shown. - */ - @Cordova({ - sync: true, - platforms: ['iOS', 'Android'], - }) - hide(): void {} - - /** - * Force keyboard to be shown. - */ - @Cordova({ - sync: true, - platforms: ['Android'], - }) - show(): void {} - - /** - * Programatically set the resize mode - * - * @param mode {string} - */ - @Cordova({ - sync: true, - platforms: ['iOS'], - }) - setResizeMode(mode: KeyboardResizeMode): void {} - - /** - * Programatically set Keyboard style - * - * @param mode {string} - * @param style - */ - @Cordova({ - sync: true, - platforms: ['iOS'], - }) - setKeyboardStyle(style: KeyboardStyle): void {} - - /** - * Programatically enable or disable the WebView scroll - * - * @param mode {string} - * @param disable - */ - @Cordova({ - sync: true, - platforms: ['iOS'], - }) - disableScroll(disable: boolean): void {} - - /** - * Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch. - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'native.keyboardshow', - platforms: ['iOS', 'Android'], - }) - onKeyboardShow(): Observable { - return; - } - - /** - * Creates an observable that notifies you when the keyboard will show. Unsubscribe to observable to cancel event watch. - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'keyboardWillShow', - platforms: ['iOS', 'Android'], - }) - onKeyboardWillShow(): Observable { - return; - } - - /** - * Creates an observable that notifies you when the keyboard did show. Unsubscribe to observable to cancel event watch. - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'keyboardDidShow', - platforms: ['iOS', 'Android'], - }) - onKeyboardDidShow(): Observable { - return; - } - - /** - * Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch. - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'native.keyboardhide', - platforms: ['iOS', 'Android'], - }) - onKeyboardHide(): Observable { - return; - } - - /** - * Creates an observable that notifies you when the keyboard will hide. Unsubscribe to observable to cancel event watch. - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'keyboardWillHide', - platforms: ['iOS', 'Android'], - }) - onKeyboardWillHide(): Observable { - return; - } - - /** - * Creates an observable that notifies you when the keyboard did hide. Unsubscribe to observable to cancel event watch. - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'keyboardDidHide', - platforms: ['iOS', 'Android'], - }) - onKeyboardDidHide(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/keychain/index.ts b/src/@awesome-cordova-plugins/plugins/keychain/index.ts deleted file mode 100644 index 26ede62d..00000000 --- a/src/@awesome-cordova-plugins/plugins/keychain/index.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Keychain - * @description - * Get and set data in the iOS Keychain - * - * Requires Cordova plugin: `cordova-plugin-ios-keychain`. For more info, please see the [Keychain plugin docs](https://github.com/ionic-team/cordova-plugin-ios-keychain). - * - * See also [Secure Storage](https://ionic.io/docs/secure-storage) for more supported platforms. - * @usage - * ```typescript - * import { Keychain } from '@awesome-cordova-plugins/keychain/ngx'; - * - * constructor(private keychain: Keychain) { } - * - * ... - * - * this.keychain.set(key, value, false).then(() => { - * this.keychain.get(key) - * .then(value => console.log('Got value', value)) - * .catch(err => console.error('Error getting', err)); - * }) - * .catch(err => console.error('Error setting', err)); - * ``` - */ -@Plugin({ - pluginName: 'Keychain', - plugin: 'cordova-plugin-ios-keychain', - pluginRef: 'window.Keychain', - repo: 'https://github.com/ionic-team/cordova-plugin-ios-keychain', - platforms: ['iOS'], -}) -@Injectable() -export class Keychain extends AwesomeCordovaNativePlugin { - /** - * Retrieves a value for a key - * - * @param {string} key the key to retrieve - * @param {string} [touchIDMessage] the message to show underneath the TouchID prompt (if any) - */ - @Cordova({ - callbackOrder: 'reverse', - }) - get(key: string, touchIDMessage?: string): Promise { - return; - } - - /** - * Sets a value for a key - * - * @param {string} key the key to set - * @param {string|number|boolean} value the value to set - * @param {boolean} [useTouchID] whether to store the value with security such that TouchID will be needed to grab it - */ - @Cordova({ - callbackOrder: 'reverse', - }) - set(key: string, value: string | number | boolean, useTouchID: boolean): Promise { - return; - } - - /** - * Gets a JSON value for a key - * - * @param {string} key the key to retrieve - * @param {string} touchIDMessage the message to show underneath the TouchID prompt (if any) - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getJson(key: string, touchIDMessage?: string): Promise { - return; - } - - /** - * Sets a JSON value for a key - * - * @param {string} key the key to set - * @param {any} obj value the value to set - * @param {boolean} [useTouchId] Wether to store the value with security such that TouchID will be needed to grab it - */ - @Cordova({ - callbackOrder: 'reverse', - }) - setJson(key: string, obj: any, useTouchId?: boolean): Promise { - return; - } - - /** - * Removes a value for a key - * - * @param {string} key the key to remove - */ - @Cordova({ - callbackOrder: 'reverse', - }) - remove(key: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/kommunicate/index.ts b/src/@awesome-cordova-plugins/plugins/kommunicate/index.ts deleted file mode 100644 index 3adfc491..00000000 --- a/src/@awesome-cordova-plugins/plugins/kommunicate/index.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name Kommunicate - * @description - * The plugin for the Kommunicate SDK. - * With the help of this plugin, you can easily add human + bot chat support functionality to you app. - * Refer to: TODO: insert site link - * For documentation: TODO: insert link - * @usage - * ```typescript - * import { Kommunicate } from '@awesome-cordova-plugins/Kommunicate'; - * - * constructor(private kommunicate: Kommunicate) { } - * //also add [..., Kommunicate, ... ] inside the providers array, if required - * - * var kmUser = { - * userId : 'randomstring', - * authenticationTypeId : 1 - * }; - * - * this.kommunicate.login(kmUser) - * .then((res: any) => console.log("Sucessfully logged in." + res)) - * .catch((error: any) => console.error("Error logging in." + error)); - * - * var conversationObject = { - * isUnique : false - * }; - * - * this.kommunicate.conversationBuilder(converationObject) - * .then((clientChannelKey: any) => console.log("Kommunicate create conversation successful the clientChannelKey is : " + clientChannelKey)) - * .catch((error: any) => console.error("Error creating conversation." + error)); - * - * ``` - */ -@Plugin({ - pluginName: 'Kommunicate', - plugin: 'kommunicate-cordova-plugin', - pluginRef: 'kommunicate', - repo: 'https://github.com/Kommunicate-io/Kommunicate-Cordova-Ionic-PhoneGap-Chat-Plugin', - platforms: ['Android', 'Browser', 'iOS'], -}) -@Injectable() -export class Kommunicate extends AwesomeCordovaNativePlugin { - /** - * Login the user with the details passed in - * Creates a new user with the details provided there is no existing user - * - * var kmUser = { - * 'userId' : 'userId', //Replace it with the userId of the logged in user - * 'password' : 'password', //replace with password - * 'authenticationTypeId' : 1, - * 'imageLink' : - * 'applicationId' : '', //replace this with your APP_ID from Applozic Dashboard - * 'deviceApnsType' : 0 //Set 0 for Development and 1 for Distribution (Release) - * }; - * - * @param kmUser {any} the user details - * @returns {Promise} Returns a promise - */ - @Cordova() - login(kmUser: any): Promise { - return; - } - - /** - * Register for push notification - * - * @returns {Promise} Returns a promise - */ - @Cordova() - registerPushNotification(): Promise { - return; - } - - /** - * Check if any user is logged in or not - * - * @returns {Promise} Returns a promise - */ - @Cordova() - isLoggedIn(): Promise { - return; - } - - /** - * Update the token for push notifications - * - * @param token {string} the user details - * @returns {Promise} Returns a promise - */ - @Cordova() - updatePushNotificationToken(token: string): Promise { - return; - } - - /** - * Launch the conversation screen (it contains all the existing conversations) - * - * @returns {Promise} Returns a promise - */ - @Cordova() - launchConversation(): Promise { - return; - } - - /** - * Launch the conversation identified by the given channel(conversation) key - * - * let convObj = { - * 'clientChannelKey' : clientChannelKey, //pass the clientChannelKey here - * 'takeOrder' : true //skip chat list on back press, pass false if you want to show chat list on back press - * }; - * - * @param conversationObject {any} the channel key and other information - * @returns {Promise} Returns a promise - */ - @Cordova() - launchParticularConversation(conversationObject: any): Promise { - return; - } - - /** - * Start a new conversation, details about the conversation to be passed as parameters - * - * @deprecated - * @param conversationParams - * @param converationParams {any} the user details - * @returns {Promise} Returns a promise - */ - @Cordova() - startNewConversation(conversationParams: any): Promise { - return; - } - - /** - * Process push notifications - * - * @param data {any} the user details - * @returns {boolean} Returns true/false - */ - @Cordova({ sync: true }) - processPushNotification(data: any): boolean { - return; - } - - /** - * Logout the current user - * - * @returns {Promise} Returns a promise - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * Start a single chat (conversation) - * - * @deprecated - * @param data {any} the user details - * @returns {Promise} Returns a promise - */ - @Cordova() - startSingleChat(data: any): Promise { - return; - } - - /** - * Launches a conversation with the properties passed in the conversation param - * - * var conversationObject = { - * 'isUnique' : false, - * 'agentIds':[''], //List of agentIds. AGENT_ID is the emailID used to signup on Kommunicate - * 'botIds': [''] //List of botIds. Go to Manage Bots(https://dashboard.kommunicate.io/bots/manage-bots) -> Copy botID - * }; - * - * @param conversationObject {any} the user details - * @param converationObject - * @returns {Promise} Returns a promise - */ - @Cordova() - conversationBuilder(converationObject: any): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/launch-navigator/index.ts b/src/@awesome-cordova-plugins/plugins/launch-navigator/index.ts deleted file mode 100644 index 9e9bb54a..00000000 --- a/src/@awesome-cordova-plugins/plugins/launch-navigator/index.ts +++ /dev/null @@ -1,450 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface PromptsOptions { - /** - * a function to pass the user's decision whether to remember their choice of app. - * This will be passed a single boolean value indicating the user's decision. - * - * @param rememberChoice - */ - callback?: (rememberChoice: boolean) => void; - - /** - * text to display in the native prompt header asking user whether to remember their choice. - * Defaults to "Remember your choice?" if not specified. - */ - headerText?: string; - - /** - * text to display in the native prompt body asking user whether to remember their choice. - * Defaults to "Use the same app for navigating next time?" if not specified. - */ - bodyText?: string; - - /** - * text to display for the Yes button. - * Defaults to "Yes" if not specified. - */ - yesButtonText?: string; - - /** - * text to display for the No button. - * Defaults to "No" if not specified. - */ - noButtonText?: string; -} - -export interface RememberChoiceOptions { - /** - * whether to remember user choice of app for next time, instead of asking again for user choice. - * `"prompt"` - Prompt user to decide whether to remember choice. - * - Default value if unspecified. - * - If `promptFn` is defined, this will be used for user confirmation. - * - Otherwise (by default), a native dialog will be displayed to ask user. - * `false` - Do not remember user choice. - * `true` - Remember user choice. - */ - enabled?: boolean | string; - - /** - * a function which asks the user whether to remember their choice of app. - * If this is defined, then the default dialog prompt will not be shown, allowing for a custom UI for asking the user. - * This will be passed a callback function which should be invoked with a single boolean argument which indicates the user's decision to remember their choice. - * - * @param callback - */ - promptFn?: (callback: (rememberChoice: boolean) => void) => void; - - /** - * options related to the default dialog prompt used to ask the user whether to remember their choice of app. - */ - prompt?: PromptsOptions; -} - -export interface AppSelectionOptions { - /** - * text to display in the native picker which enables user to select which navigation app to launch. - * Defaults to "Select app for navigation" if not specified. - */ - dialogHeaderText?: string; - - /** - * text to display for the cancel button in the native picker which enables user to select which navigation app to launch. - * Defaults to "Cancel" if not specified. - */ - cancelButtonText?: string; - - /** - * List of apps, defined as `launchnavigator.APP` constants, which should be displayed in the picker if the app is available. - * This can be used to restrict which apps are displayed, even if they are installed. - * By default, all available apps will be displayed. - */ - list?: string[]; - - /** - * Callback to invoke when the user selects an app in the native picker. - * A single string argument is passed which is the app what was selected defined as a `launchnavigator.APP` constant. - */ - callback?: (app: string) => void; - - /** - * (Android only) native picker theme. Specify using `actionsheet.ANDROID_THEMES` constants. - * Default `actionsheet.ANDROID_THEMES.THEME_HOLO_LIGHT` - */ - androidTheme?: number; - - /** - * options related to whether to remember user choice of app for next time, instead of asking again for user choice. - */ - rememberChoice?: RememberChoiceOptions; -} - -export interface LaunchNavigatorOptions { - /** - * A callback to invoke when the navigation app is successfully launched. - */ - successCallback?: Function; - - /** - * A callback to invoke if an error is encountered while launching the app. - * A single string argument containing the error message will be passed in. - */ - errorCallback?: (error: string) => void; - - /** - * name of the navigation app to use for directions. - * Specify using launchnavigator.APP constants. - * e.g. `launchnavigator.APP.GOOGLE_MAPS`. - * If not specified, defaults to User Selection. - */ - app?: string; - - /** - * nickname to display in app for destination. e.g. "Bob's House". - */ - destinationName?: string; - - /** - * Start point of the navigation. - * If not specified, the current device location will be used. - * Either: - * - a {string} containing the address. e.g. "Buckingham Palace, London" - * - a {string} containing a latitude/longitude coordinate. e.g. "50.1. -4.0" - * - an {array}, where the first element is the latitude and the second element is a longitude, as decimal numbers. e.g. [50.1, -4.0] - */ - start?: string | number[]; - - /** - * nickname to display in app for start . e.g. "My House". - */ - startName?: string; - - /** - * Transportation mode for navigation: "driving", "walking" or "transit". Defaults to "driving" if not specified. - */ - transportMode?: string; - - /** - * If true, debug log output will be generated by the plugin. Defaults to false. - */ - enableDebug?: boolean; - - /** - * a key/value map of extra app-specific parameters. For example, to tell Google Maps on Android to display Satellite view in "maps" launch mode: `{"t": "k"}` - */ - extras?: any; - - /** - * (Android only) mode in which to open Google Maps app. - * `launchnavigator.LAUNCH_MODE.MAPS` or `launchnavigator.LAUNCH_MODE.TURN_BY_TURN` - * Defaults to `launchnavigator.LAUNCH_MODE.MAPS` if not specified. - */ - launchModeGoogleMaps?: string; - - /** - * (iOS only) method to use to open Apple Maps app. - * `launchnavigator.LAUNCH_MODE.URI_SCHEME` or `launchnavigator.LAUNCH_MODE.MAPKIT` - * Defaults to `launchnavigator.LAUNCH_MODE.URI_SCHEME` if not specified. - */ - launchModeAppleMaps?: string; - - /** - * (Windows only) If false, the plugin will NOT attempt to use the geolocation plugin to determine the current device position when the start location parameter is omitted. Defaults to true. - */ - enableGeolocation?: boolean; - - /** - * (Android and iOS only) If true, and input location type(s) doesn't match those required by the app, use geocoding to obtain the address/coords as required. Defaults to true. - */ - enableGeocoding?: boolean; - - /** - * options related to the default native actionsheet picker which enables user to select which navigation app to launch if `app` is not specified. - */ - appSelection?: AppSelectionOptions; -} - -export interface UserChoice { - /** - * Indicates whether a user choice exists for a preferred navigator app. - * - * @param callback - function to pass result to: will receive a boolean argument. - */ - exists: (callback: (exists: boolean) => void) => void; - - /** - * Returns current user choice of preferred navigator app. - * - * @param callback - function to pass result to: will receive a string argument indicating the app, which is a constant in `launchnavigator.APP`. - */ - get: (callback: (app: string) => void) => void; - - /** - * Sets the current user choice of preferred navigator app. - * - * @param app - app to set as preferred choice as a constant in `launchnavigator.APP`. - * @param callback - function to call once operation is complete. - */ - set: (app: string, callback: () => void) => void; - - /** - * Clears the current user choice of preferred navigator app. - * - * @param callback - function to call once operation is complete. - */ - clear: (callback: () => void) => void; -} - -export interface UserPrompted { - /** - * Indicates whether user has already been prompted whether to remember their choice a preferred navigator app. - * - * @param callback - function to pass result to: will receive a boolean argument. - */ - get: (callback: (exists: boolean) => void) => void; - - /** - * Sets flag indicating user has already been prompted whether to remember their choice a preferred navigator app. - * - * @param callback - function to call once operation is complete. - */ - set: (callback: () => void) => void; - - /** - * Clears flag which indicates if user has already been prompted whether to remember their choice a preferred navigator app. - * - * @param callback - function to call once operation is complete. - */ - clear: (callback: () => void) => void; -} - -export interface AppSelection { - userChoice: UserChoice; - userPrompted: UserPrompted; -} - -/** - * @name Launch Navigator - * @description - * Requires Cordova plugin: uk.co.workingedge.phonegap.plugin.launchnavigator. For more info, please see the [LaunchNavigator plugin docs](https://github.com/dpa99c/phonegap-launch-navigator). - * @usage - * Please refer to the plugin's repo for detailed usage. This docs page only explains the Native wrapper. - * - * ```typescript - * import { LaunchNavigator, LaunchNavigatorOptions } from '@awesome-cordova-plugins/launch-navigator/ngx'; - * - * constructor(private launchNavigator: LaunchNavigator) { } - * - * ... - * - * let options: LaunchNavigatorOptions = { - * start: 'London, ON', - * app: LaunchNavigator.APPS.UBER - * } - * - * this.launchNavigator.navigate('Toronto, ON', options) - * .then( - * success => console.log('Launched navigator'), - * error => console.log('Error launching navigator', error) - * ); - * ``` - * @interfaces - * LaunchNavigatorOptions - * PromptsOptions - * RememberChoiceOptions - * AppSelectionOptions - * UserChoice - * UserPrompted - * AppSelection - */ -@Plugin({ - pluginName: 'LaunchNavigator', - plugin: 'uk.co.workingedge.phonegap.plugin.launchnavigator', - pluginRef: 'launchnavigator', - repo: 'https://github.com/dpa99c/phonegap-launch-navigator', - platforms: ['Android', 'iOS', 'Windows', 'Windows Phone 8'], -}) -@Injectable() -export class LaunchNavigator extends AwesomeCordovaNativePlugin { - APP: any = { - USER_SELECT: 'user_select', - APPLE_MAPS: 'apple_maps', - GOOGLE_MAPS: 'google_maps', - WAZE: 'waze', - CITYMAPPER: 'citymapper', - NAVIGON: 'navigon', - TRANSIT_APP: 'transit_app', - YANDEX: 'yandex', - UBER: 'uber', - TOMTOM: 'tomtom', - BING_MAPS: 'bing_maps', - SYGIC: 'sygic', - HERE_MAPS: 'here_maps', - MOOVIT: 'moovit', - }; - - TRANSPORT_MODE: any = { - DRIVING: 'driving', - WALKING: 'walking', - BICYCLING: 'bicycling', - TRANSIT: 'transit', - }; - - @CordovaProperty() - appSelection: AppSelection; - - /** - * Launches navigator app - * - * @param destination {string|number[]} Location name or coordinates (as string or array) - * @param options {LaunchNavigatorOptions} - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2 - }) - navigate(destination: string | number[], options?: LaunchNavigatorOptions): Promise { - return; - } - - /** - * Determines if the given app is installed and available on the current device. - * - * @param app {string} - * @returns {Promise} - */ - @Cordova() - isAppAvailable(app: string): Promise { - return; - } - - /** - * Returns a list indicating which apps are installed and available on the current device. - * - * @returns {Promise} - */ - @Cordova() - availableApps(): Promise { - return; - } - - /** - * Returns the display name of the specified app. - * - * @param app {string} - * @returns {string} - */ - @Cordova({ sync: true }) - getAppDisplayName(app: string): string { - return; - } - - /** - * Returns list of supported apps on a given platform. - * - * @param platform {string} - * @returns {string[]} - */ - @Cordova({ sync: true }) - getAppsForPlatform(platform: string): string[] { - return; - } - - /** - * Indicates if an app on a given platform supports specification of transport mode. - * - * @param app {string} specified as a string, you can use one of the constants, e.g `LaunchNavigator.APP.GOOGLE_MAPS` - * @param platform {string} - * @returns {boolean} - */ - @Cordova({ sync: true }) - supportsTransportMode(app: string, platform: string): boolean { - return; - } - - /** - * Returns the list of transport modes supported by an app on a given platform. - * - * @param app {string} - * @param platform {string} - * @returns {string[]} - */ - @Cordova({ sync: true }) - getTransportModes(app: string, platform: string): string[] { - return; - } - - /** - * @param app {string} - * @param platform {string} - * @returns {boolean} - */ - @Cordova({ sync: true }) - supportsDestName(app: string, platform: string): boolean { - return; - } - - /** - * Indicates if an app on a given platform supports specification of start location. - * - * @param app {string} - * @param platform {string} - * @returns {boolean} - */ - @Cordova({ sync: true }) - supportsStart(app: string, platform: string): boolean { - return; - } - - /** - * @param app {string} - * @param platform {string} - * @returns {boolean} - */ - @Cordova({ sync: true }) - supportsStartName(app: string, platform: string): boolean { - return; - } - - /** - * Indicates if an app on a given platform supports specification of launch mode. - * Note that currently only Google Maps on Android does. - * - * @param app {string} - * @param platform {string} - * @returns {boolean} - */ - @Cordova({ sync: true }) - supportsLaunchMode(app: string, platform: string): boolean { - return; - } - - /** - * @param destination {string | number[]} - * @param options {LaunchNavigatorOptions} - */ - @Cordova({ sync: true }) - userSelect(destination: string | number[], options: LaunchNavigatorOptions): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/launch-review/index.ts b/src/@awesome-cordova-plugins/plugins/launch-review/index.ts deleted file mode 100644 index ecbca8c0..00000000 --- a/src/@awesome-cordova-plugins/plugins/launch-review/index.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name Launch Review - * @description - * - * Assists in leaving user reviews/ratings in the App Stores. - * - Launches the platform's App Store page for the current app in order for the user to leave a review. - * - On iOS (10.3 and above) invokes the native in-app rating dialog which allows a user to rate your app without needing to open the App Store. - * @usage - * ```typescript - * import { LaunchReview } from '@awesome-cordova-plugins/launch-review/ngx'; - * - * constructor(private launchReview: LaunchReview) { } - * - * ... - * - * this.launchReview.launch() - * .then(() => console.log('Successfully launched store app')); - * - * if(this.launchReview.isRatingSupported()){ - * this.launchReview.rating() - * .then(() => console.log('Successfully launched rating dialog')); - * } - * ``` - */ -@Plugin({ - pluginName: 'LaunchReview', - plugin: 'cordova-launch-review', - pluginRef: 'LaunchReview', - repo: 'https://github.com/dpa99c/cordova-launch-review', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class LaunchReview extends AwesomeCordovaNativePlugin { - /** - * Launches App Store on current platform in order to leave a review for given app. - * - * @param appId {string} - (optional) the platform-specific app ID to use to open the page in the store app. - * If not specified, the plugin will use the app ID for the app in which the plugin is contained. - * On Android this is the full package name of the app. For example, for Google Maps: `com.google.android.apps.maps` - * On iOS this is the Apple ID of the app. For example, for Google Maps: `585027354` - * @returns {Promise} - */ - @Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' }) - launch(appId?: string): Promise { - return; - } - - /** - * Invokes the native in-app rating dialog which allows a user to rate your app without needing to open the App Store. - * Requires iOS 10.3 and above: Calling this on any platform/version other than iOS 10.3+ will result in the error callback. - * Success callback will be called up to 3 times: - * - First: after `LaunchReview.rating()` is called and the request to show the dialog is successful. Will be passed the value `requested`. - * - Second: if and when the Rating dialog is actually displayed. Will be passed the value `shown`. - * - Third: if and when the Rating dialog is dismissed. Will be passed the value `dismissed`. - * - * @returns {Observable} - */ - @Cordova({ observable: true }) - rating(): Observable { - return; - } - - /** - * Indicates if the current platform/version supports in-app ratings dialog, i.e. calling LaunchReview.rating(). - * Will return true if current platform is iOS 10.3 or above. - * - * @returns {boolean} - */ - @Cordova({ platforms: ['Android', 'iOS'], sync: true }) - isRatingSupported(): boolean { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/lets-cooee/index.ts b/src/@awesome-cordova-plugins/plugins/lets-cooee/index.ts deleted file mode 100644 index 6c54fa27..00000000 --- a/src/@awesome-cordova-plugins/plugins/lets-cooee/index.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name Lets Cooee - * @description - * AI driven Personalised Notifications for Better Customer Engagement - * - * @usage - * ```typescript - * import { Cooee } from '@awesome-cordova-plugins/lets-cooee/nx'; - * - * - * constructor(private cooee: Cooee) { } - * - * ... - * - * - * this.cooee.functionName('Hello', 123) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'Cooee', - plugin: '@letscooee/cordova-plugin', - pluginRef: 'cordova.plugins.Cooee', - repo: 'https://github.com/letscooee/cordova-plugin-cooee', - install: 'ionic cordova plugin add @letscooee/cordova-plugin --variable COOEE_APP_ID=appId', - installVariables: ['COOEE_APP_ID'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Cooee extends AwesomeCordovaNativePlugin { - /** - * Send the given user data and user properties to the server. - * @return {Promise} Returns a promise so user can be notified. - * @param eventName {string} Name of the event - * @param eventProperties {Record} Properties of the event - */ - @Cordova() - sendEvent(eventName: string, eventProperties: Record): Promise { - return; - } - - /** - * Send the given user data and user properties to the server. - * @return {Promise} Returns a promise so user can be notified. - * @param userProfile {Record} User data to send to the server - */ - @Cordova() - updateUserProfile(userProfile: Record): Promise { - return; - } - - /** - * Send the given screen name with every event. - * @return {Promise} Returns a promise so user can be notified. - * @param screenName {string} Screen name to send to the server - */ - @Cordova() - setCurrentScreen(screenName: string): Promise { - return; - } - - /** - * Provide Cooee's userID assigned to the current user. - * @return {Promise} Returns a promise with userId. - */ - @Cordova() - getUserID(): Promise { - return; - } - - /** - * Provides callback for the onCooeeCTAListener event. - * @return {Observable} Returns an observable record. - */ - @Cordova({ - eventObservable: true, - event: 'onCooeeCTAListener', - element: document, - }) - addCooeeCTAListener(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/line-login/index.ts b/src/@awesome-cordova-plugins/plugins/line-login/index.ts deleted file mode 100644 index 8cbb59a2..00000000 --- a/src/@awesome-cordova-plugins/plugins/line-login/index.ts +++ /dev/null @@ -1,154 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface LineLoginParams { - /** - * Line Channel ID - */ - channel_id: string; -} - -export interface LineLoginProfile { - /** - * Line User ID - */ - userID: string; - - /** - * Line Profile Image URL - */ - pictureURL: string; - - /** - * Line Profile Name - */ - displayName: string; - - /** - * Email - */ - email?: string; -} - -export interface LineLoginAccessToken { - /** - * Line Access Token - */ - accessToken: string; - - /** - * Line Access Token Expire Time - */ - expireTime: string; -} - -/** - * @name Line Login - * @description - * The function login, logs out, acquires, verifies, and refreshes the access token. The version of LineSDK you are using is as follows. - * @usage - * ```typescript - * import { LineLogin } from '@awesome-cordova-plugins/line-login/ngx'; - * - * - * constructor(private lineLogin: LineLogin) { } - * - * ... - * - * - * this.lineLogin.initialize({ channel_id: "xxxxxxxxxx" }) - * - * this.lineLogin.login() - * .then(result => console.log(result)) - * .catch(error => console.log(error)) - * - * ``` - * @interfaces - * LineLoginParams - * LineLoginProfile - * LineLoginAccessToken - */ -@Plugin({ - pluginName: 'LineLogin', - plugin: 'cordova-line-login-plugin', - pluginRef: 'lineLogin', - repo: 'https://github.com/nrikiji/cordova-line-login-plugin', - install: - 'ionic cordova plugin add https://github.com/nrikiji/cordova-line-login-plugin.git --variable LINE_CHANNEL_ID="your_line_channel_id"', - installVariables: ['LINE_CHANNEL_ID'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class LineLogin extends AwesomeCordovaNativePlugin { - /** - * Initialize - * - * @param param LineLoginParams - * @returns {Promise} - */ - @Cordova() - initialize(param: LineLoginParams): Promise { - return; - } - - /** - * Login - * - * @returns {Promise} - */ - @Cordova() - login(): Promise { - return; - } - - /** - * Login with Web - * (iOS only) - * - * @returns {Promise} - */ - @Cordova() - loginWeb(): Promise { - return; - } - - /** - * Logout - * - * @returns {Promise} - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * Get Access Token - * - * @returns {Promise} - */ - @Cordova() - getAccessToken(): Promise { - return; - } - - /** - * Verify AccessToken - * - * @returns {Promise} - */ - @Cordova() - verifyAccessToken(): Promise { - return; - } - - /** - * Refresh Access Token - * - * @returns {Promise} - */ - @Cordova() - refreshAccessToken(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/local-backup/index.ts b/src/@awesome-cordova-plugins/plugins/local-backup/index.ts deleted file mode 100644 index 80bfa515..00000000 --- a/src/@awesome-cordova-plugins/plugins/local-backup/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name LocalBackup - * @description - * This plugin to create local backup - * @usage - * ```typescript - * import { LocalBackup } from '@awesome-cordova-plugins/local-backup/ngx'; - * - * - * constructor(private localBackup: LocalBackup) { } - * - * ... - * - * - * this.localBackup.create({data: {key: 'value'}}) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'LocalBackup', - plugin: 'cordova-plugin-local-backup', - pluginRef: 'LocalBackup', - repo: 'https://github.com/MaximBelov/cordova-plugin-local-backup', - install: 'ionic cordova plugin add cordova-plugin-local-backup', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class LocalBackup extends AwesomeCordovaNativePlugin { - @Cordova() - create(data: any): Promise { - return; - } - - @Cordova() - read(): Promise { - return; - } - - @Cordova() - exists(): Promise { - return; - } - - @Cordova() - remove(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/local-notifications/index.ts b/src/@awesome-cordova-plugins/plugins/local-notifications/index.ts deleted file mode 100755 index 8cd8af29..00000000 --- a/src/@awesome-cordova-plugins/plugins/local-notifications/index.ts +++ /dev/null @@ -1,861 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export enum ELocalNotificationTriggerUnit { - SECOND = 'second', - MINUTE = 'minute', - HOUR = 'hour', - DAY = 'day', - WEEK = 'week', - MONTH = 'month', - QUARTER = 'quarter', - YEAR = 'year', - WEEKDAY = 'weekday', - WEEKDAY_ORDINAL = 'weekdayOrdinal', - WEEK_OF_MONTH = 'weekOfMonth', -} - -export interface ILocalNotificationEvery { - /** - * The minute. - */ - minute?: number; - - /** - * The hour. - */ - hour?: number; - - /** - * The day. - */ - day?: number; - - /** - * The day of week. - */ - weekday?: number; - - /** - * The week of yeaday of the ardinal week. - */ - week?: number; - - /** - * The day of the ordinal week. - */ - weekdayOrdinal?: number; - - /** - * The week of month. - */ - weekOfMonth?: number; - - /** - * The month. - */ - month?: number; - - /** - * The quarter. - */ - quarter?: number; - - /** - * The year. - */ - year?: number; -} - -export interface ILocalNotificationTrigger { - /** ***** FIX */ - - /** - * The date and time when the system should deliver the local notification. If the specified value is nil or is a date in the past, the local notification is delivered immediately. - * Default: now ~ new Date() - */ - at?: Date; - - /** ***** TIMESPAN */ - - /** - * Amount of units - */ - in?: number; - - /** - * Unit - */ - unit?: ELocalNotificationTriggerUnit; - - /** ***** REPEAT/MATCH */ - - /** - * Amount of units - */ - count?: number; - - /** - * The unit - */ - every?: ELocalNotificationTriggerUnit | ILocalNotificationEvery; - - /** - * The end of the repeating notification - */ - before?: Date; - - /** - * The date and time when the system should deliver the local notification. If the specified value is nil or is a date in the past, the local notification is delivered immediately. - * Only for "repeat" - * Default: now ~ new Date() - */ - firstAt?: Date; - - /** - * Only for "match" - */ - after?: Date; - - /** ***** LOCATION */ - - /** - * IOS ONLY - * Center of the location - * Latitude and Longitude values - */ - center?: number[]; - - /** - * IOS ONLY - * Radius in meters - */ - radius?: number; - - /** - * IOS ONLY - * Trigger on entry of the location - */ - notifyOnEntry?: boolean; - - /** - * IOS ONLY - * Trigger on exit of the location - */ - notifyOnExit?: boolean; - - /** - * IOS ONLY - * Trigger only once? - */ - single?: boolean; -} - -export enum ILocalNotificationActionType { - INPUT = 'input', - BUTTON = 'button', -} - -/** - * Notification action - * - * @see https://github.com/katzer/cordova-plugin-local-notifications#actions - */ -export interface ILocalNotificationAction { - /** - * The id of the action is used as the event name in the listener function - */ - id?: string; - - /** - * The title of the notification message - */ - title?: string; - - /** - * Make this notification show when app in foreground. - */ - foreground?: boolean; - - /** - * Specifies whether the action causes the app to launch in the foreground - */ - launch?: boolean; - - /** - * If the value is 'decline' the action is displayed with special highlighting to indicate that it performs a destructive task - */ - ui?: string; - - /** - * Specifies whether the action requires that the user’s device be unlocked. - * When the user selects an action with this option, the system prompts - * the user to unlock the device - */ - needsAuth?: boolean; - - /** - * The resource path of the action icon - */ - icon?: string; - - /** - * ANDROID ONLY - * An array of pre-defined choices for users input - */ - choices?: string[]; - - /** - * ANDROID ONLY - * Specifies whether the user can provide arbitrary text values - */ - editable?: boolean; - - /** - * IOS ONLY - * The title of the text input button that is displayed to the user. - */ - submitTitle?: string; - - /** - * The type of the action. If omitted 'button' is used. - */ - type?: ILocalNotificationActionType; -} - -export interface ILocalNotificationProgressBar { - /** - * Is the progress bar enabled? - */ - enabled?: boolean; - - /** - * The current value - */ - value?: number; - - /** - * ANDROID ONLY - * The maximum value (default is 100) - */ - maxValue?: number; - - /** - * ANDROID ONLY - * Show an indeterminate progress bar - */ - indeterminate?: boolean; - - /** - * WINDOWS ONLY - * Gets or sets an optional string to be displayed instead of the - * default percentage string. If this isn't provided, something - * like "70%" will be displayed. - */ - description?: string; - - /** - * WINDOWS ONLY - * Sets the status (required), which is displayed underneath the progress bar - * on the left. - * This string should reflect the status of the operation, - * like "Downloading..." or "Installing..." - */ - status?: string; -} - -export interface ILocalNotification { - /** - * A unique identifier required to clear, cancel, update or retrieve the local notification in the future - * Default: 0 - */ - id?: number; - - /** - * First row of the notification - * Default: Empty string (iOS) or the app name (Android) - */ - title?: string; - - /** - * Second row of the notification - * Default: Empty string - */ - text?: string | string[]; - - /** - * The number currently set as the badge of the app icon in Springboard (iOS) or at the right-hand side of the local notification (Android) - * Default: 0 (which means don't show a number) - */ - badge?: number; - - /** - * Uri of the file containing the sound to play when an alert is displayed - * Default: res://platform_default - */ - sound?: string; - - /** - * Arbitrary data, objects will be encoded to JSON string - * Default: null - */ - data?: any; - - /** - * ANDROID ONLY - * Uri of the icon that is shown in the ticker and notification - * Default: res://icon - */ - icon?: string; - - /** - * ANDROID ONLY - * Uri of the resource (only res://) to use in the notification layouts. Different classes of devices may return different sizes - * Default: res://ic_popup_reminder - */ - smallIcon?: string; - - /** - * ANDROID ONLY - * RGB value for the background color of the smallIcon. - * Default: Androids COLOR_DEFAULT, which will vary based on Android version. - */ - color?: string; - - /** - * ANDROID ONLY - * Use the default notification vibrate. - */ - vibrate?: boolean; - - /** - * ANDROID ONLY - * Define the blinking of the LED on the device. - * If set to true, the LED will blink in the default color with - * timings for on and off set to 1000 ms. - * If set to a string, the LED will blink in this ARGB value with - * timings for on and off set to 1000 ms. - * If set to an array, the value of the key 0 will be used as the color, - * the value of the key 1 will be used as the 'on' timing, the value of - * the key 2 will be used as the 'off' timing - */ - led?: { color: string; on: number; off: number } | any[] | boolean | string; - - /** - * Notification priority. - * Integers between -2 and 2, whereas -2 is minimum and 2 is maximum priority - */ - priority?: number; - - /** - * Is a silent notification - */ - silent?: boolean; - - /** - * Specifies whether the a click on the notification causes the app - * to launch in the foreground - */ - launch?: boolean; - - /** - * ANDROID ONLY - * Wakeup the device. (default is true) - */ - wakeup?: boolean; - - /** - * ANDROID ONLY - * Specifies a duration in milliseconds after which this notification should be canceled, if it is not already canceled. - */ - timeoutAfter?: number | false; - - /** - * Actions id or actions - */ - actions?: string | ILocalNotificationAction[]; - - /** - * When to trigger the notification - */ - trigger?: ILocalNotificationTrigger; - - /** - * A list of image attachments - */ - attachments?: string[]; - - /** - * ANDROID ONLY - * If and how the notification shall show the when date. - * Possbile values: - * boolean: true equals 'clock', false disable a watch/counter - * 'clock': Show the when date in the content view - * 'chronometer': Show a stopwatch - * - */ - clock?: boolean | string; - - /** - * Shows a progress bar - * Setting a boolean is a shortcut for {enabled: true/false} respectively - */ - progressBar?: ILocalNotificationProgressBar | boolean; - - /** - * ANDROID ONLY - * If multiple notifications have the same group your app can present - * them as a single group. - */ - group?: string; - - /** - * ANDROID ONLY - * If set to 'true' this notification could use 'summary' to summarize - * the contents of the whole group - */ - groupSummary?: boolean; - - /** - * ANDROID ONLY - * Summary of the whole notification group. Should be used in conjuntion - * with 'groupSummary' set to true - */ - summary?: string; - - /** - * ANDROID ONLY - * Sets the number of items this notification represents. - */ - number?: number; - - /** - * ANDROID ONLY - * Set whether this is an "ongoing" notification. - * Ongoing notifications cannot be dismissed by the user, - * so your application or service must take care of canceling them. - */ - sticky?: boolean; - - /** - * ANDROID ONLY - * Make this notification automatically dismissed when the user touches it. - */ - autoClear?: boolean; - - /** - * ANDROID ONLY - * If set to true the notification will be show in its entirety on all lockscreens. - * If set to false it will not be revealed on a secure lockscreen. - */ - lockscreen?: boolean; - - /** - * ANDROID ONLY - * Set the default notification options that will be used. - * The value should be one or more of the following fields combined with - * bitwise-or: DEFAULT_SOUND, DEFAULT_VIBRATE, DEFAULT_LIGHTS. - */ - defaults?: number; - - /** - * ANDROID ONLY - * Specifies the channel the notification should be delivered on. - */ - channel?: string; - - /** - * ANDROID ONLY - * Set the token for the media session - */ - mediaSession?: string; - - /** - * Make this notification show when app in foreground. - */ - foreground?: boolean; -} - -/** - * @name Local Notifications - * @description - * This plugin allows you to display local notifications on the device - * @usage - * ```typescript - * import { LocalNotifications } from '@awesome-cordova-plugins/local-notifications/ngx'; - * - * - * constructor(private localNotifications: LocalNotifications) { } - * - * ... - * - * - * // Schedule a single notification - * this.localNotifications.schedule({ - * id: 1, - * text: 'Single ILocalNotification', - * sound: isAndroid? 'file://sound.mp3': 'file://beep.caf', - * data: { secret: key } - * }); - * - * - * // Schedule multiple notifications - * this.localNotifications.schedule([{ - * id: 1, - * text: 'Multi ILocalNotification 1', - * sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf', - * data: { secret:key } - * },{ - * id: 2, - * title: 'Local ILocalNotification Example', - * text: 'Multi ILocalNotification 2', - * icon: 'http://example.com/icon.png' - * }]); - * - * - * // Schedule delayed notification - * this.localNotifications.schedule({ - * text: 'Delayed ILocalNotification', - * trigger: {at: new Date(new Date().getTime() + 3600)}, - * led: 'FF0000', - * sound: null - * }); - * ``` - * @interfaces - * ILocalNotification - */ -@Plugin({ - pluginName: 'LocalNotifications', - plugin: 'cordova-plugin-local-notification', - pluginRef: 'cordova.plugins.notification.local', - repo: 'https://github.com/katzer/cordova-plugin-local-notifications', - platforms: ['Android', 'iOS', 'Windows'], -}) -@Injectable() -export class LocalNotifications extends AwesomeCordovaNativePlugin { - /** - * Informs if the app has the permission to show notifications. - * - * @returns {Promise} - */ - @Cordova() - hasPermission(): Promise { - return; - } - - /** - * Request permission to show notifications if not already granted. - * - * @returns {Promise} - */ - @Cordova() - requestPermission(): Promise { - return; - } - - /** - * Schedules a single or multiple notifications - * - * @param options {Notification | ILocalNotification[]} optional - */ - @Cordova({ - sync: true, - }) - schedule(options?: ILocalNotification | ILocalNotification[]): void {} - - /** - * Updates a previously scheduled notification. Must include the id in the options parameter. - * - * @param options {ILocalNotification} optional - */ - @Cordova({ - sync: true, - }) - update(options?: ILocalNotification): void {} - - /** - * Clears single or multiple notifications - * - * @param notificationId {any} A single notification id, or an array of notification ids. - * @returns {Promise} Returns a promise when the notification had been cleared - */ - @Cordova() - clear(notificationId: any): Promise { - return; - } - - /** - * Clears all notifications - * - * @returns {Promise} Returns a promise when all notifications have cleared - */ - @Cordova() - clearAll(): Promise { - return; - } - - /** - * Cancels single or multiple notifications - * - * @param notificationId {any} A single notification id, or an array of notification ids. - * @returns {Promise} Returns a promise when the notification is canceled - */ - @Cordova() - cancel(notificationId: any): Promise { - return; - } - - /** - * Cancels all notifications - * - * @returns {Promise} Returns a promise when all notifications are canceled - */ - @Cordova() - cancelAll(): Promise { - return; - } - - /** - * Checks presence of a notification - * - * @param notificationId {number} - * @returns {Promise} - */ - @Cordova() - isPresent(notificationId: number): Promise { - return; - } - - /** - * Checks is a notification is scheduled - * - * @param notificationId {number} - * @returns {Promise} - */ - @Cordova() - isScheduled(notificationId: number): Promise { - return; - } - - /** - * Checks if a notification is triggered - * - * @param notificationId {number} - * @returns {Promise} - */ - @Cordova() - isTriggered(notificationId: number): Promise { - return; - } - - /** - * Check if a notification has a given type. - * - * @param {number} id The ID of the notification. - * @param {string} type The type of the notification. - * @returns {Promise} - */ - @Cordova() - hasType(id: number, type: string): Promise { - return; - } - - /** - * Get the type (triggered, scheduled) for the notification. - * - * @param {number} id The ID of the notification. - */ - @Cordova() - getType(id: number): Promise { - return; - } - - /** - * Get all the notification ids - * - * @returns {Promise>} - */ - @Cordova() - getIds(): Promise { - return; - } - - /** - * Get the ids of scheduled notifications - * - * @returns {Promise} Returns a promise - */ - @Cordova() - getScheduledIds(): Promise { - return; - } - - /** - * Get the ids of triggered notifications - * - * @returns {Promise>} - */ - @Cordova() - getTriggeredIds(): Promise { - return; - } - - /** - * Get a notification object - * - * @param notificationId {any} The id of the notification to get - * @returns {Promise} - */ - @Cordova() - get(notificationId: any): Promise { - return; - } - - /** - * Get all notification objects - * - * @returns {Promise} - */ - @Cordova() - getAll(): Promise { - return; - } - - /** - * Get a scheduled notification object - * - * @param notificationId {any} The id of the notification to get - * @returns {Promise} - */ - @Cordova() - getScheduled(notificationId: any): Promise { - return; - } - - /** - * Get a triggered notification object - * - * @param notificationId The id of the notification to get - * @returns {Promise} - */ - @Cordova() - getTriggered(notificationId: any): Promise { - return; - } - - /** - * Adds a group of actions - * - * @param groupId The id of the action group - * @param actions The actions of this group - * @returns {Promise} - */ - @Cordova() - addActions(groupId: any, actions: ILocalNotificationAction[]): Promise { - return; - } - - /** - * Removes a group of actions - * - * @param groupId The id of the action group - * @returns {Promise} - */ - @Cordova() - removeActions(groupId: any): Promise { - return; - } - - /** - * Checks if a group of actions is defined - * - * @param groupId The id of the action group - * @returns {Promise} Whether the group is defined - */ - @Cordova() - hasActions(groupId: any): Promise { - return; - } - - /** - * Gets the (platform specific) default settings. - * - * @returns {Promise} An object with all default settings - */ - @Cordova({ - sync: true, - }) - getDefaults(): Promise { - return; - } - - /** - * Overwrites the (platform specific) default settings. - * - * @param defaults - * @returns {Promise} - */ - @Cordova({ - sync: true, - }) - setDefaults(defaults: any): Promise { - return; - } - - /** - * Get all scheduled notification objects - * - * @returns {Promise>} - */ - @Cordova() - getAllScheduled(): Promise { - return; - } - - /** - * Get all triggered notification objects - * - * @returns {Promise>} - */ - @Cordova() - getAllTriggered(): Promise { - return; - } - - /** - * Sets a callback for a specific event - * - * @param eventName {string} The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall. Custom event names are possible for actions - * @returns {Observable} - */ - @Cordova({ - observable: true, - clearFunction: 'un', - clearWithArgs: true, - }) - on(eventName: string): Observable { - return; - } - - /** - * Not an official interface, however its possible to manually fire events. - * - * @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall. Custom event names are possible for actions - * @param args Optional arguments - */ - @Cordova({ - sync: true, - }) - fireEvent(eventName: string, args: any): void {} - - /** - * Fire queued events once the device is ready and all listeners are registered. - * - * @returns {Promise} - */ - @Cordova() - fireQueuedEvents(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/location-accuracy/index.ts b/src/@awesome-cordova-plugins/plugins/location-accuracy/index.ts deleted file mode 100644 index a6fa2e81..00000000 --- a/src/@awesome-cordova-plugins/plugins/location-accuracy/index.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Location Accuracy - * @description - * This Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog from within the app, avoiding the need for the user to leave your app to change location settings manually. - * @usage - * ```typescript - * import { LocationAccuracy } from '@awesome-cordova-plugins/location-accuracy/ngx'; - * - * constructor(private locationAccuracy: LocationAccuracy) { } - * - * ... - * - * this.locationAccuracy.canRequest().then((canRequest: boolean) => { - * - * if(canRequest) { - * // the accuracy option will be ignored by iOS - * this.locationAccuracy.request(this.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY).then( - * () => console.log('Request successful'), - * error => console.log('Error requesting location permissions', error) - * ); - * } - * - * }); - * - * ``` - */ -@Plugin({ - pluginName: 'LocationAccuracy', - plugin: 'cordova-plugin-request-location-accuracy', - pluginRef: 'cordova.plugins.locationAccuracy', - repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class LocationAccuracy extends AwesomeCordovaNativePlugin { - /** - * Convenience constant - * - * @type {number} - */ - REQUEST_PRIORITY_NO_POWER = 0; - /** - * Convenience constant - * - * @type {number} - */ - REQUEST_PRIORITY_LOW_POWER = 1; - /** - * Convenience constant - * - * @type {number} - */ - REQUEST_PRIORITY_BALANCED_POWER_ACCURACY = 2; - /** - * Convenience constant - * - * @type {number} - */ - REQUEST_PRIORITY_HIGH_ACCURACY = 3; - /** - * Convenience constant - * - * @type {number} - */ - SUCCESS_SETTINGS_SATISFIED = 0; - /** - * Convenience constant - * - * @type {number} - */ - SUCCESS_USER_AGREED = 1; - /** - * Convenience constant - * - * @type {number} - */ - ERROR_ALREADY_REQUESTING = -1; - /** - * Convenience constant - * - * @type {number} - */ - ERROR_INVALID_ACTION = 0; - /** - * Convenience constant - * - * @type {number} - */ - ERROR_INVALID_ACCURACY = 1; - /** - * Convenience constant - * - * @type {number} - */ - ERROR_EXCEPTION = 1; - /** - * Convenience constant - * - * @type {number} - */ - ERROR_CANNOT_CHANGE_ACCURACY = 3; - /** - * Convenience constant - * - * @type {number} - */ - ERROR_USER_DISAGREED = 4; - /** - * Convenience constant - * - * @type {number} - */ - ERROR_GOOGLE_API_CONNECTION_FAILED = 4; - - /** - * Indicates if you can request accurate location - * - * @returns {Promise} Returns a promise that resovles with a boolean that indicates if you can request accurate location - */ - @Cordova() - canRequest(): Promise { - return; - } - - /** - * Indicates if a request is currently in progress - * - * @returns {Promise} Returns a promise that resolves with a boolean that indicates if a request is currently in progress - */ - @Cordova() - isRequesting(): Promise { - return; - } - - /** - * Requests accurate location - * - * @param accuracy {number} Accuracy, from 0 to 4. You can use the static properties of this class that start with REQUEST_PRIORITY_ - * @returns {Promise} Returns a promise that resolves on success and rejects if an error occurred - */ - @Cordova({ callbackOrder: 'reverse' }) - request(accuracy: number): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/lottie-splash-screen/index.ts b/src/@awesome-cordova-plugins/plugins/lottie-splash-screen/index.ts deleted file mode 100644 index 56810a13..00000000 --- a/src/@awesome-cordova-plugins/plugins/lottie-splash-screen/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Lottie Splash Screen - * @description - * Cordova plugin to show bodymovin/Lottie animations as the splash screen with Airbnb's Lottie wrapper - * @usage - * ```typescript - * import { LottieSplashScreen } from '@awesome-cordova-plugins/lottie-splash-screen/ngx'; - * - * - * constructor(private lottieSplashScreen: LottieSplashScreen) { } - * - * ... - * - * - * this.lottieSplashScreen.show('www/lottie/animation.json', false, 1024, 768) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'LottieSplashScreen', - plugin: 'cordova-plugin-lottie-splashscreen', - pluginRef: 'lottie.splashscreen', - repo: 'https://github.com/timbru31/cordova-plugin-lottie-splashscreen', - install: '', - installVariables: [], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class LottieSplashScreen extends AwesomeCordovaNativePlugin { - /** - * 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) - * - * @param location {string} Location of the Lottie JSON file that should be loaded. - * @param remote {number} Toggles Lottie's remote mode which allows files to be downloaded/displayed from URLs. Example: - * @param width {number} Width of the container that's rendering the Lottie animation - * @param height {number} Height of the container that's rendering the Lottie animation - */ - @Cordova({ - sync: true, - }) - show(location?: string, remote?: boolean, width?: number, height?: number): void {} - - /** - * This methods hides the current active Lottie splashscreen and destroys the views. - */ - @Cordova({ sync: true }) - hide(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/magnetometer/index.ts b/src/@awesome-cordova-plugins/plugins/magnetometer/index.ts deleted file mode 100644 index 4b83e0f8..00000000 --- a/src/@awesome-cordova-plugins/plugins/magnetometer/index.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface MagnetometerReading { - /** - * X reading of magnetometer. (Number) - */ - x: number; - /** - * Y reading of magnetometer. (Number) - */ - y: number; - /** - * Z reading of magnetometer. (Number) - */ - z: number; - /** - * Calculated total - always positive of magnetometer. (Number) - */ - magnitude: number; -} - -/** - * @name Device eMagnetometer - * @description - * Requires Cordova plugin: `cordova-plugin-magnetometer`. For more info, please see the [Device Orientation docs](https://github.com/sdesalas/cordova-plugin-magnetometer). - * - * @usage - * ```typescript - * // MagnetometerReading is an interface for compass - * import { Magnetometer, MagnetometerReading } from '@awesome-cordova-plugins/device-orientation/ngx'; - * - * constructor(private magnetometer: Magnetometer) { } - * - * ... - * - * // Get the device current compass heading - * this.magnetometer.getReading().then( - * (data: MagnetometerReading) => console.log(data), - * (error: any) => console.log(error) - * ); - * - * // Watch the device compass heading change - * var subscription = this.magnetometer.watchReadings().subscribe( - * (data: MagnetometerReading) => console.log(data) - * ); - * - * // Stop watching heading change - * subscription.unsubscribe(); - * ``` - * @interfaces - * MagnetometerReading - */ -@Plugin({ - pluginName: 'Magnetometer', - plugin: 'cordova-plugin-magnetometer', - pluginRef: 'cordova.plugins.magnetometer', - repo: 'https://github.com/sdesalas/cordova-plugin-magnetometer', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Magnetometer extends AwesomeCordovaNativePlugin { - /** - * Get the current compass reading. - * @returns {Promise} - */ - @Cordova() - getReading(): Promise { - return; - } - /** - * Get the device current heading at a regular interval - * - * Stop the watch by unsubscribing from the observable - * @param {DeviceOrientationCompassOptions} [options] Options for compass. Frequency and Filter. Optional - * @returns {Observable} Returns an observable that contains the compass heading - */ - @Cordova({ - callbackOrder: 'reverse', - observable: true, - clearFunction: 'stop', - }) - watchReadings(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/market/index.ts b/src/@awesome-cordova-plugins/plugins/market/index.ts deleted file mode 100644 index dd29b813..00000000 --- a/src/@awesome-cordova-plugins/plugins/market/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -/** - * @name Market - * @description - * Opens an app's page in the market place (Google Play, App Store) - * - * @usage - * ```typescript - * import { Market } from '@awesome-cordova-plugins/market/ngx'; - * - * constructor(private market: Market) { } - * - * ... - * - * this.market.open('your.package.name'); - * - * ``` - */ -@Plugin({ - pluginName: 'Market', - plugin: 'cordova-plugin-market', - pluginRef: 'cordova.plugins.market', - repo: 'https://github.com/xmartlabs/cordova-plugin-market', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Market extends AwesomeCordovaNativePlugin { - /** - * Opens an app in Google Play / App Store - * @param appId {string} Package name - * @return {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'success', - errorName: 'failure', - }) - open(appId: string): Promise { - return; - } - - /** - * Search apps by keyword - * @param keyword {string} Keyword - * @return {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'success', - errorName: 'failure', - platforms: ['Android'], - }) - search(keyword: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/media-capture/index.ts b/src/@awesome-cordova-plugins/plugins/media-capture/index.ts deleted file mode 100644 index e7b21255..00000000 --- a/src/@awesome-cordova-plugins/plugins/media-capture/index.ts +++ /dev/null @@ -1,247 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -declare const navigator: any; - -export interface MediaFile { - /** - * The name of the file, without path information. - */ - name: string; - /** - * The full path of the file, including the name. - */ - fullPath: string; - /** - * The file's mime type - */ - type: string; - - /** - * The date and time when the file was last modified. - */ - lastModifiedDate: Date; - - /** - * The size of the file, in bytes. - */ - size: number; - - /** - * Retrieves the format information of the media file. - * - * @param {Function} successCallback - * @param {Function} errorCallback - */ - getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): void; -} - -export interface MediaFileData { - /** - * The actual format of the audio and video content. - */ - codecs: string; - /** - * The average bitrate of the content. The value is zero for images. - */ - bitrate: number; - /** - * The height of the image or video in pixels. The value is zero for audio clips. - */ - height: number; - /** - * The width of the image or video in pixels. The value is zero for audio clips. - */ - width: number; - /** - * The length of the video or sound clip in seconds. The value is zero for images. - */ - duration: number; -} - -export interface CaptureError { - code: string; -} - -export interface CaptureAudioOptions { - /** - * Maximum number of audio clips. Defaults to 1. - * On iOS you can only record one file. - */ - limit?: number; - /** - * Maximum duration of an audio sound clip, in seconds. This does not work on Android devices. - */ - duration?: number; -} - -export interface CaptureImageOptions { - /** - * Maximum number of images to capture. This limit is not supported on iOS, only one image will be taken per invocation. - */ - limit?: number; -} - -export interface CaptureVideoOptions { - /** - * Maximum number of video clips to record. This value is ignored on iOS, only one video clip can be taken per invocation. - */ - limit?: number; - /** - * Maximum duration per video clip. This will be ignored on BlackBerry. - */ - duration?: number; - /** - * Quality of the video. This parameter can only be used with Android. - */ - quality?: number; -} - -export interface ConfigurationData { - /** - * The ASCII-encoded lowercase string representing the media type. - */ - type: string; - /** - * The height of the image or video in pixels. The value is zero for sound clips. - */ - height: number; - /** - * The width of the image or video in pixels. The value is zero for sound clips. - */ - width: number; -} - -/** - * @name Media Capture - * @premier media-capture - * @description - * This plugin provides access to the device's audio, image, and video capture capabilities. - * - * Requires Cordova plugin: `cordova-plugin-media-capture`. For more info, please see the [Media Capture plugin docs](https://github.com/apache/cordova-plugin-media-capture). - * @usage - * ```typescript - * import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from '@awesome-cordova-plugins/media-capture/ngx'; - * - * - * constructor(private mediaCapture: MediaCapture) { } - * - * ... - * - * - * let options: CaptureImageOptions = { limit: 3 } - * this.mediaCapture.captureImage(options) - * .then( - * (data: MediaFile[]) => console.log(data), - * (err: CaptureError) => console.error(err) - * ); - * - * ``` - * @interfaces - * MediaFile - * MediaFileData - * CaptureError - * CaptureAudioOptions - * CaptureImageOptions - * CaptureVideoOptions - * ConfigurationData - */ -@Plugin({ - pluginName: 'MediaCapture', - plugin: 'cordova-plugin-media-capture', - pluginRef: 'navigator.device.capture', - repo: 'https://github.com/apache/cordova-plugin-media-capture', - platforms: ['Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class MediaCapture extends AwesomeCordovaNativePlugin { - /** - * The recording image sizes and formats supported by the device. - * - * @returns {ConfigurationData[]} - */ - @CordovaProperty() - supportedImageModes: ConfigurationData[]; - - /** - * The audio recording formats supported by the device. - * - * @returns {ConfigurationData[]} - */ - @CordovaProperty() - supportedAudioModes: ConfigurationData[]; - - /** - * The recording video resolutions and formats supported by the device. - * - * @returns {ConfigurationData[]} - */ - @CordovaProperty() - supportedVideoModes: ConfigurationData[]; - - /** - * Start the audio recorder application and return information about captured audio clip files. - * - * @param options - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - captureAudio(options?: CaptureAudioOptions): Promise { - return; - } - - /** - * Start the camera application and return information about captured image files. - * - * @param options - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - captureImage(options?: CaptureImageOptions): Promise { - return; - } - - /** - * Start the video recorder application and return information about captured video clip files. - * - * @param options - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - captureVideo(options?: CaptureVideoOptions): Promise { - return; - } - - /** - * is fired if the capture call is successful - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'pendingcaptureresult', - }) - onPendingCaptureResult(): Observable { - return; - } - - /** - * is fired if the capture call is unsuccessful - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'pendingcaptureerror', - }) - onPendingCaptureError(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/media/index.ts b/src/@awesome-cordova-plugins/plugins/media/index.ts deleted file mode 100644 index d8cfe46c..00000000 --- a/src/@awesome-cordova-plugins/plugins/media/index.ts +++ /dev/null @@ -1,357 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - CordovaInstance, - InstanceProperty, - AwesomeCordovaNativePlugin, - Plugin, - checkAvailability, -} from '@awesome-cordova-plugins/core'; -import { Observable, Observer } from 'rxjs'; - -/** - * @hidden - */ -export class MediaObject { - /** - * An observable that notifies you on actions success - */ - onSuccess: Observable; - - /** - * An observable that notifies you when an error occurs - */ - onError: Observable; - - /** - * An observable that notifies you when the file status changes - */ - onStatusUpdate: Observable; - - /** - * @hidden - */ - @InstanceProperty() successCallback: Function; - - /** - * @hidden - */ - @InstanceProperty() errorCallback: Function; - - /** - * @hidden - */ - @InstanceProperty() statusCallback: Function; - - constructor(private _objectInstance: any) { - this.onSuccess = new Observable((observer: Observer) => { - this.successCallback = observer.next.bind(observer); - return () => (this.successCallback = () => {}); - }); - - this.onError = new Observable((observer: Observer) => { - this.errorCallback = observer.next.bind(observer); - return () => (this.errorCallback = () => {}); - }); - - this.onStatusUpdate = new Observable((observer: Observer) => { - this.statusCallback = observer.next.bind(observer); - return () => (this.statusCallback = () => {}); - }); - } - - /** - * Get the current amplitude of the current recording. - * - * @returns {Promise} Returns a promise with the amplitude of the current recording - */ - @CordovaInstance() - getCurrentAmplitude(): Promise { - return; - } - - /** - * Get the current position within an audio file. Also updates the Media object's position parameter. - * - * @returns {Promise} Returns a promise with the position of the current recording - */ - @CordovaInstance() - getCurrentPosition(): Promise { - return; - } - - /** - * Get the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1. - * - * @returns {number} Returns a promise with the duration of the current recording - */ - @CordovaInstance({ sync: true }) - getDuration(): number { - return; - } - - /** - * Starts or resumes playing an audio file. - * - * @param iosOptions - * @param iosOptions.numberOfLoops - * @param iosOptions.playAudioWhenScreenIsLocked - */ - @CordovaInstance({ sync: true }) - play(iosOptions?: { numberOfLoops?: number; playAudioWhenScreenIsLocked?: boolean }): void {} - - /** - * Pauses playing an audio file. - */ - @CordovaInstance({ sync: true }) - pause(): void {} - - /** - * Releases the underlying operating system's audio resources. This is particularly important for Android, since there are a finite amount of OpenCore instances for media playback. Applications should call the release function for any Media resource that is no longer needed. - */ - @CordovaInstance({ sync: true }) - release(): void {} - - /** - * Sets the current position within an audio file. - * - * @param {number} milliseconds The time position you want to set for the current audio file - */ - @CordovaInstance({ sync: true }) - seekTo(milliseconds: number): void {} - - /** - * Set the volume for an audio file. - * - * @param volume {number} The volume to set for playback. The value must be within the range of 0.0 to 1.0. - */ - @CordovaInstance({ sync: true }) - setVolume(volume: number): void {} - - @CordovaInstance({ sync: true }) - setRate(speedRate: number): void {} - - /** - * Starts recording an audio file. - */ - @CordovaInstance({ sync: true }) - startRecord(): void {} - - /** - * Stops recording - */ - @CordovaInstance({ sync: true }) - stopRecord(): void {} - - /** - * Pauses recording - */ - @CordovaInstance({ sync: true }) - pauseRecord(): void {} - - /** - * Resumes recording - */ - @CordovaInstance({ sync: true }) - resumeRecord(): void {} - - /** - * Stops playing an audio file. - */ - @CordovaInstance({ sync: true }) - stop(): void {} -} - -export type MediaStatusUpdateCallback = (statusCode: number) => void; - -export interface MediaError { - /** - * Error message - */ - message: string; - - /** - * Error code - */ - code: number; -} - -export enum MEDIA_STATUS { - NONE = 0, - STARTING, - RUNNING, - PAUSED, - STOPPED, -} - -export enum MEDIA_ERROR { - ABORTED = 1, - NETWORK, - DECODE, - SUPPORTED, -} - -export type MediaErrorCallback = (error: MediaError) => void; - -/** - * @name Media - * @premier media - * @description - * This plugin provides the ability to record and play back audio files on a device. - * @usage - * ```typescript - * import { Media, MediaObject } from '@awesome-cordova-plugins/media/ngx'; - * - * - * constructor(private media: Media) { } - * - * - * ... - * - * - * // Create a Media instance. Expects path to file or url as argument - * // We can optionally pass a second argument to track the status of the media - * - * const file: MediaObject = this.media.create('file.mp3'); - * - * // to listen to plugin events: - * - * file.onStatusUpdate.subscribe(status => console.log(status)); // fires when file status changes - * - * file.onSuccess.subscribe(() => console.log('Action is successful')); - * - * file.onError.subscribe(error => console.log('Error!', error)); - * - * // play the file - * file.play(); - * - * // pause the file - * file.pause(); - * - * // get current playback position - * file.getCurrentPosition().then((position) => { - * console.log(position); - * }); - * - * // get file duration - * let duration = file.getDuration(); - * console.log(duration); - * - * // skip to 10 seconds (expects int value in ms) - * file.seekTo(10000); - * - * // stop playing the file - * file.stop(); - * - * // release the native audio resource - * // Platform Quirks: - * // iOS simply create a new instance and the old one will be overwritten - * // Android you must call release() to destroy instances of media when you are done - * file.release(); - * - * - * - * // Recording to a file - * const file: MediaObject = this.media.create('path/to/file.mp3'); - * - * file.startRecord(); - * - * file.stopRecord(); - * - * - * ``` - * - * Some hints if you are using iOS and recording doesn't work: - * 1.) Try to use a absolute file path but remove beginning "file://". - * Then it looks like: `/var/mobile/Containers/Data/Application/AF438B8B-7724-4FBB-8E69-083463224FC4/tmp/my_file.m4a` - * Example: `this.media.create(this.file.tempDirectory.replace(/^file:\/\//, '') + 'my_file.m4a')` - * 2.) If that's not working, too, create the file before using. - * Example: - * ```typescript - * import { Media, MediaObject } from '@awesome-cordova-plugins/media/ngx'; - * import { File } from '@awesome-cordova-plugins/file/ngx'; - * - * ... - * - * constructor(private media: Media, private file: File) { } - * - * ... - * - * this.file.createFile(this.file.tempDirectory, 'my_file.m4a', true).then(() => { - * let file = this.media.create(this.file.tempDirectory.replace(/^file:\/\//, '') + 'my_file.m4a'); - * file.startRecord(); - * window.setTimeout(() => file.stopRecord(), 10000); - * }); - * ``` - * - * You can find the reasons here: https://github.com/ionic-team/ionic-native/issues/1452#issuecomment-299605906 - * @classes - * MediaObject - * @interfaces - * MediaError - */ -@Plugin({ - pluginName: 'Media', - repo: 'https://github.com/apache/cordova-plugin-media', - plugin: 'cordova-plugin-media', - pluginRef: 'Media', - platforms: ['Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class Media extends AwesomeCordovaNativePlugin { - // Constants - /** - * @hidden - */ - MEDIA_NONE = 0; - /** - * @hidden - */ - MEDIA_STARTING = 1; - /** - * @hidden - */ - MEDIA_RUNNING = 2; - /** - * @hidden - */ - MEDIA_PAUSED = 3; - /** - * @hidden - */ - MEDIA_STOPPED = 4; - - // error codes - /** - * @hidden - */ - MEDIA_ERR_ABORTED = 1; - /** - * @hidden - */ - MEDIA_ERR_NETWORK = 2; - /** - * @hidden - */ - MEDIA_ERR_DECODE = 3; - /** - * @hidden - */ - MEDIA_ERR_NONE_SUPPORTED = 4; - - /** - * Open a media file - * - * @param src {string} A URI containing the audio content. - * @returns {MediaObject} - */ - create(src: string): MediaObject { - let instance: any; - - if (checkAvailability(Media.getPluginRef(), null, Media.getPluginName()) === true) { - // Creates a new media object - instance = new (Media.getPlugin())(src); - } - - return new MediaObject(instance); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/metrix/index.ts b/src/@awesome-cordova-plugins/plugins/metrix/index.ts deleted file mode 100644 index c185e98c..00000000 --- a/src/@awesome-cordova-plugins/plugins/metrix/index.ts +++ /dev/null @@ -1,235 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export class MetrixConfig { - private appId: string; - private secretId: number = null; - private info1: number = null; - private info2: number = null; - private info3: number = null; - private info4: number = null; - private defaultTrackerToken: string = null; - private shouldLaunchDeeplink = false; - private firebaseAppId: string = null; - private firebaseProjectId: string = null; - private firebaseApiKey: string = null; - private isLocationListeningEnable = false; - private eventUploadThreshold: number = null; - private eventUploadMaxBatchSize: number = null; - private eventMaxCount: number = null; - private eventUploadPeriodMillis: number = null; - private sessionTimeoutMillis: number = null; - private store: string = null; - - private userIdListener: (userId: string) => void = null; - private sessionIdListener: (sessionId: string) => void = null; - private attributionChangeListener: (attribution: MetrixAttribution) => void = null; - private deeplinkResponseListener: (uri: string) => void = null; - - constructor(appId: string) { - this.appId = appId; - } - - setDefaultTracker(defaultTrackerToken: string) { - this.defaultTrackerToken = defaultTrackerToken; - } - - setFirebaseId(firebaseAppId: string, firebaseProjectId: string, firebaseApiKey: string) { - this.firebaseAppId = firebaseAppId; - this.firebaseProjectId = firebaseProjectId; - this.firebaseApiKey = firebaseApiKey; - } - - setAppSecret(secretId: number, info1: number, info2: number, info3: number, info4: number) { - this.secretId = secretId; - this.info1 = info1; - this.info2 = info2; - this.info3 = info3; - this.info4 = info4; - } - - setShouldLaunchDeeplink(shouldLaunchDeeplink: boolean) { - this.shouldLaunchDeeplink = shouldLaunchDeeplink; - } - - setOnAttributionChangeListener(attributionChangeListener: (attribution: MetrixAttribution) => void) { - this.attributionChangeListener = attributionChangeListener; - } - - setOnDeeplinkResponseListener(deeplinkResponseListener: (uri: string) => void) { - this.deeplinkResponseListener = deeplinkResponseListener; - } - - setOnReceiveUserIdListener(userIdListener: (userId: string) => void) { - this.userIdListener = userIdListener; - } - - setOnSessionIdListener(sessionIdListener: (sessionId: string) => void) { - this.sessionIdListener = sessionIdListener; - } - - setLocationListening(isLocationListeningEnable: boolean) { - this.isLocationListeningEnable = isLocationListeningEnable; - } - - setEventUploadThreshold(threshold: number) { - this.eventUploadThreshold = threshold; - } - - setEventUploadMaxBatchSize(size: number) { - this.eventUploadMaxBatchSize = size; - } - - setEventMaxCount(count: number) { - this.eventMaxCount = count; - } - - setEventUploadPeriodMillis(period: number) { - this.eventUploadPeriodMillis = period; - } - - setSessionTimeoutMillis(timeout: number) { - this.sessionTimeoutMillis = timeout; - } - - setStore(store: string) { - this.store = store; - } - - private getAttributionChangeListener() { - return this.attributionChangeListener; - } - - private getDeeplinkResponseListener() { - return this.deeplinkResponseListener; - } - - private getOnReceiveUserIdListener() { - return this.userIdListener; - } - - private getOnSessionIdListener() { - return this.sessionIdListener; - } - - private hasAttributionChangeListener() { - return this.attributionChangeListener !== null; - } - - private hasDeeplinkResponseListener() { - return this.deeplinkResponseListener !== null; - } - - private hasUserIdListener() { - return this.userIdListener !== null; - } - - private hasSessionIdListener() { - return this.sessionIdListener !== null; - } -} - -export interface MetrixAttribution { - acquisitionAd: string; - acquisitionAdSet: string; - acquisitionCampaign: string; - acquisitionSource: string; - attributionStatus: MetrixAttributionStatus; -} - -export enum MetrixAttributionStatus { - Attributed = 'ATTRIBUTED', - NotAttributedYet = 'NOT_ATTRIBUTED_YET', - AttributionNotNeeded = 'ATTRIBUTION_NOT_NEEDED', - Unknown = 'UNKNOWN', -} - -/** - * @name Metrix - * @description - * This is the Ionic Cordova SDK of Metrix™. You can read more about Metrix™ at metrix.ir. - * - * Requires Cordova plugin: `ir.metrix.sdk`. For more info, please see the [Metrix Cordova SDK](https://github.com/metrixorg/MetrixSDK-CordovaPlugin) - * @usage - * ```typescript - * import { Metrix, MetrixConfig } from '@awesome-cordova-plugins/metrix'; - * - * constructor(private metrix: Metrix) { } - * - * ... - * - * const config = new MetrixConfig('APP-ID-HERE'); - * // Set other config properties. - * metrix.create(config); - * - * ``` - * @interfaces - * MetrixAttribution - * @classes - * MetrixConfig - * @enums - * MetrixAttributionStatus - */ -@Plugin({ - pluginName: 'Metrix', - plugin: 'ir.metrix.sdk', - pluginRef: 'Metrix', - repo: 'https://github.com/metrixorg/MetrixSDK-CordovaPlugin', - platforms: ['Android'], -}) -@Injectable() -export class Metrix extends AwesomeCordovaNativePlugin { - /** - * This method initializes Metrix SDK - * - * @param {MetrixConfig} config MetrixConfig object used as starting options - */ - @Cordova({ sync: true }) - create(config: MetrixConfig): void {} - - /** - * Function used to get Session Number - * - * @returns {Promise} Returns a promise with session number value - */ - @Cordova() - getSessionNum(): Promise { - return; - } - - /** - * This method tracks an event - * - * @param {string} slug the slug of the event to be tracked - * @param {Map | object} attributes optional attributes of the event to be tracked - */ - @Cordova({ sync: true }) - newEvent(slug: string, attributes?: Map | object): void {} - - /** - * This method adds the provided attributes to all metrix events - * - * @param {Map | object} attributes the attributes to be added to all future events - */ - @Cordova({ sync: true }) - addUserAttributes(attributes: Map | object): void {} - - /** - * This method tracks a revenue - * - * @param {string} slug the slug of the event to be tracked - * @param {number} amount the amount of money gained by the revenue - * @param {number} currency (OPTIONAL) currency of the amount - * @param {string} orderId (OPTIONAL) id of the revenue - */ - @Cordova({ sync: true }) - newRevenue(slug: string, amount: number, currency?: number, orderId?: string): void {} - - /** - * By making this call, the Metrix SDK will try to find if there is any new attribution info inside of the deep link and if any, it will be sent to the Metrix backend. - * - * @param {string} url URL of the deeplink - */ - @Cordova({ sync: true }) - appWillOpenUrl(url: string): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/mixpanel/index.ts b/src/@awesome-cordova-plugins/plugins/mixpanel/index.ts deleted file mode 100644 index 9183f81b..00000000 --- a/src/@awesome-cordova-plugins/plugins/mixpanel/index.ts +++ /dev/null @@ -1,269 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -declare let mixpanel: any; - -/** - * @name Mixpanel - * @description - * Cordova Plugin that wraps Mixpanel SDK for Android and iOS - * @usage - * ```typescript - * import { Mixpanel } from '@awesome-cordova-plugins/mixpanel/ngx'; - * - * constructor(private mixpanel: Mixpanel, private mixpanelPeople: MixpanelPeople) { } - * - * ... - * - * this.mixpanel.init(token) - * .then(onSuccess) - * .catch(onError); - * - * ``` - * @classes - * MixpanelPeople - */ -@Plugin({ - pluginName: 'Mixpanel', - plugin: 'cordova-plugin-mixpanel', - pluginRef: 'mixpanel', - repo: 'https://github.com/samzilverberg/cordova-mixpanel-plugin', - platforms: ['Android', 'Browser', 'iOS'], -}) -@Injectable() -export class Mixpanel extends AwesomeCordovaNativePlugin { - /** - * If originalId is omitted, aliasId will be used as originalId. - * - * @param aliasId {string} - * @param originalId {string} - * @returns {Promise} - */ - @Cordova() - alias(aliasId: string, originalId?: string): Promise { - return; - } - - /** - * - * @returns {Promise} - */ - @Cordova() - distinctId(): Promise { - return; - } - - /** - * @returns {Promise} - */ - @Cordova() - flush(): Promise { - return; - } - - /** - * The usePeople parameter is used for the iOS Mixpanel SDK. - * - * @param distinctId {string} - * @param usePeople {boolean} - * @returns {Promise} - */ - @Cordova() - identify(distinctId: string, usePeople?: boolean): Promise { - return; - } - - /** - * - * @param token {string} - * @returns {Promise} - */ - @Cordova() - init(token: string): Promise { - return; - } - - /** - * - * @returns {Promise} - */ - @Cordova() - getSuperProperties(): Promise { - return; - } - - /** - * - * @param superProperties {any} - * @returns {Promise} - */ - @Cordova() - registerSuperProperties(superProperties: any): Promise { - return; - } - - /** - * - * @param superProperties {any} - * @returns {Promise} - */ - @Cordova() - registerSuperPropertiesOnce(superProperties: any): Promise { - return; - } - - /** - * - * @param superPropertyName {string} - * @returns {Promise} - */ - @Cordova() - unregisterSuperProperty(superPropertyName: string): Promise { - return; - } - - /** - * - * @returns {Promise} - */ - @Cordova() - reset(): Promise { - return; - } - - /** - * - * @param eventName {string} - * @returns {Promise} - */ - @Cordova() - timeEvent(eventName: string): Promise { - return; - } - - /** - * - * @param eventName {string} - * @param eventProperties {any} optional - * @returns {Promise} - */ - @Cordova({ - successIndex: 2, - errorIndex: 3, - }) - track(eventName: string, eventProperties?: any): Promise { - return; - } -} - -/** - * @hidden - */ -@Plugin({ - plugin: 'cordova-plugin-mixpanel', - pluginRef: 'mixpanel.people', - pluginName: 'Mixpanel', -}) -@Injectable() -export class MixpanelPeople extends AwesomeCordovaNativePlugin { - /** - * - * @param appendObject {any} - * @returns {Promise} - */ - @Cordova() - append(appendObject: any): Promise { - return; - } - - /** - * - * @returns {Promise} - */ - @Cordova() - deleteUser(): Promise { - return; - } - - /** - * - * @param distinctId {string} - * @returns {Promise} - * @deprecated since 2016-11-21 - Use Mixpanel.identify instead. - */ - @Cordova() - identify(distinctId: string): Promise { - return; - } - - /** - * - * @param peopleProperties {string} - * @returns {Promise} - */ - @Cordova() - increment(peopleProperties: any): Promise { - return; - } - - /** - * - * @param pushId - * @returns {Promise} - */ - @Cordova() - setPushId(pushId: string): Promise { - return; - } - - /** - * - * @param peopleProperties - * @returns {Promise} - */ - @Cordova() - set(peopleProperties: any): Promise { - return; - } - - /** - * - * @param peopleProperties {any} - * @returns {Promise} - */ - @Cordova() - setOnce(peopleProperties: any): Promise { - return; - } - - /** - * - * @param amount {number} - * @param chargeProperties - * @returns {Promise} - */ - @Cordova() - trackCharge(amount: number, chargeProperties: any): Promise { - return; - } - - /** - * - * @param propertiesArray - * @returns {Promise} - */ - @Cordova() - unset(propertiesArray: string[]): Promise { - return; - } - - /** - * - * @param unionObject {any} - * @returns {Promise} - */ - @Cordova() - union(unionObject: any): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/mlkit-translate/index.ts b/src/@awesome-cordova-plugins/plugins/mlkit-translate/index.ts deleted file mode 100644 index 70365c1c..00000000 --- a/src/@awesome-cordova-plugins/plugins/mlkit-translate/index.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * This is the language object which will be returned by `downloadModel`, `deleteModel`, `getAvailableModels` and `getDownloadedModels` methods. - */ -export interface LanguageModel { - /** - * BCP-47 language code of the language. For example: en - * For full list of languages codes, see https://firebase.google.com/docs/ml-kit/translation-language-support - */ - code: string; - - /** - * Display name of the language. For example: English - */ - displayName: string; -} - -/** - * @name MLKitTranslate - * @description - * Plugin that implements MLKit Translation and Language Identification features. - * @usage - * ```typescript - * import { MLKitTranslate } from '@awesome-cordova-plugins/ml-kit-translate'; - * - * - * constructor(private mlkitTranslate: MLKitTranslate) { } - * - * ... - * - * this.mlkitTranslate.translate('Hello', 'en', 'es') - * .then((resultText: string) => console.log(res)) - * .catch((error: string) => console.error(error)); - * - * @interfaces - * LanguageModel - * ``` - */ -@Plugin({ - pluginName: 'MLKitTranslate', - plugin: 'cordova-plugin-mlkit-translate', - pluginRef: 'MLKitTranslate', - repo: 'https://github.com/rigelglen/cordova-plugin-mlkit-translate', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class MLKitTranslate extends AwesomeCordovaNativePlugin { - /** - * Translates text from one language to another. Requires the source and target languages need to be downloaded. - * If not the languages are downloaded in the background automatically. - * - * @param text {string} text to be translated - * @param targetLanguage {string} BCP-47 language code of the language to translate to - * @param sourceLanguage {string=} (optional) BCP-47 language code of the language to translate to. If not provided, source language is inferred from text - * @returns {Promise} Returns a promise that resolves with the translated text - */ - @Cordova() - translate(text: string, targetLanguage: string, sourceLanguage?: string): Promise { - return; - } - - /** - * Determines the language of a string of text. - * - * @param text {string} text to be translated - * @returns {Promise} Returns a promise that resolves with the identified language - */ - @Cordova() - identifyLanguage(text: string): Promise { - return; - } - - /** - * List of language models that have been downloaded to the device. - * - * @returns {Promise} Returns a promise that resolves with an array of languages that have been downloaded. - */ - @Cordova() - getDownloadedModels(): Promise { - return; - } - - /** - * List of language models that can be downloaded. - * - * @returns {Promise} Returns a promise that resolves with an array of possible languages that can be downloaded. - */ - @Cordova() - getAvailableModels(): Promise { - return; - } - - /** - * Downloads a specified language model. - * - * @param code {string} BCP-47 language code of the language to download - * @returns {Promise} Returns a promise that resolves with the downloaded language. - */ - @Cordova() - downloadModel(code: string): Promise { - return; - } - - /** - * Deletes a specified language model. - * - * @param code {string} BCP-47 language code of the language to delete - * @returns {Promise} Returns a promise that resolves with the deleted language. - */ - @Cordova() - deleteModel(code: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/mobile-accessibility/index.ts b/src/@awesome-cordova-plugins/plugins/mobile-accessibility/index.ts deleted file mode 100644 index dfbc3d5a..00000000 --- a/src/@awesome-cordova-plugins/plugins/mobile-accessibility/index.ts +++ /dev/null @@ -1,258 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Mobile Accessibility - * @description - * This plugin exposes information on the status of various accessibility features of mobile operating systems, including, for example, whether a screen reader is running, invert colors is enabled, and the preferred scaling for text. - * It also allows an application to send a string to be spoken by the screen reader, or a command to stop the screen reader from speaking. - * - * @usage - * ```typescript - * import { MobileAccessibility } from '@awesome-cordova-plugins/mobile-accessibility/ngx'; - * - * - * constructor(private mobileAccessibility: MobileAccessibility) { } - * - * ... - * - * - * this.mobileAccessibility.isScreenReaderRunningCallback(); - * ``` - */ -@Plugin({ - pluginName: 'MobileAccessibility', - plugin: 'phonegap-plugin-mobile-accessibility', - pluginRef: 'window.MobileAccessibility', - repo: 'https://github.com/phonegap/phonegap-mobile-accessibility', - install: '', - installVariables: [], - platforms: ['Android', 'iOS', 'Amazon Fire OS'], -}) -@Injectable() -export class MobileAccessibility extends AwesomeCordovaNativePlugin { - /** - * This function does something - * @param arg1 {string} Some param to configure something - * @param arg2 {number} Another param to configure something - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - functionName(arg1: string, arg2: number): Promise { - return; // We add return; here to avoid any IDE / Compiler errors - } - - MobileAccessibilityNotifications: { - ANNOUNCEMENT: 'ANNOUNCEMENT'; - BOLD_TEXT_STATUS_CHANGED: 'BOLD_TEXT_STATUS_CHANGED'; - CLOSED_CAPTIONING_STATUS_CHANGED: 'CLOSED_CAPTIONING_STATUS_CHANGED'; - DARKER_SYSTEM_COLORS_STATUS_CHANGED: 'DARKER_SYSTEM_COLORS_STATUS_CHANGED'; - GRAYSCALE_STATUS_CHANGED: 'GRAYSCALE_STATUS_CHANGED'; - GUIDED_ACCESS_STATUS_CHANGED: 'GUIDED_ACCESS_STATUS_CHANGED'; - INVERT_COLORS_STATUS_CHANGED: 'INVERT_COLORS_STATUS_CHANGED'; - LAYOUT_CHANGED: 'LAYOUT_CHANGED'; - MONO_AUDIO_STATUS_CHANGED: 'MONO_AUDIO_STATUS_CHANGED'; - PAGE_SCROLLED: 'PAGE_SCROLLED'; - REDUCE_MOTION_STATUS_CHANGED: 'REDUCE_MOTION_STATUS_CHANGED'; - REDUCE_TRANSPARENCY_STATUS_CHANGED: 'REDUCE_TRANSPARENCY_STATUS_CHANGED'; - SCREEN_CHANGED: 'SCREEN_CHANGED'; - SCREEN_READER_STATUS_CHANGED: 'SCREEN_READER_STATUS_CHANGED'; - SPEAK_SCREEN_STATUS_CHANGED: 'SPEAK_SCREEN_STATUS_CHANGED'; - SPEAK_SELECTION_STATUS_CHANGED: 'SPEAK_SELECTION_STATUS_CHANGED'; - SWITCH_CONTROL_STATUS_CHANGED: 'SWITCH_CONTROL_STATUS_CHANGED'; - TOUCH_EXPLORATION_STATUS_CHANGED: 'TOUCH_EXPLORATION_STATUS_CHANGED'; - }; - - /** - * Makes an asynchronous call to native MobileAccessibility to determine if a screen reader is running. - * @returns {Promise} A result method to receive the boolean result asynchronously from the native MobileAccessibility plugin. - */ - @Cordova() - isScreenReaderRunning(): Promise { - return; - } - /** - * An iOS-specific proxy for the MobileAccessibility.isScreenReaderRunning method - * @returns {Promise} A result method to receive the boolean result asynchronously from the native MobileAccessibility plugin. - */ - @Cordova() - isVoiceOverRunning(): Promise { - return; - } - /** - * An Android/Amazon Fire OS-specific proxy for the MobileAccessibility.isScreenReaderRunning method. - * @returns {Promise} A result method to receive the boolean result asynchronously from the native MobileAccessibility plugin. - */ - @Cordova() - isTalkBackRunning(): Promise { - return; - } - /** - * On Android, this method returns true if ChromeVox is active and properly initialized with access to the text to speech API in the WebView. - * If TalkBack is running but ChromeVox is not active, this method is useful to alert the user of a potential problem. - * @returns {Promise} Returns the result - */ - @Cordova() - isChromeVoxActive(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isBoldTextEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isClosedCaptioningEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isDarkerSystemColorsEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isGrayscaleEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isGuidedAccessEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isInvertColorsEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isMonoAudioEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isReduceMotionEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isReduceTransparencyEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isSpeakScreenEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isSpeakSelectionEnabled(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isSwitchControlRunning(): Promise { - return; - } - /** - * - * @returns {Promise} Returns the result - */ - @Cordova() - isTouchExplorationEnabled(): Promise { - return; - } - /** - * - * * @returns {Promise} Returns the result - */ - @Cordova() - getTextZoom(): Promise { - return; - } - /** - * @param textZoom {number} A percentage value by which text in the WebView should be scaled. - */ - @Cordova() - setTextZoom(textZoom: number): void { - return; - } - /** - * - */ - @Cordova() - updateTextZoom(): void { - return; - } - /** - * A Boolean value which specifies whether to use the preferred text zoom of a default percent value of 100. - * @param value {boolean} Returns the result - */ - @Cordova() - usePreferredTextZoom(value: boolean): void {} - /** - * Posts a notification with a string for the screen reader to announce if it is running. - * @param mobileAccessibilityNotification {any} - * @param value {string} A string to be announced by a screen reader. - * @returns {Promise} Returns the result - */ - @Cordova() - postNotification(mobileAccessibilityNotification: any, value: string): Promise { - return; - } - /** - * Speaks a given string through the screenreader. On Android, if ChromeVox is active, it will use the specified queueMode and properties. - * @param value {string} - * @param queueMode {mumber} - * @param properties {any} - */ - @Cordova() - speak(value: string, queueMode?: number, properties?: any): void { - return; - } - /** - * Stops speech. - */ - @Cordova() - stop(): void { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/mobile-messaging/index.ts b/src/@awesome-cordova-plugins/plugins/mobile-messaging/index.ts deleted file mode 100644 index 15407c9c..00000000 --- a/src/@awesome-cordova-plugins/plugins/mobile-messaging/index.ts +++ /dev/null @@ -1,589 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export type OS = 'Android' | 'iOS'; -export type Gender = 'Male' | 'Female'; -export type Event = - | 'messageReceived' - | 'notificationTapped' - | 'tokenReceived' - | 'registrationUpdated' - | 'geofenceEntered' - | 'actionTapped' - | 'installationUpdated' - | 'userUpdated' - | 'personalized' - | 'depersonalized' - | 'inAppChat.availabilityUpdated' - | 'inAppChat.unreadMessageCounterUpdated' - | 'deeplink'; - -export interface CustomEvent { - definitionId: string; - properties: Record; -} - -export interface Configuration { - /** - * The application code of your Application from Push Portal website - */ - applicationCode: string; - geofencingEnabled?: boolean; - inAppChatEnabled?: boolean; - /** - * Message storage save callback - */ - messageStorage?: CustomMessageStorage; - defaultMessageStorage?: boolean; - ios?: { - notificationTypes?: string[]; // ['alert', 'badge', 'sound'] - forceCleanup?: boolean; - logging?: boolean; - }; - android?: { - notificationIcon?: string; // a resource name for a status bar icon (without extension), located in '/platforms/android/app/src/main/res/mipmap' - multipleNotifications?: boolean; // set to 'true' to enable multiple notifications - notificationAccentColor?: string; // set to hex color value in format '#RRGGBB' or '#AARRGGBB' - firebaseOptions?: { - apiKey: string; - applicationId: string; - databaseUrl?: string; - gaTrackingId?: string; - gcmSenderId?: string; - storageBucket?: string; - projectId: string; - }; - }; - privacySettings?: { - applicationCodePersistingDisabled?: boolean; - userDataPersistingDisabled?: boolean; - carrierInfoSendingDisabled?: boolean; - systemInfoSendingDisabled?: boolean; - }; - notificationCategories?: [ - { - identifier: string; - actions?: [ - { - identifier: string; - title?: string; - foreground?: boolean; - authenticationRequired?: boolean; - moRequired?: boolean; - destructive?: boolean; - icon?: string; - textInputActionButtonTitle?: string; - textInputPlaceholder?: string; - } - ]; - } - ]; -} - -export interface UserData { - externalUserId?: string; - firstName?: string; - lastName?: string; - middleName?: string; - gender?: Gender; - birthday?: string; - phones?: string[]; - emails?: string[]; - tags?: string[]; - customAttributes?: Record; -} - -export interface Installation { - isPrimaryDevice?: boolean; - isPushRegistrationEnabled?: boolean; - notificationsEnabled?: boolean; - geoEnabled?: boolean; - sdkVersion?: string; - appVersion?: string; - os?: OS; - osVersion?: string; - deviceManufacturer?: string; - deviceModel?: string; - deviceSecure?: boolean; - language?: string; - deviceTimezoneId?: string; - applicationUserId?: string; - deviceName?: string; - customAttributes?: Record; -} - -/** - * User's unique ID. One UserIdentity parameter must be provided if used. - */ -export interface UserIdentity { - phones?: string[]; - emails?: string[]; - externalUserId?: string; -} - -export interface PersonalizeContext { - userIdentity: UserIdentity; - userAttributes?: Record; - forceDepersonalize?: boolean; -} - -export interface GeoData { - area: GeoArea; -} - -export interface GeoArea { - id: string; - center: GeoCenter; - radius: number; - title: string; -} - -export interface GeoCenter { - lat: number; - lon: number; -} - -export interface Message { - messageId: string; - title?: string; - body?: string; - sound?: string; - silent?: boolean; - customPayload?: Record; - internalData?: string; - receivedTimestamp?: number; - seenDate?: number; - contentUrl?: string; - seen?: boolean; - geo?: boolean; - originalPayload?: Record; // iOS only - vibrate?: boolean; // Android only - icon?: string; // Android only - category?: string; // Android only - chat?: string; - browserUrl?: string; - deeplink?: string; - webViewUrl?: string; - inAppOpenTitle?: string | undefined; - inAppDismissTitle?: string; -} - -export interface MobileMessagingError { - code: string; - description: string; - domain?: string; -} - -export interface ChatConfig { - ios?: { - showModally: boolean; - }; -} - -export class DefaultMessageStorage { - @Cordova({ sync: true }) - find(messageId: string, callback: (message: Message) => void) { - return; - } - - @Cordova({ sync: true }) - findAll(callback: (messages: Message[]) => void) { - return; - } - - @Cordova({ sync: true }) - delete(messageId: string, callback: () => void) { - return; - } - - @Cordova({ sync: true }) - deleteAll(callback: () => void) { - return; - } -} - -export class CustomMessageStorage { - /** - * Will be called by the plugin when messages are received and it's time to save them to the storage - * - * @param array of message objects to save to storage - */ - @Cordova({ sync: true }) - save(messages: Message[]) { - return; - } - - /** - * Will be called by the plugin to find a message by message id - * - * @param callback has to be called on completion with one parameter - found message object - */ - @Cordova({ sync: true }) - find(messageId: string, callback: (message: Message) => void) { - return; - } - - /** - * Will be called by the plugin to find all messages in the storage - * - * @param callback has to be called on completion with one parameter - an array of available messages - */ - @Cordova({ sync: true }) - findAll(callback: (messages: Message[]) => void) { - return; - } - - /** - * Will be called by the plugin when its time to initialize the storage - */ - @Cordova({ sync: true }) - start() { - return; - } - - /** - * Will be called by the plugin when its time to deinitialize the storage - */ - @Cordova({ sync: true }) - stop() { - return; - } -} - -export interface ChatSettingsIOS { - title: string; - sendButtonColor: string; - navigationBarItemsColor: string; - navigationBarColor: string; - navigationBarTitleColor: string; -} - -/** - * @name Mobile Messaging - * @description - * Mobile Messaging SDK is designed and developed to easily enable push notification channel in your mobile application. - * In almost no time of implementation you get push notification in your application and access to the features of [Infobip IP Messaging Platform](https://portal.infobip.com/push/). - * This document describes library integration steps for your Cordova project. - * - * For more info see [Cordova plugin docs](https://github.com/infobip/mobile-messaging-cordova-plugin) - * @usage - * ```typescript - * import { MobileMessaging } from '@awesome-cordova-plugins/mobile-messaging/ngx'; - * - * - * constructor(private mobileMessaging: MobileMessaging) { } - * - * ... - * - * - * this.mobileMessaging.init({ - * applicationCode: '', - * geofencingEnabled: '', - * defaultMessageStorage: '', - * ios: { - * notificationTypes: ['alert', 'badge', 'sound'] - * }, - * android: { - * notificationIcon: , - * multipleNotifications: , - * notificationAccentColor: - * }}, (err) => { - * ... - * }); - * - * this.mobileMessaging.register('messageReceived').subscribe((message: Message) => { - * ... - * }); - * - * ``` - */ -@Plugin({ - pluginName: 'MobileMessaging', - plugin: 'com-infobip-plugins-mobilemessaging', - pluginRef: 'MobileMessaging', - repo: 'https://github.com/infobip/mobile-messaging-cordova-plugin', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class MobileMessaging extends AwesomeCordovaNativePlugin { - /** - * Starts a new Mobile Messaging session. - * - * @name init - * @param config. Configuration for Mobile Messaging - * @param config - * @param onInitError - * @param {Function} onInitError. Error callback - */ - @Cordova({ sync: true }) - init(config: Configuration, onInitError?: (error: MobileMessagingError) => void) { - return; - } - - /** - * Register to event coming from MobileMessaging library. - * - * @name register - * @param event - */ - @Cordova({ - observable: true, - }) - register(event: Event): Observable { - return; - } - - @Cordova({ - observable: true, - }) - on(event: Event): Observable { - return; - } - - /** - * Un register from MobileMessaging library event. - * - * @name unregister - * @param {string} eventName - * @param event - * @param {Function} handler will be unregistered from event - */ - @Cordova({ - observable: true, - }) - unregister(event: Event): Observable { - return; - } - - @Cordova({ - observable: true, - }) - off(event: Event): Observable { - return; - } - - /** - * Sends an event to the server eventually, handles possible errors and do retries for you. - * - * @name submitEvent - * @param {Object} eventData. An object containing event data - * { - * definitionId: "eventDefinitionId" - * properties: { - * "stringAttribute": "string", - * "numberAttribute": 1, - * "dateAttribute": "2020-02-26T09:41:57Z", - * "booleanAttribute": true - * } - * @param event - * } - */ - @Cordova({ - sync: true, - }) - submitEvent(event: CustomEvent): void { - return; - } - - /** - * Sends an event to the server immediately. - * You have to handle possible connection or server errors, do retries yourself. - * - * @name submitEventImmediately - * @param {Object} eventData. An object containing event data - * { - * definitionId: "eventDefinitionId" - * properties: { - * "stringAttribute": "string", - * "numberAttribute": 1, - * "dateAttribute": "2020-02-26T09:41:57Z", - * "booleanAttribute": true - * } - * } - * @param event - * @param {Function} callback will be called on result, you have to handle error and do retries yourself - */ - @Cordova({ - observable: true, - }) - submitEventImmediately(event: CustomEvent): Promise { - return; - } - - /** - * Saves user data to the server. - * - * @name saveUser - * @param userData - * @param {Object} userData. An object containing user data - */ - @Cordova() - saveUser(userData: UserData): Promise { - return; - } - - /** - * Fetch user data from the server. - * - * @name fetchUser - */ - @Cordova() - fetchUser(): Promise { - return; - } - - /** - * Gets user data from the locally stored cache. - * - * @name getUser - */ - @Cordova() - getUser(): Promise { - return; - } - - /** - * Saves installation to the server. - * - * @name saveInstallation - * @param installation - * @param {Object} installation. An object containing installation data - */ - @Cordova() - saveInstallation(installation: Installation): Promise { - return; - } - - /** - * Fetches installation from the server. - * - * @name fetchInstallation - */ - @Cordova() - fetchInstallation(): Promise { - return; - } - - /** - * Gets locally cached installation. - * - * @name getInstallation - */ - @Cordova() - getInstallation(): Promise { - return; - } - - /** - * Sets any installation as primary for this user. - * - * @name setInstallationAsPrimary - * @param {string} pushRegistrationId of an installation - * @param {boolean} primary or not - */ - @Cordova() - setInstallationAsPrimary(pushRegistrationId: string, primary: boolean): Promise { - return; - } - - /** - * Performs personalization of the current installation on the platform. - * - * @name personalize - * @param context - * @param {Object} context. An object containing user identity information as well as additional user attributes. - */ - @Cordova() - personalize(context: PersonalizeContext): Promise { - return; - } - - /** - * Performs depersonalization of the current installation on the platform. - * - * @name depersonalize - */ - @Cordova() - depersonalize(): Promise { - return; - } - - /** - * Performs depersonalization of the installation referenced by pushRegistrationId. - * - * @param {string} pushRegistrationId of the remote installation to depersonalize - */ - @Cordova() - depersonalizeInstallation(pushRegistrationId: string): Promise { - return; - } - - /** - * Mark messages as seen - * - * @name markMessagesSeen - * @param {Array} messageIds of identifiers of message to mark as seen - */ - @Cordova() - markMessagesSeen(messageIds: string[]): Promise { - return; - } - - /** - * Displays built-in error dialog so that user can resolve errors during sdk initialization. - * - * @name showDialogForError - * @param {number} errorCode to display dialog for - */ - @Cordova() - showDialogForError(errorCode: number): Promise { - return; - } - - @Cordova({ sync: true }) - defaultMessageStorage(): DefaultMessageStorage | undefined { - return; - } - - /** - * Displays chat view. - * - * @name showChat - * @param config - * @param {ChatConfig} chat config - */ - @Cordova() - showChat(config?: ChatConfig): Promise { - return; - } - - /** - * Setup chat settings for iOS only - * - * @param settings - */ - @Cordova() - setupiOSChatSettings(settings: ChatSettingsIOS): Promise { - return; - } - - /** - * Returns unread in-app chat push messages counter. - * The counter increments each time the application receives in-app chat push message - * (this usually happens when chat screen is inactive or the application is in background/terminated state). - */ - @Cordova({ sync: true }) - getMessageCounter(onResult: (counter: number) => void) { - return; - } - - /** - * MobileMessaging plugin automatically resets the counter to 0 whenever user opens the in-app chat screen. - * However, use the following API in case you need to manually reset the counter. - */ - @Cordova() - resetMessageCounter() { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/multiple-document-picker/index.ts b/src/@awesome-cordova-plugins/plugins/multiple-document-picker/index.ts deleted file mode 100644 index 16bc77ae..00000000 --- a/src/@awesome-cordova-plugins/plugins/multiple-document-picker/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * This is a wrapper for MultipleDocumentsPicker plugin - * - */ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Multiple Documents Picker - * @description - * This plugin allows users to pick multiple documents/images at once - * @usage - * ```typescript - * import { MultipleDocumentsPicker } from '@awesome-cordova-plugins/multiple-document-picker/ngx'; - * - * - * constructor(private multipleDocumentsPicker: MultipleDocumentsPicker) { } - * - * ... - * - * - * this.multipleDocumentsPicker.pick(1) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'MultipleDocumentsPicker', - plugin: 'cordova-plugin-multiple-documents-picker', - pluginRef: 'multipleDocumentsPicker', - repo: 'https://github.com/akeotech/cordova-plugin-multiple-documents-picker', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class MultipleDocumentsPicker extends AwesomeCordovaNativePlugin { - /** - * This function allow user to show native file picker - * - * @param type {number} To pick type of files: for images send 1, for all files send 2 - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - pick(type: number): Promise { - return; // We add return; here to avoid any IDE / Compiler errors - } -} diff --git a/src/@awesome-cordova-plugins/plugins/music-controls/index.ts b/src/@awesome-cordova-plugins/plugins/music-controls/index.ts deleted file mode 100644 index 437e5255..00000000 --- a/src/@awesome-cordova-plugins/plugins/music-controls/index.ts +++ /dev/null @@ -1,223 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface MusicControlsOptions { - track?: string; - artist?: string; - cover?: string; - isPlaying?: boolean; - dismissable?: boolean; - hasPrev?: boolean; - hasNext?: boolean; - hasSkipForward?: boolean; - hasSkipBackward?: boolean; - skipForwardInterval?: number; - skipBackwardInterval?: number; - hasScrubbing?: boolean; - hasClose?: boolean; - album?: string; - duration?: number; - elapsed?: number; - ticker?: string; - playIcon?: string; - pauseIcon?: string; - prevIcon?: string; - nextIcon?: string; - closeIcon?: string; - notificationIcon?: string; -} - -/** - * @name Music Controls - * @capacitorincompatible true - * @description - * Music controls for Cordova applications. - * Display a 'media' notification with play/pause, previous, next buttons, allowing the user to control the play. - * Handle also headset event (plug, unplug, headset button). - * @usage - * ```typescript - * import { MusicControls } from '@awesome-cordova-plugins/music-controls/ngx'; - * - * constructor(private musicControls: MusicControls) { } - * - * ... - * - * this.musicControls.create({ - * track : 'Time is Running Out', // optional, default : '' - * artist : 'Muse', // optional, default : '' - * cover : 'albums/absolution.jpg', // optional, default : nothing - * // cover can be a local path (use fullpath 'file:///storage/emulated/...', or only 'my_image.jpg' if my_image.jpg is in the www folder of your app) - * // or a remote url ('http://...', 'https://...', 'ftp://...') - * isPlaying : true, // optional, default : true - * dismissable : true, // optional, default : false - * - * // hide previous/next/close buttons: - * hasPrev : false, // show previous button, optional, default: true - * hasNext : false, // show next button, optional, default: true - * hasClose : true, // show close button, optional, default: false - * - * // iOS only, optional - * album : 'Absolution', // optional, default: '' - * duration : 60, // optional, default: 0 - * elapsed : 10, // optional, default: 0 - * hasSkipForward : true, // show skip forward button, optional, default: false - * hasSkipBackward : true, // show skip backward button, optional, default: false - * skipForwardInterval: 15, // display number for skip forward, optional, default: 0 - * skipBackwardInterval: 15, // display number for skip backward, optional, default: 0 - * hasScrubbing: false, // enable scrubbing from control center and lockscreen progress bar, optional - * - * // Android only, optional - * // text displayed in the status bar when the notification (and the ticker) are updated, optional - * ticker : 'Now playing "Time is Running Out"', - * // All icons default to their built-in android equivalents - * playIcon: 'media_play', - * pauseIcon: 'media_pause', - * prevIcon: 'media_prev', - * nextIcon: 'media_next', - * closeIcon: 'media_close', - * notificationIcon: 'notification' - * }); - * - * this.musicControls.subscribe().subscribe(action => { - * - * function events(action) { - * const message = JSON.parse(action).message; - * switch(message) { - * case 'music-controls-next': - * // Do something - * break; - * case 'music-controls-previous': - * // Do something - * break; - * case 'music-controls-pause': - * // Do something - * break; - * case 'music-controls-play': - * // Do something - * break; - * case 'music-controls-destroy': - * // Do something - * break; - * - * // External controls (iOS only) - * case 'music-controls-toggle-play-pause' : - * // Do something - * break; - * case 'music-controls-seek-to': - * const seekToInSeconds = JSON.parse(action).position; - * this.musicControls.updateElapsed({ - * elapsed: seekToInSeconds, - * isPlaying: true - * }); - * // Do something - * break; - * case 'music-controls-skip-forward': - * // Do something - * break; - * case 'music-controls-skip-backward': - * // Do something - * break; - * - * // Headset events (Android only) - * // All media button events are listed below - * case 'music-controls-media-button' : - * // Do something - * break; - * case 'music-controls-headset-unplugged': - * // Do something - * break; - * case 'music-controls-headset-plugged': - * // Do something - * break; - * default: - * break; - * } - * } - * }); - * - * this.musicControls.listen(); // activates the observable above - * - * this.musicControls.updateIsPlaying(true); - * - * - * ``` - * @interfaces - * MusicControlsOptions - */ -@Plugin({ - pluginName: 'MusicControls', - plugin: 'cordova-plugin-music-controls2', - pluginRef: 'MusicControls', - repo: 'https://github.com/ghenry22/cordova-plugin-music-controls2', - platforms: ['Android', 'iOS', 'Windows'], -}) -@Injectable() -export class MusicControls extends AwesomeCordovaNativePlugin { - /** - * Create the media controls - * - * @param options {MusicControlsOptions} - * @returns {Promise} - */ - @Cordova() - create(options: MusicControlsOptions): Promise { - return; - } - - /** - * Destroy the media controller - * - * @returns {Promise} - */ - @Cordova() - destroy(): Promise { - return; - } - - /** - * Subscribe to the events of the media controller - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - subscribe(): Observable { - return; - } - - /** - * Start listening for events, this enables the Observable from the subscribe method - */ - @Cordova({ sync: true }) - listen(): void {} - - /** - * Toggle play/pause: - * - * @param isPlaying {boolean} - */ - @Cordova() - updateIsPlaying(isPlaying: boolean): void {} - - /** - * Update elapsed time, optionally toggle play/pause: - * - * @param args {Object} - * @param args.elapsed - * @param args.isPlaying - */ - @Cordova({ - platforms: ['iOS'], - }) - updateElapsed(args: { elapsed: number; isPlaying: boolean }): void {} - - /** - * Toggle dismissable: - * - * @param dismissable {boolean} - */ - @Cordova() - updateDismissable(dismissable: boolean): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/native-audio/index.ts b/src/@awesome-cordova-plugins/plugins/native-audio/index.ts deleted file mode 100644 index c9d29d69..00000000 --- a/src/@awesome-cordova-plugins/plugins/native-audio/index.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -/** - * @name Native Audio - * @description Native Audio Playback - * @usage - * ```typescript - * import { NativeAudio } from '@awesome-cordova-plugins/native-audio/ngx'; - * - * constructor(private nativeAudio: NativeAudio) { } - * - * ... - * - * this.nativeAudio.preloadSimple('uniqueId1', 'path/to/file.mp3').then(onSuccess, onError); - * this.nativeAudio.preloadComplex('uniqueId2', 'path/to/file2.mp3', 1, 1, 0).then(onSuccess, onError); - * - * this.nativeAudio.play('uniqueId1').then(onSuccess, onError); - * - * // can optionally pass a callback to be called when the file is done playing - * this.nativeAudio.play('uniqueId1', () => console.log('uniqueId1 is done playing')); - * - * this.nativeAudio.loop('uniqueId2').then(onSuccess, onError); - * - * this.nativeAudio.setVolumeForComplexAsset('uniqueId2', 0.6).then(onSuccess,onError); - * - * this.nativeAudio.stop('uniqueId1').then(onSuccess,onError); - * - * this.nativeAudio.unload('uniqueId1').then(onSuccess,onError); - * - * ``` - */ -@Plugin({ - pluginName: 'NativeAudio', - plugin: 'cordova-plugin-nativeaudio', - pluginRef: 'plugins.NativeAudio', - repo: 'https://github.com/floatinghotpot/cordova-plugin-nativeaudio', - platforms: ['Android', 'Browser', 'iOS'], -}) -@Injectable() -export class NativeAudio extends AwesomeCordovaNativePlugin { - /** - * Loads an audio file into memory. Optimized for short clips / single shots (up to five seconds). Cannot be stopped / looped. - * - * @param id {string} unique ID for the audio file - * @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset. - * @returns {Promise} - */ - @Cordova() - preloadSimple(id: string, assetPath: string): Promise { - return; - } - - /** - * Loads an audio file into memory. Optimized for background music / ambient sound. Uses highlevel native APIs with a larger footprint. (iOS: AVAudioPlayer). Can be stopped / looped and used with multiple voices. Can be faded in and out using the delay parameter. - * - * @param id {string} unique ID for the audio file - * @param assetPath {string} the relative path or absolute URL (inluding http://) to the audio asset. - * @param volume {number} the volume of the preloaded sound (0.1 to 1.0) - * @param voices {number} the number of multichannel voices available - * @param delay {number} - * @returns {Promise} - */ - @Cordova() - preloadComplex(id: string, assetPath: string, volume: number, voices: number, delay: number): Promise { - return; - } - - /** - * Plays an audio asset - * - * @param id {string} unique ID for the audio file - * @param completeCallback {Function} optional. Callback to be invoked when audio is done playing - * @returns {Promise} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - play(id: string, completeCallback?: Function): Promise { - return; - } - - /** - * Stops playing an audio - * - * @param id {string} unique ID for the audio file - * @returns {Promise} - */ - @Cordova() - stop(id: string): Promise { - return; - } - - /** - * Loops an audio asset infinitely, this only works for complex assets - * - * @param id {string} unique ID for the audio file - * @returns {Promise} - */ - @Cordova() - loop(id: string): Promise { - return; - } - - /** - * Unloads an audio file from memory - * - * @param id {string} unique ID for the audio file - * @returns {Promise} - */ - @Cordova() - unload(id: string): Promise { - return; - } - - /** - * Changes the volume for preloaded complex assets. - * - * @param id {string} unique ID for the audio file - * @param volume {number} the volume of the audio asset (0.1 to 1.0) - * @returns {Promise} - */ - @Cordova() - setVolumeForComplexAsset(id: string, volume: number): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/native-geocoder/index.ts b/src/@awesome-cordova-plugins/plugins/native-geocoder/index.ts deleted file mode 100644 index 8c5b1611..00000000 --- a/src/@awesome-cordova-plugins/plugins/native-geocoder/index.ts +++ /dev/null @@ -1,153 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Native Geocoder - * @description - * Cordova plugin for native forward and reverse geocoding - * @usage - * ```typescript - * import { NativeGeocoder, NativeGeocoderResult, NativeGeocoderOptions } from '@awesome-cordova-plugins/native-geocoder/ngx'; - * - * constructor(private nativeGeocoder: NativeGeocoder) { } - * - * ... - * - * let options: NativeGeocoderOptions = { - * useLocale: true, - * maxResults: 5 - * }; - * - * this.nativeGeocoder.reverseGeocode(52.5072095, 13.1452818, options) - * .then((result: NativeGeocoderResult[]) => console.log(JSON.stringify(result[0]))) - * .catch((error: any) => console.log(error)); - * - * this.nativeGeocoder.forwardGeocode('Berlin', options) - * .then((result: NativeGeocoderResult[]) => console.log('The coordinates are latitude=' + result[0].latitude + ' and longitude=' + result[0].longitude)) - * .catch((error: any) => console.log(error)); - * ``` - * @interfaces - * NativeGeocoderResult - * NativeGeocoderOptions - */ -@Plugin({ - pluginName: 'NativeGeocoder', - plugin: 'cordova-plugin-nativegeocoder', - pluginRef: 'nativegeocoder', - repo: 'https://github.com/sebastianbaar/cordova-plugin-nativegeocoder', - platforms: ['iOS', 'Android'], -}) -@Injectable() -export class NativeGeocoder extends AwesomeCordovaNativePlugin { - /** - * Reverse geocode a given latitude and longitude to find location address - * - * @param latitude {number} The latitude - * @param longitude {number} The longitude - * @param options {NativeGeocoderOptions} The options - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - reverseGeocode( - latitude: number, - longitude: number, - options?: NativeGeocoderOptions - ): Promise { - return; - } - - /** - * Forward geocode a given address to find coordinates - * - * @param addressString {string} The address to be geocoded - * @param options {NativeGeocoderOptions} The options - * @returns {Promise} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - forwardGeocode(addressString: string, options?: NativeGeocoderOptions): Promise { - return; - } -} - -/** - * Encapsulates format information about a geocoding result. - * more Info: - * - https://developer.apple.com/documentation/corelocation/clplacemark - * - https://developer.android.com/reference/android/location/Address.html - */ -export interface NativeGeocoderResult { - /** - * The latitude. - */ - latitude: string; - /** - * The longitude. - */ - longitude: string; - /** - * The country code. - */ - countryCode: string; - /** - * The country name. - */ - countryName: string; - /** - * The postal code. - */ - postalCode: string; - /** - * The administrativeArea. - */ - administrativeArea: string; - /** - * The subAdministrativeArea. - */ - subAdministrativeArea: string; - /** - * The locality. - */ - locality: string; - /** - * The subLocality. - */ - subLocality: string; - /** - * The thoroughfare. - */ - thoroughfare: string; - /** - * The subThoroughfare. - */ - subThoroughfare: string; - /** - * The areasOfInterest - */ - areasOfInterest: string[]; -} - -/** - * Options for reverse and forward geocoding. - */ -export interface NativeGeocoderOptions { - /** - * The locale to use when returning the address information. - * If set to 'false' the locale will always be 'en_US'. - * Default is 'true' - */ - useLocale: boolean; - /** - * The default locale to use when returning the address information. - * e.g.: 'fa-IR' or 'de_DE'. - */ - defaultLocale?: string; - /** - * The maximum number of result to return (max is 5). - * Default is 1 - */ - maxResults: number; -} diff --git a/src/@awesome-cordova-plugins/plugins/native-keyboard/index.ts b/src/@awesome-cordova-plugins/plugins/native-keyboard/index.ts deleted file mode 100644 index c812bd4d..00000000 --- a/src/@awesome-cordova-plugins/plugins/native-keyboard/index.ts +++ /dev/null @@ -1,246 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -export interface NativeKeyboardOptions { - /** - * A function invoked when the user submits his input. Receives the text as a single property. Make sure your page is UTF-8 encoded so Chinese and Emoji are rendered OK. - */ - onSubmit: Function; - - /** - * A function invoked when the keyboard is about to pop up. Receives the height as a single property. (iOS only) - */ - onKeyboardWillShow: Function; - - /** - * A function invoked when the keyboard popped up. Receives the height as a single property. - */ - onKeyboardDidShow: Function; - - /** - * A function invoked when the keyboard is about to close. (iOS only) - */ - onKeyboardWillHide: Function; - - /** - * A function invoked when the keyboard closed. - */ - onKeyboardDidHide: Function; - - /** - * A function invoked when any key is pressed, sends the entire text as response. - */ - onTextChanged: Function; - - /** - * Highly recommended to pass in if you want to replicate the behavior of the video's above (scroll down when the keyboard opens). Pass in the scrollable DOM element containing the messages. - */ - autoscrollElement: HTMLElement; - - /** - * If `autoscrollElement` was set you can also make the list scroll down initially, when the messenger bar (without the keyboard popping up) is shown. - */ - scrollToBottomAfterMessengerShows: boolean; - - /** - * Setting this to `true` is like the video's above: the keyboard doesn't close upon submit. Defaults to `false`. - */ - keepOpenAfterSubmit: boolean; - - /** - * Makes the messenger bar slide in from the bottom. Defaults to `false`. - */ - animated: boolean; - - /** - * Open the keyboard when showing the messenger. Defaults to `false`. - */ - showKeyboard: boolean; - - /** - * The default text set in the messenger input bar. - */ - text: string; - - /** - * The color of the typed text. Defaults to `#444444`. - */ - textColor: string; - - /** - * Like a regular HTML input placeholder. - */ - placeholder: string; - - /** - * The color of the placeholder text. Defaults to `#CCCCCC`. - */ - placeholderColor: string; - - /** - * The background color of the messenger bar. Defaults to `#F6F6F6`. - */ - backgroundColor: string; - - /** - * The background color of the textview. Looks nicest on Android if it's the same color as the `backgroundColor` property. Defaults to `#F6F6F6`. - */ - textViewBackgroundColor: string; - - /** - * The border color of the textview. Defaults to `#666666`. (iOS only) - */ - textViewBorderColor: string; - - /** - * Setting this > 0 will make a counter show up on iOS (and ignore superfluous input on Android, for now) - */ - maxChars: number; - - /** - * Options are: `"none"`, `"split"`, `"countdown"`, `"countdownreversed"`. Note that if `maxChars` is set, `"none"` will still show a counter. Defaults to `"none"`. (iOS only) - */ - counterStyle: string; - - /** - * Options are: "default", "decimalpad", "phonepad", "numberpad", "namephonepad", "number", "email", "twitter", "url", "alphabet", "search", "ascii". (iOS only) - */ - type: string; - - /** - * Options are: "light", "dark". (iOS only) - */ - appearance: string; - - /** - * Disables things like the Emoji keyboard and the Predicive text entry bar (iOS only) - */ - secure: boolean; - - /** - * - */ - leftButton: NativeKeyboardLeftButton; - - /** - * - */ - rightButton: NativeKeyboardButton; -} - -export interface NativeKeyboardButton { - /** - * Either "text" (Android only currently), "fontawesome" or "ionicon". - */ - type: string; - /** - * Depends on the type. Examples: for "text" use "Send", for "fontawesome" use "fa-battery-quarter", for "ionicon" use "\uf48a" (go to http://ionicons.com, right-click and inspect the icon and use the value you find in :before). Note that some fonticons are not supported as the embedded fonts in the plugin may lag behind a little. So try one of the older icons first. - */ - value: string; - /** - * If type is "text" you can set this to either "normal", "bold" or "italic". - */ - textStyle: string; - /** - * A function invoked when the button is pressed. Use this button to prompt the user what he wants to do next by for instance rendering an ActionSheet. - */ - onPress: Function; -} - -export interface NativeKeyboardLeftButton extends NativeKeyboardButton { - /** - * Set to `true` to disable the button once text has been entered. - */ - disabledWhenTextEntered: boolean; -} - -export interface NativeKeyboardUpdateMessengerOptions { - /** - * Replace the messenger's text by this. The current text remains if omitted. - */ - text: string; - /** - * Position the cursor anywhere in the text range. Defaults to the end of the text. - */ - caretIndex: number; - /** - * If `false` or omitted no changes to the keyboard state are made. - */ - showKeyboard: boolean; -} - -/** - * @paid - * @name Native Keyboard - * @description - * A cross platform WhatsApp / Messenger / Slack -style keyboard even. For your Cordova app. - * @usage - * ``` - * import { NativeKeyboard } from '@awesome-cordova-plugins/native-keyboard/ngx'; - * - * - * constructor(private nativeKeyboard: NativeKeyboard) { } - * - * ... - * - * - * ``` - * @interfaces - * NativeKeyboardOptions - * NativeKeyboardButton - * NativeKeyboardLeftButton - * NativeKeyboardUpdateMessengerOptions - */ -@Plugin({ - pluginName: 'NativeKeyboard', - plugin: 'cordova-plugin-native-keyboard', - pluginRef: 'NativeKeyboard', - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-native-keyboard', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class NativeKeyboard extends AwesomeCordovaNativePlugin { - /** - * Show messenger - * - * @param options {NativeKeyboardOptions} - */ - @Cordova({ sync: true }) - showMessenger(options: NativeKeyboardOptions): void {} - - /** - * Hide messenger - * - * @param options {NativeKeyboardOptions} - */ - @Cordova({ sync: true }) - hideMessenger(options: NativeKeyboardOptions): void {} - - /** - * Programmatically pop up the keyboard again if the user dismissed it. - * - * @returns {Promise} - */ - @Cordova() - showMessengerKeyboard(): Promise { - return; - } - - /** - * Programmatically hide the keyboard (but not the messenger bar) - */ - @Cordova() - hideMessengerKeyboard(): Promise { - return; - } - - /** - * Manipulate the messenger while it's open. For instance if you want to update the text programmatically based on what the user typed. - * - * @param options - */ - @Cordova() - updateMessenger(options: NativeKeyboardUpdateMessengerOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/native-page-transitions/index.ts b/src/@awesome-cordova-plugins/plugins/native-page-transitions/index.ts deleted file mode 100644 index b1b01595..00000000 --- a/src/@awesome-cordova-plugins/plugins/native-page-transitions/index.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface NativeTransitionOptions { - direction?: string; - duration?: number; - slowdownfactor?: number; - slidePixels?: number; - iosdelay?: number; - androiddelay?: number; - winphonedelay?: number; - fixedPixelsTop?: number; - fixedPixelsBottom?: number; - action?: string; - origin?: string; - href?: string; -} - -/** - * @name Native Page Transitions - * @description - * The Native Page Transitions plugin uses native hardware acceleration to animate your transitions between views. You have complete control over the type of transition, the duration, and direction. - * @usage - * ```typescript - * import { NativePageTransitions, NativeTransitionOptions } from '@awesome-cordova-plugins/native-page-transitions/ngx'; - * - * constructor(private nativePageTransitions: NativePageTransitions) { } - * - * ... - * - * - * // example of adding a transition when a page/modal closes - * ionViewWillLeave() { - * - * let options: NativeTransitionOptions = { - * direction: 'up', - * duration: 500, - * slowdownfactor: 3, - * slidePixels: 20, - * iosdelay: 100, - * androiddelay: 150, - * fixedPixelsTop: 0, - * fixedPixelsBottom: 60 - * } - * - * this.nativePageTransitions.slide(options) - * .then(onSuccess) - * .catch(onError); - * - * } - * - * - * // example of adding a transition when pushing a new page - * openPage(page: any) { - * - * this.nativePageTransitions.slide(options); - * this.navCtrl.push(page); - * - * } - * - * ``` - */ -@Plugin({ - pluginName: 'NativePageTransitions', - plugin: 'com.telerik.plugins.nativepagetransitions', - pluginRef: 'plugins.nativepagetransitions', - repo: 'https://github.com/Telerik-Verified-Plugins/NativePageTransitions', - platforms: ['Android', 'iOS', 'Windows Phone 8'], -}) -@Injectable() -export class NativePageTransitions extends AwesomeCordovaNativePlugin { - /** - * Perform a slide animation - * - * @param options {NativeTransitionOptions} Options for the transition - * @returns {Promise} - */ - @Cordova() - slide(options: NativeTransitionOptions): Promise { - return; - } - - /** - * Perform a flip animation - * - * @param options {NativeTransitionOptions} Options for the transition - * @returns {Promise} - */ - @Cordova() - flip(options: NativeTransitionOptions): Promise { - return; - } - - /** - * Perform a fade animation - * - * @param options {NativeTransitionOptions} Options for the transition - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS', 'Android'] }) - fade(options: NativeTransitionOptions): Promise { - return; - } - - /** - * Perform a slide animation - * - * @param options {NativeTransitionOptions} Options for the transition - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS', 'Android'] }) - drawer(options: NativeTransitionOptions): Promise { - return; - } - - /** - * Perform a slide animation - * - * @param options {NativeTransitionOptions} Options for the transition - * @returns {Promise} - */ - @Cordova({ platforms: ['iOS'] }) - curl(options: NativeTransitionOptions): Promise { - return; - } - - /** - * Execute pending transition - * - * @returns {Promise} - */ - @Cordova() - executePendingTransition(): Promise { - return; - } - - /** - * Cancel pending transition - * - * @returns {Promise} - */ - @Cordova() - cancelPendingTransition(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/native-storage/index.ts b/src/@awesome-cordova-plugins/plugins/native-storage/index.ts deleted file mode 100644 index df1e242a..00000000 --- a/src/@awesome-cordova-plugins/plugins/native-storage/index.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Native Storage - * @premier nativestorage - * @description Native storage of variables in Android and iOS - * @usage - * ```typescript - * import { NativeStorage } from '@awesome-cordova-plugins/native-storage/ngx'; - * - * constructor(private nativeStorage: NativeStorage) { } - * - * ... - * - * this.nativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'}) - * .then( - * () => console.log('Stored item!'), - * error => console.error('Error storing item', error) - * ); - * - * this.nativeStorage.getItem('myitem') - * .then( - * data => console.log(data), - * error => console.error(error) - * ); - * ``` - */ -@Plugin({ - pluginName: 'NativeStorage', - plugin: 'cordova-plugin-nativestorage', - pluginRef: 'NativeStorage', - repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage', - platforms: ['Android', 'Browser', 'iOS', 'macOS', 'Windows'], -}) -@Injectable() -export class NativeStorage extends AwesomeCordovaNativePlugin { - /** - * Initialises shared storage with the suite name when using app groups in iOS - * - * @param reference {string} - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - initWithSuiteName(reference: string): Promise { - return; - } - - /** - * Stores a value - * - * @param reference {string} - * @param value - * @returns {Promise} - */ - @Cordova() - setItem(reference: string, value: any): Promise { - return; - } - - /** - * Gets a stored item - * - * @param reference {string} - * @returns {Promise} - */ - @Cordova() - getItem(reference: string): Promise { - return; - } - - /** - * Retrieving all keys - * - * @returns {Promise} - */ - @Cordova() - keys(): Promise { - return; - } - - /** - * Removes a single stored item - * - * @param reference {string} - * @returns {Promise} - */ - @Cordova() - remove(reference: string): Promise { - return; - } - - /** - * Removes all stored values. - * - * @returns {Promise} - */ - @Cordova() - clear(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/native-view/index.ts b/src/@awesome-cordova-plugins/plugins/native-view/index.ts deleted file mode 100644 index 90953710..00000000 --- a/src/@awesome-cordova-plugins/plugins/native-view/index.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name NativeView - * @description Shows the native view. - * @usage - * ```typescript - * import { NativeView } from '@awesome-cordova-plugins/native-view/ngx'; - * - * - * constructor(private nativeView: NativeView) { } - * - * ... - * - * - * this.nativeView.functionName('Hello', 123) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -export interface ResultView { - success: boolean; - name?: string; - message?: string; - uri?: string; - [key: string]: any; -} - -export interface ResultAppInstalled extends ResultView { - packageName?: string; - applicationInfo?: string; - activityName?: string; -} - -export interface NativeParams { - package?: string; - packageName?: string; - packageApp?: string; - className?: string; - uri?: string; - storyboardName?: string; - viewControllerName?: string; - params?: string; -} - -export interface NativeMarketParams extends NativeParams { - marketId?: string; -} -@Plugin({ - pluginName: 'NativeView', - plugin: 'cordova-plugin-nativeview', - pluginRef: 'cordova.plugins.NativeView', - repo: 'https://github.com/mfdeveloper/cordova-plugin-nativeview', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class NativeView extends AwesomeCordovaNativePlugin { - /** - * Shows the native view. - * - * Define the `packageOrClass` param to a package (Android) or a - * storyboard/classname (IOS) - * - * ```ts - * - * //Android - * cordova.plugins.NativeView.show('com.mycompany', 'MyActivity') - * .then(() => { - * // Do something - * }); - * - * //IOS - * cordova.plugins.NativeView.show('MyStoryboard', 'MyUIViewController') - * .then(() => { - * // Do something - * }); - * - * //OR Back to previous View (IOS only) - * cordova.plugins.NativeView.show().then(() => { - * // Do something - * }); - * - * ``` - * - * @param {NativeParams|string} packageOrClass Package or class name of view to open - * @param {string} className Class name of view to open - * @param {any} [extraParams] [Optional] Params to send to a Native view that will be opened - * @param {Function} [success] [Optional] Callback when success, if you don't want use promise "then()" - * @param {Function} [error] [Optional] Callback when error happens, if you don't want use promise "catch()" - */ - @Cordova() - show( - packageOrClass: NativeParams | string, - className?: string, - extraParams?: any, - success?: Function, - error?: Function - ): Promise { - return; - } - - /** - * Check if a specific app is installed - * - * @param {NativeParams} config - * @param {Function} [success] Callback when success. Use `.then()` Promise method, instead - * @param {Function} [error] Callback callbed when an error happens. Use `.catch()` Promise method, instead - * @returns {Promise} Returns data information about the installed app - */ - @Cordova() - checkIfAppInstalled(config: NativeParams, success?: Function, error?: Function): Promise { - return; - } - - /** - * Shows a store/market fo install a specific app - * - * @param {NativeMarketParams} config Native package and/or marketId to show in Google Play/Apple Store - * @param {Function} [success] Callback when success. Use `.then()` Promise method, instead - * @param {Function} [error] Callback callbed when an error happens. Use `.catch()` Promise method, instead - * @returns {Promise} - */ - @Cordova() - showMarket(config: NativeMarketParams, success?: Function, error?: Function): Promise { - return; - } - - /** - * ### ANDROID ONLY - * - * Get the **Android** current build variant FLAVOR - * This is great if you change the FLAVOR in compile time - * - * @param {boolean} [config.catchError] `config.catchError` True, if you wish catch a JSON with error information - * @param config - * @param {Function} [success] Callback when success. Use `.then()` Promise method, instead - * @param {Function} [error] Callback callbed when an error happens. Use `.catch()` Promise method, instead - * @returns {Promise} Returns a current FLAVOR string - */ - @Cordova({ - platforms: ['android'], - }) - getBuildVariant(config: { catchError?: boolean }, success?: Function, error?: Function): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/network-interface/index.ts b/src/@awesome-cordova-plugins/plugins/network-interface/index.ts deleted file mode 100644 index 14e96e05..00000000 --- a/src/@awesome-cordova-plugins/plugins/network-interface/index.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Network Interface - * @description - * Network interface information plugin for Cordova/PhoneGap that supports Android, Blackberry 10, Browser, iOS, and Windows Phone 8. - * @usage - * ```typescript - * import { NetworkInterface } from '@awesome-cordova-plugins/network-interface/ngx'; - * - * constructor( private networkInterface: NetworkInterface ) { - * - * this.networkInterface.getWiFiIPAddress() - * .then(address => console.info(`IP: ${address.ip}, Subnet: ${address.subnet}`)) - * .catch(error => console.error(`Unable to get IP: ${error}`)); - * - * this.networkInterface.getCarrierIPAddress() - * .then(address => console.info(`IP: ${address.ip}, Subnet: ${address.subnet}`)) - * .catch(error => console.error(`Unable to get IP: ${error}`)); - * - * const url = 'www.github.com'; - * this.networkInterface.getHttpProxyInformation(url) - * .then(proxy => console.info(`Type: ${proxy.type}, Host: ${proxy.host}, Port: ${proxy.port}`)) - * .catch(error => console.error(`Unable to get proxy info: ${error}`)); - * } - * ``` - */ -@Plugin({ - pluginName: 'NetworkInterface', - plugin: 'cordova-plugin-networkinterface', - pluginRef: 'networkinterface', - repo: 'https://github.com/salbahra/cordova-plugin-networkinterface', - platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'Windows', 'Windows Phone'], -}) -@Injectable() -export class NetworkInterface extends AwesomeCordovaNativePlugin { - /** - * Gets the WiFi IP address - * - * @returns {Promise} Returns a Promise that resolves with the IP address information. - */ - @Cordova() - getWiFiIPAddress(): Promise { - return; - } - - /** - * Gets the wireless carrier IP address - * - * @returns {Promise} Returns a Promise that resolves with the IP address information. - */ - @Cordova() - getCarrierIPAddress(): Promise { - return; - } - - /** - * Gets the relevant proxies for the passed URL in order of application - * - * @param {url} message The message to display. - * @param url - * @returns {Promise} Returns a Promise that resolves with the proxy information. - */ - @Cordova() - getHttpProxyInformation(url: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/network/index.ts b/src/@awesome-cordova-plugins/plugins/network/index.ts deleted file mode 100644 index 288421f2..00000000 --- a/src/@awesome-cordova-plugins/plugins/network/index.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Cordova, - CordovaCheck, - CordovaProperty, - AwesomeCordovaNativePlugin, - Plugin, -} from '@awesome-cordova-plugins/core'; -import { Observable, merge } from 'rxjs'; -import { mapTo } from 'rxjs/operators'; - -declare const navigator: any; - -export enum Connection { - UNKNOWN = 'unknown', - ETHERNET = 'ethernet', - WIFI = 'wifi', - CELL_2G = '2g', - CELL_3G = '3g', - CELL_4G = '4g', - CELL = 'cellular', - NONE = 'none', -} - -/** - * @name Network - * @premier network-information - * @description - * Requires Cordova plugin: cordova-plugin-network-information. For more info, please see the [Network plugin docs](https://github.com/apache/cordova-plugin-network-information). - * @usage - * ```typescript - * import { Network } from '@awesome-cordova-plugins/network/ngx'; - * - * constructor(private network: Network) { } - * - * ... - * - * // watch network for a disconnection - * let disconnectSubscription = this.network.onDisconnect().subscribe(() => { - * console.log('network was disconnected :-('); - * }); - * - * // stop disconnect watch - * disconnectSubscription.unsubscribe(); - * - * - * // watch network for a connection - * let connectSubscription = this.network.onConnect().subscribe(() => { - * console.log('network connected!'); - * // We just got a connection but we need to wait briefly - * // before we determine the connection type. Might need to wait. - * // prior to doing any api requests as well. - * setTimeout(() => { - * if (this.network.type === 'wifi') { - * console.log('we got a wifi connection, woohoo!'); - * } - * }, 3000); - * }); - * - * // stop connect watch - * connectSubscription.unsubscribe(); - * - * ``` - * @advanced - * The `type` property will return one of the following connection types: `unknown`, `ethernet`, `wifi`, `2g`, `3g`, `4g`, `cellular`, `none` - */ -@Plugin({ - pluginName: 'Network', - plugin: 'cordova-plugin-network-information', - pluginRef: 'navigator.connection', - repo: 'https://github.com/apache/cordova-plugin-network-information', - platforms: ['Amazon Fire OS', 'Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class Network extends AwesomeCordovaNativePlugin { - /** - * Constants for possible connection types - */ - Connection = { - UNKNOWN: 'unknown', - ETHERNET: 'ethernet', - WIFI: 'wifi', - CELL_2G: '2g', - CELL_3G: '3g', - CELL_4G: '4g', - CELL: 'cellular', - NONE: 'none', - }; - - /** - * Connection type - * - * @returns {string} - */ - @CordovaProperty() type: string; - - /** - * Downlink Max Speed - * - * @returns {string} - */ - @CordovaProperty() downlinkMax: string; - - /** - * Returns an observable to watch connection changes - * - * @returns {Observable<'connected' | 'disconnected'>} - */ - @CordovaCheck() - onChange(): Observable<'connected' | 'disconnected'> { - return merge( - this.onConnect().pipe(mapTo('connected')), - this.onDisconnect().pipe(mapTo('disconnected')) as Observable<'disconnected'> - ); - } - - /** - * Get notified when the device goes offline - * - * @returns {Observable} Returns an observable. - */ - @Cordova({ - eventObservable: true, - event: 'offline', - element: document, - }) - onDisconnect(): Observable { - return; - } - - /** - * Get notified when the device goes online - * - * @returns {Observable} Returns an observable. - */ - @Cordova({ - eventObservable: true, - event: 'online', - element: document, - }) - onConnect(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/newrelic/index.ts b/src/@awesome-cordova-plugins/plugins/newrelic/index.ts deleted file mode 100644 index ce89fbc8..00000000 --- a/src/@awesome-cordova-plugins/plugins/newrelic/index.ts +++ /dev/null @@ -1,319 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name newrelic mobile - * @description - * This NewRelic plugin collect crashes, network traffic, and other information for hybrid apps using native components. - * - * @usage - * ```typescript - * import { NewRelic } from "@awesome-cordova-plugins/newrelic/ngx"; - * - * - * constructor(private newrelic: newrelic) { } - * - * ... - * - * - * NewRelic.startInteraction('Getting Data From Server') - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'NewRelic', - plugin: 'newrelic-cordova-plugin', // npm package name, example: cordova-plugin-camera - pluginRef: 'NewRelic', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/newrelic/newrelic-cordova-plugin', // the github repository URL for the plugin - install: - 'ionic cordova plugin add https://github.com/newrelic/newrelic-cordova-plugin.git --variable IOS_APP_TOKEN="{ios-app-token}" --variable ANDROID_APP_TOKEN="{android-app-token}"', // OPTIONAL install command, in case the plugin requires variables - installVariables: ['IOS_APP_TOKEN', 'ANDROID_APP_TOKEN'], // OPTIONAL the plugin requires variables - platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] -}) -@Injectable() -export class NewRelic extends AwesomeCordovaNativePlugin { - /** - * Sets a custom user identifier value to associate mobile user - * @param {string} userId The user identifier string. - */ - @Cordova({ - sync: true, - }) - setUserId(userId: string): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Creates a custom attribute with a specified name and value. - * When called, it overwrites its previous value and type. - * The created attribute is shared by multiple Mobile event types. - * @param {string} attributeName Name of the attribute. - * @param {number} value Value of the attribute. - */ - @Cordova({ - sync: true, - }) - setAttribute(name: string, value: any): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Remove a custom attribute with a specified name and value. - * When called, it removes the attribute specified by the name string. - * The removed attribute is shared by multiple Mobile event types. - * @param {string} name Name of the attribute. - */ - @Cordova({ - sync: true, - }) - removeAttribute(name: string): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Creates and records a MobileBreadcrumb event. - * @param {string} eventName The name you want to give to a breadcrumb event. - * @param {Map} attributes A map that includes a list of attributes. - */ - @Cordova({ - sync: true, - }) - recordBreadcrumb(name: string, eventAttributes: Map): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Creates and records a custom event, for use in New Relic Insights. - * The event includes a list of attributes, specified as a map. - * @param {string} eventType The type of event. - * @param {string} eventName The name of the event. - * @param {Map} attributes A map that includes a list of attributes. - */ - @Cordova({ - sync: true, - }) - recordCustomEvent(eventType: string, eventName: string, eventAttributes: Map): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Track a method as an interaction. - * @param {string} actionName The name of the action. - * @param {function} cb A success callback function. - * @returns {Promise} A promise containing the interactionId. - */ - @Cordova({ - sync: true, - }) - startInteraction(name: string): Promise { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * End an interaction - * @param {string} interactionId The string ID for the interaction you want to end. This string is returned when you use startInteraction(). - */ - - @Cordova({ - sync: true, - }) - endInteraction(name: string): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - - /** - * Throws a demo run-time exception to test New Relic crash reporting. - * @param {string} message An optional argument attached to the exception. - */ - @Cordova({ - sync: true, - }) - crashNow(message: string): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Returns the current session ID as a parameter to the successful callback function. - * This method is useful for consolidating monitoring of app data (not just New Relic data) based on a single session definition and identifier. - * @param {function} cb A success callback function. - * @returns {Promise} A promise containing the current session ID. - */ - @Cordova({ - sync: true, - }) - currentSessionId(name: string): Promise { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Increments the count of an attribute with a specified name. - * When called, it overwrites its previous value and type each time. - * If attribute does not exist, it creates an attribute with a value of 1. - * The incremented attribute is shared by multiple Mobile event types. - * @param {string} name The name of the attribute. - * @param {number} value Optional argument that increments the attribute by this value. - */ - @Cordova({ - sync: true, - }) - incrementAttribute(name: string, value: any): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * - * @param {string} name The name for the custom metric. - * @param {string} category The metric category name. - * @param {number} value Optional. The value of the metric. Value should be a non-zero positive number. - * @param {string} countUnit Optional (but requires value and valueUnit to be set). Unit of measurement for the metric count. Supported values are 'PERCENT', 'BYTES', 'SECONDS', 'BYTES_PER_SECOND', or 'OPERATIONS'. - * @param {string} valueUnit Optional (but requires value and countUnit to be set). Unit of measurement for the metric value. Supported values are 'PERCENT', 'BYTES', 'SECONDS', 'BYTES_PER_SECOND', or 'OPERATIONS'. - */ - @Cordova({ - sync: true, - }) - recordMetric(name: string, category: any, value: Number, countUnit: string, valueUnit: string): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Removes all attributes from the session.. - */ - @Cordova({ - sync: true, - }) - removeAllAttributes(): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Sets the maximum size of the event pool stored in memory until the next harvest cycle. - * When the pool size limit is reached, the agent will start sampling events, discarding some new and old, until the pool of events is sent in the next harvest cycle. - * Default is a maximum of 1000 events per event harvest cycle. - * @param {number} maxPoolSize The maximum number of events per harvest cycle. - */ - @Cordova({ - sync: true, - }) - setMaxEventPoolSize(maxPoolSize: Number): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Sets the event harvest cycle length. - * Default is 600 seconds (10 minutes). - * Minimum value cannot be less than 60 seconds. - * Maximum value should not be greater than 600 seconds. - * @param {number} maxBufferTimeInSeconds The maximum time (in seconds) that the agent should store events in memory. - */ - @Cordova({ - sync: true, - }) - setMaxEventBufferTime(maxBufferTimeInSeconds: Number): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * FOR ANDROID ONLY. - * Enable or disable collection of event data. - * @param {boolean} enabled Boolean value for enabling analytics events. - */ - @Cordova({ - sync: true, - }) - analyticsEventEnabled(enabled: Boolean): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Enable or disable reporting sucessful HTTP request to the MobileRequest event type. - * @param {boolean} enabled Boolean value for enable successful HTTP requests. - */ - @Cordova({ - sync: true, - }) - networkRequestEnabled(enabled: Boolean): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Enable or disable reporting network and HTTP request errors to the MobileRequestError event type. - * @param {boolean} enabled Boolean value for enabling network request errors. - */ - @Cordova({ - sync: true, - }) - networkErrorRequestEnabled(enabled: Boolean): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Enable or disable capture of HTTP response bodies for HTTP error traces, and MobileRequestError events. - * @param {boolean} enabled Boolean value for enabling HTTP response bodies. - */ - @Cordova({ - sync: true, - }) - httpRequestBodyCaptureEnabled(enabled: Boolean): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * - * @param {string} url The URL of the request. - * @param {string} method The HTTP method used, such as GET or POST. - * @param {number} status The statusCode of the HTTP response, such as 200 for OK. - * @param {number} startTime The start time of the request in milliseconds since the epoch. - * @param {number} endTime The end time of the request in milliseconds since the epoch. - * @param {number} bytesSent The number of bytes sent in the request. - * @param {number} bytesReceived The number of bytes received in the response. - * @param {string} body Optional. The response body of the HTTP response. The response body will be truncated and included in an HTTP Error metric if the HTTP transaction is an error. - */ - @Cordova({ - sync: true, - }) - noticeHttpTransaction( - url: string, - method: string, - status: Number, - startTime: Number, - endTime: Number, - bytesSent: Number, - bytesReceived: Number, - body: string - ): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Records network failures. - * If a network request fails, use this method to record details about the failure. - * In most cases, place this call inside exception handlers. - * @param {string} url The URL of the request. - * @param {string} httpMethod The HTTP method used, such as GET or POST. - * @param {number} startTime The start time of the request in milliseconds since the epoch. - * @param {number} endTime The end time of the request in milliseconds since the epoch. - * @param {string} failure The name of the network failure. Possible values are 'Unknown', 'BadURL', 'TimedOut', 'CannotConnectToHost', 'DNSLookupFailed', 'BadServerResponse', 'SecureConnectionFailed'. - */ - @Cordova({ - sync: true, - }) - noticeNetworkFailure(url: string, method: string, startTime: Number, endTime: Number, failure: string): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Records JavaScript errors for ionic. - * @param {Error} err The error to report. - */ - @Cordova({ - sync: true, - }) - recordError(err: Error): void { - return; // We add return; here to avoid any IDE / Compiler errors - } - -} diff --git a/src/@awesome-cordova-plugins/plugins/nfc/index.ts b/src/@awesome-cordova-plugins/plugins/nfc/index.ts deleted file mode 100644 index 96e7b0f1..00000000 --- a/src/@awesome-cordova-plugins/plugins/nfc/index.ts +++ /dev/null @@ -1,589 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; -declare let window: any; - -// tag should be NfcTag, but keeping as NdefTag to avoid breaking existing code -export interface NdefEvent { - tag: NdefTag; -} - -export interface NdefRecord { - id: any[]; - payload: number[]; - tnf: number; - type: number[]; -} - -/** - * @deprecated use NfcTag - */ -export interface NdefTag { - canMakeReadOnly: boolean; - id: number[]; - isWritable: boolean; - maxSize: number; - ndefMessage: NdefRecord[]; - techTypes: string[]; - type: string; -} - -export interface NfcTag { - id?: number[]; - canMakeReadOnly?: boolean; - isWritable?: boolean; - maxSize?: number; - ndefMessage?: NdefRecord[]; - techTypes?: string[]; - type?: string; -} - -export interface ScanOptions { - /** - * If true, keep the scan session open so write can be called - * after reading. The default value is false. - */ - keepSessionOpen?: boolean; -} - -/** - * @name NFC - * @description - * The NFC plugin allows you to read and write NFC tags. You can also beam to, and receive from, other NFC enabled devices. - * - * Use to - * - read data from NFC tags - * - write data to NFC tags - * - send data to other NFC enabled devices - * - receive data from NFC devices - * - * This plugin uses NDEF (NFC Data Exchange Format) for maximum compatibilty between NFC devices, tag types, and operating systems. - * @usage - * ```typescript - * import { NFC, Ndef } from '@awesome-cordova-plugins/nfc/ngx'; - * - * constructor(private nfc: NFC, private ndef: Ndef) { } - * - * ... - * - * // Read NFC Tag - Android - * // Once the reader mode is enabled, any tags that are scanned are sent to the subscriber - * let flags = this.nfc.FLAG_READER_NFC_A | this.nfc.FLAG_READER_NFC_V; - * this.readerMode$ = this.nfc.readerMode(flags).subscribe( - * tag => console.log(JSON.stringify(tag)), - * err => console.log('Error reading tag', err) - * ); - * - * // Read NFC Tag - iOS - * // On iOS, a NFC reader session takes control from your app while scanning tags then returns a tag - * try { - * let tag = await this.nfc.scanNdef(); - * console.log(JSON.stringify(tag)); - * } catch (err) { - * console.log('Error reading tag', err); - * } - * - * ``` - * - * For more details on NFC tag operations see https://github.com/chariotsolutions/phonegap-nfc - */ -@Plugin({ - pluginName: 'NFC', - plugin: 'phonegap-nfc', - pluginRef: 'nfc', - repo: 'https://github.com/chariotsolutions/phonegap-nfc', - platforms: ['Android', 'iOS', 'Windows'], -}) -/** - * @{ NFC } class methods - */ -@Injectable() -export class NFC extends AwesomeCordovaNativePlugin { - // Flags for readerMode - // https://developer.android.com/reference/android/nfc/NfcAdapter#FLAG_READER_NFC_A - @CordovaProperty() - FLAG_READER_NFC_A: number; - @CordovaProperty() - FLAG_READER_NFC_B: number; - @CordovaProperty() - FLAG_READER_NFC_F: number; - @CordovaProperty() - FLAG_READER_NFC_V: number; - @CordovaProperty() - FLAG_READER_NFC_BARCODE: number; - @CordovaProperty() - FLAG_READER_SKIP_NDEF_CHECK: number; - @CordovaProperty() - FLAG_READER_NO_PLATFORM_SOUNDS: number; - - /** - * Read NFC tags sending the tag data to the success callback. - * See https://github.com/chariotsolutions/phonegap-nfc#nfcreadermode - * - * @param flags - * @returns {Observable} - */ - @Cordova({ - observable: true, - clearFunction: 'disableReaderMode', - clearWithArgs: false, - }) - readerMode(flags: number): Observable { - return; - } - - /** - * Function scanNdef starts the NFCNDEFReaderSession allowing iOS to scan NFC tags. - * https://github.com/chariotsolutions/phonegap-nfc#nfcscanndef - * - * @param options - */ - @Cordova({ sync: true }) - scanNdef(options?: ScanOptions): Promise { - return; - } - - /** - * Function scanTag starts the NFCTagReaderSession allowing iOS to scan NFC tags. - * - * You probably want *scanNdef* for reading NFC tags on iOS. Only use scanTag if you need the tag UID. - * https://github.com/chariotsolutions/phonegap-nfc#nfcscantag - * - * @param options - */ - @Cordova({ sync: true }) - scanTag(options?: ScanOptions): Promise { - return; - } - - /** - * Function cancelScan stops the NFCReaderSession returning control to your app. - * https://github.com/chariotsolutions/phonegap-nfc#nfccancelscan - */ - @Cordova({ sync: true }) - cancelScan(): Promise { - return; - } - - /** - * Connect to the tag and enable I/O operations to the tag from this TagTechnology object. - * https://github.com/chariotsolutions/phonegap-nfc#nfcconnect - * - * @param tech The tag technology class name e.g. android.nfc.tech.IsoDep - * @param timeout The transceive(byte[]) timeout in milliseconds [optional] - */ - @Cordova({ sync: true }) - connect(tech: string, timeout?: number): Promise { - return; - } - - /** - * Close TagTechnology connection. - * https://github.com/chariotsolutions/phonegap-nfc#nfcclose - */ - @Cordova({ sync: true }) - close(): Promise { - return; - } - - /** - * Send raw command to the tag and receive the response. - * https://github.com/chariotsolutions/phonegap-nfc#nfctransceive - * - * Example code https://github.com/chariotsolutions/phonegap-nfc#tag-technology-functions-1 - * - * @param data an ArrayBuffer or string of hex data e.g. '00 A4 04 00 07 D2 76 00 00 85 01 00' - */ - @Cordova({ sync: true }) - transceive(data: string | ArrayBuffer): Promise { - return; - } - - /** - * Starts the NFCNDEFReaderSession allowing iOS to scan NFC tags. - * - * @deprecated use scanNdef or scanTag - * @param onSuccess - * @param onFailure - * @returns {Observable} - */ - @Cordova({ - observable: true, - successIndex: 0, - errorIndex: 3, - clearFunction: 'invalidateSession', - clearWithArgs: true, - }) - beginSession(onSuccess?: Function, onFailure?: Function): Observable { - return; - } - - /** - * Registers an event listener for any NDEF tag. - * - * @param onSuccess - * @param onFailure - * @returns {Observable} - */ - @Cordova({ - observable: true, - successIndex: 0, - errorIndex: 3, - clearFunction: 'removeNdefListener', - clearWithArgs: true, - }) - addNdefListener(onSuccess?: Function, onFailure?: Function): Observable { - return; - } - - /** - * Registers an event listener for tags matching any tag type. - * - * @param onSuccess - * @param onFailure - * @returns {Observable} - */ - @Cordova({ - observable: true, - successIndex: 0, - errorIndex: 3, - clearFunction: 'removeTagDiscoveredListener', - clearWithArgs: true, - }) - addTagDiscoveredListener(onSuccess?: Function, onFailure?: Function): Observable { - return; - } - - /** - * Registers an event listener for NDEF tags matching a specified MIME type. - * - * @param mimeType - * @param onSuccess - * @param onFailure - * @returns {Observable} - */ - @Cordova({ - observable: true, - successIndex: 1, - errorIndex: 4, - clearFunction: 'removeMimeTypeListener', - clearWithArgs: true, - }) - addMimeTypeListener(mimeType: string, onSuccess?: Function, onFailure?: Function): Observable { - return; - } - - /** - * Registers an event listener for formatable NDEF tags. - * - * @param onSuccess - * @param onFailure - * @returns {Observable} - */ - @Cordova({ - observable: true, - successIndex: 0, - errorIndex: 3, - }) - addNdefFormatableListener(onSuccess?: Function, onFailure?: Function): Observable { - return; - } - - /** - * Writes an NdefMessage(array of ndef records) to a NFC tag. - * - * @param message {any[]} - * @returns {Promise} - */ - @Cordova() - write(message: any[]): Promise { - return; - } - /** - * Makes a NFC tag read only. **Warning** this is permanent. - * - * @returns {Promise} - */ - @Cordova() - makeReadOnly(): Promise { - return; - } - - /** - * Shares an NDEF Message(array of ndef records) via peer-to-peer. - * - * @param message An array of NDEF Records. - * @returns {Promise} - */ - @Cordova() - share(message: any[]): Promise { - return; - } - - /** - * Stop sharing NDEF data via peer-to-peer. - * - * @returns {Promise} - */ - @Cordova() - unshare(): Promise { - return; - } - - /** - * Erase a NDEF tag - */ - @Cordova() - erase(): Promise { - return; - } - - /** - * Send a file to another device via NFC handover. - * - * @param uris A URI as a String, or an array of URIs. - * @returns {Promise} - */ - @Cordova() - handover(uris: string[]): Promise { - return; - } - - /** - * Stop sharing NDEF data via NFC handover. - * - * @returns {Promise} - */ - @Cordova() - stopHandover(): Promise { - return; - } - - /** - * Opens the device's NFC settings. - * - * @returns {Promise} - */ - @Cordova() - showSettings(): Promise { - return; - } - - /** - * Check if NFC is available and enabled on this device. - * - * @returns {Promise} - */ - @Cordova() - enabled(): Promise { - return; - } - /** - * @{ NFC } class utility methods - * for use with - */ - /** - * Convert byte array to string - * - * @param bytes {number[]} - * @returns {string} - */ - @Cordova({ sync: true }) - bytesToString(bytes: number[]): string { - return; - } - /** - * Convert string to byte array. - * - * @param str {string} - * @returns {number[]} - */ - @Cordova({ sync: true }) - stringToBytes(str: string): number[] { - return; - } - /** - * Convert byte array to hex string - * - * @param bytes {number[]} - * @returns {string} - */ - @Cordova({ sync: true }) - bytesToHexString(bytes: number[]): string { - return; - } -} -/** - * @hidden - */ -@Plugin({ - pluginName: 'NFC', - plugin: 'phonegap-nfc', - pluginRef: 'ndef', -}) -/** - * @description - * Utility methods for creating ndef records for the ndef tag format. - * Move records into array before usage. Then pass an array to methods as parameters. - * Do not pass bytes as parameters for these methods, conversion is built in. - * For usage with nfc.write() and nfc.share() - */ -@Injectable() -export class Ndef extends AwesomeCordovaNativePlugin { - @CordovaProperty() - TNF_EMPTY: number; - @CordovaProperty() - TNF_WELL_KNOWN: number; - @CordovaProperty() - TNF_MIME_MEDIA: number; - @CordovaProperty() - TNF_ABSOLUTE_URI: number; - @CordovaProperty() - TNF_EXTERNAL_TYPE: number; - @CordovaProperty() - TNF_UNKNOWN: number; - @CordovaProperty() - TNF_UNCHANGED: number; - @CordovaProperty() - TNF_RESERVED: number; - - @Cordova({ sync: true }) - record(tnf: number, type: number[] | string, id: number[] | string, payload: number[] | string): NdefRecord { - return; - } - - @Cordova({ sync: true }) - textRecord(text: string, languageCode?: string, id?: number[] | string): NdefRecord { - return; - } - - @Cordova({ sync: true }) - uriRecord(uri: string, id?: number[] | string): NdefRecord { - return; - } - - @Cordova({ sync: true }) - absoluteUriRecord(uri: string, payload: number[] | string, id?: number[] | string): NdefRecord { - return; - } - - @Cordova({ sync: true }) - mimeMediaRecord(mimeType: string, payload: string): NdefRecord { - return; - } - - @Cordova({ sync: true }) - smartPoster(ndefRecords: any[], id?: number[] | string): NdefRecord { - return; - } - - @Cordova({ sync: true }) - emptyRecord(): NdefRecord { - return; - } - - @Cordova({ sync: true }) - androidApplicationRecord(packageName: string): NdefRecord { - return; - } - - @Cordova({ sync: true }) - encodeMessage(ndefRecords: any): any { - return; - } - - @Cordova({ sync: true }) - decodeMessage(bytes: any): any { - return; - } - - @Cordova({ sync: true }) - decodeTnf(tnf_byte: any): any { - return; - } - - @Cordova({ sync: true }) - encodeTnf(mb: any, me: any, cf: any, sr: any, il: any, tnf: any): any { - return; - } - - @Cordova({ sync: true }) - tnfToString(tnf: any): string { - return; - } - - @CordovaProperty() - textHelper: TextHelper; - - @CordovaProperty() - uriHelper: UriHelper; -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'NFC', - plugin: 'phonegap-nfc', - pluginRef: 'util', -}) -@Injectable() -export class NfcUtil extends AwesomeCordovaNativePlugin { - @Cordova({ sync: true }) - toHex(i: number): string { - return; - } - - @Cordova({ sync: true }) - toPrintable(i: number): string { - return; - } - - @Cordova({ sync: true }) - bytesToString(i: number[]): string { - return; - } - - @Cordova({ sync: true }) - stringToBytes(s: string): number[] { - return; - } - - @Cordova({ sync: true }) - bytesToHexString(bytes: number[]): string { - return; - } - - @Cordova({ sync: true }) - isType(record: NdefRecord, tnf: number, type: number[] | string): boolean { - return; - } - - @Cordova({ sync: true }) - arrayBufferToHexString(buffer: ArrayBuffer): string { - return; - } - - @Cordova({ sync: true }) - hexStringToArrayBuffer(hexString: string): ArrayBuffer { - return; - } -} - -export class TextHelper extends AwesomeCordovaNativePlugin { - decodePayload(data: number[]): string { - return; - } - encodePayload(text: string, lang: string): number[] { - return; - } -} - -export class UriHelper extends AwesomeCordovaNativePlugin { - decodePayload(data: number[]): string { - return; - } - encodePayload(uri: string): number[] { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/ocr/index.ts b/src/@awesome-cordova-plugins/plugins/ocr/index.ts deleted file mode 100644 index 74f98019..00000000 --- a/src/@awesome-cordova-plugins/plugins/ocr/index.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export enum OCRSourceType { - /** - * Normal processing from a file URL. This is the overall recommended choice - * for most applications. The distinction between file and native URLs is - * only relevant on iOS; under Android `NORMFILEURL` and `NORMNATIVEURL` - * are interchangeable. - */ - NORMFILEURL = 0, - - /** - * Normal processing from a native URL. Since this source type uses deprecated - * OS APIs to interact with the camera plugin, it is best avoided, especially - * if ongoing forward compatibility is a concern. For further information, see - * https://github.com/NeutrinosPlatform/cordova-plugin-mobile-ocr#plugin-usage - * Under Android, this is equivalent to `NORMFILEURL`. - */ - NORMNATIVEURL = 1, - - /** - * Fast processing from a file URL. As the compression done internally causes - * a significant loss in extraction quality, it should only be preferred when - * dealing with large images containing significant amounts of text, where - * the execution time required to perform normal processing is prohibitive. - * The distinction between file and native URLs is only relevant on iOS; - * under Android `FASTFILEURL` and `FASTNATIVEURL` are interchangeable. - */ - FASTFILEURL = 2, - - /** - * Fast processing from a native URL. See comments above for `FASTFILEURL` - * concerning quality loss. - * - * The distinction between file and native URLs is only relevant on iOS; - * under Android `FASTFILEURL` and `FASTNATIVEURL` are interchangeable. - */ - FASTNATIVEURL = 3, - - /** - * Normal processing from a base64-encoded string. Quality is equivalent - * to `NORMFILEURL`, but due to significantly higher memory requirements, - * is only appropriate for use with very small images. - */ - BASE64 = 4, -} - -/** - * Four points (ordered in clockwise direction) that enclose a text - * component. May not be axis-aligned due to perspective skew. - */ -export interface OCRCorners { - x1: number; - y1: number; - x2: number; - y2: number; - x3: number; - y3: number; - x4: number; - y4: number; -} - -/** - * An axis-aligned bounding rectangle. `x` and `y` represent the top left. - */ -export interface OCRRect { - x: number; - y: number; - height: number; - width: number; -} - -/** - * This is the return value from the `recText` method. - */ -export interface OCRResult { - /** - * Was any text extracted? If `foundText` is false, no other fields are - * returned. If foundText is true, all other fields are reliable. - */ - foundText: boolean; - - /** - * A block is the largest unit of text, which can be thought of as a paragraph. - * This field consists of several parallel arrays, so the text in `blocktext[0]` - * is bounded by `blockpoints[0]` and `blockframe[0]`. - */ - blocks: { - blocktext: string[]; - blockpoints: OCRCorners[]; - blockframe: OCRRect[]; - }; - - /** - * A line is the central unit of text, containing several elements. A block - * can contain N lines. This field consists of several parallel arrays, so the - * text in `linetext[0]` is bounded by `linepoints[0]` and `lineframe[0]`. - */ - lines: { - linetext: string[]; - linepoints: OCRCorners[]; - lineframe: OCRRect[]; - }; - - /** - * A word (or element) is the smallest unit of text. This field consists of - * several parallel arrays, so the text in `wordtext[0]` is bounded by - * `wordpoints[0]` and `wordframe[0]`. - */ - words: { - wordtext: string[]; - wordpoints: OCRCorners[]; - wordframe: OCRRect[]; - }; -} - -/** - * @name OCR - * @description - * This plugin attempts to identify and extract text from an image. - * Please note: This plugin depends on the GoogleMobileVision pod which is referencing UIWebview, that has been deprecated by Apple. - * Don't use this plugin in an app intended for App Store as you will get a review rejection from Apple: `Deprecated API Usage — Apple will stop accepting submissions of apps that use UIWebView APIs` - * For more info, please see the following Github issue [Google Mobile Vision relying on deprecated UIWebview](https://github.com/NeutrinosPlatform/cordova-plugin-mobile-ocr/issues/27). - * @usage - * ```typescript - * import { OCR, OCRSourceType } from '@awesome-cordova-plugins/ocr/ngx'; - * - * - * constructor(private ocr: OCR) { } - * - * ... - * - * this.ocr.recText(OCRSourceType.NORMFILEURL, "file://path/to/image.png") - * .then((res: OCRResult) => console.log(JSON.stringify(res))) - * .catch((error: any) => console.error(error)); - * - * ``` - * @interfaces - * OCRCorners - * OCRRect - * OCRResult - * @enums - * OCRSourceType - */ -@Plugin({ - pluginName: 'OCR', - plugin: 'cordova-plugin-mobile-ocr', - pluginRef: 'textocr', - repo: 'https://github.com/NeutrinosPlatform/cordova-plugin-mobile-ocr', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class OCR extends AwesomeCordovaNativePlugin { - /** - * Extract text from image - * - * @param sourceType {OCRSourceType} type of image source - * @param source {string} image source (either file URL or base64 string) - * @returns {Promise} extracted text and geometry - */ - @Cordova() - recText(sourceType: OCRSourceType, source: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/onesignal/index.ts b/src/@awesome-cordova-plugins/plugins/onesignal/index.ts deleted file mode 100644 index 51ab3eee..00000000 --- a/src/@awesome-cordova-plugins/plugins/onesignal/index.ts +++ /dev/null @@ -1,907 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface OSNotification { - /** - * Was app in focus. - */ - isAppInFocus?: boolean; - /** - * Was notification shown to the user. Will be false for silent notifications. - */ - shown?: boolean; - /** - * ANDROID** - Android Notification assigned to the notification. Can be used to cancel or replace the notification. - */ - androidNotificationId?: number; - /** - * Payload received from OneSignal. - */ - payload?: OSNotificationPayload; - /** - * How the notification was displayed to the user. Can be set to `Notification`, `InAppAlert`, or `None` if it was not displayed. - */ - displayType?: OSDisplayType; - /** - * ANDROID** - Notification is a summary notification for a group this will contain all notification payloads it was created from. - */ - groupedNotifications?: OSNotificationPayload[]; - app_id?: string; - contents?: any; - headings?: any; - isIos?: boolean; - isAndroid?: boolean; - isWP?: boolean; - isWP_WNS?: boolean; - isAdm?: boolean; - isChrome?: boolean; - isChromeWeb?: boolean; - isSafari?: boolean; - isAnyWeb?: boolean; - included_segments?: string[]; - excluded_segments?: string[]; - include_player_ids?: string[]; - include_ios_tokens?: string[]; - include_android_reg_ids?: string[]; - include_wp_uris?: string[]; - include_wp_wns_uris?: string[]; - include_amazon_reg_ids?: string[]; - include_chrome_reg_ids?: string[]; - include_chrome_web_reg_ids?: string[]; - app_ids?: string[]; - tags?: any[]; - ios_badgeType?: string; - ios_badgeCount?: number; - ios_sound?: string; - android_sound?: string; - adm_sound?: string; - wp_sound?: string; - wp_wns_sound?: string; - data?: any; - buttons?: any; - collapse_id?: string; - small_icon?: string; - large_icon?: string; - big_picture?: string; - adm_small_icon?: string; - adm_large_icon?: string; - adm_big_picture?: string; - chrome_icon?: string; - chrome_big_picture?: string; - chrome_web_icon?: string; - firefox_icon?: string; - url?: string; - send_after?: string; - delayed_option?: string; - delivery_time_of_day?: string; - android_led_color?: string; - android_accent_color?: string; - android_visibility?: number; - content_available?: boolean; - amazon_background_data?: boolean; - template_id?: string; - android_group?: string; - android_group_message?: any; - adm_group?: string; - adm_group_message?: any; - ttl?: number; - priority?: number; - ios_category?: string; -} - -/** - * ANDROID** - Privacy setting for how the notification should be shown on the lockscreen of Android 5+ devices. - */ -export enum OSLockScreenVisibility { - /** - * Fully visible (default) - */ - Public = 1, - /** - * Contents are hidden - */ - Private = 0, - /** - * Not shown - */ - Secret = -1, -} - -/** - * How the notification was displayed to the user. Part of OSNotification. See inFocusDisplaying for more information on how this is used. - */ -export enum OSDisplayType { - /** - * notification is silent, or inFocusDisplaying is disabled. - */ - None = 0, - /** - * (**DEFAULT**) - native alert dialog display. - */ - InAppAlert = 1, - /** - * native notification display. - */ - Notification = 2, -} - -/** - * Contents and settings of the notification the user received. - */ -export interface OSNotificationPayload { - /** - * OneSignal notification UUID. - */ - notificationID: string; - /** - * Title of the notification. - */ - title: string; - /** - * Body of the notification. - */ - body: string; - /** - * Custom additional data that was sent with the notification. Set on the dashboard under Options > Additional Data - * or with the 'data' field on the REST API. - */ - additionalData?: any; - /** - * ANDROID** - Small icon resource name set on the notification. - */ - smallIcon?: string; - /** - * ANDROID** - Large icon set on the notification. - */ - largeIcon?: string; - /** - * ANDROID** - Big picture image set on the notification. - */ - bigPicture?: string; - /** - * ANDROID** - Accent color shown around small notification icon on Android 5+ devices. ARGB format. - */ - smallIconAccentColor?: string; - /** - * URL to open when opening the notification. - */ - launchURL?: string; - /** - * Sound resource to play when the notification is shown. - */ - sound: string; - /** - * ANDROID** - Devices that have a notification LED will blink in this color. ARGB format. - */ - ledColor?: string; - lockScreenVisibility?: OSLockScreenVisibility; - /** - * ANDROID** - Notifications with this same key will be grouped together as a single summary notification. - */ - groupKey?: string; - /** - * ANDROID** - Summary text displayed in the summary notification. - */ - groupMessage?: string; - /** - * List of action buttons on the notification. - */ - actionButtons: OSActionButton[]; - /** - * ANDROID** - The Google project number the notification was sent under. - */ - fromProjectNumber?: string; - /** - * ANDROID** - If a background image was set this object will be available. - */ - backgroundImageLayout?: OSBackgroundImageLayout; - priority?: number; - /** - * List of action buttons on the notification. - */ - rawPayload: string; -} - -/** - * List of action buttons on the notification. - */ -export interface OSActionButton { - /** - * Id assigned to the button. - */ - id: string; - /** - * Text show on the button to the user. - */ - text: string; - /** - * ANDROID** - Icon shown on the button. - */ - icon: string; -} - -/** - * OSPermissionState - */ -export interface OSPermissionState { - /** - * User was prompted. - */ - hasPrompted: boolean; - /** - * Permissions Status (iOS Only) - */ - status: any; - /** - * Permissions State (Android Only) - */ - state: any; -} - -/** - * OSSubscriptionState - */ -export interface OSSubscriptionState { - subscribed: boolean; - userSubscriptionSetting: any; - userId: any; - pushToken: any; -} - -/** - * Subscription and permissions status - */ -export interface OSPermissionSubscriptionState { - /** - * Id assigned to the button. - */ - permissionStatus: OSPermissionState; - /** - * Text show on the button to the user. - */ - subscriptionStatus: OSSubscriptionState; -} - -/** - * ANDROID** - If a background image was set, this object will be available. - */ -export interface OSBackgroundImageLayout { - /** - * Image URL or name used as the background image. - */ - image: string; - /** - * Text color of the title on the notification. ARGB Format. - */ - titleTextColor: string; - /** - * Text color of the body on the notification. ARGB Format. - */ - bodyTextColor: string; -} - -/** - * The information returned from a notification the user received. - */ -export interface OSNotificationOpenedResult { - action: { - /** - * Was the notification opened normally (`Opened`) or was a button pressed on the notification (`ActionTaken`). - */ - type: OSActionType; - /** - * If `type` == `ActionTaken` then this will contain the id of the button pressed. - */ - actionID?: string; - }; - notification: OSNotification; -} - -export enum OSActionType { - Opened = 0, - ActionTake = 1, -} - -/** - * Details about the In-App Message action element (button or image) that was tapped on. - */ -export interface OSInAppMessageAction { - /** - * An optional click name defined for the action element. null or nil (iOS) if not set. - */ - click_name: string; - /** - * An optional URL that opens when the action takes place. null or nil (iOS) if not set. - */ - click_url: string; - /** - * `true` if this is the first time the user has pressed any action on the In-App Message. - */ - first_click: boolean; - /** - * If `true`, the In-App Message will animate off the screen. If `false`, the In-App Message will stay on screen until the user dismisses it. - */ - closes_message: boolean; -} - -/** - * @name OneSignal - * @description - * The OneSignal plugin is an client implementation for using the [OneSignal](https://onesignal.com/) Service. - * OneSignal is a simple implementation for delivering push notifications. - * - * Please view the official [OneSignal Ionic SDK Installation](https://documentation.onesignal.com/docs/ionic-sdk-setup) guide - * for more information. - * - * #### Icons - * If you want to use generated icons with command `ionic cordova resources`: - * - * 1. Add a file to your `hooks` directory called `copy_android_notification_icons.js` - * - * 2. Configure the hook in your config.xml - * ``` - * - * - * - * ``` - * - * 3. Put the following code in it: - * - * ``` - * #!/usr/bin/env node - * - * var fs = require('fs'); - * var path = require('path'); - * - * var filestocopy = [{ - * "resources/android/icon/drawable-hdpi-icon.png": - * "platforms/android/app/src/main/res/drawable-hdpi/ic_stat_onesignal_default.png" - * }, { - * "resources/android/icon/drawable-mdpi-icon.png": - * "platforms/android/app/src/main/res/drawable-mdpi/ic_stat_onesignal_default.png" - * }, { - * "resources/android/icon/drawable-xhdpi-icon.png": - * "platforms/android/app/src/main/res/drawable-xhdpi/ic_stat_onesignal_default.png" - * }, { - * "resources/android/icon/drawable-xxhdpi-icon.png": - * "platforms/android/app/src/main/res/drawable-xxhdpi/ic_stat_onesignal_default.png" - * }, { - * "resources/android/icon/drawable-xxxhdpi-icon.png": - * "platforms/android/app/src/main/res/drawable-xxxhdpi/ic_stat_onesignal_default.png" - * } ]; - * - * module.exports = function(context) { - * - * // no need to configure below - * var rootdir = context.opts.projectRoot; - * - * filestocopy.forEach(function(obj) { - * Object.keys(obj).forEach(function(key) { - * var val = obj[key]; - * var srcfile = path.join(rootdir, key); - * var destfile = path.join(rootdir, val); - * console.log("copying "+srcfile+" to "+destfile); - * var destdir = path.dirname(destfile); - * if (fs.existsSync(srcfile) && fs.existsSync(destdir)) { - * fs.createReadStream(srcfile).pipe( - * fs.createWriteStream(destfile)); - * } - * }); - * }); - * - * }; - * ``` - * - * 3. From the root of your project make the file executable: - * `$ chmod +x hooks/copy_android_notification_icons.js` - * @usage - * ```typescript - * import { OneSignal } from '@awesome-cordova-plugins/onesignal/ngx'; - * - * constructor(private oneSignal: OneSignal) { } - * - * ... - * - * this.oneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261'); - * - * this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert); - * - * this.oneSignal.handleNotificationReceived().subscribe(() => { - * // do something when notification is received - * }); - * - * this.oneSignal.handleNotificationOpened().subscribe(() => { - * // do something when a notification is opened - * }); - * - * this.oneSignal.endInit(); - * ``` - * @interfaces - * OSNotification - * OSLockScreenVisibility - * OSDisplayType - * OSNotificationPayload - * OSActionButton - * OSBackgroundImageLayout - * OSNotificationOpenedResult - * OSActionType - * OSInAppMessageAction - */ -@Plugin({ - pluginName: 'OneSignal', - plugin: 'onesignal-cordova-plugin', - pluginRef: 'plugins.OneSignal', - repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK', - platforms: ['Amazon Fire OS', 'Android', 'iOS', 'Windows'], -}) -@Injectable() -export class OneSignal extends AwesomeCordovaNativePlugin { - /** - * constants to use in inFocusDisplaying() - * - * @hidden - */ - OSInFocusDisplayOption = { - None: 0, - InAppAlert: 1, - Notification: 2, - }; - - /** - * Start the initialization process. Once you are done configuring OneSignal, call the `endInit` function. - * - * @param {string} appId Your OneSignal app id - * @param {string} googleProjectNumber **ANDROID** - your Google project number; only required for Android GCM/FCM pushes. - * @returns {any} - */ - @Cordova({ sync: true }) - startInit(appId: string, googleProjectNumber?: string): any { - return; - } - - /** - * Callback to run when a notification is received, whether it was displayed or not. - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - handleNotificationReceived(): Observable { - return; - } - - /** - * Callback to run when a notification is tapped on from the notification shade (**ANDROID**) or notification - * center (**iOS**), or when closing an Alert notification shown in the app (if InAppAlert is enabled in - * inFocusDisplaying). - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - handleNotificationOpened(): Observable { - return; - } - - /** - * Use to process an In-App Message the user just tapped on. - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - handleInAppMessageClicked(): Observable { - return; - } - - /** - * iOS** - Settings for iOS apps - * - * @param settings - * kOSSettingsKeyAutoPrompt: boolean = true - * Auto prompt user for notification permissions. - * - * kOSSettingsKeyInAppLaunchURL: boolean = false - * Launch notifications with a launch URL as an in app webview. - * @param settings.kOSSettingsKeyAutoPrompt - * @param settings.kOSSettingsKeyInAppLaunchURL - * @returns {any} - */ - @Cordova({ - sync: true, - platforms: ['iOS'], - }) - iOSSettings(settings: { kOSSettingsKeyAutoPrompt: boolean; kOSSettingsKeyInAppLaunchURL: boolean }): any { - return; - } - - /** - * Must be called after `startInit` to complete initialization of OneSignal. - * - * @returns {any} - */ - @Cordova({ sync: true }) - endInit(): any { - return; - } - - /** - * Prompt the user for notification permissions. Callback fires as soon as the user accepts or declines notifications. - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - promptForPushNotificationsWithUserResponse(): Promise { - return; - } - - /** - * Retrieve a list of tags that have been set on the user from the OneSignal server. - * - * Quirk**: You must wait for `getTags` to resolve before calling it again, as the plugin will only process the last method call and discard any previous ones. - * - * @returns {Promise} Returns a Promise that resolves when tags are recieved. - */ - @Cordova() - getTags(): Promise { - return; - } - - /** - * Lets you retrieve the OneSignal user id and device token. - * Your handler is called after the device is successfully registered with OneSignal. - * - * @returns {Promise} Returns a Promise that resolves if the device was successfully registered. - * - * userId {string} OneSignal userId is a UUID formatted string. (unique per device per app) - * - * pushToken {string} A push token is a Google/Apple assigned identifier(unique per device per app). - */ - @Cordova() - getIds(): Promise<{ userId: string; pushToken: string }> { - return; - } - - /** - * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users. - * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time. - * - * @param {string} Key of your choosing to create or update. - * @param {string} Value to set on the key. NOTE: Passing in a blank String deletes the key, you can also call deleteTag. - * @param key - * @param value - */ - @Cordova({ sync: true }) - sendTag(key: string, value: string): void {} - - /** - * Tag a user based on an app event of your choosing so later you can create segments on [onesignal.com](https://onesignal.com/) to target these users. - * Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time. - * - * @param {string} Pass a json object with key/value pairs like: {key: "value", key2: "value2"} - * @param json - */ - @Cordova({ sync: true }) - sendTags(json: any): void {} - - /** - * Deletes a tag that was previously set on a user with `sendTag` or `sendTags`. Use `deleteTags` if you need to delete more than one. - * - * @param {string} Key to remove. - * @param key - */ - @Cordova({ sync: true }) - deleteTag(key: string): void {} - - /** - * Deletes tags that were previously set on a user with `sendTag` or `sendTags`. - * - * @param {string[]} Keys to remove. - * @param keys - */ - @Cordova({ sync: true }) - deleteTags(keys: string[]): void {} - - /** - * Call this when you would like to prompt an iOS user to accept push notifications with the default system prompt. - * Only works if you set `kOSSettingsAutoPrompt` to `false` in `iOSSettings` - */ - @Cordova({ sync: true }) - registerForPushNotifications(): void {} - - /** - * Warning: - * Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications. - * - * By default OneSignal always vibrates the device when a notification is displayed unless the device is in a total silent mode. - * Passing false means that the device will only vibrate lightly when the device is in it's vibrate only mode. - * - * @param {boolean} false to disable vibrate, true to re-enable it. - * @param enable - */ - @Cordova({ sync: true }) - enableVibrate(enable: boolean): void {} - - /** - * Warning: - * Only applies to Android and Amazon. You can call this from your UI from a button press for example to give your user's options for your notifications. - * - * By default OneSignal plays the system's default notification sound when the device's notification system volume is turned on. - * Passing false means that the device will only vibrate unless the device is set to a total silent mode. - * - * @param {boolean} false to disable sound, true to re-enable it. - * @param enable - */ - @Cordova({ sync: true }) - enableSound(enable: boolean): void {} - - /** - * - * Setting to control how OneSignal notifications will be shown when one is received while your app is in focus. By default this is set to inAppAlert, which can be helpful during development. - * - * @param {DisplayType} displayOption - * @returns {any} - */ - @Cordova({ sync: true }) - inFocusDisplaying(displayOption: OSDisplayType): any { - return; - } - - /** - * You can call this method with false to opt users out of receiving all notifications through OneSignal. - * You can pass true later to opt users back into notifications. - * - * @param {boolean} enable - */ - @Cordova({ sync: true }) - setSubscription(enable: boolean): void {} - - /** - * Get the current notification and permission state. Returns a OSPermissionSubscriptionState type described below. - * - * @returns {Promise} - */ - @Cordova() - getPermissionSubscriptionState(): Promise { - return; - } - - /** - * - * @param {notificationObj} Parameters see POST [documentation](https://documentation.onesignal.com/v2.0/docs/notifications-create-notification) - * @param notificationObj - * @returns {Promise} Returns a Promise that resolves if the notification was send successfully. - */ - @Cordova() - postNotification(notificationObj: OSNotification): Promise { - return; - } - - /** - * Cancels a single OneSignal notification based on its Android notification integer id. Use instead of NotificationManager.cancel(id); otherwise the notification will be restored when your app is restarted. - * - * @param notificationId {string} - */ - @Cordova({ sync: true }) - cancelNotification(notificationId: string): void {} - - /** - * Prompts the user for location permission to allow geotagging based on the "Location radius" filter on the OneSignal dashboard. - */ - @Cordova({ sync: true }) - promptLocation(): void {} - - /** - * - * @param email {string} - */ - @Cordova({ sync: true }) - syncHashedEmail(email: string): void {} - - /** - * Enable logging to help debug if you run into an issue setting up OneSignal. - * The logging levels are as follows: 0 = None, 1= Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose - * - * The higher the value the more information is shown. - * - * @param {loglevel} contains two properties: logLevel (for console logging) and visualLevel (for dialog messages) - * @param logLevel - * @param logLevel.logLevel - * @param logLevel.visualLevel - */ - @Cordova({ sync: true }) - setLogLevel(logLevel: { logLevel: number; visualLevel: number }): void {} - - /** - * Disable or enable location collection (Defaults to enabled) if your app has location permission. - * - * @param shared {boolean} - */ - @Cordova({ sync: true }) - setLocationShared(shared: boolean): void {} - - /** - * The passed in function will be fired when a notification permission setting changes. - * This includes the following events: - * - Notification permission prompt shown - * - The user accepting or declining the permission prompt - * - Enabling/disabling notifications for your app in the device Settings after returning to your app. - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - addPermissionObserver(): Observable { - return; - } - - /** - * The passed in function will be fired when a notification subscription property changes. - * This includes the following events: - * - Getting a push token from Apple / Google. - * - Getting a player / user id from OneSignal - * - OneSignal.setSubscription is called - * - User disables or enables notifications - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - addSubscriptionObserver(): Observable { - return; - } - - /** - * Clears all OneSignal notifications - * - * @param email - * @param emailAuthToken - */ - @Cordova() - setEmail(email: string, emailAuthToken?: string): Promise { - return; - } - - /** - * If your app implements logout functionality, you can call logoutEmail to dissociate the email from the device - */ - @Cordova() - logoutEmail(): Promise { - return; - } - - /** - * The passed in function will be fired when a notification subscription property changes. - * This includes the following events: - * - Getting a push token from Apple / Google. - * - Getting a player / user id from OneSignal - * - OneSignal.setSubscription is called - * - User disables or enables notifications - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - addEmailSubscriptionObserver(): Observable { - return; - } - - /** - * Clears all OneSignal notifications - */ - @Cordova({ sync: true }) - clearOneSignalNotifications(): void {} - - /** - * Allows you to delay the initialization of the SDK until the user provides privacy consent. - * The SDK will not be fully initialized until the provideUserConsent(true) method is called. - * - * @param {boolean} required - */ - @Cordova() - setRequiresUserPrivacyConsent(required: boolean): void {} - - /** - * If your application is set to require the user's privacy consent, you can provide this consent using this method. - * Until you call provideUserConsent(true), the SDK will not fully initialize and will not send any data to OneSignal. - * - * @param {boolean} granted - */ - @Cordova() - provideUserConsent(granted: boolean): void {} - - /** - * Accepts a callback, which returns a boolean variable indicating if the user has given privacy consent yet. - * - * @param {Function} callback - */ - @Cordova() - userProvidedPrivacyConsent(callback: Function): void {} - - /** - * Allows you to use your own system's user ID's to send push notifications to your users. - * To tie a user to a given user ID, you can use this method. - * - * @param {string} externalId - */ - @Cordova() - setExternalUserId(externalId: string): void {} - - /** - * Removes whatever was set as the current user's external user ID. - */ - @Cordova() - removeExternalUserId(): void {} - - /** - * Add a trigger. May show an In-App Message if its trigger conditions were met. - * - * @param {string} key Key for the trigger. - * @param {string | number | Object} value Value for the trigger. String or number recommended. Object passed in will be converted to a string. - */ - @Cordova({ - sync: true, - }) - addTrigger(key: string, value: string | number | Object): void {} - - /** - * Add a map of triggers. May show an In-App Message if its trigger conditions were met. - * - * @param {Object.} triggers Allows you to set multiple trigger key/value pairs simultaneously. Pass a json object with key/value pairs like: `{"key": "value", "key2": "value2"}`. - */ - @Cordova({ - sync: true, - }) - addTriggers(triggers: Object): void {} - - /** - * Removes a single trigger for the given key. May show an In-App Message if its trigger conditions were met. - * - * @param {string} key Key for trigger to remove. - */ - @Cordova({ - sync: true, - }) - removeTriggerForKey(key: string): void {} - - /** - * Removes a list of triggers based on a collection (array) of keys. May show an In-App Message if its trigger conditions were met. - * - * @param {string[]} keys Removes a collection of triggers from their keys. Pass an array of trigger keys like: `["key1", "key2", "key3"]`. - */ - @Cordova({ - sync: true, - }) - removeTriggersForKeys(keys: string[]): void {} - - /** - * Gets a trigger value for a provided trigger key. - * - * @param {string} key Key for trigger to get value. - * @returns {Promise} Return value set with `addTrigger`, or `null`/`nil` (iOS) if never set or removed. - */ - @Cordova() - getTriggerValueForKey(key: string): Promise { - return; - } - - /** - * Allows you to temporarily pause all In-App Messages. You may want to do this while the user is engaged in an activity that you don't want a message to interrupt (such as watching a video). - * An In-App Message that would display if not paused will display right after resume if its conditions to display remains satisfied. - * - * @param {boolean} pause To pause, set `true`. To resume, set `false`. - */ - @Cordova({ - sync: true, - }) - pauseInAppMessages(pause: boolean): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/open-native-settings/index.ts b/src/@awesome-cordova-plugins/plugins/open-native-settings/index.ts deleted file mode 100644 index 4691f648..00000000 --- a/src/@awesome-cordova-plugins/plugins/open-native-settings/index.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Open Native Settings - * @description - * Plugin to open native screens of iOS/android settings - * @usage - * You can open any of these settings: - * ``` - * "about", // ios - * "accessibility", // ios, android - * "account", // ios, android - * "airplane_mode", // ios, android - * "apn", // android - * "application_details", // ios, android - * "application_development", // android - * "application", // android - * "autolock", // ios - * "battery_optimization", // android - * "bluetooth", // ios, android - * "castle", // ios - * "captioning", // android - * "cast", // android - * "cellular_usage", // ios - * "configuration_list", // ios - * "data_roaming", // android - * "date", // ios, android - * "display", // ios, android - * "dream", // android - * "facetime", // ios - * "home", // android - * "keyboard", // ios, android - * "keyboard_subtype", // android - * "locale", // ios, android - * "location", // ios, android - * "locations", // ios - * "manage_all_applications", // android - * "manage_applications", // android - * "memory_card", // android - * "music", // ios - * "music_equalizer", // ios - * "music_volume", // ios - * "network", // ios, android - * "nike_ipod", // ios - * "nfcsharing", // android - * "nfc_payment", // android - * "nfc_settings", // android - * "notes", // ios - * "notification_id", // ios - * "passbook", // ios - * "phone", // ios - * "photos", // ios - * "print", // android - * "privacy", // android - * "quick_launch", // android - * "reset", // ios - * "ringtone", // ios - * "browser", // ios - * "search", // ios, android - * "security", // android - * "settings", // ios, android - * "show_regulatory_info", - * "sound", // ios, android - * "software_update", // ios - * "storage", // ios, android - * "store", // ios, android - * "sync", // android - * "tethering", // ios - * "twitter", // ios - * "touch", // ios - * "usage", // ios, android - * "user_dictionary", // android - * "video", // ios - * "voice_input", // android - * "vpn", // ios - * "wallpaper", // ios - * "wifi_ip", // android - * "wifi", // ios, android - * "wireless" // android - * ``` - * ```typescript - * import { OpenNativeSettings } from '@awesome-cordova-plugins/open-native-settings/ngx'; - * - * - * constructor(private openNativeSettings: OpenNativeSettings) { } - * - * ... - * - * - * ``` - */ -@Plugin({ - pluginName: 'OpenNativeSettings', - plugin: 'cordova-open-native-settings', - pluginRef: 'cordova.plugins.settings', - repo: 'https://github.com/guyromb/Cordova-open-native-settings', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class OpenNativeSettings extends AwesomeCordovaNativePlugin { - /** - * Opens a setting dialog - * - * @param setting {string|array} setting name - * @returns {Promise} - */ - @Cordova() - open(setting: string | [string, boolean]): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/openalpr/index.ts b/src/@awesome-cordova-plugins/plugins/openalpr/index.ts deleted file mode 100644 index 3404acd4..00000000 --- a/src/@awesome-cordova-plugins/plugins/openalpr/index.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface OpenALPROptions { - /** Country used for scanning the license plate */ - country?: string; - - /** Amount of results returned */ - amount?: number; -} - -export interface OpenALPRResult { - /** LicensePlate */ - number: string; - /** Probability */ - confidence: number; -} - -/** - * @name OpenALPR - * @description - * This Cordova plugin adds support for the OpenALPR (Automatic License Plate Recognition) library, which provides support for retrieving the license plate from a picture. - * @usage - * ```typescript - * import { OpenALPR, OpenALPROptions, OpenALPRResult } from '@awesome-cordova-plugins/openalpr/ngx'; - * - * - * constructor(private openALPR: OpenALPR) { } - * - * const scanOptions: OpenALPROptions = { - * country: this.openALPR.Country.EU, - * amount: 3 - * } - * - * // To get imageData, you can use the @awesome-cordova-plugins/camera module for example. It works with DestinationType.FILE_URI and DATA_URL - * - * this.openALPR.scan(imageData, scanOptions) - * .then((res: [OpenALPRResult]) => console.log(res)) - * .catch((error: Error) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'OpenALPR', - plugin: 'cordova-plugin-openalpr', - pluginRef: 'cordova.plugins.OpenALPR', - repo: 'https://github.com/iMicknl/cordova-plugin-openalpr', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class OpenALPR extends AwesomeCordovaNativePlugin { - Country = { - AU: 'au', - BR: 'br', - BR2: 'br2', - EU: 'eu', - IN: 'in', - KR2: 'kr2', - US: 'us', - VN2: 'vn2', - }; - - /** - * This function does something - * - * @param imageData {any} Base64 encoding of the image data or the image file URI - * @param options {OpenALPROptions} Options to pass to the OpenALPR scanner - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - scan(imageData: any, options?: OpenALPROptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/paytabs/index.ts b/src/@awesome-cordova-plugins/plugins/paytabs/index.ts deleted file mode 100644 index e5185466..00000000 --- a/src/@awesome-cordova-plugins/plugins/paytabs/index.ts +++ /dev/null @@ -1,486 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * PaymentSDKConfiguration: payment request configuration - */ -export interface PaymentSDKConfiguration { - /** - * merchant profile id - */ - profileID: string; - /** - * merchant server key - */ - serverKey: string; - /** - * merchant client key - */ - clientKey: string; - /** - * transaction type: refer to TransactionType enum - */ - transactionType?: string; - /** - * transaction class: refer to TransactionClass enum - */ - transactionClass?: string; - /** - * order or cart id - */ - cartID: string; - /** - * payment currency - */ - currency: string; - /** - * amount - */ - amount: number; - /** - * order or cart description - */ - cartDescription: string; - /** - * user interface language code(en, ar, ..) - */ - languageCode?: string; - /** - * validate shipping info - */ - forceShippingInfo?: boolean; - /** - * validate billing info - */ - showBillingInfo?: boolean; - /** - * handle missing shipping info by showing shipping info section - */ - showShippingInfo?: boolean; - /** - * configured billing details - */ - billingDetails?: PaymentSDKBillingDetails; - /** - * configured shipping details - */ - shippingDetails?: PaymentSDKShippingDetails; - /** - * merchant country code - */ - merchantCountryCode: string; - /** - * title of the screen - */ - screenTitle?: string; - /** - * merchant name - */ - merchantName?: string; - /** - * server ip - */ - serverIP?: string; - /** - * tokenise type: refer to TokeiseType enum - */ - tokeniseType?: string; - /** - * token format: refer to TokeiseFormat enum - */ - tokenFormat?: string; - /** - * option to hide or show card scanner button - */ - hideCardScanner?: string; - /** - * merchant apple pay bundle id - */ - merchantApplePayIdentifier?: string; - /** - * minize the vlaidation on apple pay billing and shipping info - */ - simplifyApplePayValidation?: string; - /** - * supported apple pay networks - */ - supportedApplePayNetworks?: [string]; - /** - * returned token - */ - token?: string; - /** - * returned transaction reference - */ - transactionReference?: string; - /** - * samsung Token - */ - samsungToken?: string; - /** - * customized theme - */ - theme?: PaymentSDKTheme; - /** - * list of alternative payment methods - */ - alternativePaymentMethods?: [string]; -} - -/** - * PaymentSDKBillingDetails - */ -export interface PaymentSDKBillingDetails { - /** - * billing: customer name - */ - name?: string; - /** - * billing: customer email - */ - email?: string; - /** - * billing: customer phone - */ - phone?: string; - /** - * billing: customer address line - */ - addressLine?: string; - /** - * billing: customer city - */ - city?: string; - /** - * billing: customer state - */ - state?: string; - /** - * billing: customer country code - */ - countryCode?: string; - /** - * billing: customer zip code - */ - zip?: string; -} - -/** - * PaymentSDKShippingDetails - */ -export interface PaymentSDKShippingDetails { - /** - * shipping: customer name - */ - name?: string; - /** - * shipping: customer email - */ - email?: string; - /** - * shipping: customer phone - */ - phone?: string; - /** - * shipping: customer address line - */ - addressLine?: string; - /** - * shipping: customer city - */ - city?: string; - /** - * shipping: customer state - */ - state?: string; - /** - * shipping: customer country code - */ - countryCode?: string; - /** - * shipping: customer zip code - */ - zip?: string; -} - -/** - * PaymentSDKTheme - */ -export interface PaymentSDKTheme { - /** - * theme: primary color - */ - primaryColor?: string; - /** - * theme: primary font color - */ - primaryFontColor?: string; - /** - * theme: primary font - */ - primaryFont?: string; - /** - * theme: secondary color - */ - secondaryColor?: string; - /** - * theme: secondary font color - */ - secondaryFontColor?: string; - /** - * theme: secondary font - */ - secondaryFont?: string; - /** - * theme: stroke color - */ - strokeColor?: string; - /** - * theme: primary color - */ - strokeThinckness?: number; - /** - * theme: input corner radius - */ - inputsCornerRadius?: number; - /** - * theme: button color - */ - buttonColor?: string; - /** - * theme: button font color - */ - buttonFontColor?: string; - /** - * theme: button font - */ - buttonFont?: string; - /** - * theme: title font color - */ - titleFontColor?: string; - /** - * theme: title font - */ - titleFont?: string; - /** - * theme: background color - */ - backgroundColor?: string; - /** - * theme: placeholder color - */ - placeholderColor?: string; -} - -/** - * TokeniseType: define the behaviour of of saving card option inside the SDKs. - */ -export enum TokeniseType { - /** - * none: tokenise is off - */ - none = 'none', - /** - * merchantMandatory: tokenise is forced - */ - merchantMandatory = 'merchantMandatory', - /** - * userMandatory: tokenise is forced as per user approval - */ - userMandatory = 'userMandatory', - /** - * userOptinoal: tokenise if optional as per user approval - */ - userOptinoal = 'userOptinoal', -} - -/** - * TokeniseFromat: the returned token format - */ -export enum TokeniseFromat { - /** - * none: no format - */ - none = '1', - /** - * hex32: Hex with 32 length - */ - hex32 = '2', - /** - * alphaNum20: alpha numeric 20 length - */ - alphaNum20 = '3', - /** - * digit22: digits with 22 length - */ - digit22 = '3', - /** - * digit16: digits with 16 length - */ - digit16 = '5', - /** - * alphaNum32: alpha numeric 32 length - */ - alphaNum32 = '6', -} - -/** - * TransactionType - */ -export enum TransactionType { - /** - * sale - */ - sale = 'sale', - /** - * authorize / capture option - */ - authorize = 'auth', -} - -/** - * TransactionClass - */ -export enum TransactionClass { - /** - * ecom: default transaction - */ - ecom = 'ecom', - /** - * recurring: recurring transaction - */ - recurring = 'recur', -} - -/** - * AlternativePaymentMethod - */ -export enum AlternativePaymentMethod { - /** - * unionpay: for supporting payment with unionpay - */ - unionPay = 'unionpay', - /** - * stcpay: for supporting payment with stcpay - */ - stcPay = 'stcpay', - /** - * valu: for supporting payment with valu - */ - valu = 'valu', - /** - * meezaqr: for supporting payment with meezaqr - */ - meezaQR = 'meezaqr', - /** - * omannet: for supporting payment with omannet - */ - omannet = 'omannet', - /** - * knetcredit: for supporting payment with knetcredit - */ - knetCredit = 'knetcredit', - /** - * knetdebit: for supporting payment with knetdebit - */ - knetDebit = 'knetdebit', - /** - * fawry: for supporting payment with fawry - */ - fawry = 'fawry', -} - -/** - * @name PayTabs - * @description - * A plugin that allows you to use PayTabs's Native SDKs for Android and iOS. - * @usage - * ```typescript - * import { PayTabs } from '@awesome-cordova-plugins/paytabs/ngx'; - * - * constructor(private paytabs: PayTabs) { } - * - * ... - * let billingDetails: PaymentSDKBillingDetails = { - * name: "John Smith", - * email: "email@domain.com", - * phone: "+201111111111", - * addressLine: "Address line", - * city: "Dubai", - * state: "Dubai", - * countryCode: "AE", - * zip: "1234" - * }; - * - * var configuration: PaymentSDKConfiguration = { - * profileID: "*profile id*", - * serverKey: "*server key*", - * clientKey: "*cleint key*", - * cartID: "12345", - * currency: "USD", - * cartDescription: "Flowers", - * merchantCountryCode: "ae", - * merchantName: "Flowers Store", - * amount: 20, - * screenTitle:"Pay with Card", - * billingDetails: billingDetails - * } - * - * this.paytabs.startCardPayment(configuration) - * .then(result => console.log(result)) - * .catch(error => console.error(error)); - * - * this.paytabs.startApplePayPayment(configuration) - * .then(result => console.log(result)) - * .catch(error => console.error(error)); - * - * this.paytabs.startAlternativePaymentMethod(configuration) - * .then(result => console.log(result)) - * .catch(error => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'PayTabs', - plugin: 'com.paytabs.cordova.plugin', - pluginRef: 'com.paytabs.cordova.plugin', - repo: 'https://github.com/paytabscom/paytabs-cordova', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class PayTabs extends AwesomeCordovaNativePlugin { - /** - * Start Card Payment - * - * @param params {PaymentSDKConfiguration} payment request configuration - * @param configuration - * @returns {Promise} returns a promise that resolves with transaction details, or rejects with an error - */ - @Cordova() - startCardPayment(configuration: PaymentSDKConfiguration): Promise { - return; - } - /** - * Start ApplePay Payment - * - * @param params {PaymentSDKConfiguration} payment request configuration - * @param configuration - * @returns {Promise} returns a promise that resolves with transaction details, or rejects with an error - */ - @Cordova() - startApplePayPayment(configuration: PaymentSDKConfiguration): Promise { - return; - } - /** - * Start Alternative Payment Method - * - * @param params {PaymentSDKConfiguration} payment request configuration - * @param configuration - * @returns {Promise} returns a promise that resolves with transaction details, or rejects with an error - */ - @Cordova() - startAlternativePaymentMethod(configuration: PaymentSDKConfiguration): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/pdf-generator/index.ts b/src/@awesome-cordova-plugins/plugins/pdf-generator/index.ts deleted file mode 100644 index a7d5d926..00000000 --- a/src/@awesome-cordova-plugins/plugins/pdf-generator/index.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface PDFGeneratorOptions { - /** - * The document size, e.g., A2, A3, or A4. - * Only supported on iOS. - * The default is 'A4'. - */ - documentSize?: string; - - /** - * Option to change to landscape orientation. - * Default is 'portrait'. - */ - landscape?: 'landscape' | 'portrait'; - - /** - * The type to be returned, either 'share' or 'base64'. - * If 'share is chosen, the PDF is shared with the system capabilities. - * Default is 'base64' - */ - type?: string; - - /** - * The desired filename the resulting PDF should have. - * Default is 'default.pdf' - */ - fileName?: string; - - /** - * Option to set the base URL for pathing. - * Default is 'null'. - */ - baseUrl?: string; -} - -/** - * @name PDFGenerator - * @description - * Simple plugin to generate (offline) pdf. The plugin transforms HTML to PDF and also provide the mechanism to share the pdf to other apps like Mail, etc. - * @usage - * ```typescript - * import { PDFGenerator } from '@awesome-cordova-plugins/pdf-generator'; - * - * constructor(private pdfGenerator: PDFGenerator) { } - * - * ... - * - * this.pdfGenerator.fromURL(url, options).then(base64String => console.log(base64String)); - * - * ``` - */ -@Plugin({ - pluginName: 'PDFGenerator', - plugin: 'cordova-pdf-generator', - pluginRef: 'cordova.plugins.pdf', - repo: 'https://github.com/cesarvr/pdf-generator', - platforms: ['Android', 'iOS'], -}) -@Injectable({ - providedIn: 'root', -}) -export class PDFGenerator extends AwesomeCordovaNativePlugin { - /** - * Creates a PDF using a URL, it download the document into an in memory Webkit object, and renders it into a PDF. - * - * @param url {string} URL to create a PDF from - * @param options {PDFGeneratorOptions} options for PDF generation - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - fromURL(url: string, options?: PDFGeneratorOptions): Promise { - return; - } - - /** - * Creates a PDF using string with the HTML representation, it download the document into an in memory Webkit object, and renders it into a PDF. - * - * @param data {string} HTML string representation to create a PDF from - * @param options {PDFGeneratorOptions} options for PDF generation - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - fromData(data: string, options?: PDFGeneratorOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/photo-library/index.ts b/src/@awesome-cordova-plugins/plugins/photo-library/index.ts deleted file mode 100644 index 8d51f3a5..00000000 --- a/src/@awesome-cordova-plugins/plugins/photo-library/index.ts +++ /dev/null @@ -1,307 +0,0 @@ -import { Cordova, CordovaOptions, AwesomeCordovaNativePlugin, Plugin, wrap } from '@awesome-cordova-plugins/core'; -import { Observable, Observer } from 'rxjs'; -import { Injectable } from '@angular/core'; - -/** - * @hidden - */ -export interface CordovaFiniteObservableOptions extends CordovaOptions { - /** - * Function that gets a result returned from plugin's success callback, and decides whether it is last value and observable should complete. - */ - resultFinalPredicate?: string; - /** - * Function that gets called after resultFinalPredicate, and removes service data that indicates end of stream from the result. - */ - resultTransform?: string; -} - -/** - * @param opts - * @hidden - * - * Wraps method that returns an observable that can be completed. Provided opts.resultFinalPredicate dictates when the observable completes. - */ -export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {}) { - opts.observable = true; - return (target: Object, methodName: string, descriptor: TypedPropertyDescriptor) => { - return { - value(...args: any[]) { - const wrappedObservable: Observable = wrap(this, methodName, opts).apply(this, args); - return new Observable((observer: Observer) => { - const wrappedSubscription = wrappedObservable.subscribe({ - next: (x: any) => { - observer.next(opts.resultTransform ? x[opts.resultTransform] : x); - if (opts.resultFinalPredicate && x[opts.resultFinalPredicate]) { - observer.complete(); - } - }, - error: (err: any) => { - observer.error(err); - }, - complete: () => { - observer.complete(); - }, - }); - return () => { - wrappedSubscription.unsubscribe(); - }; - }); - }, - enumerable: true, - }; - }; -} - -/** - * @name Photo Library - * @description - * The PhotoLibrary plugin allows access to photos from device by url. So you can use plain img tag to display photos and their thumbnails, and different 3rd party libraries as well. - * Saving photos and videos to the library is also supported. - * cdvphotolibrary urls should be trusted by Angular. See plugin homepage to learn how. - * @usage - * ```typescript - * import { PhotoLibrary } from '@awesome-cordova-plugins/photo-library/ngx'; - * - * constructor(private photoLibrary: PhotoLibrary) { } - * - * this.photoLibrary.requestAuthorization().then(() => { - * this.photoLibrary.getLibrary().subscribe({ - * next: library => { - * library.forEach(function(libraryItem) { - * console.log(libraryItem.id); // ID of the photo - * console.log(libraryItem.photoURL); // Cross-platform access to photo - * console.log(libraryItem.thumbnailURL);// Cross-platform access to thumbnail - * console.log(libraryItem.fileName); - * console.log(libraryItem.width); - * console.log(libraryItem.height); - * console.log(libraryItem.creationDate); - * console.log(libraryItem.latitude); - * console.log(libraryItem.longitude); - * console.log(libraryItem.albumIds); // array of ids of appropriate AlbumItem, only of includeAlbumsData was used - * }); - * }, - * error: err => { console.log('could not get photos'); }, - * complete: () => { console.log('done getting photos'); } - * }); - * }) - * .catch(err => console.log('permissions weren\'t granted')); - * - * ``` - */ -@Plugin({ - pluginName: 'PhotoLibrary', - plugin: 'cordova-plugin-photo-library', - pluginRef: 'cordova.plugins.photoLibrary', - repo: 'https://github.com/terikon/cordova-plugin-photo-library', - install: - 'ionic cordova plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"', - installVariables: ['PHOTO_LIBRARY_USAGE_DESCRIPTION'], - platforms: ['Android', 'Browser', 'iOS'], -}) -@Injectable() -export class PhotoLibrary extends AwesomeCordovaNativePlugin { - /** - * Retrieves library items. Library item contains photo metadata like width and height, as well as photoURL and thumbnailURL. - * - * @param success - * @param error - * @param options {GetLibraryOptions} Optional, like thumbnail size and chunks settings. - * @returns {Observable} Returns library items. If appropriate option was set, will be returned by chunks. - */ - @Cordova({ - observable: true, - }) - getLibrary( - success?: (res?: any) => void, - error?: (err?: any) => void, - options?: GetLibraryOptions - ): Observable { - return; - } - - /** - * Asks user permission to access photo library. - * - * @param options {RequestAuthorizationOptions} Optional, like whether only read access needed or read/write. - * @returns { Promise} Returns a promise that resolves when permissions are granted, and fails when not. - */ - @Cordova({ - callbackOrder: 'reverse', - }) - requestAuthorization(options?: RequestAuthorizationOptions): Promise { - return; - } - - /** - * Returns list of photo albums on device. - * - * @returns {Promise} Resolves to list of albums. - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getAlbums(): Promise { - return; - } - - /** - * Provides means to request URL of thumbnail, with specified size or quality. - * - * @param photo {string | LibraryItem} Id of photo, or LibraryItem. - * @param options {GetThumbnailOptions} Options, like thumbnail size or quality. - * @returns {Promise} Resolves to URL of cdvphotolibrary schema. - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - getThumbnailURL(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise { - return; - } - - /** - * Provides means to request photo URL by id. - * - * @param photo {string | LibraryItem} Id or LibraryItem. - * @param options {GetPhotoOptions} Optional options. - * @returns {Promise} Resolves to URL of cdvphotolibrary schema. - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - getPhotoURL(photo: string | LibraryItem, options?: any): Promise { - return; - } - - /** - * Returns thumbnail as Blob. - * - * @param photo {string | LibraryItem} Id or LibraryItem. - * @param options {GetThumbnailOptions} Options, like thumbnail size or quality. - * @returns {Promise} Resolves requested thumbnail as blob. - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - getThumbnail(photo: string | LibraryItem, options?: GetThumbnailOptions): Promise { - return; - } - - /** - * Returns photo as Blob. - * - * @param photo {string | LibraryItem} Id or LibraryItem. - * @param options {GetPhotoOptions} Optional options. - * @returns {Promise} Resolves requested photo as blob. - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - getPhoto(photo: string | LibraryItem, options?: any): Promise { - return; - } - - /** - * Saves image to specified album. Album will be created if not exists. - * LibraryItem that represents saved image is returned. - * - * @param url {string} URL of a file, or DataURL. - * @param album {AlbumItem | string} Name of an album or AlbumItem object. - * @param options {GetThumbnailOptions} Options, like thumbnail size for resulting LibraryItem. - * @returns {Promise} Resolves to LibraryItem that represents saved image. - */ - @Cordova({ - successIndex: 2, - errorIndex: 3, - }) - saveImage(url: string, album: AlbumItem | string, options?: GetThumbnailOptions): Promise { - return; - } - - /** - * Saves video to specified album. Album will be created if not exists. - * - * @param url {string} URL of a file, or DataURL. - * @param album {AlbumItem | string} Name of an album or AlbumItem object. - * @returns {Promise} Resolves when save operation completes. - */ - @Cordova({ - successIndex: 2, - errorIndex: 3, - }) - saveVideo(url: string, album: AlbumItem | string): Promise { - return; - } -} - -/** - * @hidden - */ -export interface LibraryItem { - /** - * Local id of the photo - */ - id: string; - /** - * URL of cdvphotolibrary schema. - */ - photoURL: string; - /** - * URL of cdvphotolibrary schema. - */ - thumbnailURL: string; - fileName: string; - width: number; - height: number; - creationDate: Date; - latitude?: number; - longitude?: number; - albumIds?: string[]; -} - -/** - * @hidden - */ -export interface AlbumItem { - /** - * Local id of the album - */ - id: string; - title: string; -} - -/** - * @hidden - */ -export interface GetLibraryOptions { - thumbnailWidth?: number; - thumbnailHeight?: number; - quality?: number; - itemsInChunk?: number; - chunkTimeSec?: number; - useOriginalFileNames?: boolean; - includeAlbumData?: boolean; - includeVideos?: boolean; - maxItems?: number; -} - -/** - * @hidden - */ -export interface RequestAuthorizationOptions { - read?: boolean; - write?: boolean; -} - -/** - * @hidden - */ -export interface GetThumbnailOptions { - thumbnailWidth?: number; - thumbnailHeight?: number; - quality?: number; -} diff --git a/src/@awesome-cordova-plugins/plugins/photo-viewer/index.ts b/src/@awesome-cordova-plugins/plugins/photo-viewer/index.ts deleted file mode 100644 index 8205bb8c..00000000 --- a/src/@awesome-cordova-plugins/plugins/photo-viewer/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface PhotoViewerOptions { - /** - * Set to false to disable the share button (Android only). Default: true - */ - share?: boolean; - /** - * Add HTTP headers to the request. Useful for authenticated pages. - * The value is a string in a JSON format. Default: '' - */ - headers?: string; - /** - * Option for close button visibility when share false [ONLY FOR iOS] - */ - closeButton?: boolean; - /** - * If you need to copy image to reference before show then set it true [ONLY FOR iOS] - */ - copyToReference?: boolean; - /** - * Enable or Disable Picasso Options ( Only Android ): fit, centerInside, centerCrop. - */ - piccasoOptions?: { - fit?: boolean; - centerInside?: boolean; - centerCrop?: boolean; - }; -} - -/** - * @name Photo Viewer - * @description This plugin can display your image in full screen with the ability to pan, zoom, and share the image. - * @usage - * ```typescript - * import { PhotoViewer } from '@awesome-cordova-plugins/photo-viewer/ngx'; - * - * constructor(private photoViewer: PhotoViewer) { } - * - * ... - * - * this.photoViewer.show('https://mysite.com/path/to/image.jpg'); - * - * this.photoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false}); - * - * this.photoViewer.show('https://mysecuresite.com/path/to/image.jpg', 'My image title', {share: false, headers: '{username:foo,password:bar}'}); - * ``` - */ -@Plugin({ - pluginName: 'PhotoViewer', - plugin: 'com-sarriaroman-photoviewer', - pluginRef: 'PhotoViewer', - repo: 'https://github.com/sarriaroman/photoviewer', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class PhotoViewer extends AwesomeCordovaNativePlugin { - /** - * Shows an image in full screen - * - * @param url {string} URL or path to image - * @param title {string} - * @param options {PhotoViewerOptions} - */ - @Cordova({ sync: true }) - show(url: string, title?: string, options?: PhotoViewerOptions): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/play-install-referrer/index.ts b/src/@awesome-cordova-plugins/plugins/play-install-referrer/index.ts deleted file mode 100644 index eab8c9df..00000000 --- a/src/@awesome-cordova-plugins/plugins/play-install-referrer/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -@Plugin({ - pluginName: 'PlayInstallReferrer', - plugin: 'cordova-plugin-play-installreferrer', - pluginRef: 'installReferrer', - repo: 'https://github.com/swayangjit/cordova-plugin-play-installreferrer', - platforms: ['Android'], -}) -@Injectable() -export class PlayInstallReferrer extends AwesomeCordovaNativePlugin { - @Cordova() - getReferrer(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/pollfish/index.ts b/src/@awesome-cordova-plugins/plugins/pollfish/index.ts deleted file mode 100644 index 961f63ae..00000000 --- a/src/@awesome-cordova-plugins/plugins/pollfish/index.ts +++ /dev/null @@ -1,172 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, CordovaProperty, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Pollfish - * @description - * Pollfish Ionic Native plugin wrapper - * @usage - * ```typescript - * import { Pollfish } from '@awesome-cordova-plugins/pollfish/ngx'; - * - * - * constructor(private pollfish: Pollfish) { } - * - * ... - * - * this.pollfish.init(false, false, 'YOUR_API_KEY', 1, 8, 'REQUEST_UUID', false); - * - * this.pollfish.initWithUserAttributes(false, false, 'YOUR_API_KEY', 1, 8, 'REQUEST_UUID', false, { - * 'gender': '1', - * ... - * }); - * - * this.pollfish.showPollfish(); - * - * this.pollfish.hidePollfish(); - * - * // Event Listeners - * - * this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyReceived, (surveyInfo) => { - * console.log("Survey Received: " + JSON.stringify(surveyInfo)); - * }); - * - * this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyCompleted, (result) => { - * console.log("Survey Completed: " + JSON.stringify(surveyInfo)); - * }); - * - * this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishUserNotEligible, (_) => { - * console.log("Pollfish User Not Eligible"); - * }); - * - * this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishSurveyNotAvailable, (_) => { - * console.log("Pollfish Survey not available"); - * }); - * - * this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishOpened, (_) => { - * console.log("Pollfish Survey panel is open"); - * }); - * - * this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishClosed, (_) => { - * console.log("Pollfish Survey panel is closed"); - * }); - * - * this.pollfish.setEventCallback(pollfish.EventListener.OnPollfishUserRejectedSurvey, (_) => { - * console.log("Pollfish User Rejected Survey"); - * }); - * - * ``` - */ -@Plugin({ - pluginName: 'Pollfish', - plugin: 'com.pollfish.cordova_plugin', - pluginRef: 'pollfishplugin', - repo: 'https://github.com/pollfish/cordova-plugin-pollfish', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Pollfish extends AwesomeCordovaNativePlugin { - @CordovaProperty() - EventListener: { - OnPollfishClosed: string; - OnPollfishOpened: string; - OnPollfishSurveyReceived: string; - OnPollfishSurveyCompleted: string; - OnPollfishUserNotEligible: string; - OnPollfishUserRejectedSurvey: string; - OnPollfishSurveyNotAvailable: string; - }; - - @CordovaProperty() - Position: { - TOP_LEFT: number; - TOP_RIGHT: number; - MIDDLE_LEFT: number; - MIDDLE_RIGHT: number; - BOTTOM_LEFT: number; - BOTTOM_RIGHT: number; - }; - - /** - * Function to init Pollfish - * - * @param releaseMode {boolean} - * @param rewardMode {boolean} - * @param apiKey {string} - * @param position {number} - * @param padding {number} - * @param requestUUID {string} - * @param offerwallMode {boolean} - */ - @Cordova() - init( - releaseMode: boolean, - rewardMode: boolean, - apiKey: string, - position: number, - padding: number, - requestUUID: string, - offerwallMode: boolean - ): any { - return; - } - - /** - * Function to init Pollfish with user attributes - * - * @param releaseMode {boolean} - * @param rewardMode {boolean} - * @param apiKey {string} - * @param position {number} - * @param padding {number} - * @param requestUUID {string} - * @param offerwallMode {boolean} - * @param userAttributes {Json} - */ - - @Cordova() - initWithUserAttributes( - releaseMode: boolean, - rewardMode: boolean, - apiKey: string, - position: number, - padding: number, - requestUUID: string, - offerwallMode: boolean, - userAttributes: {} - ) { - return; - } - - /** - * Function to manually show Pollfish - */ - - @Cordova() - showPollfish() { - return; - } - - /** - * Function to manually hide Pollfish - */ - - @Cordova() - hidePollfish() { - return; - } - - /** - * Function to set event callbacks - * - * @param eventName - * @param callback - */ - - @Cordova({ - sync: true, - }) - setEventCallback(eventName: string, callback: (info?: any) => void) { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/power-management/index.ts b/src/@awesome-cordova-plugins/plugins/power-management/index.ts deleted file mode 100644 index 66b038dd..00000000 --- a/src/@awesome-cordova-plugins/plugins/power-management/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -/** - * @name Power Management - * @description - * The PowerManagement plugin offers access to the devices power-management functionality. - * It should be used for applications which keep running for a long time without any user interaction. - * @usage - * ``` - * import { PowerManagement } from '@awesome-cordova-plugins/power-management/ngx'; - * - * constructor(private powerManagement: PowerManagement) { } - * - * ... - * - * this.powerManagement.acquire() - * .then(onSuccess) - * .catch(onError); - * - * ``` - */ -@Plugin({ - pluginName: 'PowerManagement', - plugin: 'cordova-plugin-powermanagement-orig', - pluginRef: 'powerManagement', - repo: 'https://github.com/Viras-/cordova-plugin-powermanagement', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class PowerManagement extends AwesomeCordovaNativePlugin { - /** - * Acquire a wakelock by calling this. - * @returns {Promise} - */ - @Cordova() - acquire(): Promise { - return; - } - - /** - * This acquires a partial wakelock, allowing the screen to be dimmed. - * @returns {Promise} - */ - @Cordova() - dim(): Promise { - return; - } - - /** - * Release the wakelock. It's important to do this when you're finished with the wakelock, to avoid unnecessary battery drain. - * @returns {Promise} - */ - @Cordova() - release(): Promise { - return; - } - - /** - * 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). - * It will reacquire the wakelock upon app resume. If you would prefer to disable this behaviour, you can use this function. - * @param set {boolean} - * @returns {Promise} - */ - @Cordova() - setReleaseOnPause(set: boolean): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/power-optimization/index.ts b/src/@awesome-cordova-plugins/plugins/power-optimization/index.ts deleted file mode 100644 index 249e1d34..00000000 --- a/src/@awesome-cordova-plugins/plugins/power-optimization/index.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -/** - * @name Power Optimization - * @description - * Android Custom Roms made sometimes your apps unfunctional due to being killed in the background, notification messages do not appearing or your services being killed by agressive power saving mode. - * The Power Optimization plugin give you android PowerManager methods with cordova. - * @usage - * ```typescript - * import { PowerOptimization } from '@awesome-cordova-plugins/power-optimization/ngx'; - * - * constructor(private powerOptimization: PowerOptimization) { } - * - * ... - * - * this.powerOptimization.IsIgnoringBatteryOptimizations() - * .then(onSuccess) - * .catch(onError); - * - * ``` - */ -@Plugin({ - pluginName: 'PowerOptimization', - plugin: 'cordova-plugin-power-optimization', - pluginRef: 'cordova.plugins.PowerOptimization', - repo: 'https://github.com/snt1017/cordova-plugin-power-optimization', - platforms: ['Android'], -}) -@Injectable() -export class PowerOptimization extends AwesomeCordovaNativePlugin { - /** - * Check if the battery optimization is ignoring - * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - IsIgnoringBatteryOptimizations(): Promise { - return; - } - /** - * Request permisson to ignore optimizations: - * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - RequestOptimizations(): Promise { - return; - } - /** - * Go to battery optimizations configurations menu: - * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - RequestOptimizationsMenu(): Promise { - return; - } - /** - * Check if have any data restrictions in background: - * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - IsIgnoringDataSaver(): Promise { - return; - } - /** - * Go to data restrictions in background configurations menu: - * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - RequestDataSaverMenu(): Promise { - return; - } - /** - * Check if have another battery restriction is present into phone (like huawei, xiaomi, etc): - * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - HaveProtectedAppsCheck(): Promise { - return; - } - /** - * Go to configurations menu if another battery restriction is present into phone (like huawei, xiaomi, etc). You can send true into params if you want to force show the menu (is only show the fist time without params): - * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization - * - * @returns {Promise} - */ - @Cordova({ sync: true }) - ProtectedAppCheck(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/preview-any-file/index.ts b/src/@awesome-cordova-plugins/plugins/preview-any-file/index.ts deleted file mode 100644 index 5f71f4ee..00000000 --- a/src/@awesome-cordova-plugins/plugins/preview-any-file/index.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; -/** - * @name PreviewAnyFile - * @description - * 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. - * - * Requires Cordova plugin: `cordova-plugin-preview-any-file`. For more info, please see the [previewAnyFile plugin docs](https://github.com/mostafa-mansour1/previewAnyFile). - * @usage - * ```typescript - * import { PreviewAnyFile } from '@awesome-cordova-plugins/preview-any-file/ngx'; - * - * - * constructor(private previewAnyFile: PreviewAnyFile) { } - * - * ... - * - * - * this.previewAnyFile.previewPath('file://path/to/file.xls') - * .subscribe(res => console.log(res),error => console.error(error)) - * - * //if the file in the url has no extension, you must define the name or mimetype in the options - * this.previewAnyFile.previewPath('https://domain.com/file/pdfFile',{name:file.pdf}) - * .subscribe(res => console.log(res),error => console.error(error)) - * - * // view file from local folder in the app - * this.previewAnyFile.previewAsset('/assets/localFile.doc') - * .subscribe(res => console.log(res),error => console.error(error)) - * - * this.previewAnyFile.previewBase64('data:image/gif;base64,R0lGODlhP.....') - * .subscribe(res => console.log(res),error => console.error(error)) - * - * //if the mime type not exist in the base64, you must define the name or mimetype in the options - * this.previewAnyFile.previewBase64('JVBERi0xLjMKJcTl8uXr.....',{mimeType:'application/pdf'}) - * .subscribe(res => console.log(res),error => console.error(error)) - * - * ``` - */ - -export interface PreviewOptions { - // overwrite the name of the file ex: file.pdf - name?: string; - // overwrite the mime type of the file ex: application/pdf - mimeType?: string; -} - -export type PreviewResponse = 'CLOSING' | 'SUCCESS' | 'NO_APP'; -@Plugin({ - pluginName: 'Preview/Open Any File', - plugin: 'cordova-plugin-preview-any-file', // npm package name, example: cordova-plugin-camera - pluginRef: 'PreviewAnyFile', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/mostafa-mansour1/previewAnyFile', // the github repository URL for the plugin - install: '', // OPTIONAL install command, in case the plugin requires variables - installVariables: [], // OPTIONAL the plugin requires variables - platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] -}) -@Injectable() -export class PreviewAnyFile extends AwesomeCordovaNativePlugin { - /** - * @deprecated Use the previewPath,previewBase64 or previewAsset. they have more options - * @param url {String} full absolute URL -> file://, content://, http://, https, ... etc - * @returns {Promise} Returns a promise that resolves if the file opened reject if not; - * @author Mostafa Mansour - */ - @Cordova() - preview(url: string): Promise { - return; - } - - /** - * previewPath function will return SUCCESS,NO_APP or CLOSING in Observable Callback , if the content is base64 you have to use previewBase64 method - * - * @param path {String} full absolute URL -> file://, content://, http://, https, ... etc, if extension not exist, you must define it in the opt param - * @param opt {PreviewOptions} define the name of the file with extension or it's mimeType, if the correct extension not exist in the path - * @returns {Observable} Returns an Observable that resolves if the file opened, closed or not opened , it will reject if any error; - * @author Mostafa Mansour - */ - @Cordova({ - observable: true, - callbackOrder: 'reverse', - }) - previewPath(path: string, opt: PreviewOptions = {}): Observable { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * previewBase64 function will return SUCCESS,NO_APP or CLOSING in Observable Callback , if the content is url or path you have to use previewPath method - * - * @param path {String} full absolute URL -> file://, content://, http://, https, ... etc, if extension not exist, you must define it in the opt param - * @param base64 - * @param opt {PreviewOptions} define the name of the file with extension or it's mimeType, if the mimetype not exist in the base64 string - * @returns {Observable} Returns an Observable that resolves if the file opened, closed or not opened , it will reject if any error; - * @author Mostafa Mansour - */ - @Cordova({ - observable: true, - callbackOrder: 'reverse', - }) - previewBase64(base64: string, opt: PreviewOptions = {}): Observable { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * Use previewAsset function to open a file from assets folder, it will return SUCCESS,NO_APP or CLOSING in Observable Callback , - * - * @param path {String} relative path of the file from assets folder "/assets/file.pdf" , if extension not exist, you must define it in the opt param - * @param opt {PreviewOptions} define the name of the file with extension or it's mimeType, if the correct extension not exist in the path - * @returns {Observable} Returns an Observable that resolves if the file opened, closed or not opened , it will reject if any error; - * @author Mostafa Mansour - */ - @Cordova({ - observable: true, - callbackOrder: 'reverse', - }) - previewAsset(path: string, opt: PreviewOptions = {}): Observable { - return; // We add return; here to avoid any IDE / Compiler errors - } -} diff --git a/src/@awesome-cordova-plugins/plugins/printer/index.ts b/src/@awesome-cordova-plugins/plugins/printer/index.ts deleted file mode 100644 index abd61cf0..00000000 --- a/src/@awesome-cordova-plugins/plugins/printer/index.ts +++ /dev/null @@ -1,217 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaCheck, AwesomeCordovaNativePlugin, Plugin, getPromise } from '@awesome-cordova-plugins/core'; - -interface FontOptions { - name: string; // The name of the font family. Only supported on iOS - size: number; // The size of the font. Only supported on iOS, Android - italic: boolean; // Set to true to enable these font traits. Only supported on iOS - bold: boolean; // Set to true to enable these font traits. Only supported on iOS - align: 'left' | 'right' | 'center' | 'justified'; // Possible alignments are left, right, center and justified. Only supported on iOS - color: string; // The color of the font in hexa-decimal RGB format - "FF0000" means red. Only supported on iOS -} - -interface HeaderFooterLabelOptions { - text: string; // The plain text to display. Use %ld to indicate where to insert the page index. For example "Page %ld" would result into "Page 1", "Page 2", .... Only supported on iOS - top: string; // The relative position where to place the label within the footer or header area. Only supported on iOS - right: string; // The relative position where to place the label within the footer or header area. Only supported on iOS - left: string; // The relative position where to place the label within the footer or header area. Only supported on iOS - bottom: string; // The relative position where to place the label within the footer or header area. Only supported on iOS - font: FontOptions; // The font attributes for the label. Only supported on iOS - showPageIndex: boolean; // Set to true if you want to display the page index. Only supported on iOS -} - -export interface PrintOptions { - /** - * The name of the print job and the document - */ - name?: string; - - /** - * The number of copies for the print task. - * Only supported on iOS, Windows - */ - copies?: number; - - /** - * Limits the pages to print even the document contains more. - * To skip the last n pages you can assign a negative value on iOS. - * Only supported on iOS, Android - */ - pageCount?: number; - - /** - * Specifies the duplex mode to use for the print job. - * Either double-sided on short site (duplex:'short'), - * double-sided on long site (duplex:'long') or single-sided (duplex:'none'). - */ - duplex?: boolean; - - /** - * The orientation of the printed content, portrait or landscape - * Portrait by default. - */ - orientation?: 'landscape' | 'portrait'; - - /** - * If your application only prints black text, setting this property to true can result in better performance in many cases. - * False by default. - */ - monochrome?: boolean; - - /** - * If your application only prints black text, setting this property to true can result in better performance in many cases. - * False by default. - * Only supported on iOS, Windows - */ - photo?: boolean; - - /** - * Set to false to disable downscaling the image to fit into the content aread. - * Only supported on Android - */ - autoFit?: boolean; - - /** - * The network URL to the printer. - * Only supported on iOS - */ - printer?: string; - - /** - * Defines the maximum size of the content area. - * Only supported on iOS - */ - maxHeight?: string; - - /** - * Defines the maximum size of the content area. - * Only supported on iOS - */ - maxWidth?: string; - - /** - * Set to false to avoid margins. - * The margins for each printed page. Each printer might have its own minimum margins depends on media type and paper format. - */ - margin?: - | boolean - | { - top?: string; - left?: string; - right?: string; - bottom?: string; - }; - - ui?: { - hideNumberOfCopies?: string; // Set to true to hide the control for the number of copies. Only supported on iOS - hidePaperFormat?: string; // Set to true to hide the control for the paper format. Only supported on iOS - top?: number; // The position of the printer picker. Only supported on iPad - left?: number; // The position of the printer picker. Only supported on iPad - height?: number; // The size of the printer picker. Only supported on iPad - width?: number; // The size of the printer picker. Only supported on iPad - }; - - paper?: { - width: string; // The dimensions of the paper – iOS will will try to choose a format which fits bests. Only supported on iOS - height: string; // The dimensions of the paper – iOS will will try to choose a format which fits bests. Only supported on iOS - name: string; // The name of the format like IsoA4 or Roll22Inch. https://docs.microsoft.com/en-us/uwp/api/windows.graphics.printing.printmediasize. Only supported on Windows - length: string; // On roll-fed printers you can decide when the printer cuts the paper. https://docs.microsoft.com/en-us/uwp/api/windows.graphics.printing.printmediasize. Only supported on iOs - }; - - font?: FontOptions; - - header?: { - height: string; // The height of the header or footer on each page. Only supported on iOS - labels: string[]; // An array of labels to display. Only use if there are more then one. Only supported on iOS - label: HeaderFooterLabelOptions; - }; - - footer?: { - height: string; // The height of the header or footer on each page. Only supported on iOS - labels: string[]; // An array of labels to display. Only use if there are more then one. Only supported on iOS - label: HeaderFooterLabelOptions; - }; -} - -/** - * @name Printer - * @description Prints documents or HTML rendered content - * @usage - * ```typescript - * import { Printer, PrintOptions } from '@awesome-cordova-plugins/printer/ngx'; - * - * constructor(private printer: Printer) { } - * - * ... - * - * this.printer.isAvailable().then(onSuccess, onError); - * - * let options: PrintOptions = { - * name: 'MyDocument', - * duplex: true, - * orientation: 'landscape', - * monochrome: true - * } - * - * this.printer.print(content, options).then(onSuccess, onError); - * ``` - * @interfaces - * PrintOptions - */ -@Plugin({ - pluginName: 'Printer', - plugin: 'cordova-plugin-printer', - pluginRef: 'cordova.plugins.printer', - repo: 'https://github.com/katzer/cordova-plugin-printer', - platforms: ['Android', 'iOS', 'Windows'], -}) -@Injectable() -export class Printer extends AwesomeCordovaNativePlugin { - /** - * Checks whether the device is capable of printing (uses `check()` internally) - * - * @returns {Promise} - */ - isAvailable(): Promise { - return this.check().then((res: any) => Promise.resolve(res.avail)); - } - - /** - * Checks To check if printing is supported in general - * - * @returns {Promise} returns a promise that resolve with an object indicating whether printing is available - */ - @CordovaCheck() - check(): Promise { - return getPromise((resolve: Function) => { - Printer.getPlugin().canPrintItem((avail: boolean, count: any) => { - resolve({ avail, count }); - }); - }); - } - - /** - * Displays a system interface allowing the user to select an available printer. To speak with a printer directly you need to know the network address by picking them before via `printer.pick`. - * - * @returns {Promise} - */ - @Cordova() - pick(): Promise { - return; - } - - /** - * Sends content to the printer. - * - * @param content {string | HTMLElement} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used. - * @param options {PrintOptions} optional. The options to pass to the printer - * @returns {Promise} - */ - @Cordova({ - successIndex: 2, - errorIndex: 4, - }) - print(content?: string | HTMLElement, options?: PrintOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/pspdfkit-cordova/index.ts b/src/@awesome-cordova-plugins/plugins/pspdfkit-cordova/index.ts deleted file mode 100644 index 63147c63..00000000 --- a/src/@awesome-cordova-plugins/plugins/pspdfkit-cordova/index.ts +++ /dev/null @@ -1,636 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Plugin, - Cordova, - CordovaProperty, - CordovaInstance, - InstanceProperty, - AwesomeCordovaNativePlugin, -} from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name PSPDFKit-Cordova - * @description - * The official plugin to use PSPDFKit with Cordova and Ionic. - * @usage - * ```typescript - * import { PSPDFKit } from '@awesome-cordova-plugins/pspdfkit-cordova/ngx'; - * - * - * constructor(private pspdfkit: PSPDFKit) { } - * - * ... - * - * // Set your license key here. - * this.pspdfkit.setLicenseKey("YOUR KEY"); - * - * // Show a PDF in single page mode, with a black background. - * this.pspdfkit.present('document.pdf', {pageMode: 'single', backgroundColor: "black"}) - * .then(result => { - * console.log(result); // Success - * }) - * .catch(error => { - * console.log(error); // Failed - * }); - * } - * - * // Scroll to page at index 1. - * this.pspdfkit.setPage(1, true); - * - * ``` - */ -@Plugin({ - pluginName: 'PSPDFKit', - plugin: 'pspdfkit-cordova', - pluginRef: 'PSPDFKit', - repo: 'https://github.com/PSPDFKit/PSPDFKit-Cordova', - install: 'ionic cordova plugin add pspdfkit-cordova', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class PSPDFKit extends AwesomeCordovaNativePlugin { - /** - * Activates PSPDFKit with your license key from https://customers.pspdfkit.com. - * - * @param key {string} The license key. - * @param licenseKey - * @returns {Promise} Success and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - setLicenseKey(licenseKey: string): Promise { - return; - } - - /** - * iOS: Displays a PDF in a full-screen modal. - * Android: Opens the PSPDFActivity to show a document from the local device file system. - * - * @param path {string} The path should be a string containing the file path (not URL) for the PDF. Relative paths are assumed to be relative to the www directory (if the path has a different base URL set, this will be ignored). To specify a path inside the application documents or library directory, use a `~`, e.g. `"~/Documents/mypdf.pdf"` or `"~/Library/Application Support/mypdf.pdf"`. Path can be null, but must not be omitted - * @param options {any} The `options` parameter is an optional object containing configuration properties for the PDF document and/or view controller. All currently supported values are listed below under Options. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - present(path: string, options?: any): Promise { - return; - } - - /** - * Opens the PSPDFActivity to show a document from the app's assets folder. This method copies the - * file to the internal app directory on the device before showing it. - * - * @param assetFile {string} Relative path within the app's assets folder. - * @param options {any} PSPDFKit configuration options. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -Android - */ - @Cordova() - presentFromAssets(assetFile: string, options?: any): Promise { - return; - } - - /** - * Displays a PDF in a full-screen modal and imports annotations from a given XFDF file. - * - * @param path {string} Should be a string containing the file path (not URL) for the PDF. Relative paths are assumed to be relative to the www directory (if the path has a different base URL set, this will be ignored). To specify a path inside the application documents or library directory, use a `~`, e.g. `"~/Documents/mypdf.pdf"` or `"~/Library/Application Support/mypdf.pdf"`. Path can be null, but must not be omitted - * @param xfdfPath {string} should be a string containing the file path (not URL) for the XFDF file backing the PDF document. Relative paths are assumed to be relative to the www directory (if the xfdf path has a different base URL set, we will create an XFDF file in `'"~/Documents/" + xfdfPath'`). To specify a path inside the application documents or library directory, use a ~, e.g. `"~/Documents/myXFDF.xfdf"` or `"~/Library/Application Support/myXFDF.xfdf"`. The xfdfPath cannot be null and must not be omitted. - * @param options {any} The `options` parameter is an optional object containing configuration properties for the PDF document and/or view controller. All currently supported values are listed below under Options. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - presentWithXFDF(path: string, xfdfPath: string, options?: any): Promise { - return; - } - - /** - * iOS: Dismisses the modally presented PDF view. - * Android: Dismisses any previously launched PDF activity. Calls the optional callback function after all activities have been dismissed. - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - dismiss(): Promise { - return; - } - - /** - * Reloads the current PDF. - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - reload(): Promise { - return; - } - /** - * Saves the document to original location if it has been changed. If there were no changes to the - * document, the document file will not be modified. - * Provides "wasModified" as a part of a successful response which will be equal to true if - * the file was modified and changes were saved. false if there was nothing to save. - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -Android - */ - @Cordova() - saveDocument(): Promise { - return; - } - - /** - * Saves any changed annotations in the current document. - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - saveAnnotations(): Promise { - return; - } - - /** - * Return true in the success (or result) callback if the document has unsaved annotation. Returns false otherwise. - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - getHasDirtyAnnotations(): Promise { - return; - } - - /** - * Triggers a search for the specified query. - * - * @param query {string} Search Term to query - * @param animated {boolean} Determines if the search should be animated (if omitted, the search will not be animated). The optional headless argument determines whether the search UI should be disaplyed (if omitted, the search UI *will* be displayed). - * @param headless {boolean} Determines whether the search UI should be disaplyed (if omitted, the search UI *will* be displayed). - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - search(query: string, animated?: boolean, headless?: boolean): Promise { - return; - } - - /** - * Sets multiple document and view controller settings at once. - * - * @param options {any} The options set will be applied to the current document (if there is one) as well as all subsequently displayed documents. All currently supported values are listed below under Options. - * @param animated {boolean} determines if the property should be animated. Not all property changes can be animated, so if the property does not support animation the animated argument will be ignored. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - setOptions(options: any, animated: boolean): Promise { - return; - } - - /** - * Gets several document or view controller options in a single call. - * - * @param names {any} array of option names - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - getOptions(names: any): Promise { - return; - } - - /** - * Sets a single document or view controller settings at once. - * - * @param name {string} the option name - * @param value {any} the option value - * @param animated {boolean} determines if the property should be animated. Not all property changes can be animated, so if the property does not support animation the animated argument will be ignored. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - setOption(name: string, value: any, animated: boolean): Promise { - return; - } - - /** - * Gets a single document or view controller settings at once. - * - * @param name {string} the option name - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - getOption(name: string): Promise { - return; - } - - /** - * Sets the current visible page. - * - * @param page {number} the page index - * @param animated {boolean} Optional argument. Determines if the page change should be animated (if omitted, the search will not be animated). - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - setPage(page: number, animated?: boolean): Promise { - return; - } - - /** - * Gets the currently visible page. - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - getPage(): Promise { - return; - } - - /** - * Gets the page count of the current document. - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - getPageCount(): Promise { - return; - } - - /** - * Scrolls to the next page. - * - * @param animated {boolean} Optional argument. Determines if the page change should be animated (if omitted, the search will not be animated). - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - scrollToNextPage(animated?: boolean): Promise { - return; - } - - /** - * Scrolls to the previous page. - * - * @param animated {boolean} Optional argument. Determines if the page change should be animated (if omitted, the search will not be animated). - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - scrollToPreviousPage(animated?: boolean): Promise { - return; - } - - /** - * Sets the appearance mode. - * - * @param appearanceMode {string} the appearance mode. Can be 'default', 'sepia', or 'night' - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - setAppearanceMode(appearanceMode: string): Promise { - return; - } - - /** - * Clears the entire render cache. This invalidates render caches for all previously rendered documents. - * Consider using `removeCacheForPresentedDocument()` or `clearCacheForPage()` instead of this, - * since invalidating single documents or specific page caches since excessive cache invalidation may decrease performance. - * - * @param clearDiskCache {boolean} optional parameter. Android: if set to true clears disk cache as well. iOS: has no effect. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - clearCache(clearDiskCache?: boolean): Promise { - return; - } - - /** - * Clears the cache from the currently presented document. - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - removeCacheForPresentedDocument(): Promise { - return; - } - - /** - * Invalidates the render cache for the specified page. - * - * @param pageIndex {number} 0-based index of the page whose render cache should be invalidated. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -Android - */ - @Cordova() - clearCacheForPage(pageIndex: number): Promise { - return; - } - - /** - * Hides the annotation toolbar - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - hideAnnotationToolbar(): Promise { - return; - } - - /** - * Shows the annotation toolbar - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - showAnnotationToolbar(): Promise { - return; - } - - /** - * Toggles the annotation toolbar - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - toggleAnnotationToolbar(): Promise { - return; - } - - /** - * Applies the passed in document Instant JSON. - * - * @param jsonValue {string} The document Instant JSON to apply. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - applyInstantJSON(jsonValue: string): Promise { - return; - } - - /** - * Adds a new annotation to the current document using the Instant JSON Annotation - * payload - https://pspdfkit.com/guides/ios/current/importing-exporting/instant-json/#instant-annotation-json-api - * - * @param jsonAnnotation {string} Instant JSON of the annotation to add. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - addAnnotation(jsonAnnotation: string): Promise { - return; - } - - /** - * Removes a given annotation from the current document. The annotaion is expected to be in Instant - * JSON format - https://pspdfkit.com/guides/ios/current/importing-exporting/instant-json/#instant-annotation-json-api - * - * @param jsonAnnotation {string} Instant JSON of the annotation to remove. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - removeAnnotation(jsonAnnotation: string): Promise { - return; - } - - /** - * Gets all annotations of the given type from the page. - * - * @param pageIndex {number} The page to get the annotations for. - * @param type {string} The type of annotations to get (See here for types https://pspdfkit.com/guides/server/current/api/json-format/) or `null` to get all annotations. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - getAnnotations(pageIndex: number, type?: string): Promise { - return; - } - - /** - * Gets all unsaved changes to annotations. - * - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - getAllUnsavedAnnotations(): Promise { - return; - } - - /** - * Sets the value of the form element of the fully qualified name. - * - * @param value {string} the value. - * @param fullyQualifiedName {string} the fully qualified name of the form element. - * @returns {Promise} callback Success (result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - setFormFieldValue(value: string, fullyQualifiedName: string): Promise { - return; - } - - /** - * Gets the value of the form element of the fully qualified name. - * - * @param fullyQualifiedName {string} description. - * @returns {Promise} callback Success (result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - getFormFieldValue(fullyQualifiedName: string): Promise { - return; - } - - /** - * Imports all annotations from the specified XFDF file to the current document. - * - * @param xfdfPath {string} XFDF file path to import annotations - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - importXFDF(xfdfPath: string): Promise { - return; - } - - /** - * Exports all annotations from the current document to the specified XFDF file path. - * - * @param xfdfPath {string} XFDF file path to export annotations - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - exportXFDF(xfdfPath: string): Promise { - return; - } - - /** - * Processes annotations (embed, remove, flatten, or print) and saves the processed document to the given document path. - * - * @param annotationChange {string} the annotation change. Can be 'flatten', 'remove', 'embed' or 'print' - * @param processedDocumentPath {string} description. - * @param annotationType {string} The optional string annotationType argument. If omitted, we process 'All' annotations. The annotation type can have one of the following values: None, Undefined, Link, Highlight, StrikeOut, Underline, Squiggly, FreeText, Ink, Square, Circle, Line, Text, Stamp, Caret, RichMedia, Screen, Widget, Sound, FileAttachment, Polygon, PolyLine, Popup, Watermark, TrapNet, 3D, Redact, All. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - * -Android - */ - @Cordova() - processAnnotations(annotationChange: string, processedDocumentPath: string, annotationType: string): Promise { - return; - } - - /** - * Generates a PDF document from HTML string. - * - * @param html {string} HTML string. - * @param fileName {string} File name of the generated PDF. - * @param options {string} Options to be considered when converting the HTML string to PDF. - * @returns {Promise} callback Success (or result) and error callback function. - * - * __Supported Platforms__ - * - * -iOS - */ - @Cordova() - convertPDFFromHTMLString(html: string, fileName: string, options: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/purchases/index.ts b/src/@awesome-cordova-plugins/plugins/purchases/index.ts deleted file mode 100644 index 23e50931..00000000 --- a/src/@awesome-cordova-plugins/plugins/purchases/index.ts +++ /dev/null @@ -1,1181 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export enum ATTRIBUTION_NETWORK { - APPLE_SEARCH_ADS = 0, - ADJUST = 1, - APPSFLYER = 2, - BRANCH = 3, - TENJIN = 4, - FACEBOOK = 5, -} - -export enum PURCHASE_TYPE { - /** - * A type of SKU for in-app products. - */ - INAPP = 'inapp', - - /** - * A type of SKU for subscriptions. - */ - SUBS = 'subs', -} - -/** - * Enum for billing features. - * Currently, these are only relevant for Google Play Android users: - * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType - */ -export enum BILLING_FEATURE { - /** - * Purchase/query for subscriptions. - */ - SUBSCRIPTIONS, - - /** - * Subscriptions update/replace. - */ - SUBSCRIPTIONS_UPDATE, - - /** - * Purchase/query for in-app items on VR. - */ - IN_APP_ITEMS_ON_VR, - - /** - * Purchase/query for subscriptions on VR. - */ - SUBSCRIPTIONS_ON_VR, - - /** - * Launch a price change confirmation flow. - */ - PRICE_CHANGE_CONFIRMATION, -} - -export enum PRORATION_MODE { - UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0, - - /** - * Replacement takes effect immediately, and the remaining time will be - * prorated and credited to the user. This is the current default behavior. - */ - IMMEDIATE_WITH_TIME_PRORATION = 1, - - /** - * Replacement takes effect immediately, and the billing cycle remains the - * same. The price for the remaining period will be charged. This option is - * only available for subscription upgrade. - */ - IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2, - - /** - * Replacement takes effect immediately, and the new price will be charged on - * next recurrence time. The billing cycle stays the same. - */ - IMMEDIATE_WITHOUT_PRORATION = 3, - - /** - * Replacement takes effect when the old plan expires, and the new price will - * be charged at the same time. - */ - DEFERRED = 4, -} - -export enum PACKAGE_TYPE { - /** - * A package that was defined with a custom identifier. - */ - UNKNOWN = 'UNKNOWN', - - /** - * A package that was defined with a custom identifier. - */ - CUSTOM = 'CUSTOM', - - /** - * A package configured with the predefined lifetime identifier. - */ - LIFETIME = 'LIFETIME', - - /** - * A package configured with the predefined annual identifier. - */ - ANNUAL = 'ANNUAL', - - /** - * A package configured with the predefined six month identifier. - */ - SIX_MONTH = 'SIX_MONTH', - - /** - * A package configured with the predefined three month identifier. - */ - THREE_MONTH = 'THREE_MONTH', - - /** - * A package configured with the predefined two month identifier. - */ - TWO_MONTH = 'TWO_MONTH', - - /** - * A package configured with the predefined monthly identifier. - */ - MONTHLY = 'MONTHLY', - - /** - * A package configured with the predefined weekly identifier. - */ - WEEKLY = 'WEEKLY', -} - -export enum INTRO_ELIGIBILITY_STATUS { - /** - * RevenueCat doesn't have enough information to determine eligibility. - */ - INTRO_ELIGIBILITY_STATUS_UNKNOWN = 0, - /** - * The user is not eligible for a free trial or intro pricing for this product. - */ - INTRO_ELIGIBILITY_STATUS_INELIGIBLE, - /** - * The user is eligible for a free trial or intro pricing for this product. - */ - INTRO_ELIGIBILITY_STATUS_ELIGIBLE, - /** - * There is no free trial or intro pricing for this product. - */ - INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS, -} - -/** - * @name Purchases - * @description - * Purchases is a cross platform solution for managing in-app subscriptions. A backend is also provided via [RevenueCat](https://www.revenuecat.com) - * - * ## Features - * | | RevenueCat | - * | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | - * | ✅ | Server-side receipt validation | - * | ➡️ | [Webhooks](https://docs.revenuecat.com/docs/webhooks) - enhanced server-to-server communication with events for purchases, renewals, cancellations, and more | - * | 🎯 | Subscription status tracking - know whether a user is subscribed whether they're on iOS, Android or web | - * | 📊 | Analytics - automatic calculation of metrics like conversion, mrr, and churn | - * | 📝 | [Online documentation](https://docs.revenuecat.com/docs) up to date | - * | 🔀 | [Integrations](https://www.revenuecat.com/integrations) - over a dozen integrations to easily send purchase data where you need it | - * | 💯 | Well maintained - [frequent releases](https://github.com/RevenueCat/cordova-plugin-purchases/releases) | - * | 📮 | Great support - [Help Center](https://revenuecat.zendesk.com) | - * | 🤩 | Awesome [new features](https://trello.com/b/RZRnWRbI/revenuecat-product-roadmap) | - * - * ## Getting Started - * - * For more detailed information, you can view our complete documentation at [docs.revenuecat.com](https://docs.revenuecat.com/docs). - * @usage - * #### 1. Get a RevenueCat API key - * - * Log in to the [RevenueCat dashboard](https://app.revenuecat.com) and obtain a free API key for your application. - * - * #### 2. Initialize the SDK - * - * You should only configure _Purchases_ once (usually on app launch) as soon as your app has a unique user id for your user. This can be when a user logs in if you have accounts or on launch if you can generate a random user identifier. - * - * ```typescript - * import { Platform } from "@ionic/angular"; - * import { Purchases } from "@awesome-cordova-plugins/purchases/ngx"; - * - * constructor(public platform: Platform, private purchases: Purchases) { - * platform.ready().then(() => { - * this.purchases.setDebugLogsEnabled(true); // Enable to get debug logs - * this.purchases.configure("my_api_key", "my_app_user_id"); - * } - * } - * ``` - * - * #### 3. Quickstart - * Please follow the [Quickstart Guide](https://docs.revenuecat.com/docs/) for more information on how to use the SDK - * - * ### Requirements - * Requires XCode 11.0+ and minimum target iOS 9.0+ - * This plugin has been tested with cordova-plugin-purchases@ - * @interfaces - * PurchasesError - * IntroEligibility - * UpgradeInfo - * PurchasesOfferings - * PurchasesOffering - * PurchasesPackage - * PurchasesStoreProduct - * CustomerInfo - * PurchasesEntitlementInfos - * PurchasesEntitlementInfo - * PurchasesStoreTransaction - */ -@Plugin({ - pluginName: 'Purchases', - plugin: 'cordova-plugin-purchases@3.2.1', - pluginRef: 'Purchases', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/RevenueCat/cordova-plugin-purchases', // the github repository URL for the plugin - platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] -}) -@Injectable({ - providedIn: 'root', -}) -export class Purchases extends AwesomeCordovaNativePlugin { - /** - * Enum for attribution networks - * - * @readonly - * @enum {number} - */ - static ATTRIBUTION_NETWORK = ATTRIBUTION_NETWORK; - - /** - * Supported SKU types. - * - * @readonly - * @enum {string} - */ - static PURCHASE_TYPE = PURCHASE_TYPE; - - /** - * Enum for billing features. - * Currently, these are only relevant for Google Play Android users: - * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType - */ - static BILLING_FEATURE = BILLING_FEATURE; - - /** - * Replace SKU's ProrationMode. - * - * @readonly - * @enum {number} - */ - static PRORATION_MODE = PRORATION_MODE; - - /** - * Enumeration of all possible Package types. - * - * @readonly - * @enum {string} - */ - static PACKAGE_TYPE = PACKAGE_TYPE; - - /** - * Enum of different possible states for intro price eligibility status. - * - * @readonly - * @enum {number} - */ - static INTRO_ELIGIBILITY_STATUS = INTRO_ELIGIBILITY_STATUS; - - /** - * @deprecated Use {@link configureWith} instead. It accepts a {@link PurchasesConfiguration} object which offers more flexibility. - * - * Sets up Purchases with your API key and an app user id. - * - * @param {string} apiKey RevenueCat API Key. Needs to be a String - * @param {string?} appUserID A unique id for identifying the user - * @param {boolean} observerMode An optional boolean. Set this to TRUE if you have your own IAP implementation and - * want to use only RevenueCat's backend. Default is FALSE. If you are on Android and setting this to ON, you will have - * to acknowledge the purchases yourself. - * @param {string?} userDefaultsSuiteName An optional string. iOS-only, will be ignored for Android. - * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults - * suite, otherwise it will use standardUserDefaults. Default is null, which will make the SDK use standardUserDefaults. - */ - @Cordova({ sync: true }) - configure(apiKey: string, appUserID?: string | null, observerMode = false, userDefaultsSuiteName?: string): void {} - - /** - * Sets up Purchases with your API key and an app user id. - * @param {PurchasesConfiguration} Object containing configuration parameters - */ - @Cordova({ sync: true }) - configureWith({ apiKey, appUserID, observerMode, userDefaultsSuiteName, useAmazon }: PurchasesConfiguration): void {} - - /** - * Gets the Offerings configured in the dashboard - * - * @returns {Promise} Will return a [PurchasesError] if the offerings are not properly configured in RevenueCat or if there is another error retrieving them. - */ - @Cordova() - getOfferings(): Promise { - return; - } - - /** - * Fetch the product info - * - * @param {string[]} productIdentifiers Array of product identifiers - * @param {PURCHASE_TYPE} type Optional type of products to fetch, can be inapp or subs. Subs by default - * @returns {Promise} Will return a [PurchasesError] if the products are not properly configured in RevenueCat or if there is another error retrieving them. - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - getProducts( - productIdentifiers: string[], - type: PURCHASE_TYPE = PURCHASE_TYPE.SUBS - ): Promise { - return; - } - - /** - * Make a purchase - * - * @param {string} productIdentifier The product identifier of the product you want to purchase. - * @param {UpgradeInfo} upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU - * and the optional prorationMode. - * @param {PURCHASE_TYPE} type Optional type of product, can be inapp or subs. Subs by default - * @returns {Promise} A [PurchasesError] is triggered after an error or when the user cancels the purchase. - * If user cancelled, userCancelled will be true - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - purchaseProduct( - productIdentifier: string, - upgradeInfo?: UpgradeInfo | null, - type: PURCHASE_TYPE = PURCHASE_TYPE.SUBS - ): Promise<{ productIdentifier: string; customerInfo: CustomerInfo }> { - return; - } - - /** - * Make a purchase - * - * @param {PurchasesPackage} aPackage The Package you wish to purchase. You can get the Packages by calling getOfferings - * @param {UpgradeInfo} upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU - * and the optional prorationMode. - * @returns {Promise} A [PurchasesError] is triggered after an error or when the user cancels the purchase. - * If user cancelled, userCancelled will be true - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - purchasePackage( - aPackage: PurchasesPackage, - upgradeInfo?: UpgradeInfo | null - ): Promise<{ productIdentifier: string; customerInfo: CustomerInfo }> { - return; - } - - /** - * Restores a user's previous purchases and links their appUserIDs to any user's also using those purchases. - * - * @returns {Promise} Errors are of type [PurchasesError] - */ - @Cordova() - restorePurchases(): Promise { - return; - } - - /** - * Get the appUserID that is currently in placed in the SDK - * - * @returns {string} - */ - @Cordova({ sync: true }) - getAppUserID(): string { - return; - } - - /** - * This function will logIn the current user with an appUserID. Typically this would be used after a log in - * to identify a user without calling configure. - * - * @param {string} appUserID The appUserID that should be linked to the currently user - * @returns {Promise} an object that contains the customerInfo after logging in, as well as a boolean indicating - * whether the user has just been created for the first time in the RevenueCat backend. - */ - @Cordova() - logIn(appUserID: string): Promise { - return; - } - - /** - * Logs out the Purchases client clearing the saved appUserID. This will generate a random user id and save it in the cache. - * If the current user is already anonymous, this will produce a PurchasesError. - * - * @returns {Promise} new purchaser info after resetting. - */ - @Cordova() - logOut(): Promise { - return; - } - - /** - * Gets the current purchaser info. This call will return the cached purchaser info unless the cache is stale, in which case, - * it will make a network call to retrieve it from the servers. - * - * @returns {Promise} Errors are of type [PurchasesError] and get normally triggered if there - * is an error retrieving the purchaser info. - */ - @Cordova() - getCustomerInfo(): Promise { - return; - } - - /** - * Returns an observable that can be used to receive updates on the purchaser info - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'onCustomerInfoUpdated', - element: 'window', - }) - onCustomerInfoUpdated(): Observable { - return; - } - - /** - * Enables/Disables debugs logs - * - * @param {boolean} enabled true to enable debug logs, false to disable - */ - @Cordova({ sync: true }) - setDebugLogsEnabled(enabled: boolean): void {} - - /** - * This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation - * for subscriptions anytime a sync is needed, like after a successful purchase. - * - * @warning This function should only be called if you're not calling purchaseProduct. - */ - @Cordova({ sync: true }) - syncPurchases(): void {} - - /** - * iOS only. - * - * @param {boolean} enabled Set this property to true *only* when testing the ask-to-buy / SCA purchases flow. - * More information: http://errors.rev.cat/ask-to-buy - */ - @Cordova({ sync: true }) - setSimulatesAskToBuyInSandbox(enabled: boolean): void {} - - /** - * Enable automatic collection of Apple Search Ads attribution. Disabled by default. - * - * @param {boolean} enabled Enable or not automatic collection - */ - @Cordova({ sync: true }) - setAutomaticAppleSearchAdsAttributionCollection(enabled: boolean): void {} - - /** - * Enable automatic collection of Apple Search Ads attribution using AdServices. Disabled by default. - */ - @Cordova({ sync: true }) - enableAdServicesAttributionTokenCollection(): void {} - - /** - * @returns {Promise} A boolean indicating if the `appUserID` has been generated - * by RevenueCat or not. - */ - @Cordova({ sync: true }) - isAnonymous(): boolean { - return; - } - - /** - * iOS only. Computes whether or not a user is eligible for the introductory pricing period of a given product. - * You should use this method to determine whether or not you show the user the normal product price or the - * introductory price. This also applies to trials (trials are considered a type of introductory pricing). - * - * @note Subscription groups are automatically collected for determining eligibility. If RevenueCat can't - * definitively compute the eligibility, most likely because of missing group information, it will return - * `INTRO_ELIGIBILITY_STATUS_UNKNOWN`. The best course of action on unknown status is to display the non-intro - * pricing, to not create a misleading situation. To avoid this, make sure you are testing with the latest version of - * iOS so that the subscription group can be collected by the SDK. Android always returns INTRO_ELIGIBILITY_STATUS_UNKNOWN. - * @param productIdentifiers Array of product identifiers for which you want to compute eligibility - * @returns { Promise> } Map of IntroEligibility per productId - */ - @Cordova() - checkTrialOrIntroductoryPriceEligibility( - productIdentifiers: string[] - ): Promise<{ [productId: string]: IntroEligibility }> { - return; - } - - /** - * Sets a function to be called on purchases initiated on the Apple App Store. This is only used in iOS. - * - * @param {ShouldPurchasePromoProductListener} shouldPurchasePromoProductListener Called when a user initiates a - * promotional in-app purchase from the App Store. If your app is able to handle a purchase at the current time, run - * the deferredPurchase function. If the app is not in a state to make a purchase: cache the deferredPurchase, then - * call the deferredPurchase when the app is ready to make the promotional purchase. - * If the purchase should never be made, you don't need to ever call the deferredPurchase and the app will not - * proceed with promotional purchases. - */ - @Cordova({ sync: true }) - addShouldPurchasePromoProductListener(shouldPurchasePromoProductListener: ShouldPurchasePromoProductListener): void {} - - /** - * Removes a given ShouldPurchasePromoProductListener - * - * @param {ShouldPurchasePromoProductListener} listenerToRemove ShouldPurchasePromoProductListener reference of the listener to remove - * @returns {boolean} True if listener was removed, false otherwise - */ - @Cordova({ sync: true }) - removeShouldPurchasePromoProductListener(listenerToRemove: ShouldPurchasePromoProductListener): boolean { - return; - } - - /** - * Invalidates the cache for customer information. - * - * Most apps will not need to use this method; invalidating the cache can leave your app in an invalid state. - * Refer to https://docs.revenuecat.com/docs/customer-info#section-get-user-information for more information on - * using the cache properly. - * - * This is useful for cases where customer information might have been updated outside of the - * app, like if a promotional subscription is granted through the RevenueCat dashboard. - */ - @Cordova({ sync: true }) - invalidateCustomerInfoCache(): void {} - - /** - * iOS only. Presents a code redemption sheet, useful for redeeming offer codes - * Refer to https://docs.revenuecat.com/docs/ios-subscription-offers#offer-codes for more information on how - * to configure and use offer codes. - */ - @Cordova({ sync: true }) - presentCodeRedemptionSheet(): void {} - - /** - * Subscriber attributes are useful for storing additional, structured information on a user. - * Since attributes are writable using a public key they should not be used for - * managing secure or sensitive information such as subscription status, coins, etc. - * - * Key names starting with "$" are reserved names used by RevenueCat. For a full list of key - * restrictions refer to our guide: https://docs.revenuecat.com/docs/subscriber-attributes - * - * @param attributes Map of attributes by key. Set the value as an empty string to delete an attribute. - */ - @Cordova({ sync: true }) - setAttributes(attributes: { [key: string]: string | null }): void {} - - /** - * Subscriber attribute associated with the email address for the user - * - * @param email Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setEmail(email: string | null): void {} - - /** - * Subscriber attribute associated with the phone number for the user - * - * @param phoneNumber Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setPhoneNumber(phoneNumber: string | null): void {} - - /** - * Subscriber attribute associated with the display name for the user - * - * @param displayName Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setDisplayName(displayName: string | null): void {} - - /** - * Subscriber attribute associated with the push token for the user - * - * @param pushToken Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setPushToken(pushToken: string | null): void {} - - /** - * Subscriber attribute associated with the Adjust Id for the user - * Required for the RevenueCat Adjust integration - * - * @param adjustID Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setAdjustID(adjustID: string | null): void {} - - /** - * Subscriber attribute associated with the AppsFlyer Id for the user - * Required for the RevenueCat AppsFlyer integration - * - * @param appsflyerID Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setAppsflyerID(appsflyerID: string | null): void {} - - /** - * Subscriber attribute associated with the Facebook SDK Anonymous Id for the user - * Recommended for the RevenueCat Facebook integration - * - * @param fbAnonymousID Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setFBAnonymousID(fbAnonymousID: string | null): void {} - - /** - * Subscriber attribute associated with the mParticle Id for the user - * Recommended for the RevenueCat mParticle integration - * - * @param mparticleID Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setMparticleID(mparticleID: string | null): void {} - - /** - * Subscriber attribute associated with the OneSignal Player Id for the user - * Required for the RevenueCat OneSignal integration - * - * @param onesignalID Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setOnesignalID(onesignalID: string | null): void {} - - /** - * Subscriber attribute associated with the Airship Channel Id for the user - * Required for the RevenueCat Airship integration - * - * @param airshipChannelID Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setAirshipChannelID(airshipChannelID: string | null): void {} - - /** - * Subscriber attribute associated with the Firebase App Instance ID for the user - * Required for the RevenueCat Firebase integration - * - * @param firebaseAppInstanceID Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setFirebaseAppInstanceID(firebaseAppInstanceID: string | null): void {} - - /** - * Subscriber attribute associated with the Mixpanel Distinct ID for the user - * Required for the RevenueCat Mixpanel integration - * - * @param mixpanelDistinctID Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setMixpanelDistinctID(mixpanelDistinctID: string | null): void {} - - /** - * Subscriber attribute associated with the CleverTap ID for the user - * Required for the RevenueCat CleverTap integration - * - * @param cleverTapID Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setCleverTapID(cleverTapID: string | null): void {} - - /** - * Subscriber attribute associated with the install media source for the user - * - * @param mediaSource Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setMediaSource(mediaSource: string | null): void {} - - /** - * Subscriber attribute associated with the install campaign for the user - * - * @param campaign Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setCampaign(campaign: string | null): void {} - - /** - * Subscriber attribute associated with the install ad group for the user - * - * @param adGroup Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setAdGroup(adGroup: string | null): void {} - - /** - * Subscriber attribute associated with the install ad for the user - * - * @param ad Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setAd(ad: string | null): void {} - - /** - * Subscriber attribute associated with the install keyword for the user - * - * @param keyword Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setKeyword(keyword: string | null): void {} - - /** - * Subscriber attribute associated with the install ad creative for the user - * - * @param creative Empty String or null will delete the subscriber attribute. - */ - @Cordova({ sync: true }) - setCreative(creative: string | null): void {} - - /** - * Automatically collect subscriber attributes associated with the device identifiers. - * $idfa, $idfv, $ip on iOS - * $gpsAdId, $androidId, $ip on Android - */ - @Cordova({ sync: true }) - collectDeviceIdentifiers(): void {} - - /** - * Check if billing is supported for the current user (meaning IN-APP purchases are supported) - * and optionally, whether a list of specified feature types are supported. - * - * Note: Billing features are only relevant to Google Play Android users. - * For other stores and platforms, billing features won't be checked. - * - * @param features An array of feature types to check for support. Feature types must be one of - * [BILLING_FEATURE]. By default, is an empty list and no specific feature support will be checked. - * @returns {Promise} Or [PurchasesError] if there is an error. - */ - @Cordova() - canMakePayments(features: BILLING_FEATURE[] = []): Promise { - return; - } - - /** - * Set this property to your proxy URL before configuring Purchases *only* if you've received a proxy key value from your RevenueCat contact. - * - * @param url Proxy URL as a string. - */ - @Cordova({ sync: true }) - setProxyURL(url: string): void {} -} -/** - * The EntitlementInfo object gives you access to all of the information about the status of a user entitlement. - */ -export interface PurchasesEntitlementInfo { - /** - * The entitlement identifier configured in the RevenueCat dashboard - */ - readonly identifier: string; - /** - * True if the user has access to this entitlement - */ - readonly isActive: boolean; - /** - * True if the underlying subscription is set to renew at the end of the billing period (expirationDate). - * Will always be True if entitlement is for lifetime access. - */ - readonly willRenew: boolean; - /** - * The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL. - */ - readonly periodType: string; - /** - * The latest purchase or renewal date for the entitlement. - */ - readonly latestPurchaseDate: string; - /** - * The first date this entitlement was purchased. - */ - readonly originalPurchaseDate: string; - /** - * The expiration date for the entitlement, can be `null` for lifetime access. If the `periodType` is `trial`, - * this is the trial expiration date. - */ - readonly expirationDate: string | null; - /** - * The store where this entitlement was unlocked from. Either: appStore, macAppStore, playStore, stripe, - * promotional, unknownStore - */ - readonly store: string; - /** - * The product identifier that unlocked this entitlement - */ - readonly productIdentifier: string; - /** - * False if this entitlement is unlocked via a production purchase - */ - readonly isSandbox: boolean; - /** - * The date an unsubscribe was detected. Can be `null`. - * - * @note: Entitlement may still be active even if user has unsubscribed. Check the `isActive` property. - */ - readonly unsubscribeDetectedAt: string | null; - /** - * The date a billing issue was detected. Can be `null` if there is no billing issue or an issue has been resolved - * - * @note: Entitlement may still be active even if there is a billing issue. Check the `isActive` property. - */ - readonly billingIssueDetectedAt: string | null; -} - -/** - * Contains all the entitlements associated to the user. - */ -export interface PurchasesEntitlementInfos { - /** - * Map of all EntitlementInfo (`PurchasesEntitlementInfo`) objects (active and inactive) keyed by entitlement identifier. - */ - readonly all: { [key: string]: PurchasesEntitlementInfo }; - /** - * Map of active EntitlementInfo (`PurchasesEntitlementInfo`) objects keyed by entitlement identifier. - */ - readonly active: { [key: string]: PurchasesEntitlementInfo }; - /** - * Dictionary of active ``EntitlementInfo`` objects keyed by their identifiers. - * @ Note: When queried from the sandbox environment, it only returns entitlements active in sandbox. - * When queried from production, this only returns entitlements active in production. - */ - readonly activeInCurrentEnvironment: { [key: string]: PurchasesEntitlementInfo }; - /** - * Dictionary of active ``EntitlementInfo`` objects keyed by their identifiers. - * - * @note: these can be active on any environment. - */ - readonly activeInAnyEnvironment: { [key: string]: PurchasesEntitlementInfo }; -} - -export interface PurchasesStoreTransaction { - /** - * RevenueCat Id associated to the transaction. - */ - readonly transactionIdentifier: string; - /** - * Product Id associated with the transaction. - */ - readonly productIdentifier: string; - /** - * Purchase date of the transaction in ISO 8601 format. - */ - readonly purchaseDate: string; -} - -export interface CustomerInfo { - /** - * Entitlements attached to this customer info - */ - readonly entitlements: PurchasesEntitlementInfos; - /** - * Set of active subscription skus - */ - readonly activeSubscriptions: [string]; - /** - * Set of purchased skus, active and inactive - */ - readonly allPurchasedProductIdentifiers: [string]; - /** - * Returns all the non-subscription purchases a user has made. - * The purchases are ordered by purchase date in ascending order. - */ - readonly nonSubscriptionTransactions: PurchasesStoreTransaction[]; - /** - * The latest expiration date of all purchased skus - */ - readonly latestExpirationDate: string | null; - /** - * The date this user was first seen in RevenueCat. - */ - readonly firstSeen: string; - /** - * The original App User Id recorded for this user. - */ - readonly originalAppUserId: string; - /** - * Date when this info was requested - */ - readonly requestDate: string; - /** - * Map of skus to expiration dates - */ - readonly allExpirationDates: { [key: string]: string | null }; - /** - * Map of skus to purchase dates - */ - readonly allPurchaseDates: { [key: string]: string | null }; - /** - * Returns the version number for the version of the application when the - * user bought the app. Use this for grandfathering users when migrating - * to subscriptions. - * - * This corresponds to the value of CFBundleVersion (in iOS) in the - * Info.plist file when the purchase was originally made. This is always null - * in Android - */ - readonly originalApplicationVersion: string | null; - /** - * Returns the purchase date for the version of the application when the user bought the app. - * Use this for grandfathering users when migrating to subscriptions. - */ - readonly originalPurchaseDate: string | null; - /** - * URL to manage the active subscription of the user. If this user has an active iOS - * subscription, this will point to the App Store, if the user has an active Play Store subscription - * it will point there. If there are no active subscriptions it will be null. - * If there are multiple for different platforms, it will point to the device store. - */ - readonly managementURL: string | null; -} - -export interface PurchasesIntroPrice { - /** - * Price in the local currency. - */ - readonly price: number; - /** - * Formatted price, including its currency sign, such as €3.99. - */ - readonly priceString: string; - /** - * Number of subscription billing periods for which the user will be given the discount, such as 3. - */ - readonly cycles: number; - /** - * Billing period of the discount, specified in ISO 8601 format. - */ - readonly period: string; - /** - * Unit for the billing period of the discount, can be DAY, WEEK, MONTH or YEAR. - */ - readonly periodUnit: string; - /** - * Number of units for the billing period of the discount. - */ - readonly periodNumberOfUnits: number; -} - -export interface PurchasesStoreProductDiscount { - /** - * Identifier of the discount. - */ - readonly identifier: string; - /** - * Price in the local currency. - */ - readonly price: number; - /** - * Formatted price, including its currency sign, such as €3.99. - */ - readonly priceString: string; - /** - * Number of subscription billing periods for which the user will be given the discount, such as 3. - */ - readonly cycles: number; - /** - * Billing period of the discount, specified in ISO 8601 format. - */ - readonly period: string; - /** - * Unit for the billing period of the discount, can be DAY, WEEK, MONTH or YEAR. - */ - readonly periodUnit: string; - /** - * Number of units for the billing period of the discount. - */ - readonly periodNumberOfUnits: number; -} - -export interface PurchasesStoreProduct { - /** - * Product Id. - */ - readonly identifier: string; - /** - * Description of the product. - */ - readonly description: string; - /** - * Title of the product. - */ - readonly title: string; - /** - * Price of the product in the local currency. - */ - readonly price: number; - /** - * Formatted price of the item, including its currency sign, such as €3.99. - */ - readonly priceString: string; - /** - * Currency code for price and original price. - */ - readonly currencyCode: string; - /** - * Introductory price. - */ - readonly introPrice: PurchasesIntroPrice | null; - /** - * Collection of discount offers for a product. Null for Android. - */ - readonly discounts: PurchasesStoreProductDiscount[] | null; -} - -/** - * Contains information about the product available for the user to purchase. - * For more info see https://docs.revenuecat.com/docs/entitlements - */ -export interface PurchasesPackage { - /** - * Unique identifier for this package. Can be one a predefined package type or a custom one. - */ - readonly identifier: string; - /** - * Package type for the product. Will be one of [PACKAGE_TYPE]. - */ - readonly packageType: PACKAGE_TYPE; - /** - * Product assigned to this package. - */ - readonly product: PurchasesStoreProduct; - /** - * Offering this package belongs to. - */ - readonly offeringIdentifier: string; -} - -/** - * An offering is a collection of Packages (`PurchasesPackage`) available for the user to purchase. - * For more info see https://docs.revenuecat.com/docs/entitlements - */ -export interface PurchasesOffering { - /** - * Unique identifier defined in RevenueCat dashboard. - */ - readonly identifier: string; - /** - * Offering description defined in RevenueCat dashboard. - */ - readonly serverDescription: string; - /** - * Array of `Package` objects available for purchase. - */ - readonly availablePackages: PurchasesPackage[]; - /** - * Lifetime package type configured in the RevenueCat dashboard, if available. - */ - readonly lifetime: PurchasesPackage | null; - /** - * Annual package type configured in the RevenueCat dashboard, if available. - */ - readonly annual: PurchasesPackage | null; - /** - * Six month package type configured in the RevenueCat dashboard, if available. - */ - readonly sixMonth: PurchasesPackage | null; - /** - * Three month package type configured in the RevenueCat dashboard, if available. - */ - readonly threeMonth: PurchasesPackage | null; - /** - * Two month package type configured in the RevenueCat dashboard, if available. - */ - readonly twoMonth: PurchasesPackage | null; - /** - * Monthly package type configured in the RevenueCat dashboard, if available. - */ - readonly monthly: PurchasesPackage | null; - /** - * Weekly package type configured in the RevenueCat dashboard, if available. - */ - readonly weekly: PurchasesPackage | null; -} - -/** - * Contains all the offerings configured in RevenueCat dashboard. - * For more info see https://docs.revenuecat.com/docs/entitlements - */ -export interface PurchasesOfferings { - /** - * Map of all Offerings [PurchasesOffering] objects keyed by their identifier. - */ - readonly all: { [key: string]: PurchasesOffering }; - /** - * Current offering configured in the RevenueCat dashboard. - */ - readonly current: PurchasesOffering | null; -} - -export interface PurchasesError { - code: number; - message: string; - readableErrorCode: string; - underlyingErrorMessage?: string; -} - -/** - * Holds the information used when upgrading from another sku. For Android use only. - */ -export interface UpgradeInfo { - /** - * The oldSKU to upgrade from. - */ - readonly oldSKU: string; - /** - * The [PRORATION_MODE] to use when upgrading the given oldSKU. - */ - readonly prorationMode?: PRORATION_MODE; -} - -/** - * Holds the introductory price status - */ -export interface IntroEligibility { - /** - * The introductory price eligibility status - */ - readonly status: INTRO_ELIGIBILITY_STATUS; - /** - * Description of the status - */ - readonly description: string; -} - -/** - * Holds the logIn result - */ -export interface LogInResult { - /** - * The Customer Info for the user. - */ - readonly customerInfo: CustomerInfo; - /** - * True if the call resulted in a new user getting created in the RevenueCat backend. - */ - readonly created: boolean; -} - -/** - * Holds parameters to initialize the SDK. - */ -export interface PurchasesConfiguration { - /** - * RevenueCat API Key. Needs to be a string - */ - apiKey: string; - /** - * A unique id for identifying the user - */ - appUserID?: string | null; - /** - * An optional boolean. Set this to TRUE if you have your own IAP implementation and - * want to use only RevenueCat's backend. Default is FALSE. If you are on Android and setting this to ON, you will have - * to acknowledge the purchases yourself. - */ - observerMode?: boolean; - /** - * An optional string. iOS-only, will be ignored for Android. - * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults - * suite, otherwise it will use standardUserDefaults. Default is null, which will make the SDK use standardUserDefaults. - */ - userDefaultsSuiteName?: string; - /** - * An optional boolean. Android only. Required to configure the plugin to be used in the Amazon Appstore. - */ - useAmazon?: boolean; -} - -export type ShouldPurchasePromoProductListener = (deferredPurchase: () => void) => void; diff --git a/src/@awesome-cordova-plugins/plugins/push/index.ts b/src/@awesome-cordova-plugins/plugins/push/index.ts deleted file mode 100644 index fb7517ee..00000000 --- a/src/@awesome-cordova-plugins/plugins/push/index.ts +++ /dev/null @@ -1,501 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Cordova, - CordovaInstance, - AwesomeCordovaNativePlugin, - Plugin, - checkAvailability, -} from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -declare const window: any; - -export type EventResponse = RegistrationEventResponse & NotificationEventResponse & Error; - -export interface RegistrationEventResponse { - /** - * The registration ID provided by the 3rd party remote push service. - */ - registrationId: string; -} - -export interface NotificationEventResponse { - /** - * The text of the push message sent from the 3rd party service. - */ - message: string; - /** - * The optional title of the push message sent from the 3rd party service. - */ - title?: string; - /** - * The number of messages to be displayed in the badge iOS or message count in the notification shade in Android. - * For windows, it represents the value in the badge notification which could be a number or a status glyph. - */ - count: string; - /** - * The name of the sound file to be played upon receipt of the notification. - */ - sound: string; - /** - * The path of the image file to be displayed in the notification. - */ - image: string; - /** - * An optional collection of data sent by the 3rd party push service that does not fit in the above properties. - */ - additionalData: NotificationEventAdditionalData & any; -} - -/** - * Loosened up with a dictionary notation, but all non-defined properties need to use (map['prop']) notation - * - * Ideally the developer would overload (merged declaration) this or create a new interface that would extend this one - * so that he could specify any custom code without having to use array notation (map['prop']) for all of them. - */ -export interface NotificationEventAdditionalData { - /** - * Whether the notification was received while the app was in the foreground - */ - foreground?: boolean; - collapse_key?: string; - coldstart?: boolean; - from?: string; - notId?: string; - - [name: string]: any; -} - -export interface IOSPushOptions { - /** - * Whether to use prod or sandbox GCM setting. - */ - fcmSandbox?: boolean | string; - - /** - * If true the device shows an alert on receipt of notification. - * Note**: the value you set this option to the first time you call the init - * method will be how the application always acts. Once this is set - * programmatically in the init method it can only be changed manually by the - * user in Settings>Notifications>App Name. This is normal iOS behaviour. - */ - alert?: boolean | string; - - /** - * If true the device sets the badge number on receipt of notification. - * Note**: the value you set this option to the first time you call the init - * method will be how the application always acts. Once this is set - * programmatically in the init method it can only be changed manually by the - * user in Settings>Notifications>App Name. This is normal iOS behaviour. - */ - badge?: boolean | string; - - /** - * If true the device plays a sound on receipt of notification. - * Note**: the value you set this option to the first time you call the init - * method will be how the application always acts. Once this is set - * programmatically in the init method it can only be changed manually by the - * user in Settings>Notifications>App Name. This is normal iOS behaviour. - */ - sound?: boolean | string; - - /** - * If true the badge will be cleared on app startup. - */ - clearBadge?: boolean | string; - - /** - * If the array contains one or more strings each string will be used to - * subscribe to a GcmPubSub topic. - * Note**: only usable in conjunction with `senderID`. - */ - topics?: string[]; - - /** - * The data required in order to enable Action Buttons for iOS. - * Action Buttons on iOS - https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1 - */ - categories?: CategoryArray; - - /** - * If true the device will be set up to receive VoIP Push notifications and the - * other options will be ignored since VoIP notifications are silent - * notifications that should be handled in the "notification" event. - */ - voip?: boolean | string; -} - -export interface CategoryArray { - [name: string]: CategoryAction; -} - -export interface CategoryAction { - yes?: CategoryActionData; - no?: CategoryActionData; - maybe?: CategoryActionData; -} - -export interface CategoryActionData { - callback: string; - title: string; - foreground: boolean; - destructive: boolean; - inline?: boolean; -} - -export interface AndroidPushOptions { - /** - * Maps to the project number in the Google Developer Console. - */ - senderID?: string; - - /** - * The name of a drawable resource to use as the small-icon. The name should - * not include the extension. - */ - icon?: string; - - /** - * Sets the background color of the small icon on Android 5.0 and greater. - * [Supported Formats](http://developer.android.com/intl/ru/reference/android/graphics/Color.html#parseColor(java.lang.String)) - */ - iconColor?: string; - - /** - * If true it plays the sound specified in the push data or the default system - * sound. - */ - sound?: boolean | string; - - /** - * If true the device vibrates on receipt of notification. - */ - vibrate?: boolean | string; - - /** - * If true the icon badge will be cleared on init and before push messages are processed. - */ - clearBadge?: boolean | string; - - /** - * If true the app clears all pending notifications when it is closed. - */ - clearNotifications?: boolean | string; - - /** - * If true will always show a notification, even when the app is on the - * foreground. - */ - forceShow?: boolean | string; - - /** - * If the array contains one or more strings each string will be used to - * subscribe to a GcmPubSub topic. - */ - topics?: string[]; - - /** - * The key to search for text of notification. - */ - messageKey?: string; - - /** - * The key to search for title of notification. - */ - titleKey?: string; -} - -export interface BrowserPushOptions { - /** - * Optional. Your GCM API key if you are using VAPID keys. - */ - applicationServerKey?: string; - - /** - * URL for the push server you want to use. - * Default: http://push.api.phonegap.com/v1/push Optional. - */ - pushServiceURL?: string; -} - -export interface PushOptions { - ios?: IOSPushOptions; - android?: AndroidPushOptions; - windows?: any; - browser?: BrowserPushOptions; -} - -export type Priority = 1 | 2 | 3 | 4 | 5; -export type Visibility = 0 | 1 | -1; - -export interface Channel { - id: string; - description: string; - importance: Priority; - sound?: string; - vibration?: boolean | number[]; - visibility?: Visibility; - badge?: boolean; -} - -export type PushEvent = string; - -/** - * @name Push - * @description - * Register and receive push notifications. - * - * Requires Cordova plugin: `phonegap-plugin-push`. For more info, please see the [Push plugin docs](https://github.com/phonegap/phonegap-plugin-push). - * - * For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md). - * @usage - * ```typescript - * import { Push, PushObject, PushOptions } from '@awesome-cordova-plugins/push/ngx'; - * - * constructor(private push: Push) { } - * - * ... - * - * - * // to check if we have permission - * this.push.hasPermission() - * .then((res: any) => { - * - * if (res.isEnabled) { - * console.log('We have permission to send push notifications'); - * } else { - * console.log('We do not have permission to send push notifications'); - * } - * - * }); - * - * // Create a channel (Android O and above). You'll need to provide the id, description and importance properties. - * this.push.createChannel({ - * id: "testchannel1", - * description: "My first test channel", - * // The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest. - * importance: 3, - * //badge is used to if badge appears on the app icon see https://developer.android.com/reference/android/app/NotificationChannel.html#setShowBadge(boolean). - * //false = no badge on app icon. - * //true = badge on app icon - * badge: false - * }).then(() => console.log('Channel created')); - * - * // Delete a channel (Android O and above) - * this.push.deleteChannel('testchannel1').then(() => console.log('Channel deleted')); - * - * // Return a list of currently configured channels - * this.push.listChannels().then((channels) => console.log('List of channels', channels)) - * - * // to initialize push notifications - * - * const options: PushOptions = { - * android: {}, - * ios: { - * alert: 'true', - * badge: true, - * sound: 'false' - * }, - * windows: {}, - * browser: { - * pushServiceURL: 'http://push.api.phonegap.com/v1/push' - * } - * } - * - * const pushObject: PushObject = this.push.init(options); - * - * - * pushObject.on('notification').subscribe((notification: any) => console.log('Received a notification', notification)); - * - * pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration)); - * - * pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error)); - * - * - * ``` - * @interfaces - * RegistrationEventResponse - * NotificationEventResponse - * NotificationEventAdditionalData - * IOSPushOptions - * AndroidPushOptions - * BrowserPushOptions - * PushOptions - */ -@Plugin({ - pluginName: 'Push', - plugin: 'phonegap-plugin-push', - pluginRef: 'PushNotification', - repo: 'https://github.com/phonegap/phonegap-plugin-push', - install: 'ionic cordova plugin add phonegap-plugin-push', - platforms: ['Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class Push extends AwesomeCordovaNativePlugin { - /** - * Init push notifications - * - * @param options {PushOptions} - * @returns {PushObject} - */ - init(options: PushOptions): PushObject { - return new PushObject(options); - } - - /** - * Check whether the push notification permission has been granted. - * - * @returns {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted. - */ - @Cordova() - hasPermission(): Promise<{ isEnabled: boolean }> { - return; - } - - /** - * Create a new notification channel for Android O and above. - * - * @param channel {Channel} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - createChannel(channel?: Channel): Promise { - return; - } - - /** - * Delete a notification channel for Android O and above. - * - * @param id {string} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - deleteChannel(id?: string): Promise { - return; - } - - /** - * Returns a list of currently configured channels. - * - * @returns {Promise} - */ - @Cordova() - listChannels(): Promise { - return; - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'Push', - plugin: 'phonegap-plugin-push', - pluginRef: 'PushNotification', -}) -export class PushObject { - private _objectInstance: any; - - constructor(options: PushOptions) { - if (checkAvailability('PushNotification', 'init', 'PushNotification') === true) { - if (typeof window !== 'undefined') { - this._objectInstance = window.PushNotification.init(options); - } - } - } - - /** - * Adds an event listener - * - * @param event {string} - * @returns {Observable} - */ - @CordovaInstance({ - observable: true, - clearFunction: 'off', - clearWithArgs: true, - }) - on(event: PushEvent): Observable { - return; - } - - /** - * The unregister method is used when the application no longer wants to receive push notifications. - * Beware that this cleans up all event handlers previously registered, - * so you will need to re-register them if you want them to function again without an application reload. - */ - @CordovaInstance() - unregister(): Promise { - return; - } - - /** - * Set the badge count visible when the app is not running - * - * The count is an integer indicating what number should show up in the badge. - * Passing 0 will clear the badge. - * Each notification event contains a data.count value which can be used to set the badge to correct number. - * - * @param count - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - setApplicationIconBadgeNumber(count?: number): Promise { - return; - } - /** - * Get the current badge count visible when the app is not running - * successHandler gets called with an integer which is the current badge count - */ - @CordovaInstance() - getApplicationIconBadgeNumber(): Promise { - return; - } - - /** - * iOS only - * Tells the OS that you are done processing a background push notification. - * successHandler gets called when background push processing is successfully completed. - * - * @param [id] - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - finish(id?: string): Promise { - return; - } - - /** - * Tells the OS to clear all notifications from the Notification Center - */ - @CordovaInstance() - clearAllNotifications(): Promise { - return; - } - - /** - * The subscribe method is used when the application wants to subscribe a new topic to receive push notifications. - * - * @param topic {string} Topic to subscribe to. - * @returns {Promise} - */ - @CordovaInstance() - subscribe(topic: string): Promise { - return; - } - - /** - * The unsubscribe method is used when the application no longer wants to receive push notifications from a specific topic but continue to receive other push messages. - * - * @param topic {string} Topic to unsubscribe from. - * @returns {Promise} - */ - @CordovaInstance() - unsubscribe(topic: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/pushape-push/index.ts b/src/@awesome-cordova-plugins/plugins/pushape-push/index.ts deleted file mode 100644 index f4e3fb85..00000000 --- a/src/@awesome-cordova-plugins/plugins/pushape-push/index.ts +++ /dev/null @@ -1,474 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Plugin, - Cordova, - CordovaInstance, - AwesomeCordovaNativePlugin, - checkAvailability, -} from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -declare const window: any; - -export type EventResponse = PushapeRegistrationEventResponse & - RegistrationEventResponse & - NotificationEventResponse & - Error; - -interface RegistrationEventResponse { - /** - * The registration ID provided by the 3rd party remote push service. - */ - registrationId: string; -} - -export interface NotificationEventResponse { - /** - * The text of the push message sent from the 3rd party service. - */ - message: string; - /** - * The optional title of the push message sent from the 3rd party service. - */ - title?: string; - /** - * The number of messages to be displayed in the badge iOS or message count in the notification shade in Android. - * For windows, it represents the value in the badge notification which could be a number or a status glyph. - */ - count: string; - /** - * The name of the sound file to be played upon receipt of the notification. - */ - sound: string; - /** - * The path of the image file to be displayed in the notification. - */ - image: string; - /** - * An optional collection of data sent by the 3rd party push service that does not fit in the above properties. - */ - additionalData: NotificationEventAdditionalData & any; -} - -/** - * Loosened up with a dictionary notation, but all non-defined properties need to use (map['prop']) notation - * - * Ideally the developer would overload (merged declaration) this or create a new interface that would extend this one - * so that he could specify any custom code without having to use array notation (map['prop']) for all of them. - */ -export interface NotificationEventAdditionalData { - /** - * Whether the notification was received while the app was in the foreground - */ - foreground?: boolean; - collapse_key?: string; - coldstart?: boolean; - from?: string; - notId?: string; - - [name: string]: any; -} - -export interface IOSPushOptions { - /** - * Whether to use prod or sandbox GCM setting. - */ - fcmSandbox?: boolean | string; - - /** - * If true the device shows an alert on receipt of notification. - * Note**: the value you set this option to the first time you call the init - * method will be how the application always acts. Once this is set - * programmatically in the init method it can only be changed manually by the - * user in Settings>Notifications>App Name. This is normal iOS behaviour. - */ - alert?: boolean | string; - - /** - * If true the device sets the badge number on receipt of notification. - * Note**: the value you set this option to the first time you call the init - * method will be how the application always acts. Once this is set - * programmatically in the init method it can only be changed manually by the - * user in Settings>Notifications>App Name. This is normal iOS behaviour. - */ - badge?: boolean | string; - - /** - * If true the device plays a sound on receipt of notification. - * Note**: the value you set this option to the first time you call the init - * method will be how the application always acts. Once this is set - * programmatically in the init method it can only be changed manually by the - * user in Settings>Notifications>App Name. This is normal iOS behaviour. - */ - sound?: boolean | string; - - /** - * If true the badge will be cleared on app startup. - */ - clearBadge?: boolean | string; - - /** - * If the array contains one or more strings each string will be used to - * subscribe to a GcmPubSub topic. - * Note**: only usable in conjunction with `senderID`. - */ - topics?: string[]; - - /** - * The data required in order to enable Action Buttons for iOS. - * Action Buttons on iOS - https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1 - */ - categories?: CategoryArray; - - /** - * If true the device will be set up to receive VoIP Push notifications and the - * other options will be ignored since VoIP notifications are silent - * notifications that should be handled in the "notification" event. - */ - voip?: boolean | string; -} - -export interface CategoryArray { - [name: string]: CategoryAction; -} - -export interface CategoryAction { - yes?: CategoryActionData; - no?: CategoryActionData; - maybe?: CategoryActionData; -} - -export interface CategoryActionData { - callback: string; - title: string; - foreground: boolean; - destructive: boolean; - inline?: boolean; -} - -export interface AndroidPushOptions { - /** - * Maps to the project number in the Google Developer Console. - */ - senderID?: string; - - /** - * The name of a drawable resource to use as the small-icon. The name should - * not include the extension. - */ - icon?: string; - - /** - * Sets the background color of the small icon on Android 5.0 and greater. - * [Supported Formats](http://developer.android.com/intl/ru/reference/android/graphics/Color.html#parseColor(java.lang.String)) - */ - iconColor?: string; - - /** - * If true it plays the sound specified in the push data or the default system - * sound. - */ - sound?: boolean | string; - - /** - * If true the device vibrates on receipt of notification. - */ - vibrate?: boolean | string; - - /** - * If true the icon badge will be cleared on init and before push messages are processed. - */ - clearBadge?: boolean | string; - - /** - * If true the app clears all pending notifications when it is closed. - */ - clearNotifications?: boolean | string; - - /** - * If true will always show a notification, even when the app is on the - * foreground. - */ - forceShow?: boolean | string; - - /** - * If the array contains one or more strings each string will be used to - * subscribe to a GcmPubSub topic. - */ - topics?: string[]; - - /** - * The key to search for text of notification. - */ - messageKey?: string; - - /** - * The key to search for title of notification. - */ - titleKey?: string; -} - -export interface BrowserPushOptions { - /** - * Optional. Your GCM API key if you are using VAPID keys. - */ - applicationServerKey?: string; - - /** - * URL for the push server you want to use. - * Default: http://push.api.phonegap.com/v1/push Optional. - */ - pushServiceURL?: string; -} - -interface PushOptions { - ios?: IOSPushOptions; - android?: AndroidPushOptions; - windows?: any; - browser?: BrowserPushOptions; -} - -export type Priority = 1 | 2 | 3 | 4 | 5; -export type Visibility = 0 | 1 | -1; - -export interface Channel { - id: string; - description: string; - importance: Priority; - sound?: string; - vibration?: boolean | number[]; - visibility?: Visibility; - badge?: boolean; -} - -export type PushEvent = 'registration' | 'notification' | 'error'; - -/** Extended Pushape types */ - -export interface PushapePushOptions { - id_app: string; - platform: string; - uuid: string; -} - -export interface PushapeOptions extends PushOptions { - enabled?: boolean; - pushape: PushapePushOptions; - id_user: string; -} - -export interface PushapeRegistrationEventResponse extends RegistrationEventResponse { - push_id: string; - status: number; -} - -/** - * @name PushapePush - * @description - * Register and receive push notifications. - * This plugin extends functionalities of Push native plugin in order to use it with Pushape service. - * - * Pushape service: @link https://glue-labs.com/pushape-invio-notifiche-push-ios-android-api-sdk - * - * Requires Cordova plugin: `pushape-cordova-push`. For more info, please see the [Pushape plugin docs](https://github.com/gluelabs/pushape-cordova-push). - * - * For TypeScript users, see the [Pushape plugin docs about using TypeScript for custom notifications](https://github.com/gluelabs/pushape-cordova-push/blob/master/docs/PUSHAPE_TYPESCRIPT.md). - * @usage - * ```typescript - * import { PushapePush } from '@awesome-cordova-plugins/pushape-push/ngx'; - * - * - * constructor(private readonly pushapePush: PushapePush) { } - * - * ... - * - * - * - * ``` - * @interfaces - * PushapeRegistrationEventResponse - * NotificationEventResponse - * NotificationEventAdditionalData - * IOSPushOptions - * AndroidPushOptions - * BrowserPushOptions - * PushapePushOptions - * PushapeOptions - */ -@Plugin({ - pluginName: 'PushapePush', - plugin: 'pushape-cordova-push', - pluginRef: 'PushNotification', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/gluelabs/pushape-cordova-push', - install: 'ionic cordova plugin add pushape-cordova-push', - platforms: ['Android', 'Browser', 'iOS'], -}) -@Injectable() -export class PushapePush extends AwesomeCordovaNativePlugin { - /** - * Init push notifications - * - * @param options {PushapeOptions} - * @returns {PushObject} - */ - init(options: PushapeOptions): PushObject { - return new PushObject(options); - } - - /** - * Check whether the push notification permission has been granted. - * - * @returns {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted. - */ - @Cordova() - hasPermission(): Promise<{ isEnabled: boolean }> { - return; - } - - /** - * Create a new notification channel for Android O and above. - * - * @param channel {Channel} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - createChannel(channel?: Channel): Promise { - return; - } - - /** - * Delete a notification channel for Android O and above. - * - * @param id {string} - */ - @Cordova({ - callbackOrder: 'reverse', - }) - deleteChannel(id?: string): Promise { - return; - } - - /** - * Returns a list of currently configured channels. - * - * @returns {Promise} - */ - @Cordova() - listChannels(): Promise { - return; - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'PushapePush', - plugin: 'pushape-cordova-push', - pluginRef: 'PushNotification', -}) -export class PushObject { - private _objectInstance: any; - - constructor(options: PushapeOptions) { - if (checkAvailability('PushNotification', 'init', 'PushNotification') === true) { - if (typeof window !== 'undefined') { - this._objectInstance = window.PushNotification.init(options); - } - } - } - - /** - * Adds an event listener - * - * @param event {string} - * @returns {Observable} - */ - @CordovaInstance({ - observable: true, - clearFunction: 'off', - clearWithArgs: true, - }) - on(event: PushEvent): Observable { - return; - } - - /** - * The unregister method is used when the application no longer wants to receive push notifications. - * Beware that this cleans up all event handlers previously registered, - * so you will need to re-register them if you want them to function again without an application reload. - */ - @CordovaInstance() - unregister(): Promise { - return; - } - - /** - * Set the badge count visible when the app is not running - * - * The count is an integer indicating what number should show up in the badge. - * Passing 0 will clear the badge. - * Each notification event contains a data.count value which can be used to set the badge to correct number. - * - * @param count - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - setApplicationIconBadgeNumber(count?: number): Promise { - return; - } - /** - * Get the current badge count visible when the app is not running - * successHandler gets called with an integer which is the current badge count - */ - @CordovaInstance() - getApplicationIconBadgeNumber(): Promise { - return; - } - - /** - * iOS only - * Tells the OS that you are done processing a background push notification. - * successHandler gets called when background push processing is successfully completed. - * - * @param [id] - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - finish(id?: string): Promise { - return; - } - - /** - * Tells the OS to clear all notifications from the Notification Center - */ - @CordovaInstance() - clearAllNotifications(): Promise { - return; - } - - /** - * The subscribe method is used when the application wants to subscribe a new topic to receive push notifications. - * - * @param topic {string} Topic to subscribe to. - * @returns {Promise} - */ - @CordovaInstance() - subscribe(topic: string): Promise { - return; - } - - /** - * The unsubscribe method is used when the application no longer wants to receive push notifications from a specific topic but continue to receive other push messages. - * - * @param topic {string} Topic to unsubscribe from. - * @returns {Promise} - */ - @CordovaInstance() - unsubscribe(topic: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/safari-view-controller/index.ts b/src/@awesome-cordova-plugins/plugins/safari-view-controller/index.ts deleted file mode 100644 index c763ae6a..00000000 --- a/src/@awesome-cordova-plugins/plugins/safari-view-controller/index.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface SafariViewControllerOptions { - animated?: boolean; - barColor?: string; - controlTintColor?: string; - enterReaderModeIfAvailable?: boolean; - hidden?: boolean; - showDefaultShareMenuItem?: boolean; - tintColor?: string; - toolbarColor?: string; - transition?: string; - url?: string; -} - -/** - * @name Safari View Controller - * @description - * For displaying read-only web content. - * - * Requires Cordova plugin: `cordova-plugin-safariviewcontroller`. For more info, please see the [Safari View Controller plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller). - * @usage - * ```typescript - * import { SafariViewController } from '@awesome-cordova-plugins/safari-view-controller/ngx'; - * - * constructor(private safariViewController: SafariViewController) { } - * - * ... - * - * this.safariViewController.isAvailable() - * .then((available: boolean) => { - * if (available) { - * - * this.safariViewController.show({ - * url: 'http://ionic.io', - * hidden: false, - * animated: false, - * transition: 'curl', - * enterReaderModeIfAvailable: true, - * tintColor: '#ff0000' - * }) - * .subscribe((result: any) => { - * if(result.event === 'opened') console.log('Opened'); - * else if(result.event === 'loaded') console.log('Loaded'); - * else if(result.event === 'closed') console.log('Closed'); - * }, - * (error: any) => console.error(error) - * ); - * - * } else { - * // use fallback browser, example InAppBrowser - * } - * } - * ); - * ``` - * @interfaces - * SafariViewControllerOptions - */ -@Plugin({ - pluginName: 'SafariViewController', - plugin: 'cordova-plugin-safariviewcontroller', - pluginRef: 'SafariViewController', - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-safariviewcontroller', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class SafariViewController extends AwesomeCordovaNativePlugin { - /** - * Checks if SafariViewController is available - * - * @returns {Promise} - */ - @Cordova() - isAvailable(): Promise { - return; - } - - /** - * Shows Safari View Controller - * - * @param options {SafariViewControllerOptions} optional - * @returns {Observable} - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - observable: true, - }) - show(options?: SafariViewControllerOptions): Observable { - return; - } - - /** - * Hides Safari View Controller - */ - @Cordova() - hide(): Promise { - return; - } - - /** - * Tries to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below. - * - * @returns {Promise} - */ - @Cordova() - connectToService(): Promise { - return; - } - - /** - * Call this method whenever there's a chance the user will open an external url. - * - * @returns {Promise} - */ - @Cordova() - warmUp(): Promise { - return; - } - - /** - * For even better performance optimization, call this methods if there's more than a 50% chance the user will open a certain URL. - * - * @param url{string} - * @param url - * @returns {Promise} - */ - @Cordova() - mayLaunchUrl(url: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/screen-orientation/index.ts b/src/@awesome-cordova-plugins/plugins/screen-orientation/index.ts deleted file mode 100644 index fa5d7a07..00000000 --- a/src/@awesome-cordova-plugins/plugins/screen-orientation/index.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * @name Screen Orientation - * @premier screen-orientation - * @description - * Cordova plugin to set/lock the screen orientation in a common way. - * - * Requires Cordova plugin: `cordova-plugin-screen-orientation`. For more info, please see the [Screen Orientation plugin docs](https://github.com/apache/cordova-plugin-screen-orientation). - * @usage - * ```typescript - * import { ScreenOrientation } from '@awesome-cordova-plugins/screen-orientation/ngx'; - * - * constructor(private screenOrientation: ScreenOrientation) { } - * - * ... - * - * - * // get current - * console.log(this.screenOrientation.type); // logs the current orientation, example: 'landscape' - * - * // set to landscape - * this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE); - * - * // allow user rotate - * this.screenOrientation.unlock(); - * - * // detect orientation changes - * this.screenOrientation.onChange().subscribe( - * () => { - * console.log("Orientation Changed"); - * } - * ); - * - * ``` - * @advanced - * - * Accepted orientation values: - * - * | Value | Description | - * |-------------------------------|------------------------------------------------------------------------------| - * | portrait-primary | The orientation is in the primary portrait mode. | - * | portrait-secondary | The orientation is in the secondary portrait mode. | - * | landscape-primary | The orientation is in the primary landscape mode. | - * | landscape-secondary | The orientation is in the secondary landscape mode. | - * | portrait | The orientation is either portrait-primary or portrait-secondary (sensor). | - * | landscape | The orientation is either landscape-primary or landscape-secondary (sensor). | - */ -@Plugin({ - pluginName: 'ScreenOrientation', - plugin: 'cordova-plugin-screen-orientation', - pluginRef: 'screen.orientation', - repo: 'https://github.com/apache/cordova-plugin-screen-orientation', - platforms: ['Android', 'iOS', 'Windows'], -}) -@Injectable() -export class ScreenOrientation extends AwesomeCordovaNativePlugin { - /** - * Convenience enum for possible orientations - */ - ORIENTATIONS = { - PORTRAIT_PRIMARY: 'portrait-primary', - PORTRAIT_SECONDARY: 'portrait-secondary', - LANDSCAPE_PRIMARY: 'landscape-primary', - LANDSCAPE_SECONDARY: 'landscape-secondary', - PORTRAIT: 'portrait', - LANDSCAPE: 'landscape', - ANY: 'any', - }; - /** - * Listen to orientation change event - * - * @returns {Observable} - */ - @Cordova({ - eventObservable: true, - event: 'orientationchange', - element: 'window', - }) - onChange(): Observable { - return; - } - - /** - * Lock the orientation to the passed value. - * See below for accepted values - * - * @param orientation {string} The orientation which should be locked. Accepted values see table above. - * @returns {Promise} - */ - @Cordova({ otherPromise: true }) - lock(orientation: string): Promise { - return; - } - - /** - * Unlock and allow all orientations. - */ - @Cordova({ sync: true }) - unlock(): void {} - - /** - * Get the current orientation of the device. - */ - @CordovaProperty() - type: string; -} diff --git a/src/@awesome-cordova-plugins/plugins/secure-storage-echo/index.ts b/src/@awesome-cordova-plugins/plugins/secure-storage-echo/index.ts deleted file mode 100644 index aa5cb793..00000000 --- a/src/@awesome-cordova-plugins/plugins/secure-storage-echo/index.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - CordovaCheck, - CordovaInstance, - getPromise, - AwesomeCordovaNativePlugin, - Plugin, -} from '@awesome-cordova-plugins/core'; - -export interface SecureStorageEchoOptions { - android: { - /** - * See https://github.com/mibrito707/cordova-plugin-secure-storage-echo#sharing-data-android - */ - packageName?: string; - /** - * Sets the duration of time (seconds) for which the Private Encryption Key is authorized to be used after the user is successfully authenticated. - * See https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.Builder.html#setUserAuthenticationValidityDurationSeconds(int) - */ - userAuthenticationValidityDuration?: number; - /** - * Custom title for Confirm Credentials screen. - * See https://developer.android.com/reference/android/app/KeyguardManager.html#createConfirmDeviceCredentialIntent(java.lang.CharSequence,%20java.lang.CharSequence) - */ - unlockCredentialsTitle?: string; - /** - * Custom description for Confirm Credentials screen. - */ - unlockCredentialsDescription?: string; - }; -} - -/** - * @hidden - */ -export class SecureStorageEchoObject { - constructor(private _objectInstance: any) {} - - /** - * Gets a stored item - * - * @param key {string} - * @returns {Promise} - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - get(key: string): Promise { - return; - } - - /** - * Stores a value - * - * @param key {string} - * @param value {string} - * @returns {Promise} - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - set(key: string, value: string): Promise { - return; - } - - /** - * Removes a single stored item - * - * @param key {string} - * @returns {Promise} returns a promise that resolves with the key that was removed - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - remove(key: string): Promise { - return; - } - - /** - * Get all references from the storage. - * - * @returns {Promise} returns a promise that resolves with array of keys storage - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - keys(): Promise { - return; - } - - /** - * Clear all references from the storage. - * - * @returns {Promise} - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - clear(): Promise { - return; - } - - /** - * Brings up the screen-lock settings - * - * @returns {Promise} - */ - @CordovaInstance() - secureDevice(): Promise { - return; - } -} - -/** - * @name Secure Storage Echo - * @description - * This plugin gets, sets and removes key,value pairs from a device's secure storage. - * - * Requires Cordova plugin: `cordova-plugin-secure-storage-echo`. For more info, please see the [Cordova Secure Storage docs](https://github.com/mibrito707/cordova-plugin-secure-storage-echo). - * - * The browser platform is supported as a mock only. Key/values are stored unencrypted in localStorage. - * @usage - * - * ```typescript - * import { SecureStorageEcho, SecureStorageEchoObject } from '@awesome-cordova-plugins/secure-storage-echo/ngx'; - * - * constructor(private secureStorageEcho: SecureStorageEcho) { } - * - * ... - * - * this.secureStorageEcho.create('my_store_name') - * .then((storage: SecureStorageEchoObject) => { - * - * storage.get('key') - * .then( - * data => console.log(data), - * error => console.log(error) - * ); - * - * storage.set('key', 'value') - * .then( - * data => console.log(data), - * error => console.log(error) - * ); - * - * storage.remove('key') - * .then( - * data => console.log(data), - * error => console.log(error) - * ); - * - * }); - * - * - * ``` - * @classes - * SecureStorageEchoObject - */ -@Plugin({ - pluginName: 'SecureStorageEcho', - plugin: 'cordova-plugin-secure-storage-echo', - pluginRef: 'cordova.plugins.SecureStorage', - repo: 'https://github.com/mibrito707/cordova-plugin-secure-storage-echo', - platforms: ['Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class SecureStorageEcho extends AwesomeCordovaNativePlugin { - /** - * Creates a namespaced storage. - * - * @param store {string} - * @param options - * @returns {Promise} - */ - @CordovaCheck() - create(store: string, options?: SecureStorageEchoOptions): Promise { - return getPromise((res: Function, rej: Function) => { - const instance = new (SecureStorageEcho.getPlugin())( - () => res(new SecureStorageEchoObject(instance)), - () => rej(new SecureStorageEchoObject(instance)), - store, - options - ); - }); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/secure-storage/index.ts b/src/@awesome-cordova-plugins/plugins/secure-storage/index.ts deleted file mode 100644 index 33f979af..00000000 --- a/src/@awesome-cordova-plugins/plugins/secure-storage/index.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - CordovaCheck, - CordovaInstance, - AwesomeCordovaNativePlugin, - Plugin, - getPromise, -} from '@awesome-cordova-plugins/core'; - -/** - * @hidden - */ -export class SecureStorageObject { - constructor(private _objectInstance: any) {} - - /** - * Gets a stored item - * - * @param key {string} - * @returns {Promise} - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - get(key: string): Promise { - return; - } - - /** - * Stores a value - * - * @param key {string} - * @param value {string} - * @returns {Promise} - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - set(key: string, value: string): Promise { - return; - } - - /** - * Removes a single stored item - * - * @param key {string} - * @returns {Promise} returns a promise that resolves with the key that was removed - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - remove(key: string): Promise { - return; - } - - /** - * Get all references from the storage. - * - * @returns {Promise} returns a promise that resolves with array of keys storage - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - keys(): Promise { - return; - } - - /** - * Clear all references from the storage. - * - * @returns {Promise} - */ - @CordovaInstance({ - callbackOrder: 'reverse', - }) - clear(): Promise { - return; - } - - /** - * Brings up the screen-lock settings - * - * @returns {Promise} - */ - @CordovaInstance() - secureDevice(): Promise { - return; - } -} - -/** - * @name Secure Storage - * @description - * This plugin gets, sets and removes key,value pairs from a device's secure storage. - * - * Requires Cordova plugin: `cordova-plugin-secure-storage`. For more info, please see the [Cordova Secure Storage docs](https://github.com/Crypho/cordova-plugin-secure-storage). - * - * The browser platform is supported as a mock only. Key/values are stored unencrypted in localStorage. - * @usage - * - * ```typescript - * import { SecureStorage, SecureStorageObject } from '@awesome-cordova-plugins/secure-storage/ngx'; - * - * constructor(private secureStorage: SecureStorage) { } - * - * ... - * - * this.secureStorage.create('my_store_name') - * .then((storage: SecureStorageObject) => { - * - * storage.get('key') - * .then( - * data => console.log(data), - * error => console.log(error) - * ); - * - * storage.set('key', 'value') - * .then( - * data => console.log(data), - * error => console.log(error) - * ); - * - * storage.remove('key') - * .then( - * data => console.log(data), - * error => console.log(error) - * ); - * - * }); - * - * - * ``` - * @classes - * SecureStorageObject - */ -@Plugin({ - pluginName: 'SecureStorage', - plugin: 'cordova-plugin-secure-storage-echo', - pluginRef: 'cordova.plugins.SecureStorage', - repo: 'https://github.com/mibrito707/cordova-plugin-secure-storage-echo', - platforms: ['Android', 'Browser', 'iOS', 'Windows'], -}) -@Injectable() -export class SecureStorage extends AwesomeCordovaNativePlugin { - /** - * Creates a namespaced storage. - * - * @param store {string} - * @returns {Promise} - */ - @CordovaCheck() - create(store: string): Promise { - return getPromise((res: Function, rej: Function) => { - const instance = new (SecureStorage.getPlugin())( - () => res(new SecureStorageObject(instance)), - () => rej(new SecureStorageObject(instance)), - store - ); - }); - } -} diff --git a/src/@awesome-cordova-plugins/plugins/service-discovery/index.ts b/src/@awesome-cordova-plugins/plugins/service-discovery/index.ts deleted file mode 100644 index ce4475cf..00000000 --- a/src/@awesome-cordova-plugins/plugins/service-discovery/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name ServiceDiscovery - * @description - * Simple plugin to get any SSDP / UPnP / DLNA service on a local network - * @usage - * ```typescript - * import { ServiceDiscovery } from '@awesome-cordova-plugins/service-discovery'; - * - * - * constructor(private serviceDiscovery: ServiceDiscovery) { } - * - * ... - * - * - * this.serviceDiscovery.getNetworkServices('ssdp:all') - * .then(devices => console.log(devices)) - * .catch(error => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'ServiceDiscovery', - plugin: 'cordova-plugin-discovery', - pluginRef: 'serviceDiscovery', - repo: 'https://github.com/scottdermott/cordova-plugin-discovery', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class ServiceDiscovery extends AwesomeCordovaNativePlugin { - /** - * Finds and returns metadata about devices discovered on the network via SSDP / UPnP / DLNA - * - * @param service {string} The service name to discover - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - getNetworkServices(service: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/shake/index.ts b/src/@awesome-cordova-plugins/plugins/shake/index.ts deleted file mode 100644 index c31c98eb..00000000 --- a/src/@awesome-cordova-plugins/plugins/shake/index.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; -/** - * @name Shake - * @description Handles shake gesture - * @usage - * ```typescript - * import { Shake } from '@awesome-cordova-plugins/shake/ngx'; - * - * constructor(private shake: Shake) { } - * - * ... - * - * const watch = this.shake.startWatch(60).subscribe(() => { - * // do something - * }); - * - * watch.unsubscribe(); - * ``` - */ -@Plugin({ - pluginName: 'Shake', - plugin: 'cordova-plugin-shake', - pluginRef: 'shake', - repo: 'https://github.com/leecrossley/cordova-plugin-shake', - platforms: ['iOS'], -}) -@Injectable() -export class Shake extends AwesomeCordovaNativePlugin { - /** - * Watch for shake gesture - * - * @param sensitivity {number} Optional sensitivity parameter. Defaults to 40 - * @returns {Observable} - */ - @Cordova({ - observable: true, - clearFunction: 'stopWatch', - successIndex: 0, - errorIndex: 2, - }) - startWatch(sensitivity?: number): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/sign-in-with-apple/index.ts b/src/@awesome-cordova-plugins/plugins/sign-in-with-apple/index.ts deleted file mode 100644 index 86e572b4..00000000 --- a/src/@awesome-cordova-plugins/plugins/sign-in-with-apple/index.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @see https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidrequest - */ -export class ASAuthorizationAppleIDRequest { - static readonly ASAuthorizationScopeFullName = 0; - static readonly ASAuthorizationScopeEmail = 1; - - requestedScopes?: number[]; -} - -/** - * @see https://developer.apple.com/documentation/foundation/nspersonnamecomponents/1412193-phoneticrepresentation - */ -export interface NSPersonNameComponents { - /** - * The portion of a name’s full form of address that precedes the name itself (for example, "Dr.," "Mr.," "Ms.") - */ - namePrefix?: string; - - /** - * Name bestowed upon an individual to differentiate them from other members of a group that share a family name (for example, "Johnathan") - */ - givenName?: string; - - /** - * Secondary name bestowed upon an individual to differentiate them from others that have the same given name (for example, "Maple") - */ - middleName?: string; - - /** - * Name bestowed upon an individual to denote membership in a group or family. (for example, "Appleseed") - */ - familyName?: string; - - /** - * The portion of a name’s full form of address that follows the name itself (for example, "Esq.," "Jr.," "Ph.D.") - */ - nameSuffix?: string; - - /** - * Name substituted for the purposes of familiarity (for example, "Johnny") - */ - nickname?: string; - - /** - * The phonetic representation name components of the receiver - */ - phoneticRepresentation?: NSPersonNameComponents; -} - -/** - * @see https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidcredential - */ -export interface AppleSignInResponse { - /** - * The user’s email address i.e. abc@privaterelay.appleid.com - */ - email?: string; - - /** - * An arbitrary string that your app provided to the request that generated the credential - */ - state?: string; - - /** - * A JSON Web Token (JWT) that securely communicates information about the user to your app - */ - identityToken: string; - - /** - * A short-lived token used by your app for proof of authorization when interacting with the app's server counterpart - */ - authorizationCode: string; - - /** - * The user's name - * - * @see https://developer.apple.com/documentation/foundation/nspersonnamecomponents?language=objc - */ - fullName?: NSPersonNameComponents; - - /** - * An identifier associated with the authenticated user - */ - user?: string; -} - -/** - * @see https://developer.apple.com/documentation/foundation/nserror - */ -export interface NSError { - /** - * The error code - */ - code?: number; - - /** - * A string containing the localized description of the error - */ - localizedDescription?: string; - - /** - * A string containing the localized explanation of the reason for the error - */ - localizedFailureReason?: string; -} - -export interface AppleSignInErrorResponse extends NSError { - /** - * The error i.e. "ASAUTHORIZATION_ERROR" - */ - error?: string; -} - -/** - * @name Sign In With Apple - * @description - * Sign in with Apple makes it easy for users to sign in to your apps and websites using their Apple ID. - * Instead of filling out forms, verifying email addresses, and choosing new passwords, - * they can use Sign in with Apple to set up an account and start using your app right away. - * All accounts are protected with two-factor authentication for superior security, - * and Apple will not track users’ activity in your app or website. - * Source:* https://developer.apple.com/sign-in-with-apple/ - * @usage - * ```typescript - * import { SignInWithApple, AppleSignInResponse, AppleSignInErrorResponse, ASAuthorizationAppleIDRequest } from '@awesome-cordova-plugins/sign-in-with-apple/ngx'; - * - * - * constructor(private signInWithApple: SignInWithApple) { } - * - * ... - * - * - * this.signInWithApple.signin({ - * requestedScopes: [ - * ASAuthorizationAppleIDRequest.ASAuthorizationScopeFullName, - * ASAuthorizationAppleIDRequest.ASAuthorizationScopeEmail - * ] - * }) - * .then((res: AppleSignInResponse) => { - * // https://developer.apple.com/documentation/signinwithapplerestapi/verifying_a_user - * alert('Send token to apple for verification: ' + res.identityToken); - * console.log(res); - * }) - * .catch((error: AppleSignInErrorResponse) => { - * alert(error.code + ' ' + error.localizedDescription); - * console.error(error); - * }); - * - * ``` - */ -@Plugin({ - pluginName: 'Sign in with Apple', - plugin: 'cordova-plugin-sign-in-with-apple', - pluginRef: 'cordova.plugins.SignInWithApple', - repo: 'https://github.com/twogate/cordova-plugin-sign-in-with-apple', - platforms: ['iOS'], -}) -@Injectable() -export class SignInWithApple extends AwesomeCordovaNativePlugin { - /** - * Starts the authorization flows named during controller initialization - * - * @see https://developer.apple.com/documentation/authenticationservices/asauthorizationcontroller/3153047-performrequests - * @returns {Promise} Returns a promise when authorization succeeds - * @param {ASAuthorizationAppleIDRequest} options - * @throws AppleSignInErrorResponse - */ - @Cordova() - signin(options: ASAuthorizationAppleIDRequest = {}): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/smartlook/index.ts b/src/@awesome-cordova-plugins/plugins/smartlook/index.ts deleted file mode 100644 index 115301ec..00000000 --- a/src/@awesome-cordova-plugins/plugins/smartlook/index.ts +++ /dev/null @@ -1,610 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export class SmartlookSetupConfigBuilder { - private readonly _smartlookSetupConfig: SmartlookSetupConfig; - - constructor(smartlookAPIKey: string) { - this._smartlookSetupConfig = new SmartlookSetupConfig(smartlookAPIKey); - } - - fps(fps: number): SmartlookSetupConfigBuilder { - this._smartlookSetupConfig.fps = fps; - return this; - } - - renderingMode(renderingMode: SmartlookRenderingMode): SmartlookSetupConfigBuilder { - this._smartlookSetupConfig.renderingMode = renderingMode.getRenderingModeString(); - return this; - } - - startNewSession(startNewSession: boolean): SmartlookSetupConfigBuilder { - this._smartlookSetupConfig.startNewSession = startNewSession; - return this; - } - - startNewSessionAndUser(startNewSessionAndUser: boolean): SmartlookSetupConfigBuilder { - this._smartlookSetupConfig.startNewSessionAndUser = startNewSessionAndUser; - return this; - } - - eventTrackingModes(eventTrackingModes: SmartlookEventTrackingModes): SmartlookSetupConfigBuilder { - this._smartlookSetupConfig.eventTrackingModes = eventTrackingModes.getEventTrackingModeStringArray(); - return this; - } - - build(): SmartlookSetupConfig { - return this._smartlookSetupConfig; - } -} - -export class SmartlookSetupConfig { - private smartlookAPIKey: string; - fps: number; - renderingMode: string; - startNewSession: boolean; - startNewSessionAndUser: boolean; - eventTrackingModes: string[]; - - constructor(smartlookAPIKey: string) { - this.smartlookAPIKey = smartlookAPIKey; - } -} - -export class SmartlookResetSession { - private resetUser: boolean; - - constructor(resetUser: boolean) { - this.resetUser = resetUser; - } -} - -export class SmartlookUserIdentifier { - private identifier: string; - private sessionProperties: {}; - - constructor(identifier: string, sessionProperties?: {}) { - this.identifier = identifier; - this.sessionProperties = sessionProperties; - } -} - -export class SmartlookEventTrackingMode { - private eventTrackingMode: string; - - static FULL_TRACKING(): SmartlookEventTrackingMode { - return new SmartlookEventTrackingMode('full_tracking'); - } - - static IGNORE_USER_INTERACTION(): SmartlookEventTrackingMode { - return new SmartlookEventTrackingMode('ignore_user_interaction'); - } - - static IGNORE_NAVIGATION_INTERACTION(): SmartlookEventTrackingMode { - return new SmartlookEventTrackingMode('ignore_navigation_interaction'); - } - - static IGNORE_RAGE_CLICKS(): SmartlookEventTrackingMode { - return new SmartlookEventTrackingMode('ignore_rage_clicks'); - } - - static NO_TRACKING(): SmartlookEventTrackingMode { - return new SmartlookEventTrackingMode('no_tracking'); - } - - getEventTrackingModeString(): string { - return this.eventTrackingMode; - } - - constructor(eventTrackingMode: string) { - this.eventTrackingMode = eventTrackingMode; - } -} - -export class SmartlookEventTrackingModes { - private eventTrackingModes: string[]; - - constructor(eventTrackingModes: SmartlookEventTrackingMode[]) { - this.eventTrackingModes = eventTrackingModes.map((eventTrackingMode) => - eventTrackingMode.getEventTrackingModeString() - ); - } - - getEventTrackingModeStringArray(): string[] { - return this.eventTrackingModes; - } -} - -export class SmartlookViewState { - static START = 'start'; - static STOP = 'stop'; -} - -export class SmartlookNavigationEvent { - private name: string; - private viewState: string; - - constructor(name: string, viewState?: string) { - this.name = name; - this.viewState = this.viewState; - } -} - -export class SmartlookCustomEvent { - private name: string; - private eventProperties: {}; - - constructor(name: string, eventProperties?: {}) { - this.name = name; - this.eventProperties = eventProperties; - } -} - -export class SmartlookTimedCustomEventStart { - private name: string; - private eventProperties: {}; - - constructor(name: string, eventProperties?: {}) { - this.name = name; - this.eventProperties = eventProperties; - } -} - -export class SmartlookTimedCustomEventStop { - private eventId: string; - private eventProperties: {}; - - constructor(eventId: string, eventProperties?: {}) { - this.eventId = eventId; - this.eventProperties = eventProperties; - } -} - -export class SmartlookTimedCustomEventCancel { - private eventId: string; - private reason: string; - private eventProperties: {}; - - constructor(eventId: string, reason: string, eventProperties?: {}) { - this.eventId = eventId; - this.reason = reason; - this.eventProperties = eventProperties; - } -} - -export class SmartlookGlobalEventProperties { - private globalEventProperties: {}; - private immutable: boolean; - - constructor(globalEventProperties: {}, immutable: boolean) { - this.globalEventProperties = globalEventProperties; - this.immutable = immutable; - } -} - -export class SmartlookGlobalEventProperty { - private key: string; - private value: string; - private immutable: boolean; - - constructor(key: string, value: string, immutable: boolean) { - this.key = key; - this.value = value; - this.immutable = immutable; - } -} - -export class SmartlookGlobalEventPropertyKey { - private key: string; - - constructor(key: string) { - this.key = key; - } -} - -export class SmartlookReferrer { - private referrer: string; - private source: string; - - constructor(referrer: string, source: string) { - this.referrer = referrer; - this.source = source; - } -} - -export class SmartlookDashboardSessionUrl { - private withCurrentTimestamp: boolean; - - constructor(withCurrentTimestamp: boolean) { - this.withCurrentTimestamp = withCurrentTimestamp; - } -} - -export interface SmartlookIntegrationListener { - onSessionReady: (dashboardSessionUrl: string) => any; - onVisitorReady: (dashboardVisitorUrl: string) => any; -} - -export class SmartlookRenderingMode { - private renderingMode: string; - - static NO_RENDERING(): SmartlookRenderingMode { - return new SmartlookRenderingMode('no_rendering'); - } - - static NATIVE(): SmartlookRenderingMode { - return new SmartlookRenderingMode('native'); - } - - getRenderingModeString(): string { - return this.renderingMode; - } - - constructor(renderingMode: string) { - this.renderingMode = renderingMode; - } -} - -/** - * @name Smartlook - * @description - * Official Smartlook SDK plugin. - * Full documentation can be found here: https://smartlook.github.io/docs/sdk/ionic/ - * @usage - * ```typescript - * import { Smartlook, SmartlookSetupConfig } from '@awesome-cordova-plugins/smartlook/ngx'; - * - * ... - * - * @Component( ... ) - * export class AppComponent { - * constructor(private smartlook: Smartlook) { - * this.platform.ready().then(() => { - * this.smartlook.setupAndStartRecording(new SmartlookSetupConfig("YOUR API KEY")); - * } - * } - * } - * ``` - * @classes - * SmartlookSetupConfigBuilder - * SmartlookSetupConfig - * SmartlookResetSession - * SmartlookUserIdentifier - * SmartlookEventTrackingMode - * SmartlookNavigationEvent - * SmartlookViewState - * SmartlookCustomEvent - * SmartlookTimedCustomEventStart - * SmartlookTimedCustomEventStop - * SmartlookTimedCustomEventCancel - * SmartlookGlobalEventProperties - * SmartlookGlobalEventProperty - * SmartlookGlobalEventPropertyKey - * SmartlookReferrer - * SmartlookDashboardSessionUrl - * SmartlookRenderingMode - * SmartlookEventTrackingMode - * SmartlookEventTrackingModes - */ -@Plugin({ - pluginName: 'Smartlook', - plugin: 'https://github.com/smartlook/cordova-smartlook.git', - pluginRef: 'cordova.plugins.SmartlookPlugin', - repo: 'https://github.com/smartlook/cordova-smartlook.git', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Smartlook extends AwesomeCordovaNativePlugin { - /** - * Setup and start Smartlook SDK recording. - * - * @param config SmartlookSetupConfig object. - * @param config.smartlookAPIKey (required) Smartlook API key (you can obtain it in your dashboard). - * @param config.fps (optional) recorded video framerate (allowed values 2-10 fps). - * @param options.renderingMode (optional) Mode defining the video output of recording. - * @param options.startNewSession (optional) If true new session is going to be created - * @param options.startNewSessionAndUser (optional) If true new session and visitor is going to be created - */ - @Cordova({ sync: true }) - setupAndStartRecording(config: SmartlookSetupConfig): void { - return; - } - - /** - * Setup/initialize Smartlook SDK. This method DOESN'T start the recording (@see start()) - * - * @param config SmartlookSetupConfig object. - * @param config.smartlookAPIKey (required) Smartlook API key (you can obtain it in your dashboard). - * @param config.fps (optional) recorded video framerate (allowed values 2-10 fps). - * @param options.renderingMode (optional) Mode defining the video output of recording. - * @param options.startNewSession (optional) If true new session is going to be created - * @param options.startNewSessionAndUser (optional) If true new session and visitor is going to be created - */ - @Cordova({ sync: true }) - setup(config: SmartlookSetupConfig): void { - return; - } - - /** - * Start SDK recording. - */ - @Cordova({ sync: true }) - startRecording(): void { - return; - } - - /** - * Stop SDK recording. Recording will start again when you call start(). - */ - @Cordova({ sync: true }) - stopRecording(): void { - return; - } - - /** - * Check if SDK is currently recording. - * - * @returns {Promise} Returns a promise with isRecording boolean. - */ - @Cordova() - isRecording(): Promise { - return; - } - - /** - * Resets current session and new session in dashboard is created. - * - * @param resetSession SmartlookResetSession object. - * @param resetSession.resetUser If set to TRUE new visitor is created in the dashboard. - */ - @Cordova({ sync: true }) - resetSession(resetSession: SmartlookResetSession): void { - return; - } - - /** - * When you start sensitive mode SDK records blank videos (single color) but SDK still sends analytic events. - */ - @Cordova({ sync: true }) - startFullscreenSensitiveMode(): void { - return; - } - - /** - * Stop sensitive mode -> SDK records video. - */ - @Cordova({ sync: true }) - stopFullscreenSensitiveMode(): void { - return; - } - - /** - * Check if fullscreen sensitive mode is active. - * - * @returns {Promise} Returns a promise with isFullscreenSensitiveModeActive boolean. - */ - @Cordova() - isFullscreenSensitiveModeActive(): Promise { - return; - } - - /** - * Identify user. - * - * @param identifier SmartlookUserIdentifier object. - * @param identifier.idenfier (required) id that can be used to identify user and his records. - * You will see this Id in Smartlook dashboard so you can pair records with concrete user. - * @param identifier.sessionProperties (optional) custom session properties object. - */ - @Cordova({ sync: true }) - setUserIdentifier(identifier: SmartlookUserIdentifier): void { - return; - } - - /** - * You can configure which events are being tracked by setting eventTrackingMode. - * - * @param eventTrackingMode Can be on of: - * - EventTrackingMode.FULL_TRACKING ... track everything - * - EventTrackingMode.IGNORE_USER_INTERACTION ... will not track touches - * focus, keyboard, selector events - * - EventTrackingMode.IGNORE_NAVIGATION_INTERACTION ... will not track screen names - * - EventTrackingMode.IGNORE_RAGE_CLICKS ... will not track rage clicks - * - EventTrackingMode.NO_TRACKING ... not gonna track any events - */ - @Cordova({ sync: true }) - setEventTrackingMode(eventTrackingMode: SmartlookEventTrackingMode): void { - return; - } - - /** - * You can configure which events are being tracked by setting eventTrackingMode. - * - * @param eventTrackingModes Array of EventTrackingModes. - */ - @Cordova({ sync: true }) - setEventTrackingModes(eventTrackingModes: SmartlookEventTrackingModes): void { - return; - } - - /** - * Track custom navigation event. - * - * @param navigationEvent SmartlookNavigationEvent object. - * @param navigationEvent.name Controler/Activity/Page name. - * @param navigationEvent.viewState One of SmartlookViewState.START or SmartlookViewState.STOP. - */ - @Cordova({ sync: true }) - trackNavigationEvent(navigationEvent: SmartlookNavigationEvent) { - return; - } - - /** - * Track custom event. - * - * @param timedEvent SmartlookTimedCustomEventStart object. - * @param timedEvent.name (required) string used to identify event in dashboard. - * @param timedEvent.eventProperties (optional) timed event properties object. These properties - * are going to be merged with properties passed in stop/cancel. - * @returns {Promise} Returns a promise with eventId string (@see stopTimedCustomEvent(), @see cancelTimedCustomEvent()). - */ - @Cordova() - startTimedCustomEvent(timedEvent: SmartlookTimedCustomEventStart): Promise { - return; - } - - /** - * Stops timed event. Duration from according start is calculated and send with the event. - * - * @param timedEvent SmartlookTimedCustomEventStop object. - * @param timedEvent.eventId (required) Unique event id that is used to identify this event. - * @param timedEvent.eventProperties (optional) timed event properties object. These properties - * are going to be merged with properties passed in start. - */ - @Cordova({ sync: true }) - stopTimedCustomEvent(timedEvent: SmartlookTimedCustomEventStop): void { - return; - } - - /** - * Cancels timed event. It calculates event duration and notes that this event has failed. - * - * @param timedEvent SmartlookTimedCustomEventCancel object. - * @param timedEvent.eventId (required) Unique event id that is used to identify this event. - * @param timedEvent.reason (required) Short string description explaining why the event was canceled. - * @param timedEvent.eventProperties (optional) timed event properties object. These properties - * are going to be merged with properties passed in start. - */ - @Cordova({ sync: true }) - cancelTimedCustomEvent(timedEvent: SmartlookTimedCustomEventCancel): void { - return; - } - - /** - * Track custom event. - * - * @param event SmartlookCustomEvent object. - * @param event.name (required) string used to identify event. - * @param event.eventProperties (optional) event properties object. - */ - @Cordova({ sync: true }) - trackCustomEvent(event: SmartlookCustomEvent): void { - return; - } - - /** - * Set global event properties that will be added to every tracked event. - * - * @param properties SmartlookGlobalEventProperties object. - * @param properties.globalEventProperties (required) global event properties object. - * @param properties.immutable (required) If set to TRUE these properties have higher priority - * than mutable ones and also they cannot be changed (only removed). - */ - @Cordova({ sync: true }) - setGlobalEventProperties(properties: SmartlookGlobalEventProperties): void { - return; - } - - /** - * Check if SDK is currently recording. - * - * @param property SmartlookGlobalEventProperty object. - * @param property.key (required) global property key. - * @param property.value (required) global property value. - * @param property.immutable (required) If set to TRUE these properties have higher priority - * than mutable ones and also they cannot be changed (only removed). - */ - @Cordova({ sync: true }) - setGlobalEventProperty(property: SmartlookGlobalEventProperty): void { - return; - } - - /** - * Remove property from global event properties. - * - * @param property SmartlookGlobalEventPropertyKey object. - * @param property.key (required) Global property key. - */ - @Cordova({ sync: true }) - removeGlobalEventProperty(property: SmartlookGlobalEventPropertyKey): void { - return; - } - - /** - * Remove all properties from global event properties. - */ - @Cordova({ sync: true }) - removeAllGlobalEventProperties(): void { - return; - } - - /** - * Possibility to manually set referrer and source of the installation visible in dashboard - * and accessible via filters. - * - * @param referrer SmartlookReferrer object. - * @param referrer.referrer (required) Desired referrer value. - * @param referrer.source (required) Desired source, i.e. com.android.vending or com.amazon.venezia. - */ - @Cordova({ sync: true }) - setReferrer(referrer: SmartlookReferrer): void { - return; - } - - /** - * Obtain session URL leading to our dashboard. - * - * @param smartlookDashboardSessionUrl SmartlookDashboardSessionUrl object. - * @param smartlookDashboardSessionUrl.withCurrentTimestamp If set to TRUE record will start at current timestamp. - * @returns {Promise} Returns a promise with dashboard session URL string. - */ - @Cordova() - getDashboardSessionUrl(smartlookDashboardSessionUrl: SmartlookDashboardSessionUrl): Promise { - return; - } - - /** - * Obtain visitor URL leading to our dashboard. - * - * @returns {Promise} Returns a promise with dashboard visitor URL string. - */ - @Cordova() - getDashboardVisitorUrl(): Promise { - return; - } - - /** - * Integration listener can be used to obtain dashboard URL for current session and visitor. - * These URLs can be propagated to various analytic tools/SDKs. - * - * @param integrationListener SmartlookIntegrationListener object. - * @param integrationListener.onSessionReady Called when dashboard session URL is ready. Note that this URL can be accesed only by user - * that has access to Smartlook dashboard (it is not public share link). - * @param integrationListener.onVisitorReady Called when dashboard visitor URL is ready. Note that this URL can be accesed only by user - * that has access to Smartlook dashboard (it is not public share link). - */ - @Cordova({ sync: true }) - registerIntegrationListener(integrationListener: SmartlookIntegrationListener): void { - return; - } - - /** - * By changing rendering mode you can adjust the way we render the application for recordings. - * - * @param options.renderingMode Mode defining the video output of recording. Curently only - * SmartlookRenderingMode.NO_RENDERING() and SmartlookRenderingMode.NATIVE() available. - * @param renderingMode - */ - @Cordova({ sync: true }) - setRenderingMode(renderingMode: SmartlookRenderingMode): void { - return; - } - - /** - * Unregister Integration listener (@see registerIntegrationListener()) - */ - @Cordova({ sync: true }) - unregisterIntegrationListener(): void { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/sms-retriever/index.ts b/src/@awesome-cordova-plugins/plugins/sms-retriever/index.ts deleted file mode 100644 index 4a899aa9..00000000 --- a/src/@awesome-cordova-plugins/plugins/sms-retriever/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Sms Retriever - * @description - * This plugin retrives the SMS which arrive without requiring READ permissions. - * @usage - * ```typescript - * import { SmsRetriever } from '@awesome-cordova-plugins/sms-retriever/ngx'; - * - * - * constructor(private smsRetriever: SmsRetriever) { } - * - * ... - * - * - * this.smsRetriever.getAppHash() - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * this.smsRetriever.startWatching() - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'SmsRetriever', - plugin: 'cordova-plugin-sms-retriever-manager', - pluginRef: 'cordova.plugins.smsRetriever', - repo: 'https://github.com/hanatharesh2712/ionic-native-sms-retriever-plugin-master', - install: 'ionic cordova plugin add cordova-plugin-sms-retriever-manager --variable PLAY_SERVICES_VERSION="15.0.1"', - installVariables: ['PLAY_SERVICES_VERSION'], - platforms: ['Android'], -}) -@Injectable() -export class SmsRetriever extends AwesomeCordovaNativePlugin { - /** - * This function start wathching message arrive event and retrive message text. - * - * @returns {Promise} Returns a promise that resolves when retrives SMS text or TIMEOUT after 5 min. - */ - @Cordova() - startWatching(): Promise<{ Message: string }> { - return; - } - - /** - * This function is to get hash string of APP. - * - * @returns {Promise} Returns a promise that resolves when successfully generate hash of APP. - */ - @Cordova() - getAppHash(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/sms/index.ts b/src/@awesome-cordova-plugins/plugins/sms/index.ts deleted file mode 100644 index f29194a6..00000000 --- a/src/@awesome-cordova-plugins/plugins/sms/index.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * Options for sending an SMS - */ -export interface SmsOptions { - /** - * Set to true to replace \n by a new line. Default: false - */ - replaceLineBreaks?: boolean; - - android?: SmsOptionsAndroid; -} - -export interface SmsOptionsAndroid { - /** - * Set to "INTENT" to send SMS with the native android SMS messaging. Leaving it empty will send the SMS without opening any app. - */ - intent?: string; -} - -/** - * @name SMS - * @description - * - * Requires Cordova plugin: cordova-sms-plugin. For more info, please see the [SMS plugin docs](https://github.com/cordova-sms/cordova-sms-plugin). - * @usage - * ```typescript - * import { SMS } from '@awesome-cordova-plugins/sms/ngx'; - * - * constructor(private sms: SMS) { } - * - * - * ... - * - * - * // Send a text message using default options - * this.sms.send('416123456', 'Hello world!'); - * ``` - * @interfaces - * SmsOptions - * SmsOptionsAndroid - */ -@Plugin({ - pluginName: 'SMS', - plugin: 'cordova-sms-plugin', - pluginRef: 'sms', - repo: 'https://github.com/cordova-sms/cordova-sms-plugin', - platforms: ['Android', 'iOS', 'Windows', 'Windows Phone 8'], -}) -@Injectable() -export class SMS extends AwesomeCordovaNativePlugin { - /** - * Sends sms to a number - * - * @param phoneNumber {string|string[]} Phone number - * @param message {string} Message - * @param options {SmsOptions} Options - * @returns {Promise} Resolves promise when the SMS has been sent - */ - @Cordova({ - successIndex: 3, - errorIndex: 4, - }) - send(phoneNumber: string | string[], message: string, options?: SmsOptions): Promise { - return; - } - - /** - * This function lets you know if the app has permission to send SMS - * - * @returns {Promise} returns a promise that resolves with a boolean that indicates if we have permission - */ - @Cordova({ - platforms: ['Android'], - }) - hasPermission(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/social-sharing/index.ts b/src/@awesome-cordova-plugins/plugins/social-sharing/index.ts deleted file mode 100644 index db026206..00000000 --- a/src/@awesome-cordova-plugins/plugins/social-sharing/index.ts +++ /dev/null @@ -1,327 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Social Sharing - * @premier social-sharing - * @description - * Share text, files, images, and links via social networks, sms, and email. - * - * For Browser usage check out the Web Share API docs: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#5-web-share-api - * @usage - * ```typescript - * import { SocialSharing } from '@awesome-cordova-plugins/social-sharing/ngx'; - * - * constructor(private socialSharing: SocialSharing) { } - * - * ... - * - * // Check if sharing via email is supported - * this.socialSharing.canShareViaEmail().then(() => { - * // Sharing via email is possible - * }).catch(() => { - * // Sharing via email is not possible - * }); - * - * // Share via email - * this.socialSharing.shareViaEmail('Body', 'Subject', ['recipient@example.org']).then(() => { - * // Success! - * }).catch(() => { - * // Error! - * }); - * ``` - */ -@Plugin({ - pluginName: 'SocialSharing', - plugin: 'cordova-plugin-x-socialsharing', - pluginRef: 'plugins.socialsharing', - repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin', - platforms: ['Android', 'Browser', 'iOS', 'Windows', 'Windows Phone'], -}) -@Injectable() -export class SocialSharing extends AwesomeCordovaNativePlugin { - /** - * Shares using the share sheet - * - * @param message {string} The message you would like to share. - * @param subject {string} The subject - * @param file {string|string[]} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone. - * @param url {string} A URL to share - * @returns {Promise} - */ - @Cordova({ - successIndex: 4, - errorIndex: 5, - }) - share(message?: string, subject?: string, file?: string | string[], url?: string): Promise { - return; - } - - /** - * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+) - * - * @param options {object} The options object with the message, subject, files, url and chooserTitle properties. - * @param options.message - * @param options.subject - * @param options.files - * @param options.url - * @param options.chooserTitle - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS', 'Android'], - }) - shareWithOptions(options: { - message?: string; - subject?: string; - files?: string[]; - url?: string; - chooserTitle?: string; - }): Promise { - return; - } - - /** - * Checks if you can share via a specific app. - * - * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook - * @param message {string} - * @param subject {string} - * @param image {string} - * @param url {string} - * @returns {Promise} - */ - @Cordova({ - successIndex: 5, - errorIndex: 6, - platforms: ['iOS', 'Android'], - }) - canShareVia(appName: string, message?: string, subject?: string, image?: string, url?: string): Promise { - return; - } - - /** - * Shares directly to Twitter - * - * @param message {string} - * @param image {string} - * @param url {string} - * @returns {Promise} - */ - @Cordova({ - successIndex: 3, - errorIndex: 4, - platforms: ['iOS', 'Android'], - }) - shareViaTwitter(message: string, image?: string, url?: string): Promise { - return; - } - - /** - * Shares directly to Facebook - * - * @param message {string} - * @param image {string} - * @param url {string} - * @returns {Promise} - */ - @Cordova({ - successIndex: 3, - errorIndex: 4, - platforms: ['iOS', 'Android'], - }) - shareViaFacebook(message: string, image?: string, url?: string): Promise { - return; - } - - /** - * Shares directly to Facebook with a paste message hint - * - * @param message {string} - * @param image {string} - * @param url {string} - * @param pasteMessageHint {string} - * @returns {Promise} - */ - @Cordova({ - successIndex: 4, - errorIndex: 5, - platforms: ['iOS', 'Android'], - }) - shareViaFacebookWithPasteMessageHint( - message: string, - image?: string, - url?: string, - pasteMessageHint?: string - ): Promise { - return; - } - - /** - * Shares directly to Instagram - * - * @param message {string} - * @param image {string} - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS', 'Android'], - }) - shareViaInstagram(message: string, image: string): Promise { - return; - } - - /** - * Shares directly to WhatsApp - * - * @param message {string} - * @param image {string} - * @param url {string} - * @returns {Promise} - */ - @Cordova({ - successIndex: 3, - errorIndex: 4, - platforms: ['iOS', 'Android'], - }) - shareViaWhatsApp(message: string, image?: string, url?: string): Promise { - return; - } - - /** - * Shares directly to a WhatsApp Contact - * - * @param receiver {string} Pass phone number on Android, and Addressbook ID (abid) on iOS - * @param message {string} Message to send - * @param image {string} Image to send (does not work on iOS - * @param url {string} Link to send - * @returns {Promise} - */ - @Cordova({ - successIndex: 4, - errorIndex: 5, - platforms: ['iOS', 'Android'], - }) - shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise { - return; - } - - /** - * Share via SMS - * - * @param messge {string} message to send - * @param phoneNumber {string} Number or multiple numbers seperated by commas - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS', 'Android'], - }) - shareViaSMS(messge: string, phoneNumber: string): Promise { - return; - } - - /** - * Checks if you can share via email - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS', 'Android'], - }) - canShareViaEmail(): Promise { - return; - } - - /** - * Share via Email - * - * @param message {string} - * @param subject {string} - * @param to {string[]} - * @param cc {string[]} Optional - * @param bcc {string[]} Optional - * @param files {string|string[]} Optional URL or local path to file(s) to attach - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS', 'Android'], - successIndex: 6, - errorIndex: 7, - }) - shareViaEmail( - message: string, - subject: string, - to: string[], - cc?: string[], - bcc?: string[], - files?: string | string[] - ): Promise { - return; - } - - /** - * Share via AppName - * - * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook - * @param message {string} - * @param subject {string} - * @param image {string} - * @param url {string} - * @returns {Promise} - */ - @Cordova({ - successIndex: 5, - errorIndex: 6, - platforms: ['iOS', 'Android'], - }) - shareVia(appName: string, message: string, subject?: string, image?: string, url?: string): Promise { - return; - } - - /** - * defines the popup position before call the share method. - * - * @param targetBounds {string} left, top, width, height - */ - @Cordova({ - sync: true, - platforms: ['iOS'], - }) - setIPadPopupCoordinates(targetBounds: string): void {} - - /** - * Save an array of images to the camera roll - * - * @param {string|string[]} fileOrFileArray Single or multiple files - * @returns {Promise } - */ - @Cordova({ - platforms: ['iOS'], - }) - saveToPhotoAlbum(fileOrFileArray: string | string[]): Promise { - return; - } - - /** - * Shares directly to a WhatsApp Contact with phone number. - * - * @param phone {string} Pass phone number - * @param message {string} Message to send - * @param fileOrFileArray fileOrFileArray Single or multiple files - * @param url {string} Link to send - * @returns {Promise} - */ - @Cordova({ - successIndex: 5, - errorIndex: 6, - platforms: ['iOS', 'Android'], - }) - shareViaWhatsAppToPhone( - phone: string, - message: string, - fileOrFileArray: string | string[], - url?: string - ): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/speech-recognition/index.ts b/src/@awesome-cordova-plugins/plugins/speech-recognition/index.ts deleted file mode 100644 index 77aa2b8f..00000000 --- a/src/@awesome-cordova-plugins/plugins/speech-recognition/index.ts +++ /dev/null @@ -1,171 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export type SpeechRecognitionListeningOptions = - | SpeechRecognitionListeningOptionsIOS - | SpeechRecognitionListeningOptionsAndroid; - -export interface SpeechRecognitionListeningOptionsIOS { - /** - * used language for recognition (default `"en-US"`) - */ - language?: string; - - /** - * umber of return matches (default `5`) - */ - matches?: number; - - /** - * Allow partial results to be returned (default `false`) - */ - showPartial?: boolean; -} - -export interface SpeechRecognitionListeningOptionsAndroid { - /** - * used language for recognition (default `"en-US"`) - */ - language?: string; - - /** - * number of return matches (maximum number of matches) - */ - matches?: number; - - /** - * displayed prompt of listener popup window - */ - prompt?: string; - - /** - * display listener popup window with prompt (default `true`) - */ - showPopup?: boolean; - - /** - * Allow partial results to be returned (default `false`) - */ - showPartial?: boolean; -} - -/** - * @name Speech Recognition - * @description - * This plugin does speech recognition using cloud services - * @usage - * ```typescript - * import { SpeechRecognition } from '@awesome-cordova-plugins/speech-recognition/ngx'; - * - * constructor(private speechRecognition: SpeechRecognition) { } - * - * ... - * - * - * - * // Check feature available - * this.speechRecognition.isRecognitionAvailable() - * .then((available: boolean) => console.log(available)) - * - * // Start the recognition process - * this.speechRecognition.startListening(options) - * .subscribe( - * (matches: string[]) => console.log(matches), - * (onerror) => console.log('error:', onerror) - * ) - * - * // Stop the recognition process (iOS only) - * this.speechRecognition.stopListening() - * - * // Get the list of supported languages - * this.speechRecognition.getSupportedLanguages() - * .then( - * (languages: string[]) => console.log(languages), - * (error) => console.log(error) - * ) - * - * // Check permission - * this.speechRecognition.hasPermission() - * .then((hasPermission: boolean) => console.log(hasPermission)) - * - * // Request permissions - * this.speechRecognition.requestPermission() - * .then( - * () => console.log('Granted'), - * () => console.log('Denied') - * ) - * - * ``` - */ -@Plugin({ - pluginName: 'SpeechRecognition', - plugin: 'cordova-plugin-speechrecognition', - pluginRef: 'plugins.speechRecognition', - repo: 'https://github.com/pbakondy/cordova-plugin-speechrecognition', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class SpeechRecognition extends AwesomeCordovaNativePlugin { - /** - * Check feature available - * - * @returns {Promise} - */ - @Cordova() - isRecognitionAvailable(): Promise { - return; - } - - /** - * Start the recognition process - * - * @param options - * @returns {Promise< string[] >} list of recognized terms - */ - @Cordova({ - callbackOrder: 'reverse', - observable: true, - }) - startListening(options?: SpeechRecognitionListeningOptions): Observable { - return; - } - - /** - * Stop the recognition process - */ - @Cordova() - stopListening(): Promise { - return; - } - - /** - * Get the list of supported languages - * - * @returns {Promise< string[] >} list of languages - */ - @Cordova() - getSupportedLanguages(): Promise { - return; - } - - /** - * Check permission - * - * @returns {Promise} has permission - */ - @Cordova() - hasPermission(): Promise { - return; - } - - /** - * Request permissions - * - * @returns {Promise} - */ - @Cordova() - requestPermission(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/spinner-dialog/index.ts b/src/@awesome-cordova-plugins/plugins/spinner-dialog/index.ts deleted file mode 100644 index f7c0b106..00000000 --- a/src/@awesome-cordova-plugins/plugins/spinner-dialog/index.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface SpinnerDialogIOSOptions { - /** - * Opacity of the overlay, between 0 (transparent) and 1 (opaque). Default: 0.35 - */ - overlayOpacity?: number; - - /** - * Red component of the text color, between 0 and 1. Default: 1 - */ - textColorRed?: number; - - /** - * Green component of the text color, between 0 and 1. Default: 1 - */ - textColorGreen?: number; - - /** - * Blue component of the text color, between 0 and 1. Default: 1 - */ - textColorBlue?: number; -} - -/** - * @name Spinner Dialog - * @description - * Cordova plugin for showing a native spinner based on Paldom/SpinnerDialog. - * - * 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). - * @usage - * ```typescript - * import { SpinnerDialog } from '@awesome-cordova-plugins/spinner-dialog/ngx'; - * - * constructor(private spinnerDialog: SpinnerDialog) { } - * - * ... - * - * this.spinnerDialog.show(); - * - * this.spinnerDialog.hide(); - * ``` - * @interfaces - * SpinnerDialogIOSOptions - */ -@Plugin({ - pluginName: 'SpinnerDialog', - plugin: 'cordova-plugin-native-spinner', - pluginRef: 'SpinnerDialog', - repo: 'https://github.com/greybax/cordova-plugin-native-spinner', - platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows'], -}) -@Injectable() -export class SpinnerDialog extends AwesomeCordovaNativePlugin { - /** - * Shows the spinner dialog - * - * @param title {string} Spinner title (shows on Android only) - * @param message {string} Spinner message - * @param cancelCallback {boolean|function} Set to true to set spinner not cancelable. Or provide a function to call when the user cancels the spinner. - * @param iOSOptions {object} Options for iOS only - */ - @Cordova({ - sync: true, - }) - show(title?: string, message?: string, cancelCallback?: any, iOSOptions?: SpinnerDialogIOSOptions): void {} - - /** - * Hides the spinner dialog if visible - */ - @Cordova({ - sync: true, - }) - hide(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/splash-screen/index.ts b/src/@awesome-cordova-plugins/plugins/splash-screen/index.ts deleted file mode 100644 index 3a546423..00000000 --- a/src/@awesome-cordova-plugins/plugins/splash-screen/index.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Splash Screen - * @premier splashscreen - * @capacitorincompatible true - * @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. - * @usage - * ```typescript - * import { SplashScreen } from '@awesome-cordova-plugins/splash-screen/ngx'; - * - * constructor(private splashScreen: SplashScreen) { } - * - * ... - * - * this.splashScreen.show(); - * - * this.splashScreen.hide(); - * ``` - */ -@Plugin({ - pluginName: 'SplashScreen', - plugin: 'cordova-plugin-splashscreen', - pluginRef: 'navigator.splashscreen', - repo: 'https://github.com/apache/cordova-plugin-splashscreen', - platforms: ['Amazon Fire OS', 'Android', 'iOS', 'Windows'], -}) -@Injectable() -export class SplashScreen extends AwesomeCordovaNativePlugin { - /** - * Shows the splashscreen - */ - @Cordova({ - sync: true, - }) - show(): void {} - - /** - * Hides the splashscreen - */ - @Cordova({ - sync: true, - }) - hide(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/spotify-auth/index.ts b/src/@awesome-cordova-plugins/plugins/spotify-auth/index.ts deleted file mode 100644 index 8d4869db..00000000 --- a/src/@awesome-cordova-plugins/plugins/spotify-auth/index.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * OAuth configuration data. - */ -export interface Config { - /** The client ID as per the Spotify dev console. */ - clientId: string; - - /** The redirect URI as entered in the Spotify dev console. */ - redirectUrl: string; - - /** - * Safety margin time (in milliseconds) for the token refresh. - * - * The plugin applies a safety margin to the token lifetime in order - * to give the token user enough time to perform all operations needed. - * - * Otherwise the plugin might hand out a token that is already expired - * before it could ever be used. - * - * The safety margin defaults to 30s. - */ - refreshSafetyMargin?: number; - - /** Requested OAuth scopes. */ - scopes: string[]; - - /** The token exchange URL. */ - tokenExchangeUrl: string; - - /** The token refresh URL. */ - tokenRefreshUrl: string; -} - -/** - * The authorization data. - */ -export interface AuthorizationData { - /** A valid access token. */ - accessToken: string; - - /** The encrypted refresh token. */ - encryptedRefreshToken: string; - - /** The date (from UTC, in milliseconds) when the given access token expires. */ - expiresAt: number; -} - -/** - * @name Spotify Auth - * @description - * Cordova plugin for authenticating with Spotify - * > https://github.com/Festify/cordova-spotify-oauth - * @usage - * ```typescript - * import { SpotifyAuth } from '@awesome-cordova-plugins/spotify-auth/ngx'; - * - * // [...] - * - * constructor(private spotifyAuth: SpotifyAuth) { } - * - * // [...] - * - * const config = { - * clientId: "", - * redirectUrl: "", - * scopes: ["streaming"], // see Spotify Dev console for all scopes - * tokenExchangeUrl: "", - * tokenRefreshUrl: "", - * }; - * - * ... - * - * this.spotifyAuth.authorize(config) - * .then(({ accessToken, expiresAt }) => { - * console.log(`Got an access token, its ${accessToken}!`); - * console.log(`Its going to expire in ${expiresAt - Date.now()}ms.`); - * }); - * - * // [...] - * - * this.spotifyAuth.forget(); - * - * // [...] - * ``` - */ -@Plugin({ - pluginName: 'SpotifyAuth', - plugin: 'cordova-spotify-oauth', - pluginRef: 'cordova.plugins.spotifyAuth', - repo: 'https://github.com/Festify/cordova-spotify-oauth', - install: 'ionic cordova plugin add cordova-spotify-oauth --variable LOCAL_STORAGE_KEY="SpotifyOAuthData"', - installVariables: ['LOCAL_STORAGE_KEY'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class SpotifyAuth extends AwesomeCordovaNativePlugin { - /** - * Obtains valid authorization data. - * - * This method performs the necessary steps in order to obtain a valid - * access token. It performs the OAuth dance prompting the user to log in, - * exchanges the obtained authorization code for an access and a refresh - * token, caches those, and returns both to the developer. - * - * When it is invoked again, it will first check whether the cached access - * token is still valid (including a configurable safety margin) and the - * scopes equal, and return the token directly if that is the case. Otherwise, - * the method will transparently refresh the token (or obtain a new one if - * the scopes changed) and return that. - * - * Bottom line - always call this if you need a valid access token in your code. - * - * @param cfg {Config} configuration - * @returns {Promise} - */ - @Cordova({ - sync: false, - }) - authorize(cfg: Config): Promise { - return; - } - - /** - * Removes all cached data so that `authorize` performs the full - * oauth dance again. - * - * This is akin to a "logout". - * - * @returns {void} - */ - @Cordova({ - sync: true, - }) - forget(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/sqlite-db-copy/index.ts b/src/@awesome-cordova-plugins/plugins/sqlite-db-copy/index.ts deleted file mode 100644 index 44037779..00000000 --- a/src/@awesome-cordova-plugins/plugins/sqlite-db-copy/index.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Sqlite Db Copy - * @description - * This plugin does something - * @usage - * ```typescript - * import { SqliteDbCopy } from '@awesome-cordova-plugins/sqlite-db-copy/ngx'; - * - * - * constructor(private sqliteDbCopy: SqliteDbCopy) { } - * - * ... - * - * - * this.sqliteDbCopy.copy('sample.db', 0) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'cordova-plugin-dbcopy', - plugin: 'cordova-plugin-dbcopy', - pluginRef: 'window.plugins.sqlDB', - repo: 'https://github.com/an-rahulpandey/cordova-plugin-dbcopy', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class SqliteDbCopy extends AwesomeCordovaNativePlugin { - /** - * Copy database from www directory to device SQLite DB location - * (for ios only, use 0 for Android) - * location = 0; // (Disable iCloud Backup) If set will copy the database to Library/LocalDatabase. The database will not be synced by the iCloud Backup. - * or - * location = 1; // If set will copy the database to Library folder instead of Documents folder. - * or - * location = 2; // It will copy the database in the default SQLite Database directory. This is the default location for database - * - * @param dbname {string} Database file name available in www diretory with extension.The plugin will look for and copy the file according to the filename provided here. And the same file name should be used while opening the database via SQLitePlugin - * @param location {number} Location where to copy the database for app (only applicable for ios).For Android pass 0. - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova({ - successIndex: 2, - errorIndex: 3, - }) - copy(dbname: string, location: number): Promise { - return; - } - /** - * Check if database is available at external storage. Useful when trying to copying the database from device sdcard. - * - * @param dbname {string} Name of the database file which is available on external or intenral storage - * @param source {string} Full native path for the folder in which db file is present. The "/" must be added at the end of path. For.eg. /sdcard/mydb/. Should not include dbname. - * @returns {Promise} - */ - @Cordova({ - successIndex: 2, - errorIndex: 3, - }) - checkDbOnStorage(dbname: string, source: string): Promise { - return; - } - /** - * Copy database which is available on the device external/internal storage to app default db location - * (for ios only, use 0 for Android) - * location = 0; // (Disable iCloud Backup) If set will copy the database to Library/LocalDatabase. The database will not be synced by the iCloud Backup. - * or - * location = 1; // If set will copy the database to Library folder instead of Documents folder. - * or - * location = 2; // It will copy the database in the default SQLite Database directory. This is the default location for database - * - * @param dbname {string} Is the name of the database you want to copy. The plugin will look for and copy the file according to the filename provided here. And the same file name should be used while opening the database via SQLitePlugin - * @param location {number} Location where to copy the database for app (only applicable for ios). For Android pass 0. - * @param source {string} Source File location like /sdcard/mydb/db.db. Please provide a valid existing location and the dbname should be present in the path. - * @param deleteolddb {boolean} A boolean value if set to true, will delete the existing db from the local app database folder before copying the new db. Please provide proper boolean value true or false; - * @returns {Promise} - */ - @Cordova({ - successIndex: 4, - errorIndex: 5, - }) - copyDbFromStorage(dbname: string, location: number, source: string, deleteolddb: boolean): Promise { - return; - } - /** - * Copy the app database to external/internal storage on the device. - * (for ios only, use 0 for Android) - * location = 0; //It will copy the database from Library/LocalDatabase location. - * or - * location = 1; // It will copy the database from Library folder instead. - * or - * location = 2; // It will copy the database from the default SQLite Database directory. This is the default location for database - * - * @param dbname {string} Is the name of the database you want to copy. The plugin will look for and copy the file according to the filename provided here. And the same file name should be used while opening the database via SQLitePlugin. - * @param location {number} Location where to copy the database for app (only applicable for ios). For Android pass 0. - * @param destination {string} Destination File location like /sdcard/mydb/ Please provide a valid existing location and "/" should be present at the end of the path. Do not append db name in the path. - * @param overwrite {boolean} If set to true, then will replace the file at the destination. Otherwise will throw an error, if destination file already exists. - * @returns {Promise} - */ - @Cordova({ - successIndex: 4, - errorIndex: 5, - }) - copyDbToStorage(dbname: string, location: number, destination: string, overwrite: boolean): Promise { - return; - } - /** - * This method allows you to remove the database from the apps default database storage location. - * (for ios only, use 0 for Android) - * location = 0; // (Disable iCloud Backup) If set will copy the database to Library/LocalDatabase. The database will not be synced by the iCloud Backup. - * or - * location = 1; // If set will copy the database to Library folder instead of Documents folder. - * or - * location = 2; // It will copy the database in the default SQLite Database directory. This is the default location for database - * - * @param dbname {string} Is the name of the database you want to remove. If the database file is having any extension, please provide that also. - * @param location {number} Location where to copy the database for app (only applicable for ios).For Android pass 0. - * @returns {Promise} - */ - @Cordova({ - successIndex: 2, - errorIndex: 3, - }) - remove(dbname: string, location: number): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/sqlite-porter/index.ts b/src/@awesome-cordova-plugins/plugins/sqlite-porter/index.ts deleted file mode 100644 index 33f6e4e2..00000000 --- a/src/@awesome-cordova-plugins/plugins/sqlite-porter/index.ts +++ /dev/null @@ -1,125 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -/** - * @name SQLite Porter - * @description - * This Cordova/Phonegap plugin can be used to import/export to/from a SQLite database using either SQL or JSON. - * @usage - * ```typescript - * import { SQLitePorter } from '@awesome-cordova-plugins/sqlite-porter/ngx'; - * - * - * constructor(private sqlitePorter: SQLitePorter) { } - * - * ... - * - * let db = window.openDatabase('Test', '1.0', 'TestDB', 1 * 1024); - * // or we can use SQLite plugin - * // we will assume that we injected SQLite into this component as sqlite - * this.sqlite.create({ - * name: 'data.db', - * location: 'default' - * }) - * .then((db: any) => { - * let dbInstance = db._objectInstance; - * // we can pass db._objectInstance as the database option in all SQLitePorter methods - * }); - * - * - * let sql = 'CREATE TABLE Artist ([Id] PRIMARY KEY, [Title]);' + - * 'INSERT INTO Artist(Id,Title) VALUES ("1","Fred");'; - * - * this.sqlitePorter.importSqlToDb(db, sql) - * .then(() => console.log('Imported')) - * .catch(e => console.error(e)); - * - * - * ``` - */ -@Plugin({ - pluginName: 'SQLitePorter', - plugin: 'uk.co.workingedge.cordova.plugin.sqliteporter', - pluginRef: 'cordova.plugins.sqlitePorter', - repo: 'https://github.com/dpa99c/cordova-sqlite-porter', - platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'Browser', 'iOS', 'Tizen', 'Windows', 'Windows Phone'], -}) -@Injectable() -export class SQLitePorter extends AwesomeCordovaNativePlugin { - /** - * Executes a set of SQL statements against the defined database. Can be used to import data defined in the SQL statements into the database, and may additionally include commands to create the table structure. - * - * @param db {Object} Database object - * @param sql {string} SQL statements to execute against the database - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'successFn', - errorName: 'errorFn', - }) - importSqlToDb(db: any, sql: string): Promise { - return; - } - - /** - * Exports a SQLite DB as a set of SQL statements. - * - * @param db {Object} Database object - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'successFn', - errorName: 'errorFn', - }) - exportDbToSql(db: any): Promise { - return; - } - - /** - * Converts table structure and/or row data contained within a JSON structure into SQL statements that can be executed against a SQLite database. Can be used to import data into the database and/or create the table structure. - * - * @param db {Object} Database object - * @param json {Object|string} JSON structure containing row data and/or table structure as either a JSON object or string - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'successFn', - errorName: 'errorFn', - }) - importJsonToDb(db: any, json: any): Promise { - return; - } - - /** - * Exports a SQLite DB as a JSON structure - * - * @param db {Object} Database object - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'successFn', - errorName: 'errorFn', - }) - exportDbToJson(db: any): Promise { - return; - } - - /** - * Wipes all data from a database by dropping all existing tables - * - * @param db {Object} Database object - * @returns {Promise} - */ - @Cordova({ - callbackStyle: 'object', - successName: 'successFn', - errorName: 'errorFn', - }) - wipeDb(db: any): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/sqlite/index.ts b/src/@awesome-cordova-plugins/plugins/sqlite/index.ts deleted file mode 100644 index dd6b48b0..00000000 --- a/src/@awesome-cordova-plugins/plugins/sqlite/index.ts +++ /dev/null @@ -1,233 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Cordova, - CordovaCheck, - CordovaInstance, - InstanceProperty, - AwesomeCordovaNativePlugin, - Plugin, -} from '@awesome-cordova-plugins/core'; - -declare const sqlitePlugin: any; - -export interface SQLiteDatabaseConfig { - /** - * Name of the database. Example: 'my.db' - */ - name: string; - /** - * Location of the database. Example: 'default' - */ - location?: string; - /** - * iOS Database Location. Example: 'Library' - */ - iosDatabaseLocation?: string; - /** - * support arbitrary database location on android with https://github.com/litehelpers/cordova-sqlite-evcore-extbuild-free - */ - androidDatabaseLocation?: string; - /** - * support opening pre-filled databases with https://github.com/litehelpers/cordova-sqlite-ext - */ - createFromLocation?: number; - /** - * support encrypted databases with https://github.com/litehelpers/Cordova-sqlcipher-adapter - */ - key?: string; -} - -/** - * @hidden - */ -export interface DbTransaction { - executeSql: (sql: any, values?: any[], success?: Function, error?: Function) => void; -} - -/** - * @hidden - */ -export interface SQLiteTransaction extends DbTransaction { - start: () => void; - addStatement: DbTransaction['executeSql']; - handleStatementSuccess: (handler: Function, response: any) => void; - handleStatementFailure: (handler: Function, response: any) => void; - run: () => void; - abort: (txFailure: any) => void; - finish: () => void; - abortFromQ: (sqlerror: any) => void; -} - -/** - * @hidden - */ -export class SQLiteObject { - constructor(public _objectInstance: any) {} - - @InstanceProperty() databaseFeatures: { isSQLitePluginDatabase: boolean }; - @InstanceProperty() openDBs: any; - - @CordovaInstance({ - sync: true, - }) - addTransaction(transaction: (tx: SQLiteTransaction) => void): void {} - - /** - * @param fn {Function} - * @returns {Promise} - */ - @CordovaInstance({ - successIndex: 2, - errorIndex: 1, - }) - transaction(fn: (tx: DbTransaction) => void): Promise { - return; - } - - /** - * @param fn {Function} - * @returns {Promise} - */ - @CordovaInstance() - readTransaction(fn: (tx: SQLiteTransaction) => void): Promise { - return; - } - - @CordovaInstance({ - sync: true, - }) - startNextTransaction(): void {} - - /** - * @returns {Promise} - */ - @CordovaInstance() - open(): Promise { - return; - } - - /** - * @returns {Promise} - */ - @CordovaInstance() - close(): Promise { - return; - } - - /** - * Execute SQL on the opened database. Note, you must call `create` first, and - * ensure it resolved and successfully opened the database. - * - * @param statement - * @param params - */ - @CordovaInstance() - executeSql(statement: string, params?: any[]): Promise { - return; - } - - /** - * @param sqlStatements {string[] | string[][] | any[]} - * @returns {Promise} - */ - @CordovaInstance() - sqlBatch(sqlStatements: (string | string[] | any)[]): Promise { - return; - } - - @CordovaInstance({ - sync: true, - }) - abortallPendingTransactions(): void {} -} - -/** - * @name SQLite - * @description - * Access SQLite databases on the device. - * @usage - * - * ```typescript - * import { SQLite, SQLiteObject } from '@awesome-cordova-plugins/sqlite/ngx'; - * - * constructor(private sqlite: SQLite) { } - * - * ... - * - * this.sqlite.create({ - * name: 'data.db', - * location: 'default' - * }) - * .then((db: SQLiteObject) => { - * - * - * db.executeSql('create table danceMoves(name VARCHAR(32))', []) - * .then(() => console.log('Executed SQL')) - * .catch(e => console.log(e)); - * - * - * }) - * .catch(e => console.log(e)); - * - * ``` - * @classes - * SQLiteObject - * @interfaces - * SQLiteDatabaseConfig - * SQLiteTransaction - */ -@Plugin({ - pluginName: 'SQLite', - pluginRef: 'sqlitePlugin', - plugin: 'cordova-sqlite-storage', - repo: 'https://github.com/litehelpers/Cordova-sqlite-storage', - platforms: ['Android', 'iOS', 'macOS', 'Windows'], -}) -@Injectable() -export class SQLite extends AwesomeCordovaNativePlugin { - /** - * Open or create a SQLite database file. - * - * See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database - * - * @param config {SQLiteDatabaseConfig} database configuration - * @returns Promise - */ - @CordovaCheck() - create(config: SQLiteDatabaseConfig): Promise { - return new Promise((resolve, reject) => { - sqlitePlugin.openDatabase(config, (db: any) => resolve(new SQLiteObject(db)), reject); - }); - } - - /** - * Verify that both the Javascript and native part of this plugin are installed in your application - * - * @returns {Promise} - */ - @Cordova() - echoTest(): Promise { - return; - } - - /** - * Automatically verify basic database access operations including opening a database - * - * @returns {Promise} - */ - @Cordova() - selfTest(): Promise { - return; - } - - /** - * Deletes a database - * - * @param config {SQLiteDatabaseConfig} database configuration - * @returns {Promise} - */ - @Cordova() - deleteDatabase(config: SQLiteDatabaseConfig): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/star-prnt/index.ts b/src/@awesome-cordova-plugins/plugins/star-prnt/index.ts deleted file mode 100644 index 93825d95..00000000 --- a/src/@awesome-cordova-plugins/plugins/star-prnt/index.ts +++ /dev/null @@ -1,977 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface Printer { - /** - * Printer model name and model number - */ - modelName?: string; - - /** - * Printer Mac Address - */ - macAddress?: string; - - /** - * Printer port name used to create a new port instance of SMPort or StarIOExtManager - */ - portName?: string; - /** - * USB Serial Number (USB Printers Only) - */ - USBSerialNumber?: string; -} -/** - * Array of Printer objects returned by the portDiscovery() function - */ -export type Printers = Array; - -export interface PrinterStatus { - /** - * Printer Online/Offline status - */ - offline?: boolean; - - /** - * Printer model name and model number - */ - ModelName?: string; - - /** - * Printer cover status - */ - coverOpen?: boolean; - - /** - * Printer Paper Cutter status - */ - cutterError?: boolean; - - /** - * Printer Paper status - */ - receiptPaperEmpty?: boolean; - - /** - * Printer Firmware information - */ - FirmwareVersion?: string; -} - -export interface PrintObj { - /** - * string containing the text to print, Example: "Star Clothing Boutique\n123 Star Road\nCity, State 12345\n\n" - */ - text: string; - - /** - * Sends a PartialCutWithFeed command to the printer, defaults to true - */ - cutReceipt?: boolean; - - /** - * sends a appendPeripheral command to the printer for channels No1 and No2 - Defaults to true - */ - openCashDrawer?: boolean; -} -export interface RasterObj extends PrintObj { - /** - * Font size number, defaults to 25 - */ - fontSize?: number; - - /** - * Paper width (Units: Dots). 2 inches: 384, 3 inches: 576, 4 inches: 832, ESCPos 3 inches: 512, Dot 3 inches: 210. Defaults to 576 - */ - paperWidth?: number; -} -export interface ImageObj { - /** - * Image URI to print, this can be obtained via the camera or photo library or as a static resource saved on the phone memory - */ - uri: string; - - /** - * Image width (Units: Dots) defaults to 576 - */ - paperWidth?: number; - - /** - * Sends a PartialCutWithFeed command to the printer, defaults to true - */ - cutReceipt?: boolean; - - /** - * sends a appendPeripheral command to the printer for channels No1 and No2 - Defaults to true - */ - openCashDrawer?: boolean; -} -export interface PrintCommand { - /** - * Characther encoding is used to getByte data from all subsequent commands. Default 'US-ASCII' - * Choose the format of the return value Defined in StarPRNT.Encoding or the Encoding enum. - * Example: {appendEncoding:'US-ASCII'} - */ - appendEncoding?: string; - - /** - * Select command of the code page is generated and added to the commands property. - * Choose the format of the return value Defined in StarPRNT.CodePageType or the CodePageType enum. - * Example: {appendCodePage:'CP858'} - */ - appendCodePage?: string; - - /** - * Data (Text) is added to the command buffer. Example: {append:"Star Clothing Boutique\n123 Star Road\nCity, State 12345\n\n"} - */ - append?: string; - - /** - * Data (Text) is added to the command buffer. Example: {appendRaw:"Star Clothing Boutique\n123 Star Road\nCity, State 12345\n\n"} - */ - appendRaw?: string; - - /** - * Data (Command) is added to the command buffer. Takes an array of bytes. - * Example: {appendBytes:[0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x2e]} - */ - appendBytes?: number[]; - - /** - * Data (Command) is added to the command buffer. Takes an array of bytes. - * Example: {appendRawBytes:[0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x2e]} - */ - appendRawBytes?: number[]; - - /** - * Set command of the character space is generated and added to the command buffer. Character Spacs (Unit: Dots) Example: 4 - */ - appendCharacterSpace?: number; - - /** - * Select command of the emphasis mode is generated and added to the command buffer. Example: {appendEmphasis:"SALE\n"} - */ - appendEmphasis?: string; - - /** - * Enable emphasis mode is generated and added to the command buffer. Example: {enableEmphasis:true} - */ - enableEmphasis?: boolean; - - /** - * Select command of the invert mode is generated and added to the command buffer. Example: {appendInvert:"Refunds and Exchanges\n"} - */ - appendInvert?: string; - /** - * Enable invert mode is generated and added to the command buffer. Example: {enableInvert:true} - */ - enableInvert?: boolean; - /** - * Select command of the under line mode is generated and added to the command buffer. Example: {appendUnderline:"30 days"} - */ - appendUnderline?: string; - /** - * Enable under line mode is generated and added to the command buffer. Example: {enableUnderline:true} - */ - enableUnderline?: boolean; - - /** - * Select command of the international character mode is generated and added to the command buffer. - * Choose the format of the return value Defined in StarPRNT.InternationalType or the InternationalType enum. - * 'UK' | 'USA' | 'France' | 'Germany' | 'Denmark' | 'Sweden' | 'Italy' | 'Spain' | 'Japan' | 'Norway' | 'Denmark2' | 'Spain2' | 'LatinAmerica' | 'Korea' | 'Ireland' | 'Legal' - * Example {appendInternational:InternationalType.UK} - */ - appendInternational?: string; - - /** - * Line feed command is generated and added to the command buffer. Paper feed units (Units: Lines) Example: 2 - */ - appendLineFeed?: number; - - /** - * Unit feed command is generated and added to the command buffer. Paper feed units (Units: Dots) Example: 64 - */ - appendUnitFeed?: number; - - /** - * Set command of the line space is generated and added to the command buffer. Line spaces (Units: Dots) Example: 32 - */ - appendLineSpace?: number; - - /** - * Select command of the font style is generated and added to the command buffer. - * Choose the format of the return value defined in StarPRNT.FontStyleType or the FontStyleType enum. 'A' | 'B' - * Example: {appendFontStyle:FontStyleType.A} - */ - appendFontStyle?: string; - - /** - * Paper cut command is generated and added to the command buffer. - * Choose the format of the return value defined in StarPRNT.CutPaperAction or the CutPaperAction enum. 'FullCut' | 'FullCutWithFeed' | 'PartialCut' | 'PartialCutWithFeed' - * Example: {appendCutPaper:CutPaperAction.PartialCutWithFeed} - */ - appendCutPaper?: string; - - /** - * Black mark command is generated and added to the command buffer. - * Choose the format of the return value defined in StarPRNT.BlackMarkType or the BlackMarkType enum. 'Valid' | 'Invalid' | 'ValidWithDetection' - * Example: {appendBlackMark: BlackMarkType.Valid} - */ - appendBlackMark?: string; - - /** - * Absolute position command is generated and added to the command buffer. (Unit: Dots). Send in conjunction with the data property to append absolute position just to that string - * Example1: Append data with Absolute position {appendAbsolutePosition:40, data: "Text with absolute position"} - * Example2: Append absolute position to subsequent commands: {appendAbsolutePosition:40} - */ - appendAbsolutePosition?: number; - - /** - * Alignment command is generated and added to the command buffer. Send in conjunction with the data property to append alignment position just to that string - * Choose the format of the return value defined in StarPRNT.AlignmentPosition or the AlignmentPosition enum. 'Left' | 'Center' | 'Right'. - * Example1 Append data with Alignment position: {appendAlignment:AlignmentPosition.Center, data: "Text with centered position"} - * Example2 Append absolute position to subsequent commands: {appendAlignment:AlignmentPosition.Center} - */ - appendAlignment?: string; - - /** - * Horizontal tab set/clear command is generated and added to the command buffer. (Only works for certain printer models, check the starSDK documentation for details) - * Array of horizontal tab positions (Units: ANK character pitch). Specifying empty array deletes all currently set horizontal tab positions. - * Example: {appendHorizontalTabPosition:[15, 35]} - * Delete positions Example: {appendHorizontalTabPosition:[]} - */ - appendHorizontalTabPosition?: number[]; - - /** - * Print command of the logo is generated and added to the command buffer. The logo has to be uploaded to the printer using the Star Print utility. - * Send in conjuction with the logoSize property to set the logo size - * Example: {appendLogo:1} - * Example with LogoSize: {appendLogo:1, logoSize:LogoSize.DoubleWidthDoubleHeight} - */ - appendLogo?: number; - - /** - * Property to be used with the appendLogo command. - * Choose the format of the return value defined in StarPRNT.LogoSize or the LogoSize enum. 'Normal' | 'DoubleWidth' | 'DoubleHeight' | 'DoubleWidthDoubleHeight'; - * Example: {appendLogo:1, logoSize:LogoSize.DoubleWidthDoubleHeight} - */ - logoSize?: string; - - /** - * Print command of the barcode is generated and added to the command buffer. - * Additional Properties: BarcodeSymbology, BarcodeWidth, height, hri, absolutePosition, alignment. - * Example: {appendBarcode:"{BStar", BarcodeSymbology:BarcodeSymbology.Code128, BarcodeWidth:BarcodeWidth.Mode2, height:40, hri:true } - * Example with absolutePosition: {appendBarcode:"{BStar", BarcodeSymbology:BarcodeSymbology.Code128, BarcodeWidth:BarcodeWidth.Mode2, height:40, hri:true, absolutePosition:40 } - * Example with alignment:{appendBarcode:"{BStar", BarcodeSymbology:BarcodeSymbology.Code128, BarcodeWidth:BarcodeWidth.Mode2, height:40, hri:true, alignment:alignment:AlignmentPosition.Center } - */ - appendBarcode?: string; - - /** - * Property to be used with the appendBarcode command. - * Choose the format of the return value defined in StarPRNT.BarcodeSymbology or the BarcodeSymbology enum. - * 'Code128' | 'Code39' | 'Code93' | 'ITF' | 'JAN8' | 'JAN13' | 'NW7' | 'UPCA' | 'UPCE' | - * Example: {appendBarcode:'{BStar', BarcodeSymbology:BarcodeSymbology.Code128} - */ - BarcodeSymbology?: string; - - /** - * Property to be used with the appendBarcode command. - * Choose the format of the return value defined in StarPRNT.BarcodeWidth or the BarcodeWidth enum. - * Mode1 | Mode2 | Mode3 | Mode4 | Mode5 | Mode6 | Mode7 | Mode8 | Mode9 - * Example: {appendBarcode:'{BStar', BarcodeWidth:BarcodeWidth.Mode2} - */ - BarcodeWidth?: string; - - /** - * Property to be used with the appendBarcode command. - * Under-bar characters. true = Valid, false = Invalid - * Example: {appendBarcode:'{BStar', hri:true} - */ - hri?: boolean; - - /** - * Property to be used with the appendBarcode command or the appendMultiple command (Units:Dots) - * appendBarcode Example: {appendBarcode:'{BStar', height:40} - * appendMultiple: {appendMultiple:'text to print', height:40} - */ - height?: number; - - /** - * Property to be used with the appendBitmap command or the appendMultiple command (Units:Dots) - * appendBitmap Example: {appendBitmap:uri, width:576} - * appendMultiple: {appendMultiple:'text to print', width:40} - */ - width?: number; - - /** - * Property to be used with the appendBitmap command, the appendBarcode command, or the appendQrCode command (Units:Dots) - * appendBitmap Example: {appendBitmap:uri, absolutePosition:40}. - * appendBarcode Example: {appendBarcode:'{BStar', absolutePosition:40}. - * appendQrCode Example: {appendQrCode:'{BStar', absolutePosition:40}. - */ - absolutePosition?: number; - - /** - * Property to be used with the appendBitmap command, the appendBarcode command, or the appendQrCode command (Units:Dots) - * Choose the format of the return value defined in StarPRNT.AlignmentPosition or the AlignmentPosition enum. 'Left' | 'Center' | 'Right'. - * appendBitmap Example: {appendBitmap:uri, alignment:AlignmentPosition.Center}. - * appendBarcode Example: {appendBarcode:'{BStar', alignment:AlignmentPosition.Center}. - * appendQrCode Example: {appendQrCode:'{BStar', alignment:AlignmentPosition.Center}. - */ - alignment?: string; - - /** - * Select command of the multiple mode is generated and added to the command buffer. - * Additional properties: width:number, height:number - * Example: {appendMultiple:" $156.95\n", width:2, height:2}. - */ - appendMultiple?: string; - - /** - * Enable multiple mode is generated and added to the command buffer. - * Additional properties: width:number, height:number - * Example: {enableMultiple:true, width:2, height:2} - * Disable Example: {enableMultiple:false} - */ - enableMultiple?: boolean; - - /** - * Print command of the QR code is generated and added to the command buffer. - * Additional Properties: QrCodeModel, QrCodeLevel, cell, absolutePosition, alignment. - * Example: {appendQrCode:"{BStar", QrCodeModel:"No2", QrCodeLevel:"L", cell: 8}. - * Example with absolutePosition: {appendQrCode:"{BStar", QrCodeModel:"No2", QrCodeLevel:"L", cell: 8, absolutePosition: 40 }. - * Example with alignment: {appendQrCode:"{BStar", QrCodeModel:"No2", QrCodeLevel:"L", cell: 8, alignment:"Center" }. - */ - appendQrCode?: string; - - /** - * Property to be used with the appendQrCode command. - * Choose the format of the return value defined in StarPRNT.QrCodeModel or the QrCodeModel enum. 'No1' | 'No2' Default 'No2' - * Example: {appendQrCode:'{BStar', QrCodeModel:QrCodeModel.No1} - */ - QrCodeModel?: string; - - /** - * Property to be used with the appendQrCode command. - * Choose the format of the return value defined in StarPRNT.QrCodeLevel or the QrCodeLevel enum. 'No1' | 'No2'. Default 'H' - * Example: {appendQrCode:'{BStar', QrCodeLevel:QrCodeLevel.H} - */ - QrCodeLevel?: string; - - /** - * Property to be used with the appendQrCode command. QRCode Cell size. Default 4. - * Example: {appendQrCode:'{BStar', cell:8} - */ - cell?: number; - - /** - * Print command of the bitmap is generated and added to the command buffer. Takes a string image URI - * this can be obtained via the camera or photo library or as a static resource saved on the phone memory. - * Additional Properties: diffusion, width, bothScale, rotation, absolutePosition, alignment. - * Example: {appendBitmap:uri, diffusion: true, width:576, bothScale: true} - * Example with absolutePosition: {appendBitmap:uri, diffusion: true, width:576, bothScale: true, absolutePosition: 40 }. - * Example with alignment: {appendBitmap:uri, diffusion: true, width:576, bothScale: true, alignment:"Center" }. - */ - appendBitmap?: string; - - /** - * Property to be used with the appendBitmap command. Random dither: true = Valid, false = Invalid. Default true. - * Example: {appendBitmap:uri, diffusion: false } - */ - diffusion?: boolean; - - /** - * Property to be used with the appendBitmap command. Height is changed according to the conversion rate of the width property. - * true = Valid, false = Invalid. Default true. - * Example: {appendBitmap:uri, bothScale: true } - */ - bothScale?: boolean; - - /** - * Property to be used with the appendBitmap command. - * Choose the format of the return value defined in StarPRNT.BitmapConverterRotation or the BitmapConverterRotation enum. - * 'Normal' | 'Left90' | 'Right90' | 'Rotate180' - * Example: {appendBitmap:uri, rotation: BitmapConverterRotation.Left90 } - */ - rotation?: string; - - /** - * sends a appendPeripheral command to the printer for channel number: Example: 1 = No1, 2 = No2 - */ - openCashDrawer?: number; -} - -/** - * Emulation constants - */ -export enum Emulation { - /** mPOP, SM-L200, SM-L300, SM-S210i, SM-S220i, SM-S230i, SM-T300i/T300, SM-T400i */ - StarPRNT = 'StarPRNT', - /** SM-L200, SM-L300 */ - StarPRNTL = 'StarPRNTL', - /** FVP10, TSP650II, TSP700II, TSP800II */ - StarLine = 'StarLine', - /** TSP100 */ - StarGraphic = 'StarGraphic', - /** BSC10 */ - EscPos = 'EscPos', - /** SM-S210i, SM-S220i, SM-S230i, SM-T300i/T300, SM-T400i */ - EscPosMobile = 'EscPosMobile', - /** SP700 */ - StarDotImpact = 'StarDotImpact', -} - -/** - * Encoding constants - */ -export enum Encoding { - /** English */ - USASCII = 'US-ASCII', - /** French, German, Portuguese, Spanish */ - Windows1252 = 'Windows-1252', - /** Japanese */ - ShiftJIS = 'Shift-JIS', - /** Russian */ - Windows1251 = 'Windows-1251', - /** Simplified Chinese */ - GB2312 = 'GB2312', - /** Traditional Chinese */ - Big5 = 'Big5', - /** UFT8 */ - UTF8 = 'UTF-8', -} - -/** - * CodePageType constants - */ -export enum CodePageType { - CP737 = 'CP737', - CP772 = 'CP772', - CP774 = 'CP774', - CP851 = 'CP851', - CP852 = 'CP852', - CP855 = 'CP855', - CP857 = 'CP857', - CP858 = 'CP858', - CP860 = 'CP860', - CP861 = 'CP861', - CP862 = 'CP862', - CP863 = 'CP863', - CP864 = 'CP864', - CP865 = 'CP865', - CP869 = 'CP869', - CP874 = 'CP874', - CP928 = 'CP928', - CP932 = 'CP932', - CP999 = 'CP999', - CP1001 = 'CP1001', - CP1250 = 'CP1250', - CP1251 = 'CP1251', - CP1252 = 'CP1252', - CP2001 = 'CP2001', - CP3001 = 'CP3001', - CP3002 = 'CP3002', - CP3011 = 'CP3011', - CP3012 = 'CP3012', - CP3021 = 'CP3021', - CP3041 = 'CP3041', - CP3840 = 'CP3840', - CP3841 = 'CP3841', - CP3843 = 'CP3843', - CP3845 = 'CP3845', - CP3846 = 'CP3846', - CP3847 = 'CP3847', - CP3848 = 'CP3848', - UTF8 = 'UTF8', - Blank = 'Blank', -} - -/** - * InternationalType constants - */ -export enum InternationalType { - UK = 'UK', - USA = 'USA', - France = 'France', - Germany = 'Germany', - Denmark = 'Denmark', - Sweden = 'Sweden', - Italy = 'Italy', - Spain = 'Spain', - Japan = 'Japan', - Norway = 'Norway', - Denmark2 = 'Denmark2', - Spain2 = 'Spain2', - LatinAmerica = 'LatinAmerica', - Korea = 'Korea', - Ireland = 'Ireland', - Legal = 'Legal', -} - -/** - * FontStyleType constants. - */ -export enum FontStyleType { - /** Font-A (12 x 24 dots) / Specify 7 x 9 font (half dots) */ - A = 'A', - /** Font-B (9 x 24 dots) / Specify 5 x 9 font (2P-1) */ - B = 'B', -} - -/** - * CutPaperAction constants. - */ -export enum CutPaperAction { - FullCut = 'FullCut', - FullCutWithFeed = 'FullCutWithFeed', - PartialCut = 'PartialCut', - PartialCutWithFeed = 'PartialCutWithFeed', -} - -/** - * BlackMarkType constants. - */ -export enum BlackMarkType { - Valid = 'Valid', - Invalid = 'Invalid', - ValidWithDetection = 'ValidWithDetection', -} - -/** - * LogoSize constants - */ -export enum LogoSize { - Normal = 'Normal', - DoubleWidth = 'DoubleWidth', - DoubleHeight = 'DoubleHeight', - DoubleWidthDoubleHeight = 'DoubleWidthDoubleHeight', -} - -/** - * AlignmentPosition constants - */ -export enum AlignmentPosition { - Left = 'Left', - Center = 'Center', - Right = 'Right', -} - -/** - * BarcodeSymbology constants - */ -export enum BarcodeSymbology { - Code128 = 'Code128', - Code39 = 'Code39', - Code93 = 'Code93', - ITF = 'ITF', - JAN8 = 'JAN8', - JAN13 = 'JAN13', - NW7 = 'NW7', - UPCA = 'UPCA', - UPCE = 'UPCE', -} - -/** - * BarcodeWidth constants - */ -export enum BarcodeWidth { - Mode1 = 'Mode1', - Mode2 = 'Mode2', - Mode3 = 'Mode3', - Mode4 = 'Mode4', - Mode5 = 'Mode5', - Mode6 = 'Mode6', - Mode7 = 'Mode7', - Mode8 = 'Mode8', - Mode9 = 'Mode9', -} - -/** - * QrCodeModel constants - */ -export enum QrCodeModel { - No1 = 'No1', - No2 = 'No2', -} - -/** - * QrCodeLevel constants - */ -export enum QrCodeLevel { - H = 'H', - L = 'L', - M = 'M', - Q = 'Q', -} - -/** - * BitmapConverterRotation constants - */ -export enum BitmapConverterRotation { - Normal = 'Normal', - Left90 = 'Left90', - Right90 = 'Right90', - Rotate180 = 'Rotate180', -} - -/** - * Push a new PrintCommand object to the array for a separate instruction to the printer. Example [{append:"text"}, {"openCashDrawer: 1"}] - */ -export type CommandsArray = Array; - -/** - * @name StarPRNT - * @description - * Ionic Native wrappers for the starprnt cordova plugin for Star Micronics Bluetooth/LAN printers - * @usage - * ```typescript - * import { StarPRNT } from '@awesome-cordova-plugins/star-prnt/ngx'; - * - * - * constructor(private starprnt: StarPRNT) { } - * - * ... - * - * - * this.starprnt.portDiscovery('All') - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'StarPRNT', - plugin: 'cordova-plugin-starprnt', // npm package name, example: cordova-plugin-camera - pluginRef: 'starprnt', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/auctifera-josed/starprnt', // the github repository URL for the plugin - platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] -}) -@Injectable() -export class StarPRNT extends AwesomeCordovaNativePlugin { - /** - * Constant for Emulation - */ - Emulation = { - StarPRNT: 'StarPRNT', - StarPRNTL: 'StarPRNTL', - StarLine: 'StarLine', - StarGraphic: 'StarGraphic', - EscPos: 'EscPos', - EscPosMobile: 'EscPosMobile', - StarDotImpact: 'StarDotImpact', - }; - - /** - * Constant for possible Encoding - */ - Encoding = { - USASCII: 'US-ASCII', - Windows1252: 'Windows-1252', - ShiftJIS: 'Shift-JIS', - Windows1251: 'Windows-1251', - GB2312: 'GB2312', - Big5: 'Big5', - UTF8: 'UTF-8', - }; - - /** - * CodePageType constants - */ - CodePageType = { - CP737: 'CP737', - CP772: 'CP772', - CP774: 'CP774', - CP851: 'CP851', - CP852: 'CP852', - CP855: 'CP855', - CP857: 'CP857', - CP858: 'CP858', - CP860: 'CP860', - CP861: 'CP861', - CP862: 'CP862', - CP863: 'CP863', - CP864: 'CP864', - CP865: 'CP865', - CP869: 'CP869', - CP874: 'CP874', - CP928: 'CP928', - CP932: 'CP932', - CP999: 'CP999', - CP1001: 'CP1001', - CP1250: 'CP1250', - CP1251: 'CP1251', - CP1252: 'CP1252', - CP2001: 'CP2001', - CP3001: 'CP3001', - CP3002: 'CP3002', - CP3011: 'CP3011', - CP3012: 'CP3012', - CP3021: 'CP3021', - CP3041: 'CP3041', - CP3840: 'CP3840', - CP3841: 'CP3841', - CP3843: 'CP3843', - CP3845: 'CP3845', - CP3846: 'CP3846', - CP3847: 'CP3847', - CP3848: 'CP3848', - UTF8: 'UTF8', - Blank: 'Blank', - }; - - /** - * Constant for possible InternationalType - */ - InternationalType = { - UK: 'UK', - USA: 'USA', - France: 'France', - Germany: 'Germany', - Denmark: 'Denmark', - Sweden: 'Sweden', - Italy: 'Italy', - Spain: 'Spain', - Japan: 'Japan', - Norway: 'Norway', - Denmark2: 'Denmark2', - Spain2: 'Spain2', - LatinAmerica: 'LatinAmerica', - Korea: 'Korea', - Ireland: 'Ireland', - Legal: 'Legal', - }; - - /** - * Constant for possible FontStyleType - */ - FontStyleType = { - /** Font-A (12 x 24 dots) / Specify 7 x 9 font (half dots) */ - A: 'A', - /** Font-B (9 x 24 dots) / Specify 5 x 9 font (2P-1) */ - B: 'B', - }; - - /** - * Constant for possible CutPaperAction - */ - CutPaperAction = { - FullCut: 'FullCut', - FullCutWithFeed: 'FullCutWithFeed', - PartialCut: 'PartialCut', - PartialCutWithFeed: 'PartialCutWithFeed', - }; - - /** - * Constant for possible BlackMarkType - */ - BlackMarkType = { - Valid: 'Valid', - Invalid: 'Invalid', - ValidWithDetection: 'ValidWithDetection', - }; - - /** - * Constant for possible AlignmentPosition - */ - AlignmentPosition = { - Left: 'Left', - Center: 'Center', - Right: 'Right', - }; - - /** - * Constant for possible LogoSize - */ - LogoSize = { - Normal: 'Normal', - DoubleWidth: 'DoubleWidth', - DoubleHeight: 'DoubleHeight', - DoubleWidthDoubleHeight: 'DoubleWidthDoubleHeight', - }; - - /** - * Constant for possible BarcodeSymbology - */ - BarcodeSymbology = { - Code128: 'Code128', - Code39: 'Code39', - Code93: 'Code93', - ITF: 'ITF', - JAN8: 'JAN8', - JAN13: 'JAN13', - NW7: 'NW7', - UPCA: 'UPCA', - UPCE: 'UPCE', - }; - - /** - * Constant for possible BarcodeWidth - */ - BarcodeWidth = { - Mode1: 'Mode1', - Mode2: 'Mode2', - Mode3: 'Mode3', - Mode4: 'Mode4', - Mode5: 'Mode5', - Mode6: 'Mode6', - Mode7: 'Mode7', - Mode8: 'Mode8', - Mode9: 'Mode9', - }; - - /** - * Constant for possible QrCodeModel - */ - QrCodeModel = { - No1: 'No1', - No2: 'No2', - }; - - /** - * Constant for possible QrCodeLevel - */ - QrCodeLevel = { - H: 'H', - L: 'L', - M: 'M', - Q: 'Q', - }; - - /** - * Constant for possible BitmapConverterRotation - */ - BitmapConverterRotation = { - Normal: 'Normal', - Left90: 'Left90', - Right90: 'Right90', - Rotate180: 'Rotate180', - }; - - /** - * Find available printers - * - * @param {string} type Interface Type: All, LAN, Bluetooth, USB - * @returns {Promise} Returns a promise that resolves with an array of printers - */ - @Cordova() - portDiscovery(type: string): Promise { - return; - } - - /** - * Checks the status of the printer - * - * @param {string} port Printer name i.e BT:StarMicronics - * @param {string} emulation StarPrinter Emulation type: "StarPRNT", "StarPRNTL", "StarLine", "StarGraphic", "EscPos", "EscPosMobile", "StarDotImpact" - * @returns {Promise} Returns a promise that resolves with the PrinterStatus object - */ - @Cordova() - checkStatus(port: string, emulation: string): Promise { - return; - } - - /** - * Prints plain text - * - * @param {string} port Printer name i.e BT:StarMicronics. Send null to use a printer connected via StarIOExtManager using the connect() function - * @param {string} emulation StarPrinter Emulation type: "StarPRNT", "StarPRNTL", "StarLine", "StarGraphic", "EscPos", "EscPosMobile", "StarDotImpact" - * @param {PrintObj} printObj text:string, cutReceipt?:boolean, openCashDrawer?:boolean - * @returns {Promise} Success! if printed correctly or error message string returned by the SDK. - */ - @Cordova() - printRawText(port: string|null, emulation: string, printObj: PrintObj): Promise { - return; - } - - /** - * Converts the text into a bitmap image and sends it to the printer - * - * @param {string} port Printer name i.e BT:StarMicronics. Send null to use a printer connected via StarIOExtManager using the connect() function - * @param {string} emulation StarPrinter Emulation type: "StarPRNT", "StarPRNTL", "StarLine", "StarGraphic", "EscPos", "EscPosMobile", "StarDotImpact" - * @param {RasterObj} rasterObj text:string, cutReceipt?:boolean, openCashDrawer?:boolean, fontSize:number, paperWidth:number - * @returns {Promise} Success! if printed correctly or error message string returned by the SDK. - */ - @Cordova() - printRasterReceipt(port: string|null, emulation: string, rasterObj: RasterObj): Promise { - return; - } - - /** - * Gets an image from a string URI and converts it to bitmap to send it to the printer - * - * @param {string} port Printer name i.e BT:StarMicronics. Send null to use a printer connected via StarIOExtManager using the connect() function - * @param {string} emulation StarPrinter Emulation type: "StarPRNT", "StarPRNTL", "StarLine", "StarGraphic", "EscPos", "EscPosMobile", "StarDotImpact" - * @param {ImageObj} imageObj uri:string, paperWidth?:number, cutReceipt?:boolean, openCashDrawer?:boolean - * @returns {Promise} Success! if printed correctly or error message string returned by the SDK. - */ - @Cordova() - printImage(port: string|null, emulation: string, imageObj: ImageObj): Promise { - return; - } - - /** - * sends an appendPeripheral command to the printer for channels No1 and No2 - * - * @param {string} port Printer name i.e BT:StarMicronics. Send null to use a printer connected via StarIOExtManager using the connect() function - * @param {string} emulation StarPrinter Emulation type: "StarPRNT", "StarPRNTL", "StarLine", "StarGraphic", "EscPos", "EscPosMobile", "StarDotImpact" - * @returns {Promise} Success! if opened or error message string returned by the SDK. - */ - @Cordova() - openCashDrawer(port: string|null, emulation: string): Promise { - return; - } - - /** - * Sends an Array of commands to the command buffer using the Android ICommandBuilderInterface or iOS ISCBBuilderInterface - * - * @param {string} port Printer name i.e BT:StarMicronics. Send null to use a printer connected via StarIOExtManager using the connect() function - * @param {string} emulation StarPrinter Emulation type: "StarPRNT", "StarPRNTL", "StarLine", "StarGraphic", "EscPos", "EscPosMobile", "StarDotImpact" - * @param {CommandsArray} commandsArray each command in the array should be an instance of the PrintCommand object. Example [{append:"text"}, {"openCashDrawer: 1"}] - * @returns {Promise} Success! if printed correctly or error message string returned by the SDK. - */ - @Cordova() - print(port: string|null, emulation: string, commandsArray: CommandsArray): Promise { - return; - } - - /** - * Allows you to connect to the printer, keep the connection alive and receive status updates through an observable - * - * @param {string} port printer name i.e BT:StarMicronics. - * @param {string} emulation StarPrinter Emulation type: "StarPRNT", "StarPRNTL", "StarLine", "StarGraphic", "EscPos", "EscPosMobile", "StarDotImpact" - * @param hasBarcodeReader - * @returns {Observable} Success! if connected or error message string returned by the SDK. - */ - @Cordova({ - observable: true, - callbackStyle: 'node', - }) - connect(port: string, emulation: string, hasBarcodeReader: boolean): Observable { - return; - } - - /** - * Returns an observable with the device status events. Only fires when a printer is connnected through the connect() function - * - * @returns {Observable} dataType: printerOnline, printerOffline, printerImpossible, printerPaperEmpty, printerPaperNearEmpty, printerPaperReady, printerCoverOpen, printerCoverClose, cashDrawerOpen, cashDrawerClose - */ - @Cordova({ - eventObservable: true, - event: 'starPrntData', - }) - getStatus(): Observable { - return; - } - - /** - * Allows to disconnect (close the connection to the peripherals), this is useful to avoid keeping alive a connection when not in the app to save device battery - * (energy consumption). You should call this function when the app is paused or closed. - * - * @returns {Promise} Success! if connected or error message string returned by the SDK. - */ - @Cordova() - disconnect(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/status-bar/index.ts b/src/@awesome-cordova-plugins/plugins/status-bar/index.ts deleted file mode 100644 index fb2ebb50..00000000 --- a/src/@awesome-cordova-plugins/plugins/status-bar/index.ts +++ /dev/null @@ -1,125 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Status Bar - * @premier statusbar - * @capacitorincompatible true - * @description - * Manage the appearance of the native status bar. - * - * Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar). - * @usage - * ```typescript - * import { StatusBar } from '@awesome-cordova-plugins/status-bar/ngx'; - * - * constructor(private statusBar: StatusBar) { } - * - * ... - * - * // let status bar overlay webview - * this.statusBar.overlaysWebView(true); - * - * // set status bar to white - * this.statusBar.backgroundColorByHexString('#ffffff'); - * ``` - */ -@Plugin({ - pluginName: 'StatusBar', - plugin: 'cordova-plugin-statusbar', - pluginRef: 'StatusBar', - repo: 'https://github.com/apache/cordova-plugin-statusbar', - platforms: ['Android', 'iOS', 'Windows'], -}) -@Injectable() -export class StatusBar extends AwesomeCordovaNativePlugin { - /** - * Whether the StatusBar is currently visible or not. - */ - @CordovaProperty() - isVisible: boolean; - - /** - * Set whether the status bar overlays the main app view. The default - * is true. - * - * @param {boolean} doesOverlay Whether the status bar overlays the main app view. - */ - @Cordova({ - sync: true, - }) - overlaysWebView(doesOverlay: boolean) {} - - /** - * Use the default statusbar (dark text, for light backgrounds). - */ - @Cordova({ - sync: true, - }) - styleDefault() {} - - /** - * Use the lightContent statusbar (light text, for dark backgrounds). - */ - @Cordova({ - sync: true, - }) - styleLightContent() {} - - /** - * Use the blackTranslucent statusbar (light text, for dark backgrounds). - */ - @Cordova({ - sync: true, - }) - styleBlackTranslucent() {} - - /** - * Use the blackOpaque statusbar (light text, for dark backgrounds). - */ - @Cordova({ - sync: true, - }) - styleBlackOpaque() {} - - /** - * Set the status bar to a specific named color. Valid options: - * black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown. - * - * iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing. - * - * @param {string} colorName The name of the color (from above) - */ - @Cordova({ - sync: true, - }) - backgroundColorByName(colorName: string) {} - - /** - * Set the status bar to a specific hex color (CSS shorthand supported!). - * - * iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing. - * - * @param {string} hexString The hex value of the color. - */ - @Cordova({ - sync: true, - }) - backgroundColorByHexString(hexString: string) {} - - /** - * Hide the StatusBar - */ - @Cordova({ - sync: true, - }) - hide() {} - - /** - * Show the StatusBar - */ - @Cordova({ - sync: true, - }) - show() {} -} diff --git a/src/@awesome-cordova-plugins/plugins/streaming-media/index.ts b/src/@awesome-cordova-plugins/plugins/streaming-media/index.ts deleted file mode 100644 index 1961f3d1..00000000 --- a/src/@awesome-cordova-plugins/plugins/streaming-media/index.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * Object of options to pass into the playVideo method. - */ -export interface StreamingVideoOptions { - /** Executes after success playing audio. */ - successCallback?: Function; - /** Executes after error playing video. */ - errorCallback?: Function; - /** Force one orientation for playing video. */ - orientation?: string; - /** Should the video close after it's over. Defaults to true. */ - shouldAutoClose?: boolean; - /** Should the video have controls. Defaults to true. Android only. */ - controls?: boolean; -} - -/** - * Object of options to pass into the playAudio method. - */ -export interface StreamingAudioOptions { - /** Background color for audio player. */ - bgColor?: string; - /** Background image for audio player. */ - bgImage?: string; - /** - * Background image scale for audio player. - * Valid values are: - * fit - * stretch - * aspectStretch. - */ - bgImageScale?: string; - /** Start audio player in full screen. iOS only. */ - initFullscreen?: boolean; - /** - * Keeps the screen lit and stops it from locking - * while audio is playing. Android only. - */ - keepAwake?: boolean; - /** Executes after success playing audio. */ - successCallback?: Function; - /** Executes after error playing audio. */ - errorCallback?: Function; -} - -/** - * @name Streaming Media - * @description - * This plugin allows you to stream audio and video in a fullscreen, native player on iOS and Android. - * @usage - * ```typescript - * import { StreamingMedia, StreamingVideoOptions } from '@awesome-cordova-plugins/streaming-media/ngx'; - * - * constructor(private streamingMedia: StreamingMedia) { } - * - * let options: StreamingVideoOptions = { - * successCallback: () => { console.log('Video played') }, - * errorCallback: (e) => { console.log('Error streaming') }, - * orientation: 'landscape', - * shouldAutoClose: true, - * controls: false - * }; - * - * this.streamingMedia.playVideo('https://path/to/video/stream', options); - * - * ``` - * @interfaces - * StreamingVideoOptions - * StreamingAudioOptions - */ -@Plugin({ - pluginName: 'StreamingMedia', - plugin: 'cordova-plugin-streaming-media', - pluginRef: 'plugins.streamingMedia', - repo: 'https://github.com/nchutchind/cordova-plugin-streaming-media', - platforms: ['Amazon Fire OS', 'Android', 'iOS'], -}) -@Injectable() -export class StreamingMedia extends AwesomeCordovaNativePlugin { - /** - * Streams a video - * - * @param videoUrl {string} The URL of the video - * @param options {StreamingVideoOptions} Options - */ - @Cordova({ sync: true }) - playVideo(videoUrl: string, options?: StreamingVideoOptions): void {} - - /** - * Streams an audio - * - * @param audioUrl {string} The URL of the audio stream - * @param options {StreamingAudioOptions} Options - */ - @Cordova({ sync: true }) - playAudio(audioUrl: string, options?: StreamingAudioOptions): void {} - - /** - * Stops streaming audio - */ - @Cordova({ sync: true }) - stopAudio(): void {} - - /** - * Pauses streaming audio - */ - @Cordova({ sync: true, platforms: ['iOS'] }) - pauseAudio(): void {} - - /** - * Resumes streaming audio - */ - @Cordova({ sync: true, platforms: ['iOS'] }) - resumeAudio(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/stripe/index.ts b/src/@awesome-cordova-plugins/plugins/stripe/index.ts deleted file mode 100644 index c59cb16b..00000000 --- a/src/@awesome-cordova-plugins/plugins/stripe/index.ts +++ /dev/null @@ -1,222 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface StripeCardTokenParams { - /** - * Card number - */ - number: string; - /** - * Expiry month - */ - expMonth: number; - /** - * Expiry year - */ - expYear: number; - /** - * CVC / CVV - */ - cvc?: string; - /** - * Cardholder name - */ - name?: string; - /** - * Address line 1 - */ - address_line1?: string; - /** - * Address line 2 - */ - address_line2?: string; - /** - * City - */ - address_city?: string; - /** - * State / Province - */ - address_state?: string; - /** - * Country - */ - address_country?: string; - /** - * Postal code / ZIP Code - */ - postalCode?: string; - /** - * 3-letter ISO code for currency - */ - currency?: string; -} - -export interface StripeBankAccountParams { - /** - * Routing number. - */ - routing_number: string; - /** - * Account number. - */ - account_number: string; - /** - * Currency code. Example: `USD`. - */ - currency: string; - /** - * Country code. Example: `US`. - */ - country: string; - /** - * Account holder name. - */ - account_holder_name?: string; - /** - * Account holder type. This can be `individual` or `company`. - */ - account_holder_type?: string; -} - -export interface StripeCardTokenRes { - /** - * Card Object. - */ - card: { - brand: string; - exp_month: number; - exp_year: number; - funding: string; - last4: string; - }; - /** - * Token Request Date Time. - */ - created: string; - /** - * Card Token. - */ - id: string; - /** - * Source Type (card or account). - */ - type: string; -} - -/** - * @name Stripe - * @description - * A plugin that allows you to use Stripe's Native SDKs for Android and iOS. - * @usage - * ```typescript - * import { Stripe } from '@awesome-cordova-plugins/stripe/ngx'; - * - * constructor(private stripe: Stripe) { } - * - * ... - * - * this.stripe.setPublishableKey('my_publishable_key'); - * - * let card = { - * number: '4242424242424242', - * expMonth: 12, - * expYear: 2020, - * cvc: '220' - * } - * - * this.stripe.createCardToken(card) - * .then(token => console.log(token.id)) - * .catch(error => console.error(error)); - * - * ``` - * @interfaces - * StripeCardTokenParams - */ -@Plugin({ - pluginName: 'Stripe', - plugin: 'cordova-plugin-stripe', - pluginRef: 'cordova.plugins.stripe', - repo: 'https://github.com/zyramedia/cordova-plugin-stripe', - platforms: ['Android', 'Browser', 'iOS'], -}) -@Injectable() -export class Stripe extends AwesomeCordovaNativePlugin { - /** - * Set publishable key - * - * @param publishableKey {string} Publishable key - * @returns {Promise} - */ - @Cordova() - setPublishableKey(publishableKey: string): Promise { - return; - } - - /** - * Create Credit Card Token - * - * @param params {StripeCardTokenParams} Credit card information - * @returns {Promise} returns a promise that resolves with the token object, or rejects with an error - */ - @Cordova() - createCardToken(params: StripeCardTokenParams): Promise { - return; - } - - /** - * Create a bank account token - * - * @param params {StripeBankAccountParams} Bank account information - * @returns {Promise} returns a promise that resolves with the token, or rejects with an error - */ - @Cordova() - createBankAccountToken(params: StripeBankAccountParams): Promise { - return; - } - - /** - * Validates a credit card number - * - * @param cardNumber {string} Credit card number - * @returns {Promise} returns a promise that resolves if the number is valid, and rejects if it's invalid - */ - @Cordova() - validateCardNumber(cardNumber: string): Promise { - return; - } - - /** - * Validates a CVC number - * - * @param cvc {string} CVC number - * @returns {Promise} returns a promise that resolves if the number is valid, and rejects if it's invalid - */ - @Cordova() - validateCVC(cvc: string): Promise { - return; - } - - /** - * Validates an expiry date - * - * @param expMonth {string} expiry month (0 - 11) - * @param expYear {string} expiry year - * @returns {Promise} returns a promise that resolves if the date is valid, and rejects if it's invalid - */ - @Cordova() - validateExpiryDate(expMonth: string, expYear: string): Promise { - return; - } - - /** - * Get a card type from card number - * - * @param cardNumber {string} Card number - * @returns {Promise} returns a promise that resolves with the credit card type - */ - @Cordova() - getCardType(cardNumber: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/sum-up/index.ts b/src/@awesome-cordova-plugins/plugins/sum-up/index.ts deleted file mode 100644 index 3434b978..00000000 --- a/src/@awesome-cordova-plugins/plugins/sum-up/index.ts +++ /dev/null @@ -1,240 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export interface SumUpResponse { - // Code to identify the message - code: number; - - // Message for readable usage - message: string; -} - -export interface SumUpLoginStatus { - // Code, to check if an error occured - code: number; - - // Booleand value whether the user is logged in or not - isLoggedIn: boolean; -} - -export interface SumUpPayment { - // Unique transaction code - transaction_code: string; - - // Card type -> like MAESTRO - card_type: string; - - // Merchant code for identification - merchant_code: string; - - // Amount of the payment - amount: number; - - // Tip amount -> default 0 - tip_amount: number; - - // Vat amount -> default 0 - vat_amount: number; - - // Currency code -> like EUR - currency: string; - - // Payment status -> successful or error - status: string; - - // Type -> Card or nfc - payment_type: string; - - // Entry mode -> Like chip or contactless - entry_mode: string; - - // Number of installments -> default 1 - installments: number; -} - -/** - * @hidden - */ -export class SumUpKeys { - // The generated accessToken, to automate the login process - accessToken: string; - - // affiliateKey can also be set in the object, if it has to be changed on runtime - affiliateKey: string; - - constructor() { - this.accessToken = ''; - this.affiliateKey = ''; - } -} - -/** - * @name SumUp - * @description - * Plugin to communicate with a SumUp payment terminal - * @usage - * ```typescript - * import { SumUp } from '@awesome-cordova-plugins/sum-up'; - * - * - * constructor(private sumUp: SumUp) { } - * - * const sumUpKeys: SumUpKeys = new SumUpKeys(); - * sumUpKeys.affiliateKey = 'YOUR_API_KEY'; // if not provided in installation - * sumUpKeys.accessToken = 'YOUR_ACCESS_TOKEN'; - * - * this.sumUp.login(sumUpKeys) - * .then((res: SumUpResponse) => console.log(res)) - * .catch((error: SumUpResponse) => console.error(error)); - * - * this.sumUp.auth('YOUR_ACCESS_TOKEN') - * .then((res: SumUpResponse) => console.log(res)) - * .catch((error: SumUpResponse) => console.error(error)); - * - * this.sumUp.getSettings() - * .then((res: SumUpResponse) => console.log(res)) - * .catch((error: SumUpResponse) => console.error(error)); - * - * this.sumUp.logout() - * .then((res: SumUpResponse) => console.log(res)) - * .catch((error: SumUpResponse) => console.error(error)); - * - * this.sumUp.isLoggedIn() - * .then((res: SumUpLoginStatus) => console.log(res)) - * .catch((error: SumUpLoginStatus) => console.error(error)); - * - * this.sumUp.prepare() - * .then((res: SumUpResponse) => console.log(res)) - * .catch((error: SumUpResponse) => console.error(error)); - * - * this.sumUp.closeConnection() - * .then((res: SumUpResponse) => console.log(res)) - * .catch((error: SumUpResponse) => console.error(error)); - * - * this.sumUp.pay(10.0, 'Transaction title', 'EUR') - * .then((res: SumUpPayment) => console.log(res)) - * .catch((error: SumUpPayment) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'SumUp', - plugin: 'cordova-sumup-plugin', - pluginRef: 'window.SumUp', - repo: 'https://github.com/mariusbackes/cordova-plugin-sumup', - install: 'cordova plugin add cordova-sumup-plugin --variable SUMUP_API_KEY=INSERT_YOUR_KEY', - installVariables: ['SUMUP_API_KEY'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class SumUp extends AwesomeCordovaNativePlugin { - /** - * Login a user with an optional access token. - * If the access token is provided and valid, the user is logged in autmatically. - * Otherwise the user has to type in the credentials - * - * @param sumUpKeys {SumUpKeys} - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - login(sumUpKeys: SumUpKeys): Promise { - return; - } - - /** - * Authenticates the account with the given access token. Parameter accessToken is required. - * - * @param accessToken {string} - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - auth(accessToken: string): Promise { - return; - } - - /** - * Opens a new window with the all account settings of an logged in user. - * - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - getSettings(): Promise { - return; - } - - /** - * Logout a user from the account. - * - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * Checks whether the user is logged in or not and returns an object with the field isLoggedIn which is a boolean value. - * - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - isLoggedIn(): Promise { - return; - } - - /** - * Prepares the terminal for a payment. Checks whether the CardReader is ready to transmit and - * if an instance of the CardReaderManager is available. - * - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - prepare(): Promise { - return; - } - - /** - * Tries to close the connection to the card terminal. - * - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - closeConnection(): Promise { - return; - } - - /** - * Will setup the SumUP SDK. - * This action is required before using other functions. - * - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - setup(): Promise { - return; - } - - /** - * Test the SumUp integration using SDK tests. - * - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - test(): Promise { - return; - } - - /** - * Opens a native SumUp window to proceed a payment. Parameter amount and currencycode are required. - * If the Payment was successful it returns an SumUpPayment object with information about the payment. - * - * @param amount {number} - * @param title {string} - * @param currencyCode {string} - * @returns {Promise} Return a SumUpResponse object - */ - @Cordova() - pay(amount: number, title?: string, currencyCode?: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/system-alert-window-permission/index.ts b/src/@awesome-cordova-plugins/plugins/system-alert-window-permission/index.ts deleted file mode 100644 index 460a0899..00000000 --- a/src/@awesome-cordova-plugins/plugins/system-alert-window-permission/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name System Alert Window Permission - * @description - * This plugin does something - * @usage - * ```typescript - * import { SystemAlertWindowPermission } from '@awesome-cordova-plugins/system-alert-window-permission/ngx'; - * - * - * constructor(private systemAlertWindowPermission: SystemAlertWindowPermission) { } - * - * ... - * - * - * this.systemAlertWindowPermission.hasPermission() - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * this.systemAlertWindowPermission.requestPermission() - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ - -@Plugin({ - pluginName: 'SystemAlertWindowPermission', - plugin: 'cordova-plugin-system-alert-window-permission', - pluginRef: 'window.systemAlertWindowPermission', - repo: 'https://github.com/MaximBelov/cordova-plugin-system-alert-window-permission.git', - install: 'ionic cordova plugin add cordova-plugin-system-alert-window-permission', - platforms: ['Android'], -}) -@Injectable() -export class SystemAlertWindowPermission extends AwesomeCordovaNativePlugin { - /** - * Check permission - * - * @returns {Promise} return 0 when dont have SYSTEM_ALERT_WINDOW permission, 1 when have SYSTEM_ALERT_WINDOW permission - */ - @Cordova() - hasPermission(): Promise { - return; - } - - /** - * Request permission - * - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - requestPermission(): Promise { - return; - } - - /** - * Open notification Settings - * - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - openNotificationSettings(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/taptic-engine/index.ts b/src/@awesome-cordova-plugins/plugins/taptic-engine/index.ts deleted file mode 100644 index f940ff6d..00000000 --- a/src/@awesome-cordova-plugins/plugins/taptic-engine/index.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -/** - * @name Taptic Engine - * @description - * An Ionic plugin to use Taptic Engine API on iPhone 7, 7 Plus or newer. - * @usage - * ```typescript - * import { TapticEngine } from '@awesome-cordova-plugins/taptic-engine/ngx'; - * - * ... - * - * constructor(private taptic: TapticEngine) { } - * - * ... - * - * this.taptic.selection(); - * - * this.taptic.notification(); - * - * this.taptic.impact(); - * - * ``` - */ -@Plugin({ - pluginName: 'TapticEngine', - plugin: 'cordova-plugin-taptic-engine', - pluginRef: 'TapticEngine', - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-taptic-engine', - platforms: ['iOS'], -}) -@Injectable() -export class TapticEngine extends AwesomeCordovaNativePlugin { - /** - * Use selection feedback generators to indicate a change in selection. - * - * @returns {Promise} Returns a promise that resolves on success and rejects on error - */ - @Cordova() - selection(): Promise { - return; - } - - /** - * Use this to indicate success/failure/warning to the user. - * - * @param options {Object} should be of the type { type: 'success' } (or 'warning'/'error') - * @param {'success' | 'warning' | 'error'} options.type - * @returns {Promise} Returns a promise that resolves on success and rejects on error - */ - @Cordova() - notification(options: { type: 'success' | 'warning' | 'error' }): Promise { - return; - } - - /** - * Use this to indicate success/failure/warning to the user. - * - * @param options {Object} should be of the type { style: 'light' } (or 'medium'/'heavy') - * @param {'light' | 'medium' | 'heavy'} options.type - * @param options.style - * @returns {Promise} Returns a promise that resolves on success and rejects on error - */ - @Cordova() - impact(options: { style: 'light' | 'medium' | 'heavy' }): Promise { - return; - } - - /** - * Tell the taptic engine that a gesture for a selection change is starting. - * - * @returns {Promise} - */ - @Cordova() - gestureSelectionStart(): Promise { - return; - } - - /** - * Tell the taptic engine that a selection changed during a gesture. - * - * @returns {Promise} - */ - @Cordova() - gestureSelectionChanged(): Promise { - return; - } - - /** - * Tell the taptic engine we are done with a gesture. This needs to be called lest resources are not properly recycled. - * - * @returns {Promise} - */ - @Cordova() - gestureSelectionEnd(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/tealium-adidentifier/index.ts b/src/@awesome-cordova-plugins/plugins/tealium-adidentifier/index.ts deleted file mode 100644 index 9c3c1c94..00000000 --- a/src/@awesome-cordova-plugins/plugins/tealium-adidentifier/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -/** - * @paid - * @name TealiumAdIdentifier - * @description - * This module depends on the [Tealium Cordova Plugin](https://github.com/tealium/cordova-plugin). Without it, this module will not do anything. - * Makes the IDFA and Google Ad Identifier available in the Tealium data layer. - * @usage - * ``` - * import { TealiumAdIdentifier } from '@awesome-cordova-plugins/tealium-adidentifier/ngx'; - * - * - * constructor(private adIdentifier: TealiumAdIdentifier) { } - * - * ... - * - * - * this.adIdentifier.setPersistent("main"); - * this.adIdentifier.setVolatile("main"); - * - * ``` - */ - -@Plugin({ - pluginName: 'TealiumAdIdentifier', - plugin: 'tealium-cordova-adidentifier', // npm package name, example: cordova-plugin-camera - pluginRef: 'window.tealiumAdIdentifier', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/Tealium/cordova-plugin', // the github repository URL for the plugin - platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] - install: '', // OPTIONAL install command, in case the plugin requires variables -}) -@Injectable() -export class TealiumAdIdentifier extends AwesomeCordovaNativePlugin { - /** - * This function stores the ad identifier information as persistent data - * - * @param instanceName {string} Your arbitrary Tealium instance name provided at init time - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - setPersistent(instanceName: string): Promise { - return; - } - - /** - * This function stores the ad identifier information as volatile data - * - * @param instanceName {string} Your arbitrary Tealium instance name provided at init time - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - setVolatile(instanceName: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/tealium-installreferrer/index.ts b/src/@awesome-cordova-plugins/plugins/tealium-installreferrer/index.ts deleted file mode 100644 index 913f8eaa..00000000 --- a/src/@awesome-cordova-plugins/plugins/tealium-installreferrer/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Injectable } from '@angular/core'; - -/** - * @paid - * @name TealiumInstallReferrer - * @description - * This module depends on the [Tealium Cordova Plugin](https://github.com/tealium/cordova-plugin). Without it, this module will not do anything. - * Implements a Broadcast Receiver for the INSTALL_REFERRER intent. - * @usage - * ``` - * import { TealiumInstallReferrer } from '@awesome-cordova-plugins/tealium-installreferrer/ngx'; - * - * - * constructor(private installReferrer: TealiumInstallReferrer) { } - * - * - * this.installReferrer.setPersistent("main"); - * this.installReferrer.setVolatile("main"); - * - * - * - * ``` - */ - -@Plugin({ - pluginName: 'TealiumInstallReferrer', - plugin: 'tealium-cordova-installreferrer', // npm package name, example: cordova-plugin-camera - pluginRef: 'window.tealiumInstallReferrer', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/Tealium/cordova-plugin', // the github repository URL for the plugin - platforms: ['Android'], // Array of platforms supported, example: ['Android', 'iOS'] - install: '', // OPTIONAL install command, in case the plugin requires variables -}) -@Injectable() -export class TealiumInstallReferrer extends AwesomeCordovaNativePlugin { - /** - * This function stores the install referrer information as persistent data - * - * @param instanceName {string} Your arbitrary Tealium instance name provided at init time - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - setPersistent(instanceName: string): Promise { - return; - } - - /** - * This function stores the install referrer information as volatile data - * - * @param instanceName {string} Your arbitrary Tealium instance name provided at init time - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - setVolatile(instanceName: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/tealium/index.ts b/src/@awesome-cordova-plugins/plugins/tealium/index.ts deleted file mode 100644 index 4fec7ebf..00000000 --- a/src/@awesome-cordova-plugins/plugins/tealium/index.ts +++ /dev/null @@ -1,372 +0,0 @@ -import { Injectable } from '@angular/core'; -import { - Plugin, - Cordova, - CordovaProperty, - CordovaInstance, - InstanceProperty, - AwesomeCordovaNativePlugin, -} from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export enum Collectors { - AppData = 'AppData', - Connectivity = 'Connectivity', - DeviceData = 'DeviceData', - Lifecycle = 'Lifecycle', -} - -export enum Dispatchers { - Collect = 'Collect', - TagManagement = 'TagManagement', - RemoteCommands = 'RemoteCommands', -} - -export enum Expiry { - forever = 'forever', - untilRestart = 'untilRestart', - session = 'session', -} - -export enum ConsentPolicy { - ccpa = 'ccpa', - gdpr = 'gdpr', -} - -export interface TealiumDispatch { - dataLayer: Map; - type: string; - toJson(): string; -} - -export class TealiumView implements TealiumDispatch { - public type = 'view'; - constructor(public viewName: string, public dataLayer: Map) {} - toJson() { - const dictionary: any = {}; - dictionary['type'] = this.type; - dictionary['dataLayer'] = {}; - this.dataLayer.forEach((k, v) => { - dictionary['dataLayer'][k] = v; - }); - dictionary['type'] = this.type; - dictionary['viewName'] = this.viewName; - return JSON.stringify(dictionary); - } -} - -export class TealiumEvent implements TealiumDispatch { - public type = 'event'; - constructor(public eventName: string, public dataLayer: Map) {} - toJson() { - const dictionary: any = {}; - dictionary['type'] = this.type; - dictionary['dataLayer'] = {}; - this.dataLayer.forEach((k, v) => { - dictionary['dataLayer'][k] = v; - }); - dictionary['type'] = this.type; - dictionary['eventName'] = this.eventName; - return JSON.stringify(dictionary); - } -} - -export class ConsentExpiry { - constructor(public time: number, public unit: TimeUnit) {} -} - -export enum TimeUnit { - minutes = 'minutes', - hours = 'hours', - days = 'days', - months = 'months', -} - -export enum ConsentStatus { - consented = 'consented', - notConsented = 'notConsented', - unknown = 'unknown', -} - -export enum LogLevel { - dev = 'dev', - qa = 'qa', - prod = 'prod', - silent = 'silent', -} - -export enum TealiumEnvironment { - dev = 'dev', - qa = 'qa', - prod = 'prod', -} - -export enum ConsentCategories { - analytics = 'analytics', - affiliates = 'affiliates', - displayAds = 'display_ads', - email = 'email', - personalization = 'personalization', - search = 'search', - social = 'social', - bigData = 'big_data', - mobile = 'mobile', - engagement = 'engagement', - monitoring = 'monitoring', - crm = 'crm', - cdp = 'cdp', - cookieMatch = 'cookiematch', - misc = 'misc', -} - -export interface TealiumConfig { - account: string; - profile: string; - environment: TealiumEnvironment; - dataSource?: string; - collectors: Collectors[]; - dispatchers: Dispatchers[]; - customVisitorId?: string; - memoryReportingEnabled?: boolean; - overrideCollectURL?: string; - overrideCollectBatchURL?: string; - overrideCollectDomain?: string; - overrideLibrarySettingsURL?: string; - overrideTagManagementURL?: string; - deepLinkTrackingEnabled?: boolean; - qrTraceEnabled?: boolean; - loglevel?: LogLevel; - consentLoggingEnabled?: boolean; - consentPolicy?: ConsentPolicy; - consentExpiry?: ConsentExpiry; - lifecycleAutotrackingEnabled?: boolean; - useRemoteLibrarySettings?: boolean; - visitorServiceEnabled?: boolean; - visitorServiceRefreshInterval?: string; -} - -/** - * @name Tealium - * @description - * This plugin does provides a wrapper around the Tealium Cordova Plugin for Ionic Native. - * - * For full documentation, see [https://docs.tealium.com/platforms/cordova/](https://docs.tealium.com/platforms/cordova/) - * - * @usage - * ```typescript - * import { Tealium } from '@awesome-cordova-plugins/tealium/ngx'; - * - * - * constructor(private tealium: Tealium) { } - * - * ... - * - * let config: TealiumConfig = { - * account: , - * profile: , - * environment: TealiumEnvironment.dev, - * dispatchers: [Dispatchers.Collect, Dispatchers.RemoteCommands, Dispatchers.TagManagement], - * collectors: [Collectors.AppData, Collectors.DeviceData, Collectors.Lifecycle, Collectors.Connectivity], - * consentLoggingEnabled: true, - * consentPolicy: ConsentPolicy.gdpr, - * visitorServiceEnabled: true, - * // visitorServiceRefreshInterval: '1', - * consentExpiry: new ConsentExpiry(3, TimeUnit.minutes), - * }; - * - * Tealium.initialize(config); - * - * ``` - */ -@Plugin({ - pluginName: 'Tealium', - plugin: 'tealium-cordova-plugin', // npm package name - pluginRef: 'tealium', // the variable reference to call the plugin - repo: 'https://github.com/Tealium/cordova-plugin', // the github repository URL for the plugin - install: '', // OPTIONAL install command, in case the plugin requires variables - installVariables: [], // OPTIONAL the plugin requires variables - platforms: ['Android', 'iOS'], // Array of platforms supported -}) -@Injectable() -export class Tealium extends AwesomeCordovaNativePlugin { - /** - * This function initializes the Tealium Cordova Plugin - * @param config {TealiumConfig} - * @param callback - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - initialize(config: TealiumConfig, callback?: Function): Promise { - return; // We add return; here to avoid any IDE / Compiler errors - } - - /** - * This function tracks an event - * @param dispatch {TealiumDispatch} Dispatch containing event data - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - track(dispatch: TealiumDispatch): Promise { - return; - } - - /** - * This function terminatest the Tealium instance - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - terminateInstance(): Promise { - return; - } - - /** - * Adds data to data layer - * @param data A map containing the key-value pairs to be added to data layer - * @param expiry When the data should expire. Choose `Expiry.session` if unsure. - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - addData(data: Map, expiry: string): Promise { - return; - } - - /** - * - * @param key The key of the data to retrieve from the data layer - * @param callback - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - getData(key: string, callback?: Function): Promise { - return; - } - - /** - * Removes data from the data layer - * @param keys The keys of the data to be removed - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - removeData(keys: string[]): Promise { - return; - } - - /** - * Retrieves the user's consent status - * @param callback - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - getConsentStatus(callback?: Function): Promise { - return; - } - - /** - * Sets the user's consent status - * @param consentStatus - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - setConsentStatus(consentStatus: ConsentStatus): Promise { - return; - } - - /** - * Retrieves the user's consent categories - * @param callback - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - getConsentCategories(callback?: Function): Promise { - return; - } - - /** - * Sets the user's consent categories - * @param categories - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - setConsentCategories(categories: ConsentCategories[]): Promise { - return; - } - - /** - * Joins a trace session weith the specified Trace ID - * @param id Trace ID - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - joinTrace(id: string): Promise { - return; - } - - /** - * Leaves a trace session - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - leaveTrace(): Promise { - return; - } - - /** - * Retrieves the Tealium Visitor ID - * @param callback - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - getVisitorId(callback?: Function): Promise { - return; - } - - /** - * Sets a listener to be called when the AudienceStream visitor profile is updated - * @param callback - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - setVisitorServiceListener(callback?: Function): Promise { - return; - } - - /** - * Sets a listener to be called when the consent has expired - * @param callback - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - setConsentExpiryListener(callback?: Function): Promise { - return; - } - - /** - * Adds a remote command for later execution - * @param id The ID used to invoke the remote command - * @param callback - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - addRemoteCommand(id: string, callback?: Function): Promise { - return; - } - - /** - * Removes a previously-added remote command - * @param id The ID of remote command to be removed - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - removeRemoteCommand(id: string): Promise { - return; - } - - /** - * Removes all listeners - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - removeListeners(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/text-to-speech-advanced/index.ts b/src/@awesome-cordova-plugins/plugins/text-to-speech-advanced/index.ts deleted file mode 100644 index 4ddaffa6..00000000 --- a/src/@awesome-cordova-plugins/plugins/text-to-speech-advanced/index.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface TTSOptions { - /** text to speak */ - text: string; - /** cancel, boolean: true/false */ - identifier: string; - /** voice identifier (iOS / Android) from getVoices */ - locale?: string; - /** speed rate, 0 ~ 1 */ - rate?: number; - /** pitch, 0 ~ 1 */ - pitch?: number; - /** cancel, boolean: true/false */ - cancel?: boolean; -} - -export interface TTSVoice { - /** Voice name */ - name: string; - /** Voice language */ - language: string; - /** Voice identifier string */ - identifier: string; -} - -/** - * @name Text To Speech Advanced - * @description - * Text to Speech plugin - * @usage - * ```typescript - * import { TextToSpeechAdvanced } from '@awesome-cordova-plugins/text-to-speech-advanced/ngx'; - * - * constructor(private tts: TextToSpeechAdvanced) { } - * - * ... - * - * this.tts.speak('Hello World') - * .then(() => console.log('Success')) - * .catch((reason: any) => console.log(reason)); - * - * ``` - * @interfaces - * TTSOptions - * TTSVoice - */ -@Plugin({ - pluginName: 'Text To Speech Advanced', - plugin: 'cordova-plugin-tts-advanced', - pluginRef: 'TTS', - repo: 'https://github.com/spasma/cordova-plugin-tts-advanced', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class TextToSpeechAdvanced extends AwesomeCordovaNativePlugin { - /** - * This function speaks - * - * @param textOrOptions {string | TTSOptions} Text to speak or TTSOptions - * @returns {Promise} Returns a promise that resolves when the speaking finishes - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - speak(textOrOptions: string | TTSOptions): Promise { - return; - } - - /** - * Stop any current TTS playback - * - * @returns {Promise} - */ - @Cordova() - stop(): Promise { - return; - } - - /** - * Get all voices - * - * @returns {Promise} - */ - @Cordova() - getVoices(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/theme-detection/index.ts b/src/@awesome-cordova-plugins/plugins/theme-detection/index.ts deleted file mode 100644 index 3dbccb8b..00000000 --- a/src/@awesome-cordova-plugins/plugins/theme-detection/index.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export interface ThemeDetectionResponse { - // Boolean value about the status of the request - value: boolean; - - // Message for readable usage - message: string; -} - -/** - * @beta - * @name Theme Detection - * @description - * Cordova plugin to detect whether dark mode is enabled or not - * @usage - * ```typescript - * import { ThemeDetection } from '@awesome-cordova-plugins/theme-detection'; - * - * - * constructor(private themeDetection: ThemeDetection) { } - * - * ... - * - * this.themeDetection.isAvailable() - * .then((res: ThemeDetectionResponse) => { - * if(res.value) { - * this.themeDetection.isDarkModeEnabled().then((res: ThemeDetectionResponse) => { - * console.log(res); - * }) - * .catch((error: any) => console.error(error)); - * } - * }) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'ThemeDetection', - plugin: 'cordova-plugin-theme-detection', - pluginRef: 'cordova.plugins.ThemeDetection', - repo: 'https://github.com/mariusbackes/cordova-plugin-theme-detection', - install: 'cordova plugin add cordova-plugin-theme-detection', - installVariables: [], - platforms: ['iOS', 'Android'], -}) -@Injectable() -export class ThemeDetection extends AwesomeCordovaNativePlugin { - /** - * - * @returns {Promise} - * Returns a promise with an object that has a boolean property which gives information if the detection is available or not - */ - @Cordova() - isAvailable(): Promise { - return; - } - - /** - * - * @returns {Promise} - * Returns a promise with an object that has a boolean property which gives information if dark mode is enabled or not - */ - @Cordova() - isDarkModeEnabled(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/three-dee-touch/index.ts b/src/@awesome-cordova-plugins/plugins/three-dee-touch/index.ts deleted file mode 100644 index a81a5fb7..00000000 --- a/src/@awesome-cordova-plugins/plugins/three-dee-touch/index.ts +++ /dev/null @@ -1,193 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaFunctionOverride, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface ThreeDeeTouchQuickAction { - /** - * Type that can be used in the onHomeIconPressed callback - */ - type?: string; - - /** - * Title - */ - title: string; - - /** - * Subtitle - */ - subtitle?: string; - - /** - * Icon type. Case insensitive - */ - iconType?: string; - - /** - * Icon template - */ - iconTemplate?: string; -} - -export interface ThreeDeeTouchForceTouch { - /** - * Touch force - */ - force: number; - - /** - * Timestamp of action - */ - timestamp: number; - - /** - * X coordinate of action - */ - x: number; - - /** - * Y coordinate of action - */ - y: number; -} - -/** - * @name 3D Touch - * @description - * The 3D Touch plugin adds 3D Touch capabilities to your Cordova app. - * - * Requires Cordova plugin: `cordova-plugin-3dtouch`. For more info, please see the [3D Touch plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-3dtouch). - * @usage - * Please do refer to the original plugin's repo for detailed usage. The usage example here might not be sufficient. - * ```typescript - * import { ThreeDeeTouch, ThreeDeeTouchQuickAction, ThreeDeeTouchForceTouch } from '@awesome-cordova-plugins/three-dee-touch/ngx'; - * - * constructor(private threeDeeTouch: ThreeDeeTouch) { } - * - * ... - * - * this.threeDeeTouch.isAvailable().then(isAvailable => console.log('3D Touch available? ' + isAvailable)); - * - * this.threeDeeTouch.watchForceTouches() - * .subscribe( - * (data: ThreeDeeTouchForceTouch) => { - * console.log('Force touch %' + data.force); - * console.log('Force touch timestamp: ' + data.timestamp); - * console.log('Force touch x: ' + data.x); - * console.log('Force touch y: ' + data.y); - * } - * ); - * - * - * let actions: ThreeDeeTouchQuickAction[] = [ - * { - * type: 'checkin', - * title: 'Check in', - * subtitle: 'Quickly check in', - * iconType: 'Compose' - * }, - * { - * type: 'share', - * title: 'Share', - * subtitle: 'Share like you care', - * iconType: 'Share' - * }, - * { - * type: 'search', - * title: 'Search', - * iconType: 'Search' - * }, - * { - * title: 'Show favorites', - * iconTemplate: 'HeartTemplate' - * } - * ]; - * - * this.threeDeeTouch.configureQuickActions(actions); - * - * this.threeDeeTouch.onHomeIconPressed().subscribe( - * (payload) => { - * // returns an object that is the button you presed - * console.log('Pressed the ${payload.title} button') - * console.log(payload.type) - * - * } - * ) - * ``` - * @interfaces - * ThreeDeeTouchQuickAction - * ThreeDeeTouchForceTouch - */ -@Plugin({ - pluginName: 'ThreeDeeTouch', - plugin: 'cordova-plugin-3dtouch', - pluginRef: 'ThreeDeeTouch', - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-3dtouch', - platforms: ['iOS'], -}) -@Injectable() -export class ThreeDeeTouch extends AwesomeCordovaNativePlugin { - /** - * You need an iPhone 6S or some future tech to use the features of this plugin, so you can check at runtime if the user's device is supported. - * - * @returns {Promise} returns a promise that resolves with a boolean that indicates whether the plugin is available or not - */ - @Cordova() - isAvailable(): Promise { - return; - } - - /** - * You can get a notification when the user force touches the webview. The plugin defines a Force Touch when at least 75% of the maximum force is applied to the screen. Your app will receive the x and y coordinates, so you have to figure out which UI element was touched. - * - * @returns {Observable} Returns an observable that sends a `ThreeDeeTouchForceTouch` object - */ - @Cordova({ - observable: true, - }) - watchForceTouches(): Observable { - return; - } - - /** - * setup the 3D-touch actions, takes an array of objects with the following - * - * @param {string} type (optional) A type that can be used `onHomeIconPressed` callback - * @param {string} title Title for your action - * @param {string} subtitle (optional) A short description for your action - * @param {string} iconType (optional) Choose between Prohibit, Contact, Home, MarkLocation, Favorite, Love, Cloud, Invitation, Confirmation, Mail, Message, Date, Time, CapturePhoto, CaptureVideo, Task, TaskCompleted, Alarm, Bookmark, Shuffle, Audio, Update - * @param {string} iconTemplate (optional) Can be used to provide your own icon - * @param quickActions - */ - @Cordova({ - sync: true, - }) - configureQuickActions(quickActions: ThreeDeeTouchQuickAction[]): void {} - - /** - * When a home icon is pressed, your app launches and this JS callback is invoked. - * - * @returns {Observable} returns an observable that notifies you when he user presses on the home screen icon - */ - @CordovaFunctionOverride() - onHomeIconPressed(): Observable { - return; - } - - /** - * Enable Link Preview. - * UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9. - */ - @Cordova({ - sync: true, - }) - enableLinkPreview(): void {} - - /** - * Disabled the link preview feature, if enabled. - */ - @Cordova({ - sync: true, - }) - disableLinkPreview(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/toast/index.ts b/src/@awesome-cordova-plugins/plugins/toast/index.ts deleted file mode 100644 index e7b7c302..00000000 --- a/src/@awesome-cordova-plugins/plugins/toast/index.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface ToastOptions { - /** - * Message to display - */ - message?: string; - /** - * Duration in ms to show - */ - duration?: number; - /** - * Position - */ - position?: string; - /** - * Add negative value to move it up a bit - */ - addPixelsY?: number; - /** - * Pass JSON object to be sent back in success callback - */ - data?: any; - /** - * Styling - */ - styling?: { - opacity?: number; - backgroundColor?: string; - textColor?: string; - cornerRadius?: number; - horizontalPadding?: number; - verticalPadding?: number; - }; -} - -/** - * @name Toast - * @description - * This plugin allows you to show a native Toast (a little text popup) on iOS, Android and WP8. It's great for showing a non intrusive native notification which is guaranteed always in the viewport of the browser. - * - * Requires Cordova plugin: `cordova-plugin-x-toast`. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin). - * @usage - * ```typescript - * import { Toast } from '@awesome-cordova-plugins/toast/ngx'; - * - * constructor(private toast: Toast) { } - * - * ... - * - * this.toast.show(`I'm a toast`, '5000', 'center').subscribe( - * toast => { - * console.log(toast); - * } - * ); - * ``` - * @interfaces - * ToastOptions - */ -@Plugin({ - pluginName: 'Toast', - plugin: 'cordova-plugin-x-toast', - pluginRef: 'plugins.toast', - repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin', - platforms: ['Android', 'BlackBerry 10', 'iOS', 'Windows', 'Windows Phone 8'], -}) -@Injectable() -export class Toast extends AwesomeCordovaNativePlugin { - /** - * Show a native toast for the given duration at the specified position. - * - * @param {string} message The message to display. - * @param {string} duration Duration to show the toast, either 'short', 'long' or any number of milliseconds: '1500'. - * @param {string} position Where to position the toast, either 'top', 'center', or 'bottom'. - * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. - */ - @Cordova({ - observable: true, - clearFunction: 'hide', - }) - show(message: string, duration: string, position: string): Observable { - return; - } - - /** - * Manually hide any currently visible toast. - * - * @returns {Promise} Returns a Promise that resolves on success. - */ - @Cordova() - hide(): Promise { - return; - } - - /** - * Show a native toast with the given options. - * - * @param {Object} options Options for showing a toast. Available options: - * message The message to display. - * duration Duration to show the toast, either 'short', 'long' or any number of milliseconds: '1500'. - * position Where to position the toast, either 'top', 'center', or 'bottom'. - * addPixelsY Offset in pixels to move the toast up or down from its specified position. - * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. - */ - @Cordova({ - observable: true, - clearFunction: 'hide', - }) - showWithOptions(options: ToastOptions): Observable { - return; - } - - /** - * Shorthand for `show(message, 'short', 'top')`. - * - * @param message {string} - * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. - */ - @Cordova({ - observable: true, - clearFunction: 'hide', - }) - showShortTop(message: string): Observable { - return; - } - - /** - * Shorthand for `show(message, 'short', 'center')`. - * - * @param message {string} - * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. - */ - @Cordova({ - observable: true, - clearFunction: 'hide', - }) - showShortCenter(message: string): Observable { - return; - } - - /** - * Shorthand for `show(message, 'short', 'bottom')`. - * - * @param message {string} - * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. - */ - @Cordova({ - observable: true, - clearFunction: 'hide', - }) - showShortBottom(message: string): Observable { - return; - } - - /** - * Shorthand for `show(message, 'long', 'top')`. - * - * @param message {string} - * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. - */ - @Cordova({ - observable: true, - clearFunction: 'hide', - }) - showLongTop(message: string): Observable { - return; - } - - /** - * Shorthand for `show(message, 'long', 'center')`. - * - * @param message {string} - * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. - */ - @Cordova({ - observable: true, - clearFunction: 'hide', - }) - showLongCenter(message: string): Observable { - return; - } - - /** - * Shorthand for `show(message, 'long', 'bottom')`. - * - * @param message {string} - * @returns {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error. - */ - @Cordova({ - observable: true, - clearFunction: 'hide', - }) - showLongBottom(message: string): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/touch-id/index.ts b/src/@awesome-cordova-plugins/plugins/touch-id/index.ts deleted file mode 100644 index 9cc873e9..00000000 --- a/src/@awesome-cordova-plugins/plugins/touch-id/index.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Touch ID - * @description - * Scan the fingerprint of a user with the TouchID sensor. - * - * Requires Cordova plugin: `cordova-plugin-touch-id`. For more info, please see the [TouchID plugin docs](https://github.com/EddyVerbruggen/cordova-plugin-touch-id). - * @usage - * ```typescript - * import { TouchID } from '@awesome-cordova-plugins/touch-id/ngx'; - * - * constructor(private touchId: TouchID) { } - * - * ... - * - * this.touchId.isAvailable() - * .then( - * res => console.log('TouchID is available!'), - * err => console.error('TouchID is not available', err) - * ); - * - * this.touchId.verifyFingerprint('Scan your fingerprint please') - * .then( - * res => console.log('Ok', res), - * err => console.error('Error', err) - * ); - * ``` - * - * ### Error Codes - * - * The plugin will reject for various reasons. Your app will most likely need to respond to the cases differently. - * - * Here is a list of some of the error codes: - * - * - `-1` - Fingerprint scan failed more than 3 times - * - `-2` or `-128` - User tapped the 'Cancel' button - * - `-3` - User tapped the 'Enter Passcode' or 'Enter Password' button - * - `-4` - The scan was cancelled by the system (Home button for example) - * - `-6` - TouchID is not Available - * - `-8` - TouchID is locked out from too many tries - */ -@Plugin({ - pluginName: 'TouchID', - plugin: 'cordova-plugin-touch-id', - pluginRef: 'plugins.touchid', - repo: 'https://github.com/EddyVerbruggen/cordova-plugin-touch-id', - platforms: ['iOS'], -}) -@Injectable() -export class TouchID extends AwesomeCordovaNativePlugin { - /** - * Checks Whether TouchID is available or not. - * - * @returns {Promise} Returns a Promise that resolves if yes, rejects if no. - */ - @Cordova() - isAvailable(): Promise { - return; - } - - /** - * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, brings up standard system passcode screen. - * - * @param {string} message The message to display - * @returns {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). - */ - @Cordova() - verifyFingerprint(message: string): Promise { - return; - } - - /** - * Show TouchID dialog and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above). - * - * @param {string} message The message to display - * @returns {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). - */ - @Cordova() - verifyFingerprintWithCustomPasswordFallback(message: string): Promise { - return; - } - - /** - * Show TouchID dialog with custom 'Enter Password' message and wait for a fingerprint scan. If user taps 'Enter Password' button, rejects with code '-3' (see above). - * - * @param {string} message The message to display - * @param {string} enterPasswordLabel Custom text for the 'Enter Password' button - * @returns {Promise} Returns a Promise the resolves if the fingerprint scan was successful, rejects with an error code (see above). - */ - @Cordova() - verifyFingerprintWithCustomPasswordFallbackAndEnterPasswordLabel( - message: string, - enterPasswordLabel: string - ): Promise { - return; - } - - /** - * Checks if the fingerprint database changed. - * - * @returns {Promise} Returns a Promise that resolves if yes, rejects if no. - */ - @Cordova() - didFingerprintDatabaseChange(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/unique-device-id/index.ts b/src/@awesome-cordova-plugins/plugins/unique-device-id/index.ts deleted file mode 100644 index 2a02a381..00000000 --- a/src/@awesome-cordova-plugins/plugins/unique-device-id/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Unique Device ID - * @description - * This plugin produces a unique, cross-install, app-specific device id. - * - * @usage - * ```typescript - * import { UniqueDeviceID } from '@awesome-cordova-plugins/unique-device-id/ngx'; - * - * constructor(private uniqueDeviceID: UniqueDeviceID) { } - * - * ... - * - * this.uniqueDeviceID.get() - * .then((uuid: any) => console.log(uuid)) - * .catch((error: any) => console.log(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'UniqueDeviceID', - plugin: 'cordova-plugin-uniquedeviceid', - pluginRef: 'window.plugins.uniqueDeviceID', - repo: 'https://github.com/Paldom/UniqueDeviceID', - install: '', // OPTIONAL install command, in case the plugin requires variables - installVariables: [], // OPTIONAL the plugin requires variables - platforms: ['Android', 'iOS', 'Windows Phone 8'], // Array of platforms supported, example: ['Android', 'iOS'] -}) -@Injectable() -export class UniqueDeviceID extends AwesomeCordovaNativePlugin { - /** - * Gets a unique, cross-install, app-specific device id. - * @return {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - get(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts b/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts deleted file mode 100644 index 17526685..00000000 --- a/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts +++ /dev/null @@ -1,1675 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * Outbox Lock Result States - */ -export enum OutboxLockStatus { - LockApplied = 0, - DataBeingSent = 1, - DataNotInQueue = 2, -} - -/** - * Log levels supported in the sdk. - */ -export enum LogLevel { - important = 7, - error = 8, - debug = 9, -} - -/** - * AuthenticateAndActivateResultType Some Documentation - */ -export enum AuthenticateAndActivateResultType { - /** - * This value indicates that UMP was able to validate users credentials & activation of the user is complete. - * In mobile apps, this also means database is created & apps can proceed with their custom logic. - */ - auth_activation_success = 2, - /** - * This value indicates that UMP was unable to validate users credentials. - */ - auth_activation_error = 3, -} - -export enum AuthenticateLocalResultType { - /** - * This value indicates that UnviredCordovaSDK was able to validate users credentials and apps can proceed with their custom logic. - */ - login_success = 4, - /** - * This value indicates that UnviredCordovaSDK was unable to validate users credentials. You can retrieve the error information from AuthenticateLocalResult. - */ - login_error = 5, -} - -export enum LoginListenerType { - /** - * This value indicates that there is no user account exists and user needs to authenticate & activate. Call authenticateAndActivate() api to activate the user. - */ - auth_activation_required = 0, - /** - * Applicable for mobile. - * This value indicates user needs to login before using the app. This depends on the setting LOCAL_PASSWORD which is set in UMP Admin Cockpit. - * If LOCAL_PASSWORD is set to true, this type is set everytime user opens the app. - */ - app_requires_login = 1, - /** - * This value indicates app can proceed with its custom logic. - */ - login_success = 4, - /** - * If there are multiple accounts active & no account is specified in the login(), then this value is returned indicating that a current account needs to be specified for the login(). - */ - app_requires_current_account = 6, - - /** - * This value indicates app can proceed with demo mode. - */ - login_demo = 7, -} - -export enum LoginType { - /** - * This value represents authentication using Unvired ID. - * Example: - * ``` - * loginParameters.username = 'USER_NAME' - * loginParameters.password = 'password' - * loginParameters.company = 'unvired' - * loginParameters.loginType = LoginType.unvired - * ``` - */ - unvired = 'UNVIRED_ID', - /** - * This value represents authentication using Active Directory Service (ADS). - * Example: - * ``` - * loginParameters.username = 'USER_NAME' - * loginParameters.password = 'password' - * loginParameters.company = 'unvired' - * loginParameters.domain = 'ADS_DOMAIN' - * loginParameters.loginType = LoginType.ads - * ``` - */ - ads = 'ADS', - /** - * This value represents authentication using SAP ID. - * Example: - * ``` - * loginParameters.username = 'USER_NAME' - * loginParameters.password = 'password' - * loginParameters.company = 'unvired' - * loginParameters.port = 'SAP_PORT_NAME' - * loginParameters.domain = 'SAP_DOMAIN' - * loginParameters.loginType = LoginType.sap - * ``` - */ - sap = 'SAP', - /** - * EMAIL - * Set the type to email to login based on email id. - */ - email = 'EMAIL', - /** - * SAML 2.0 Login Type - */ - saml2 = 'SAML2', - /** - * TODO: - */ - custom = 'CUSTOM', -} - -export enum ResultType { - /** - * This value indicates a succesful operation. - */ - success = 0, - /** - * This value indicates an error. - */ - error, -} - -export enum RequestType { - /** - * Set this type if the data exchange with UMP is 1:1. The header datastructure needs to be sent which also should be present in database prior to the call. - * You can use UnviredCordovaSDK's db methods to insert data into database. - */ - RQST = 'RQST', - /** - * Set this type if the data exchange with UMP is 1:N pr 0:N. Sending a datastructure is optional and is dependent on the Process Agent function. - * If the Process Agent function is marked with metadata delete flag, then server data replaces the data in database. - * If the Process Agent function is NOT marked with metadata delete flag, then this request type behaves the same as QUERY - */ - PULL = 'PULL', - /** - * This request type is for those message which are initiated by the server. You typically do not set this request type in sync.. methods. - */ - PUSH = 'PUSH', - /** - * Set this type if the data exchange with UMP is 1:N pr 0:N. Sending a datastructure is optional and is dependent on the Process Agent function. - * Unlike PULL, this request type updates the data in database without deleting existing entries. - */ - QUERY = 'QUERY', - /** - * Set this type if the data exchange with UMP is 1:0. This handles the case where no server response is expected. - */ - REQ = 'REQ', -} - -export enum NotificationListenerType { - /** - * Notify successful asynchronous send of data to the server. This type indicates that data has moved from outbox to sent items. - */ - dataSend = 0, - /** - * Notify data changes for each BusinessEntity when received data from server. This type indicates when data is removed from sent items table. - */ - dataChanged = 1, - /** - * Notify data receive completion on receiving of all BusinessEntities from server. Data would get processed after this step. - */ - dataReceived = 2, - /** - * Notify application data reset. - */ - appReset = 3, - /** - * Notify application with error message and attchment item on attachment download success - */ - attachmentDownloadSuccess = 4, - /** - * Notify application with error message and attchment item on attachment download error - */ - attachmentDownloadError = 5, - /** - * Notify application when incoming data handling finished - */ - incomingDataProcessingFinished = 6, - /** - * Notify application when incoming data handling finished - */ - attachmentDownloadWaiting = 7, - /** - * Notify application with any InfoMessages - */ - infoMessage = 8, - /** - * Notify application with Server errors - */ - serverError = 9, - /** - * Notify attachment downloads completed - */ - attachmentDownloadCompleted = 10, - /** - * Notify when the sent item count changes. - */ - SentItemChanged = 11, - /** - * Notify that the JWT token is received - */ - JWTTokenReceived = 12, -} - -export enum AttachmentItemStatus { - DEFAULT = 0, - QUEUED_FOR_DOWNLOAD, - DOWNLOADED, - ERROR_IN_DOWNLOAD, - SAVED_FOR_UPLOAD, - UPLOADED, - ERROR_IN_UPLOAD, - MARKED_FOR_DELETE, - EXTERNAL, -} - -export class Settings { - loginType: LoginType; - ADS_DOMAIN: string; - SAP_PORT_NAME: string; - EMAIL: string; - ADS_USER_ID: string; - SAP_USER_ID: string; - FULL_NAME: string; - SERVER_URL: string; - USER_ID: string; -} - -export class UnviredResult { - /** - * The data returned in response to the api call. - */ - data: any; - /** - * The informational message returned in lieu of data. - */ - message: string; - /** - * Refer to the overrided property in subclasses. - */ - type: number; - /** - * Contains the error information which the apps can convey to the users. - */ - error: string; - /** - * Contains the detailed error information which the apps can convey to the users. - */ - errorDetail: string; -} - -export class OutboxLockResult extends UnviredResult { - type: ResultType; - data: OutboxLockStatus; -} - -export class LogResult extends UnviredResult { - type: ResultType; - data: LogLevel; -} - -export class LogDataResult extends UnviredResult { - type: ResultType; - data: string; -} - -export class NotifResult extends UnviredResult { - type: NotificationListenerType; -} - -export class SettingsResult extends UnviredResult { - data: Settings; - type: ResultType; -} - -export class SyncResult extends UnviredResult { - type: ResultType; - /** - * This code refers to the HTTP status code obtained during the network call. - */ - code: number; -} - -export class DbResult extends UnviredResult { - type: ResultType; -} - -export class LoginParameters { - /** - * Set the application name as configured in UMP. - */ - appName: string; - - /** - * Company name as configured in UMP. - */ - company: string; - - /** - * Username of the user trying to login. - */ - username: string; - - /** - * Password of the user trying to login. - */ - password: string; - - /** - * UMP URL. For example: https://umpdev.unvired.io/UMP - */ - url: string; - - /** - * Domain name. Required only if the login type is ADS or SAP. - */ - domain: string; - - /** - * Set this value to one of the allowed login types for your app as configured in UMP. - */ - loginType: LoginType; - - /** - * FrontEndUserId: This id uniquely identifies the user across devices of same type. If the Unvired user has multiple front end ids for a device type, you need to set this value. - * If the Unvired user has only one front end id, leave this field blank. - */ - feUserId: string; - - /** - * Required only if the loginType is 'sap'. This sets the SAP Port Name. - */ - port: string; - - /** - * Required for Browser Platform. - * For iOS Platform include the metadata.xml file as part of App Bundle - * For Android Platform include the metadata.xml file in src > res > raw - */ - metadataPath: string; - - /** - * This is required for Android only. Setting this value would save the attachments as Base64 string for easy access. - */ - isRequiredAttachmentBase64: boolean; - - /** - * Set an interval in seconds at which the framework has to make an attempt to send data from outbox. - * If the data-sender fails for reason, then the framework does not restart even if there are outbox items. - * In those cases, you will have to set this value, so that the framework always makes an attempt to send from outbox. - * Example: - * loginParameters.autoSendTime = '5' // Make an attempt to send data every 5 seconds. - */ - autoSendTime: string; - - /** - * Set the number of seconds at which GetMessage should automatically run. When this value is set, GetMessage would run in a interval as long as there are entries in Sent Items. - * You may need to set this value if your app doesn't support Push Notifications. - * By default, the framework does not do GetMessage automatically. - * Example: - * loginParameters.autoSyncTime = '5' // Make an attempt to receive data (GetMessage) every 5 seconds. - */ - autoSyncTime: string; - - /** - * Specify the metadata as a JSON string. This will override metadata.xml set at platform level. - */ - metadataJSON: string; - - /** - * Specify the demo data xml string for demo mode. - */ - demoData: string; - - /** - * Set 'true' if the application supports demo mode otherwise set 'false'. - */ - demoModeRequired: boolean; - - /* - * Set this value to true to persist web application database. By default, this value is false. - */ - persistWebDb: boolean; - - /* - * JWT options. - * loginParameters.jwtOptions = {"app": "myapp"}; - */ - jwtOptions: object; - - /** - * Language code to be sent to UMP. Specify a two-letter language code. - * The default value of this is 'en'. - */ - loginLanguage: string; - - /** - * Applicable for browser only. Set this flag to indicate that saved data should be reloaded upon launch. - */ - cacheWebData: boolean; - - /** - * Set this value if you the login process requires client credentials to be set. - * You can pass the client credentials with the method: |unviredSDK.setClientCredentials(credentials)| - * The passed credentials will be used based on this flag. - */ - requireClientCredentials: boolean; -} -export class LoginResult extends UnviredResult { - type: LoginListenerType; -} - -export class AuthenticateActivateResult extends UnviredResult { - type: AuthenticateAndActivateResultType; -} - -export class AuthenticateLocalResult extends UnviredResult { - type: AuthenticateLocalResultType; -} - -export class UnviredCredential { - user: string; - password: string; - port: string; -} - -/** - * @name Unvired Cordova SDK - * @description - * This plugin lets you build apps which connect to Unvired Mobile Platform (UMP). - * - - * iOS Requirements - * - - * Update your Cocoapods repo before you install the plugin. - * ``` - * $ pod repo update - * ``` - * - - * Browser Requirements - * - - * After you install the plugin, for Ionic/Angular projects, please add a reference to the following JS files within section of index.html. - * ``` - * - * - * - * - * ``` - * @usage - * ```typescript - * import { UnviredCordovaSDK } from '@awesome-cordova-plugins/unvired-cordova-sdk/ngx'; - * - * - * constructor(private unviredSDK: UnviredCordovaSDK) { } - * - * ... - * // This is usually done in app.component.ts of your app. - * // Before you can interact with UMP, you need to initialize the SDK and authenticate with UMP. - * // SDK Initialization - * let loginParameters = new LoginParameters() - * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' - * loginParameters.metadataPath = '../assets/metadata.json' - * let loginResult: LoginResult - * try { - * loginResult = await this.unviredSDK.login(loginParameters) - * } - * catch (error) { - * this.unviredSDK.logError("AppComponent", "Initialize", "Error during login: " + error) - * } - * - * - * switch (loginResult.type) { - * case LoginListenerType.auth_activation_required: - * // App is not activated. i.e, User is using the app for the very first time. - * // App needs to be activated before it can interact with UMP. - * // At this point of time, you basically navigate to a login screen & accept username / password from the user. - * // Set the username & password to loginParameters object and call authenticateAndActivate - * try { - * // Execute this block of code in a login screen. - * let loginParameters = new LoginParameters(); - * loginParameters.url = ''; - * loginParameters.company = ''; - * loginParameters.username = ''; - * loginParameters.password = ''; - * loginParameters.loginType = LoginType.unvired; - * let authenticateActivateResult: AuthenticateActivateResult = await this.unviredSDK.authenticateAndActivate(loginParameters); - * if (authenticateActivateResult.type === AuthenticateAndActivateResultType.auth_activation_success) { - * // App is fully setup. Navigate to your app's home screen. - * } else if (authenticateActivateResult.type === AuthenticateAndActivateResultType.auth_activation_error) { - * console.log("Error during login: " + authenticateActivateResult.error) - * } catch (error) { - * this.unviredSDK.logError('LoginPage', 'auth_activation_required', 'ERROR: ' + error); - * } - * break; - * - * - * - * case LoginListenerType.app_requires_login: - * // App is already activated. But, the user needs to enter credentials because the setting LOCAL_PASSWORD is set to YES in Unvired Admin Cockpit. - * // To set LOCAL_PASSWORD property for your app, contact your administrator. - * try { - * // Execute this block of code in a login screen. - * let loginParameters = new LoginParameters() - * loginParameters.username = ''; - * loginParameters.password = ''; - * let authenticateLocalResult: AuthenticateLocalResult = await this.unviredSDK.authenticateLocal(loginParameters); - * if (authenticateLocalResult.type === AuthenticateLocalResultType.login_success) { - * // App is fully setup. Navigate to your app's home screen. - * } else if (authenticateLocalResult.type === AuthenticateLocalResultType.login_error) { - * console.log("Error during local login: " + authenticateActivateResult.error) - * } catch (error) { - * this.unviredSDK.logError('LoginPage', 'app_requires_login', 'ERROR: ' + error); - * } - * break; - * - * - * - * case login_success: - * // The setting LOCAL_PASSWORD is set to false. - * // App is fully initialized. Users can interact with the UMP - * // Navigate to Home screen - * break; - * } - * - * - * - * - * - * // Synchronization APIs - * // Example 1: Make a Sync RQST call - * ``` - * await this.unviredSDK.syncForeground(RequestType.RQST, {"CUSTOMER_HEADER": {"CUST_NO" : "007", "CUST_NAME" : "James Bond"}}, '', 'PA_GET_CUSTOMER_DETAILS', true) - * ``` - * - * // Example 2: Make a Sync QUERY / PULL call - * ``` - * await this.unviredSDK.syncForeground(RequestType.QUERY, '', {"CUSTOMER_SEARCH_CONTEXT":[{"CUSTOMER_SEARCH_HEADER":{"CUST_NO":"007"}}]}, 'PA_SEARCH_CUSTOMER', true) - * ``` - * - * Example 3: Make a Async RQST call - * ``` - * await this.unviredSDK.syncBackground(RequestType.RQST, {"CUSTOMER_HEADER": {"CUST_NO" : "007", "CUST_NAME" : "James Bond"}}, '', 'PA_GET_CUSTOMER_DETAILS', 'CUSTOMER', beLID, false) - * ``` - * - * Example 4: Make a Async QUERY / PULL call - * ``` - * await this.unviredSDK.syncBackground(RequestType.QUERY, '', {"CUSTOMER_SEARCH_CONTEXT":[{"CUSTOMER_SEARCH_HEADER":{"CUST_NO":"007"}}]}, 'PA_SEARCH_CUSTOMER', '', '', true) - * ``` - * - * // Note: Subscribe to NotificationListener to get updates on data processing in background - * // However, only one screen can listen to background data updates at any point of time. - * this.unviredSDK.registerNotifListener().subscribe( data => { - * switch (data.type) { - * case NotificationListenerType.dataSend: - * break; - * case NotificationListenerType.dataChanged: - * break; - * case NotificationListenerType.dataReceived: - * break; - * . - * . - * . - * }}) - * - * - * - * - * - * // Database APIs - * // Insert a record onto database - * this.unviredsdk.dbInsert("CUSTOMER_HEADER", {"NAME":"James Bond","CUST_NO":"007"}, true); - * - * // Update a record in database - * this.unviredSDK.dbUpdate('CUSTOMER_HEADER', {"NAME":"John Doe","CUST_NO":"008"}, "CUST_NO = '007'") - * - * // Delete a record in database - * this.unviredSDK.dbDelete('CUSTOMER_HEADER', "CUST_NO = '007'") - * - * // Execute a SQL Query - * this.unviredSDK.dbExecuteStatement('SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = "007"') - */ -@Plugin({ - pluginName: 'UnviredCordovaSDK', - plugin: 'cordova-plugin-unvired-sdk', // npm package name, example: cordova-plugin-camera - pluginRef: 'ump', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/unvired/cordova-plugin-unvired-sdk/', // the github repository URL for the plugin - install: 'ionic cordova plugin add @awesome-cordova-plugins/unvired-cordova-sdk', // OPTIONAL install command, in case the plugin requires variables - installVariables: [], // OPTIONAL the plugin requires variables - platforms: ['iOS', 'Android', 'Windows', 'Browser'], // Array of platforms supported, example: ['Android', 'iOS'] -}) -@Injectable() -export class UnviredCordovaSDK extends AwesomeCordovaNativePlugin { - loginParameters: LoginParameters; - - /** - * Write debug logs. - * - * @param sourceClass Name of the class - * @param method Name of the method - * @param message The actual message - * Example: - * ``` - * this.unviredSDK.logDebug("Class Name", "Method Name", "Log Message") - * ``` - * would produce the log message like this - * 01-07-2019 15:52 | DEBUG | Class Name | Method Name | Log Message - */ - @Cordova() - logDebug(sourceClass: string, method: string, message: string): Promise { - return; - } - - /** - * Write error logs. - * - * @param sourceClass Name of the class - * @param method Name of the method - * @param message The actual message - * Example: - * ``` - * this.unviredSDK.logError("Class Name", "Method Name", "Log Message") - * ``` - * would produce the log message like this - * 01-07-2019 15:52 | ERROR | Class Name | Method Name | Log Message - */ - @Cordova() - logError(sourceClass: string, method: string, message: string): Promise { - return; - } - - /** - * Write Info logs. - * - * @param sourceClass Name of the class - * @param method Name of the method - * @param message The actual message - * Example: - * ``` - * this.unviredSDK.logInfo("Class Name", "Method Name", "Log Message") - * ``` - * would produce the log message like this - * 01-07-2019 15:52 | IMPORTANT | Class Name | Method Name | Log Message - */ - @Cordova() - logInfo(sourceClass: string, method: string, message: string): Promise { - return; - } - - /** - * Returns the contents of the log file as a string. - */ - @Cordova() - logRead(): Promise { - return; - } - - /** - * Resets the log file. - */ - @Cordova() - logDelete(): Promise { - return; - } - - /** - * Sends log file to server. The log file can be viewed under Settings > Device & Data in UMP Admin Cockpit. - */ - @Cordova() - sendLogToServer(): Promise { - return; - } - - /** - * Send logs via email interface. Calling this function opens up the default email interface with the log file as an attachment. - */ - @Cordova() - sendLogViaEmail(): Promise { - return; - } - - /** - * Returns the current log level. - */ - @Cordova() - getLogLevel(): Promise { - return; - } - - /** - * Returns the path of the log file. - */ - @Cordova() - getLogFilePath(): Promise { - return; - } - - /** - * Set the log level of the app. - * - * @param logLevel The log level to set - */ - @Cordova() - setLogLevel(logLevel: LogLevel): Promise { - return; - } - - /** - * This api initializes the Unvired Application. - * - * @param loginParameters Set of parameters to be passed the login() - * For Example: - * ``` - * let loginParameters = new LoginParameters() - * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' - * loginParameters.metadataPath = '../assets/metadata.json' - * loginParameters.loginType = LoginType.unvired - * ``` - */ - @Cordova() - login(loginParameters: LoginParameters): Promise { - return; - } - - /** - * This api initializes the Unvired Application. - * - * @param loginParameters Set of parameters to be passed the loginWithDemoData() - * For Example: - * ``` - * let loginParameters = new LoginParameters() - * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' - * loginParameters.metadataPath = '../assets/metadata.json' - * loginParameters.loginType = LoginType.unvired - * loginParameters.demoData = "" - * ``` - */ - @Cordova() - loginWithDemoData(loginParameters: LoginParameters): Promise { - return; - } - - /** - * Logs out the last active user. - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * Authenticates ( With the Unvired Server ) & activates ( Receives Framework Settings ) the app against UMP - * Example: - * ``` - * let loginParameters = new LoginParameters() - * loginParameters.username = 'MY_USERNAME' - * loginParameters.password = 'MY_PASSWORD' - * await this.unviredSDK.authenticateAndActivate(loginParameters) - * ``` - * - * @param loginParameters LoginParamerter instance used to send username / password. - */ - @Cordova() - authenticateAndActivate(loginParameters: LoginParameters): Promise { - return; - } - - /** - * Authenticates the user against the previously saved username & password. - * For ADS Login, authentication is performed with the ADS Server. - * - * @param loginParameters Send username & Password through LoginParameters - * Example: - * ``` - * let loginParameters = new LoginParameters() - * loginParameters.username = 'MY_USERNAME' - * loginParameters.password = 'MY_PASSWORD' - * await this.unviredSDK.authenticateLocal(loginParameters) - */ - @Cordova() - authenticateLocal(loginParameters: LoginParameters): Promise { - return; - } - - /** - * Get all the accounts configured on the device. - */ - @Cordova() - getAllAccounts(): Promise { - return; - } - - /** - * Switch account - * - * @param account The account to switch to - */ - @Cordova() - switchAccount(account: any): Promise { - return; - } - - /** - * Delete account - * - * @param account The account to delete - */ - @Cordova() - deleteAccount(account: any): Promise { - return; - } - - /** - * Get all InfoMessages linked to the header. - * - * @param headerName Name of the header. Example: CUSTOMER_HEADER - * @param lid LID of the header. - */ - @Cordova() - getInfoMessages(headerName: string, lid: string): Promise { - return; - } - - /** - * Supported for mobile Platforms. - * Display framework settings. - */ - @Cordova() - showSettings(): Promise { - return; - } - - /** - * Get User settings. - * Returns User setting in the following format: - * ``` - * { - * "UNVIRED_ID": "", // The Unvired ID configured in UMP - * "USER_ID": "", // Deprecated. Select among UNVIRED_ID / EMAIL / ADS_USER_ID / SAP_USER_ID depending on the LoginType - * "FULL_NAME": "FirstName LastName", - * "EMAIL": "abc@example.com", // Email id of the user as configurd in UMP - * "SERVER_URL": "https://umpdev.unvired.io/UMP", // UMP Server's URL - * "SAP_USER_ID": "SAP_ID", // If LoginType is SAP - * "SAP_PORT_NAME": "", // If LoginType is SAP - * "LOGIN_TYPE": "", // @see LoginType - * "ADS_USER_ID": "ADS_USER_ID", // If LoginType is ADS - * "ADS_DOMAIN": "ADS_DOMAIN" // If LoginType is ADS - * } - * ``` - */ - @Cordova() - userSettings(): Promise { - return; - } - - /** - * Update System Credential - * - * @param credentials The credential to update to - */ - @Cordova() - updateSystemCredentials(credentials: any): Promise { - return; - } - - /** - * Get all system credentials. - */ - @Cordova() - getSystemCredentials(): Promise { - return; - } - - /** - * Get version number of unvired-cordova-sdk. - */ - @Cordova() - getVersionNumbers(): Promise { - return; - } - - /** - * Delete all data from the device. - */ - @Cordova() - clearData(): Promise { - return; - } - - /** - * Check whether the device has internet. - */ - @Cordova() - hasInternet(): Promise { - return; - } - - /** - * Get a random id to use as guid. - */ - @Cordova({ sync: true }) - guid(): string { - return; - } - - /** - * For Debugging Only. pull database file to "temp" folder for development purpose only. - */ - @Cordova() - pullDb(): Promise { - return; - } - - /** - * For Debugging Only. ush updated database file from "temp" folder to application directory for development purpose only - */ - @Cordova() - pushDb(): Promise { - return; - } - - /** - * Select records from Database - * - * @param tableName table name. Example: CUSTOMER_HEADER - * @param whereClause {Object} Browser: JSON object containing name-value pairs. - * Mobile: Or a Sqlite whereClause ( without the 'where' keyword ) - * Example: - * ``` - * # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * this.unviredSDK.dbSelect('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'") - * ``` - */ - @Cordova() - dbSelect(tableName: string, whereClause: any): Promise { - return; - } - - /** - * Insert record into database. - * In browser platform this function always inserts or updates based on GID. - * - * @param tableName Name of the table. - * @param structureObject - JSON object containing name-value pairs. - * @param isHeader {boolean} - is DataStructure a header or item? - * Example: - * ``` - * # Insert CUSTOMER_HEADER Datastructure into DB. - * this.unviredsdk.dbInsert("CUSTOMER_HEADER", {"NAME":"USER","NO":"0039"}, true); - * ``` - */ - @Cordova() - dbInsert(tableName: string, structureObject: any, isHeader: boolean): Promise { - return; - } - - /** - * insert or update the record ( if record exists ) into database. - * In browser insert always inserts or updates based on gid - * - * @param tableName Name of the table - * @param structureObject - JSON object containing name-value pairs. - * @param isHeader {boolean} - is DataStructure a header or item? - * Example: - * ``` - * # Insert or update a CUSTOMER_HEADER with NAME as USER and NO as '0039' - * this.unviredsdk.dbInsertOrUpdate("CUSTOMER_HEADER",{"NAME":"UPDATED_USER","UPDATED_NO":"0039"},true); - * ``` - */ - @Cordova() - dbInsertOrUpdate(tableName: string, structureObject: any, isHeader: boolean): Promise { - return; - } - - /** - * Delete records from the database. - * - * @param tableName Name of the table - * @param whereClause {Object} Browser: JSON object containing name-value pairs. - * Mobile: Or a Sqlite whereClause ( without the 'where' keyword ) - * Example: - * ``` - * # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * this.unviredSDK.dbDelete('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'") - * ``` - */ - @Cordova() - dbDelete(tableName: string, whereClause: any): Promise { - return; - } - - /** - * Update records in database. - * - * @param tableName Name of the table - * @param updatedObject JSON object containing updated name-value pairs. - * @param whereClause {Object} Browser: JSON object containing name-value pairs. - * Mobile: Or a Sqlite where Clause ( without the 'where' keyword ) - * Example: - * ``` - * # Update NAME & NO from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"UPDATED_USER","UPDATED_NO":"0039"}, "FORM_ID = '5caed815892215034dacad56'") - * ``` - */ - @Cordova() - dbUpdate(tableName: string, updatedObject: any, whereClause: any): Promise { - return; - } - - /** - * Execute a SQL statement - * - * @param query {string} SQL Statement. - * Example: - * ``` - * this.unviredSDK.dbExecuteStatement("SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = '39'") - * ``` - */ - @Cordova() - dbExecuteStatement(query: string): Promise { - return; - } - - /** - * Create Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) - * - * @param savePoint {string} Name of savepoint - * Example: - * ``` - * this.unviredSDK.dbCreateSavePoint('MySavePointName') - * ``` - */ - @Cordova() - dbCreateSavePoint(savePoint: string): Promise { - return; - } - - /** - * Release Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) - * - * @param savePoint {string} Name of savepoint - * ``` - * this.unviredSDK.dbReleaseSavePoint('MySavePointName') - * ``` - */ - @Cordova() - dbReleaseSavePoint(savePoint: string): Promise { - return; - } - - /** - * Rollback Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) - * - * @param savePoint {string} Name of the savepoint - * Example: - * ``` - * this.unviredSDK.dbRollbackToSavePoint('MySavePointName') - * ``` - */ - @Cordova() - dbRollbackToSavePoint(savePoint: string): Promise { - return; - } - - /** - * Begin database transaction. - * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) - * Example: - * ``` - * this.unviredSDK.dbBeginTransaction() - * ``` - */ - @Cordova() - dbBeginTransaction(): Promise { - return; - } - - /** - * End database transaction. - * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) - * Example: - * ``` - * this.unviredSDK.dbEndTransaction() - * ``` - */ - @Cordova() - dbEndTransaction(): Promise { - return; - } - - /** - * Browser platform only. Call this function to save the WebData. This function can be used to preserve a large data that is downloaded. - * If you set the loginParameter flag, |cacheWebData|, then the plugin loads this data. - */ - @Cordova() - dbSaveWebData(): Promise { - return; - } - - /** - * Browser platform only. Call this function to export the Webdata. - * Call this function to export the Web - */ - @Cordova() - dbExportWebData(): Promise { - return; - } - - /** - * Supported in Android & Windows only. - * Launch a file from a file path - * - * @param filePath file path - */ - @Cordova() - launchFile(filePath: string): Promise { - return; - } - - /** - * Supported in Android & Windows only. - * Write Base64 string to a file and launch. - * - * @param base64string - * @param fileName - * @param extension - */ - @Cordova() - launchBase64(base64string: string, fileName: string, extension: string): Promise { - return; - } - - /** - * Supported in Windows Only - * Unzip file. - * - * @param srcPath - * @param destPath - */ - @Cordova() - unzip(srcPath: string, destPath: string) { - return; - } - - /** - * Get the path for the folder where attachments are stored. - * Apps can combine this with the attachment filename to construct absolute path to an attachment file. - */ - @Cordova() - getAttachmentFolderPath(): Promise { - return; - } - - /** - * Saves attachment item in database and prepares it for uploading to server. This api is required to associate attachment file to a Business Entity. - * This api copies the attachment file to a new path, links the attachment with the header in database. - * To send the attachment item, just send the header using either syncForeground / syncBackground api and sdk will upload all the linked attachments. - * - * @param tableName Table name of attachment item structure. This usually ends with _ATTACHMENT. - * @param structureObject {Object} attachment item as a JSON object. Please check the example below. - * Example: - * ``` - * // Steps to upload attachment. - * // 1. Store the file to be attached in device's path. - * // 2. Create an attachment item to send this file. - * var attachmentObject = new INSPECTION_ATTACHMENT() - * attachmentObject.LID = guid(); // Random id - * attachmentObject.FID = lid // LID of the header. - * attachmentObject.UID = guid(); // Random id - * attachmentObject.EXTERNAL_URL = ""; // Optional: Check with your Unvired Process Agent developer. - * attachmentObject.FILE_NAME = 'myfile.jpg'; // Name of the file as stored in the device. - * attachmentObject.LOCAL_PATH = //myfile.jpg // File path. Please make sure that the path starts with a '/' - * attachmentObject.TAG1 = '' // Optional: Check with your Unvired Process Agent developer. - * attachmentObject.TAG2 = '' // Optional: Check with your Unvired Process Agent developer. - * attachmentObject.TAG2 = '' // Optional: Check with your Unvired Process Agent developer. - * attachmentObject.TAG4 = '' // Optional: Check with your Unvired Process Agent developer. - * attachmentObject.TAG5 = '' // Optional: Check with your Unvired Process Agent developer. - * await this.unviredCordovaSDK.createAttachmentItem('INSPECTION_ATTACHMENT', attachmentObject) - * ``` - */ - @Cordova() - createAttachmentItem(tableName: string, structureObject: any): Promise { - return; - } - - /** - * Upload attachment item to server. - * - * @param tableName Table name of attachment item. - * @param structureObject JSON object containing name-value pairs. - * @param isAsync Flag which indicates whether the upload should happen in async. - */ - @Cordova() - uploadAttachment(tableName: string, structureObject: any, isAsync: boolean): Promise { - return; - } - - /** - * Download attachment from server. - * - * @param tableName Table name of attachment item. - * @param structureObject JSON object containing name-value pairs. - */ - @Cordova() - downloadAttachment(tableName: string, structureObject: any): Promise { - return; - } - - /** - * Sends data to UMP in Sync mode. This means user has to wait until the duration of SYNC call. Only one SYNC call can be active at any point of time. Once the call completes, the result would be available in the Promise. - * Apps typically block UI during a SYNC call so that there are no user-actions possible until the call completes. - * - * Example 1: Make a RQST call - * ``` - * await this.unviredSDK.syncForeground(RequestType.RQST, {"CUSTOMER_HEADER": {"CUST_NO" : "007", "CUST_NAME" : "James Bond"}}, '', 'PA_GET_CUSTOMER_DETAILS', true) - * ``` - * - * Example 2: Make a QUERY / PULL call - * ``` - * await this.unviredSDK.syncForeground(RequestType.QUERY, '', {"CUSTOMER_SEARCH_CONTEXT":[{"CUSTOMER_SEARCH_HEADER":{"CUST_NO":"007"}}]}, 'PA_SEARCH_CUSTOMER', true) - * ``` - * - * @param reqype RequestType for the message. Please check RequestType to select the right request type. - * @param header {Object} Send a value for this parameter only if RequestType is RQST. For others, send an empty string. This parameter represents the header datastructure of the Business Entity which needs to be sent as input to a Process Agent function. - * Before you make this call, ensure that the object statuses are updated for header and child tables. - * Framework builds the input by considering only those child entities whose object status is one among ADD, MODIFY or DELETE. - * Example: - * ```json - * { - * "NAME_OF_HEADER": { - * "FIELD1": "FIELD_1_VALUE", - * "FIELD2": "FIELD_2_VALUE" - * } - * } - * ``` - * @param customData {Object} Send a value for this parameter only if |reqType| is QUERY or PULL. For others, send an empty string. - * This parameter represents the actual input which need to be sent to the server. Usually this is an input entity, but check with your Process Agent developer on the type of input. - * - * Example: - * ```json - * { - * "BE_NAME": [ - * { - * "NAME_OF_HEADER": { - * "FIELD1": "FIELD_1_VALUE", - * "FIELD2": "FIELD_2_VALUE" - * } - * } - * ] - * } - * ``` - * @param paFunction Name of the Process Agent function to be executed. Example: PA_MOBILE_EXECUTE_SALES_ORDER. - * @param autoSave This defines whether to save the response to database. - */ - @Cordova() - syncForeground( - reqype: RequestType, - header: any, - customData: any, - paFunction: string, - autoSave: boolean - ): Promise { - return; - } - - /** - * Make an async call to UMP. - * The result of the call would be notified through the observable returned for the function registerNotifListener(). - * - * Pre-requisites: - * 1. Object status is updated for header and items which need to be synced with the server. - * 2. Updated header and items are saved in database. - * 3. The LID of the header. This value needs to be passed for the parameter `belid`. - * - * Example 1: Make a RQST call - * ``` - * let customerHeader = new CUSTOMER_HEADER() - * customerHeader.LID = // TODO - * customerHeader.CUST_NO = '007' - * customerHeader.CUST_NAME = 'James Bond' - * - * await this.unviredSDK.syncBackground(RequestType.RQST, {"CUSTOMER_HEADER": customerHeader}, '', 'PA_GET_CUSTOMER_DETAILS', 'CUSTOMER', customerHeader.LID, false) - * ``` - * Example 2: Make a QUERY / PULL call - * ``` - * await this.unviredSDK.syncBackground(RequestType.QUERY, '', {"CUSTOMER_SEARCH_CONTEXT":[{"CUSTOMER_SEARCH_HEADER":{"CUST_NO":"007"}}]}, 'PA_SEARCH_CUSTOMER', '', '', true) - * ``` - * - * @param reqype RequestType for the message. Please check RequestType to select the right request type. - * @param header {Object} Send a value for this parameter only if RequestType is RQST. For others, send an empty string. This parameter represents the header datastructure of the Business Entity which needs to be sent as input to a Process Agent function. - * Before you make this call, ensure that the object statuses are updated for header and child tables. - * Framework builds the input by considering only those child entities whose object status is one among ADD, MODIFY or DELETE. - * Example: - * ```json - * { - * "NAME_OF_HEADER": { - * "FIELD1": "FIELD_1_VALUE", - * "FIELD2": "FIELD_2_VALUE" - * } - * } - * ``` - * @param customData {Object} Send a value for this parameter only if |reqType| is QUERY or PULL. For others, send an empty string. - * This parameter represents the actual input which need to be sent to the server. Usually this is an input entity, but check with your Process Agent developer on the type of input. - * - * Example: - * ```json - * { - * "BE_NAME": [ - * { - * "NAME_OF_HEADER": { - * "FIELD1": "FIELD_1_VALUE", - * "FIELD2": "FIELD_2_VALUE" - * } - * } - * ] - * } - * ``` - * @param paFunction Name of the Process Agent function to be executed. Example: PA_MOBILE_EXECUTE_SALES_ORDER. - * @param beName Name of the Business Entity. Required for the RequestType RQST only. For others, send empty string. - * @param belid LID of the Header datastructure. Required for the RequestType RQST only. For others, send empty string. - * @param bypassAttachment a true value would upload the data to the server followed by attachments. A false value would do the reverse. - */ - @Cordova() - syncBackground( - reqype: RequestType, - header: any, - customData: any, - paFunction: string, - beName: string, - belid: string, - bypassAttachment: boolean - ): Promise { - return; - } - - /** - * Returns an observable containing the state of the synchronisation along with count (if applicable). Possible values are as follows: - * 1. Sending (count) // Ex: sending(3), there are 3 items in outbox and device is online. i.e datasender thread running - * 2. Receiving // There are items to be received from server & device is online - * 3. Processing (count) // Ex: processing (5), there are 5 items in inbox and they are being processed. - * 4. Waiting to connect // The device is offline & there are items in outbox - * 5. Idle // there is no synchronisation activity going on. - */ - @Cordova({ - observable: true, - }) - getSynchronizationState(): Observable { - return; - } - - /** - * For Browser platform only. - * Reinitialize web db. Use this api to initialize db from persisted local storage db - */ - @Cordova() - dbReload() { - return; - } - - /** - * For Browser platform only. - * Generate Unvired BusinessEntity json from header and items - * - * @param headerName Header Table Name - * @param header Header Datastructure object - * @param itemName Item Table Name - * @param items Array of Item Structures. - */ - @Cordova() - generateUBJson(headerName: string, header: any, itemName: string, items: any) { - return; - } - - /** - * For Browser platform only. - * parseRawUBJson - Parse response json returned from syncForeground api. - * - * @param json JSON string - */ - @Cordova() - parseRawUBJson(json: string) { - return; - } - - /** - * For Browser platform only. - * Returns a collection of all entities which belong to |tableName| - * - * @param tableName Name of the table Exanple: CUSTOMER_HEADER - */ - @Cordova() - dbGetCollection(tableName: string) { - return; - } - - /** - * Make a GetMessage call. - * A GetMessage call is a network request to download all ready messages for the user. - * To keep track of returned data, you would need to register a notification listener (registerNotifListener()) & subscribe to the observable. - */ - @Cordova() - getMessages() { - return; - } - - /** - * Subscribe to this observable to listen for life-cyle events in the case of an async message. - * Only one class can subscribe to notifications at any point of time. - */ - @Cordova({ - observable: true, - }) - registerNotifListener(): Observable { - return; - } - - /** - * Supported in mobile only - * Check whether a Header datastructure is in outbox. - * - * @param beLid LID of the Header datastructure. - */ - @Cordova() - isInOutBox(beLid: string): Promise { - return; - } - - /** - * Supported in mobile only - * Returns the count of outbox items. - */ - @Cordova() - outBoxItemCount(): Promise { - return; - } - - /** - * Supported in mobile only - * Checks whether a Header datastructure is in sent and is waiting for response. - * Typically you would use before allowing the user to update the Header datastructure. - * - * @param beLid LID of the Business Entity - */ - @Cordova() - isInSentItem(beLid: string): Promise { - return; - } - - /** - * Supported in mobile only - * Returns the count of sent items. - */ - @Cordova() - sentItemCount(): Promise { - return; - } - - /** - * Supported in mobile only - * Returns the count of Inbox items. - */ - @Cordova() - inBoxItemCount(): Promise { - return; - } - - /** - * Supported in mobile only - * Delete outbox entry for a Header datastructure. - * - * @param beLid LID of the Business Entity - */ - @Cordova() - deleteOutBoxEntry(beLid: string): Promise { - return; - } - - /** - * Resets sync data with the application such as outbox, inbox & sent item entries. - * You may want to call this function before switching account. - */ - @Cordova() - resetApplicationSyncData(): Promise { - return; - } - - /** - * For Browser platform only - * Helps in updating application database without reauthenticating with server which requires to drop both app and framework database. - */ - @Cordova() - reCreateAppDB(): Promise { - return; - } - - /** - * For Mobile platform only - * Starts Inbox handler if there are items in inbox. - */ - @Cordova() - startInboxHandler(): Promise { - return; - } - - /** - * For Mobile platform only - * Starts DataSender if there are items in outbox. - */ - @Cordova() - startDataSender(): Promise { - return; - } - - /** - * Returns platform name - * Ex: ios, android, windows, browser - */ - @Cordova() - platform(): Promise { - return; - } - - /** - * Mobile Platform only. - * Test whether push notifications can be received on the device - */ - @Cordova() - testPushNotification(): Promise { - return; - } - - /** - * Mobile Platform only. - * Lock sending of data for this BE. - * - * @param beLid LID of the Business Entity - */ - @Cordova() - lockDataSender(beLid: string): Promise { - return; - } - - /** - * Mobile Platform only. - * Release any locks applied for sending data (DataSender Thread) to the server. - */ - @Cordova() - unlockDataSender(): Promise { - return; - } - - /** - * Mobile Platform only. - * Delete an outbox item based on header's lid. - * - * @param lid - */ - @Cordova() - removeOutObjectBasedOnLid(lid: string): Promise { - return; - } - - /** - * Returns a promise containing UMP servers which are discoverable within the network. - * Clients can use this information to allow users to select appropriate UMP server in the login page. - * ``` - * let discoveryServiceResult = await this.unviredSDK.startDiscoveryService() - * if (discoveryServiceResult.type == ResultType.success) { - * let UMPServers: any[] = discoveryServiceResult.data - * UMPServers.forEach(element => { - * console.log(JSON.stringify(element)) // {"name":"Chyme 98","url":"http://192.168.98.98:8080/UMP/","root":"UNVIRED","type":"DEVELOPMENT"} - * }); - * } - * else { - * console.log('Error searching for UMP Servers: ' + discoveryServiceResult.error) - * } - * ``` - */ - @Cordova() - startDiscoveryService(): Promise { - return; - } - - /** - * Use this function to set the SAP credentials to be sent to UMP. - * - * @param credentials Array of |Credential| objects. - */ - @Cordova() - setClientCredentials(credentials: UnviredCredential[]) { - return; - } - - /** - * Check for client credentials. - * - * @returns Returns true if client credentials are set - */ - @Cordova() - isClientCredentialsSet(): Promise { - return; - } - - /** - * Encrypt a string with the key stored by the Unvired SDK. - * - * @param stringToBeEncrypted - * @returns UnviredResult.data which should contains the encrypted string. - */ - @Cordova() - encrypt(stringToBeEncrypted: string): Promise { - return; - } - - /** - * Decrypt a string with the string encrypted with the key (key stored by the Unvired SDK) - * - * @param stringToBeDecrypted - * @returns UnviredResult.data which should contains the decrypted string. - */ - @Cordova() - decrypt(stringToBeDecrypted: string): Promise { - return; - } - - /** - * Supported in browser platform only. - * You can make use of this api in order to receive push notifications. No input required. - * Upon succesful registration you will get a |evtSource| object on which various events are received. - * Usage: - * ``` - * this.unviredSDK.registerForPushNotification((evtSource) => { - * evtSource.onopen = function(event) { - * console.log(" onopen registerForPushNotification ==========") - * }; - * evtSource.onerror = function(err) { - * console.log(" onerror registerForPushNotification ==========") - * }; - * evtSource.onmessage = function(event) { - * console.log(" onmessage registerForPushNotification ==========") - * } - * }, - * (error) => { - * console.log(" error registerForPushNotification ==========") - * console.log(error) - * }); - * ``` - */ - @Cordova() - registerForPushNotification(): Promise { - return; - } - - /** - * Regenerates the JWT token used for communicating with the UMP server. - * The updated token will be available via the registered NotificationListener's callback |JWTTokenReceived| - */ - @Cordova() - refreshJWTToken(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/uptime/index.ts b/src/@awesome-cordova-plugins/plugins/uptime/index.ts deleted file mode 100644 index 38e685d3..00000000 --- a/src/@awesome-cordova-plugins/plugins/uptime/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Uptime - * @description - * This plugin provides the time spent in milliseconds since boot (uptime). - * @usage - * ```typescript - * import { Uptime } from '@awesome-cordova-plugins/uptime/ngx'; - * - * constructor(private uptime: Uptime) { } - * - * ... - * - * this.uptime.getUptime(includeDeepSleep) - * .then(uptime => console.log(uptime)) - * .catch(error => console.log(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'Uptime', - plugin: 'cordova-plugin-uptime', - pluginRef: 'Uptime', - repo: 'https://github.com/s1lviu/cordova-plugin-uptime', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Uptime extends AwesomeCordovaNativePlugin { - /** - * This function return system uptime - * - * @param {boolean} includeDeepSleep Set to true to include system deep sleep - * @returns {Promise} Returns a promise that return the uptime in milliseconds - */ - @Cordova() - getUptime(includeDeepSleep: boolean): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/urbanairship/index.ts b/src/@awesome-cordova-plugins/plugins/urbanairship/index.ts deleted file mode 100644 index c268d395..00000000 --- a/src/@awesome-cordova-plugins/plugins/urbanairship/index.ts +++ /dev/null @@ -1,1184 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -/** - * Interface for UAirship Tag Editor - */ -export interface TagGroupEditor { - addTags(tagGroup: string, tags: string[]): TagGroupEditor; - removeTags(tagGroup: string, tags: string[]): TagGroupEditor; - apply(success: () => void, failure: (message: string) => void): TagGroupEditor; -} - -/** - * Interface for UAirship Attributes Editor - */ -export interface AttributesEditor { - setAttribute(name: string, value: string | number | boolean | Date): AttributesEditor; - removeAttribute(name: string): AttributesEditor; - apply(success: () => void, failure: (message: string) => void): AttributesEditor; -} - -/** - * Interface for UAirship ChannelSubscriptionList Editor - */ -export interface ChannelSubscriptionListEditor { - subscribe(subscriptionListID: string): ChannelSubscriptionListEditor; - unsubscribe(subscriptionListID: string): ChannelSubscriptionListEditor; - apply(success: () => void, failure: (message: string) => void): ChannelSubscriptionListEditor; -} - -export type ContactSubscriptionScope = 'app' | 'email' | 'push' | 'sms'; - -/** - * Interface for UAirship ContactSubscriptionList Editor - */ -export interface ContactSubscriptionListEditor { - subscribe(subscriptionListID: string, contactScope: ContactSubscriptionScope): ContactSubscriptionListEditor; - unsubscribe(subscriptionListID: string, contactScope: ContactSubscriptionScope): ContactSubscriptionListEditor; - apply(success: () => void, failure: (message: string) => void): ContactSubscriptionListEditor; -} - -/** - * Enum for notification types. - * - * @readonly - * @enum {number} - */ -export enum NotificationType { - none = 0, - badge = 1, - sound = 2, - alert = 4, -} - -/** - * Enum for presentation options. - * - * @readonly - * @enum {number} - */ -export enum PresentationOptions { - none = 0, - badge = 1, - sound = 2, - alert = 4, -} - -/** - * @name UrbanAirShip - * @description - * This plugin does something - * @usage - * ```typescript - * import { UrbanAirShip } from '@awesome-cordova-plugins/urbanairship/ngx'; - * - * - * constructor(private urbanAirShip: UrbanAirShip) { } - * - * ... - * - * - * this.urbanAirShip.takeOff(config) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'UrbanAirShip', - plugin: 'urbanairship-cordova', - pluginRef: 'window.UAirship', - repo: 'https://www.npmjs.com/package/urbanairship-cordova', - install: 'ionic cordova plugin add urbanairship-cordova', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class UrbanAirShip extends AwesomeCordovaNativePlugin { - /** - * Event fired when a new deep link is received. - * - * @event deep_link - * @type {object} - * @param {string} [deepLink] The deep link. - */ - @Cordova({ - eventObservable: true, - event: 'urbanairship.deep_link', - element: 'document', - }) - onDeepLink(): Observable { - return; - } - - /** - * Event fired when a channel registration occurs. - * - * @event registration - * @type {object} - * @param {string} [channelID] The channel ID. - * @param {string} [registrationToken] The deviceToken on iOS, and the FCM/ADM token on Android. - * @param {string} [error] Error message if an error occurred. - */ - @Cordova({ - eventObservable: true, - event: 'urbanairship.registration', - element: 'document', - }) - onRegistration(): Observable { - return; - } - - /** - * Event fired when the inbox is updated. - * - * @event inbox_updated - */ - @Cordova({ - eventObservable: true, - event: 'urbanairship.inbox_updated', - element: 'document', - }) - onInboxUpdated(): Observable { - return; - } - - /** - * Event fired when the inbox needs to be displayed. This event is only emitted if auto - * launch message center is disabled. - * - * @event show_inbox - * @type {object} - * @param {string} [messageId] The optional message ID. - */ - @Cordova({ - eventObservable: true, - event: 'urbanairship.show_inbox', - element: 'document', - }) - onShowInbox(): Observable { - return; - } - - /** - * Event fired when a push is received. - * - * @event push - * @type {object} - * @param {string} message The push alert message. - * @param {string} title The push title. - * @param {string} subtitle The push subtitle. - * @param {object} extras Any push extras. - * @param {object} aps The raw aps dictionary (iOS only) - * @param {number} [notification_id] The Android notification ID. Deprecated in favor of notificationId. - * @param {string} [notificationId] The notification ID. - */ - @Cordova({ - eventObservable: true, - event: 'urbanairship.push', - element: 'document', - }) - onPushReceived(): Observable { - return; - } - - /** - * Event fired when notification opened. - * - * @event notification_opened - * @type {object} - * @param {string} message The push alert message. - * @param {object} extras Any push extras. - * @param {number} [notification_id] The Android notification ID. Deprecated in favor of notificationId. - * @param {string} [notificationId] The notification ID. - * @param {string} [actionID] The ID of the notification action button if available. - * @param {boolean} isForeground Will always be true if the user taps the main notification. Otherwise its defined by the notification action button. - */ - @Cordova({ - eventObservable: true, - event: 'urbanairship.notification_opened', - element: 'document', - }) - onNotificationOpened(): Observable { - return; - } - - /** - * Event fired when the user notification opt-in status changes. - * - * @event notification_opt_in_status - * @type {object} - * @param {boolean} optIn If the user is opted in or not to user notifications. - * @param {object} [authorizedNotificationSettings] iOS only. A map of authorized settings. - * @param {boolean} authorizedNotificationSettings.alert If alerts are authorized. - * @param {boolean} authorizedNotificationSettings.sound If sounds are authorized. - * @param {boolean} authorizedNotificationSettings.badge If badges are authorized. - * @param {boolean} authorizedNotificationSettings.carPlay If car play is authorized. - * @param {boolean} authorizedNotificationSettings.lockScreen If the lock screen is authorized. - * @param {boolean} authorizedNotificationSettings.notificationCenter If the notification center is authorized. - */ - @Cordova({ - eventObservable: true, - event: 'urbanairship.notification_opt_in_status', - element: 'document', - }) - onNotificationOptInStatus(): Observable { - return; - } - - /** - * Re-attaches document event listeners in this webview - */ - @Cordova({ - sync: true, - }) - reattach(): void { - return; - } - - /** - * Initailizes Urban Airship. - * - * The plugin will automatically call takeOff during the next app init in - * order to properly handle incoming push. If takeOff is called multiple times - * in a session, or if the config is different than the previous sesssion, the - * new config will not be used until the next app start. - * - * @param {object} config The Urban Airship config. - * @param {string} config.site Sets the cloud site, must be either EU or US. - * @param {object} config.development The Urban Airship development config. - * @param {string} config.development.appKey The development appKey. - * @param {string} config.development.appSecret The development appSecret. - * @param {object} config.production The Urban Airship production config. - * @param {string} config.production.appKey The production appKey. - * @param {string} config.production.appSecret The production appSecret. - */ - @Cordova() - takeOff(config: any): Promise { - return; - } - - /** - * Sets the Android notification config. Values not set will fallback to any values set in the config.xml. - * - * @param {object} config The notification config. - * @param {string} [config.icon] The name of the drawable resource to use as the notification icon. - * @param {string} [config.largeIcon] The name of the drawable resource to use as the notification large icon. - * @param {string} [config.accentColor] The notification accent color. Format is #AARRGGBB. - */ - @Cordova() - setAndroidNotificationConfig(config: any): Promise { - return; - } - - /** - * Sets the default behavior when the message center is launched from a push - * notification. If set to false the message center must be manually launched. - * - * @param {boolean} enabled true to automatically launch the default message center, false to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setAutoLaunchDefaultMessageCenter(enabled: boolean): Promise { - return; - } - - /** - * Enables or disables user notifications. - * - * @param {boolean} enabled true to enable notifications, false to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setUserNotificationsEnabled(enabled: boolean): Promise { - return; - } - - /** - * Checks if user notifications are enabled or not. - * - * @param {function(enabled)} success Success callback. - * @param {boolean} success.enabled Flag indicating if user notifications is enabled or not. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - isUserNotificationsEnabled(): Promise { - return; - } - - /** - * Checks if app notifications are enabled or not. Its possible to have `userNotificationsEnabled` - * but app notifications being disabled if the user opted out of notifications. - * - * @param {function(enabled)} success Success callback. - * @param {boolean} success.enabled Flag indicating if app notifications is enabled or not. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - isAppNotificationsEnabled(): Promise { - return; - } - - /** - * Returns the channel ID. - * - * @param {function(ID)} success The function to call on success. - * @param {string} success.ID The channel ID string - * @param {failureCallback} [failure] The function to call on failure. - * @param {string} failure.message The error message. - */ - @Cordova() - getChannelID(): Promise { - return; - } - - /** - * Returns the last notification that launched the application. - * - * @param {boolean} clear true to clear the notification. - * @param {function(push)} success The function to call on success. - * @param {object} success.push The push message object containing data associated with a push notification. - * @param {string} success.push.message The push alert message. - * @param {object} success.push.extras Any push extras. - * @param {number} [success.push.notification_id] The Android notification ID. - * @param {failureCallback} [failure] The function to call on failure. - * @param {string} failure.message The error message. - */ - @Cordova() - getLaunchNotification(clear: boolean): Promise { - return; - } - - /** - * Returns the last received deep link. - * - * @param {boolean} clear true to clear the deep link. - * @param {function(push)} success The function to call on success. - * @param {string} success.deepLink The deep link. - * @param {failureCallback} [failure] The function to call on failure. - * @param {string} failure.message The error message. - */ - @Cordova() - getDeepLink(clear: boolean): Promise { - return; - } - - /** - * Returns the tags as an array. - * - * @param {function(tags)} success The function to call on success. - * @param {Array} success.tags The tags as an array. - * @param {failureCallback} [failure] The function to call on failure. - * @param {string} failure.message The error message. - */ - @Cordova() - getTags(): Promise { - return; - } - - /** - * Sets the tags. - * - * @param {Array} tags an array of strings. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setTags(tags: string[]): Promise { - return; - } - - /** - * Returns the alias. - * - * @deprecated Deprecated since 6.7.0 - to be removed in a future version of the plugin - please use getNamedUser - * @param {function(currentAlias)} success The function to call on success. - * @param {string} success.currentAlias The alias as a string. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - getAlias(): Promise { - return; - } - - /** - * Sets the alias. - * - * @deprecated Deprecated since 6.7.0 - to be removed in a future version of the plugin - please use setNamedUser - * @param {string} alias string - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setAlias(alias: string): Promise { - return; - } - - /** - * Checks if quiet time is enabled or not. - * - * @param {function(enabled)} success Success callback. - * @param {boolean} success.enabled Flag indicating if quiet time is enabled or not. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - isQuietTimeEnabled(): Promise { - return; - } - - /** - * Enables or disables quiet time. - * - * @param {boolean} enabled true to enable quiet time, false to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setQuietTimeEnabled(enabled: boolean): Promise { - return; - } - - /** - * Checks if the device is currently in quiet time. - * - * @param {function(inQuietTime)} success Success callback. - * @param {boolean} success.inQuietTime Flag indicating if quiet time is currently in effect. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - isInQuietTime(): Promise { - return; - } - - /** - * Returns the quiet time as an object with the following: - * "startHour": Number, - * "startMinute": Number, - * "endHour": Number, - * "endMinute": Number - * - * @param {function(quietTime)} success The function to call on success. - * @param {object} success.quietTime The quietTime object represents a timespan during - * which notifications should be silenced. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - getQuietTime(): Promise { - return; - } - - /** - * Sets the quiet time. - * - * @param {number} startHour for quiet time. - * @param {number} startMinute for quiet time. - * @param {number} endHour for quiet time. - * @param {number} endMinute for quiet time. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setQuietTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise { - return; - } - - /** - * Enables or disables analytics. - * - * Disabling analytics will delete any locally stored events - * and prevent any events from uploading. Features that depend on analytics being - * enabled may not work properly if it's disabled (reports, region triggers, - * location segmentation, push to local time). - * - * @param {boolean} enabled true to enable analytics, false to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setAnalyticsEnabled(enabled: boolean): Promise { - return; - } - - /** - * Checks if analytics is enabled or not. - * - * @param {function(enabled)} success Success callback. - * @param {boolean} success.enabled Flag indicating if analytics is enabled or not. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - isAnalyticsEnabled(): Promise { - return; - } - - /** - * Returns the named user ID. - * - * @param {function(namedUser)} success The function to call on success. - * @param {string} success.namedUser The named user ID as a string. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - getNamedUser(): Promise { - return; - } - - /** - * Sets the named user ID. - * - * @param {string} namedUser identifier string. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setNamedUser(namedUser: string): Promise { - return; - } - - /** - * Runs an Urban Airship action. - * - * @param {string} actionName action as a string. - * @param {*} actionValue - * @param {function(result)} [success] The function to call on success. - * @param {object} success.result The result's value. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - runAction(actionName: string, actionValue: any): Promise { - return; - } - - /** - * Creates an editor to modify the named user tag groups. - */ - @Cordova({ sync: true }) - editNamedUserTagGroups(): TagGroupEditor { - return; - } - - /** - * Creates an editor to modify the channel tag groups. - */ - @Cordova({ sync: true }) - editChannelTagGroups(): TagGroupEditor { - return; - } - - /** - * Creates an editor to modify the channel attributes. - */ - @Cordova({ sync: true }) - editChannelAttributes(): AttributesEditor { - return; - } - - /** - * Creates an editor to modify the named user attributes. - */ - @Cordova({ sync: true }) - editNamedUserAttributes(): AttributesEditor { - return; - } - - /** - * Creates an editor to modify the channel subscription lists. - * - * @returns {ChannelSubscriptionListEditor} A subscription list editor instance. - * @since 13.3.0 - */ - @Cordova({ sync: true }) - editChannelSubscriptionLists(): ChannelSubscriptionListEditor { - return; - } - - /** - * Creates an editor to modify the contact subscription lists. - * - * @returns {ContactSubscriptionListEditor} A subscription list editor instance. - * @since 13.3.0 - */ - @Cordova({ sync: true }) - editContactSubscriptionLists(): ContactSubscriptionListEditor { - return; - } - - /** - * Returns the current set of subscription lists for the current channel, - * optionally applying pending subscription list changes that will be applied during the next channel update. - * An empty set indicates that this contact is not subscribed to any lists. - * - * @param {Function} [success] Success callback. - * @param {string} failure.message The error message. - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - getChannelSubscriptionLists(): Promise { - return; - } - - /** - * Returns the current set of subscription lists for the current contact, - * optionally applying pending subscription list changes that will be applied during the next contact update. - * An empty set indicates that this contact is not subscribed to any lists. - * - * @param {Function} [success] Success callback. - * @param {string} failure.message The error message. - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - getContactSubscriptionLists(): Promise { - return; - } - - /** - * Sets an associated identifier for the Connect data stream. - * - * @param key Custom key for identifier. - * @param identifier The identifier value. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setAssociatedIdentifier(key: string, identifier: string): Promise { - return; - } - - // Location - - /** - * Enables or disables Urban Airship location services. - * - * @param {boolean} enabled true to enable location, false to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setLocationEnabled(enabled: boolean): Promise { - return; - } - - /** - * Checks if location is enabled or not. - * - * @param {function(enabled)} success Success callback. - * @param {boolean} success.enabled Flag indicating if location is enabled or not. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @deprecated removed in version 8.0 - */ - @Cordova() - isLocationEnabled(): Promise { - return; - } - - /** - * Enables or disables background location. - * - * @param {boolean} enabled true to enable background location, false to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @deprecated removed in version 8.0 - */ - @Cordova() - setBackgroundLocationEnabled(enabled: boolean): Promise { - return; - } - - /** - * Checks if background location is enabled or not. - * - * @param {function(enabled)} success Success callback. - * @param {boolean} success.enabled Flag indicating if background location updates are enabled or not. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @deprecated removed in version 8.0 - */ - @Cordova() - isBackgroundLocationEnabled(): Promise { - return; - } - - /** - * Displays the message center. - * - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - displayMessageCenter(): Promise { - return; - } - - /** - * Dismiss the message center. - * - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - dismissMessageCenter(): Promise { - return; - } - - /** - * Dismiss the inbox message. - * - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - dismissInboxMessage(): Promise { - return; - } - - /** - * Dismiss the inbox message in the overlay. - * - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @deprecated removed in version 10.0 - */ - @Cordova() - dismissOverlayInboxMessage(): Promise { - return; - } - - /** - * Gets the array of inbox messages. Each message will have the following properties: - * "id": string - The messages ID. Needed to display, mark as read, or delete the message. - * "title": string - The message title. - * "sentDate": number - The message sent date in milliseconds. - * "listIconUrl": string, optional - The icon url for the message. - * "isRead": boolean - The unread/read status of the message. - * "extras": object - String to String map of any message extras. - * - * @param {function(messages)} success The function to call on success. - * @param {Array} success.messages The array of inbox messages. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - getInboxMessages(): Promise { - return; - } - - /** - * Marks an inbox message read. - * - * @param {string} messageId The ID of the message to mark as read. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - markInboxMessageRead(messageId: string): Promise { - return; - } - - /** - * Deletes an inbox message. - * - * @param {string} messageId The ID of the message to delete. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - deleteInboxMessage(messageId: string): Promise { - return; - } - - /** - * Displays the inbox message using a full screen view. - * - * @param {string} messageId The ID of the message to display. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - displayInboxMessage(messageId: string): Promise { - return; - } - - /** - * Forces the inbox to refresh. This is normally not needed as the inbox - * will automatically refresh on foreground or when a push arrives thats - * associated with a message, but it can be useful when providing a refresh - * button for the message listing. - * - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - refreshInbox(): Promise { - return; - } - - /** - * Displays the inbox message using an overlay display. - * - * @param {string} messageId The ID of the message to display. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @deprecated removed in version 10.0 - */ - @Cordova() - overlayInboxMessage(messageId: string): Promise { - return; - } - - /** - * Clears a notification by identifier. - * - * @param {string} identifier The notification identifier. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - */ - @Cordova() - clearNotification(identifier: string): Promise { - return; - } - - /** - * Clears all notifications posted by the application. - * - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - clearNotifications(): Promise { - return; - } - - /** - * Gets currently active notifications. - * - * Note: On Android this functionality is only supported on Android M or higher. - * - * @param {function(messages)} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - */ - @Cordova() - getActiveNotifications(): Promise { - return; - } - - // iOS only - - /** - * Enables or disables auto badge. Defaults to `NO`. - * - * @param {boolean} enabled true to enable auto badge, false to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setAutobadgeEnabled(enabled: boolean): Promise { - return; - } - - /** - * Sets the badge number. - * - * @param count number specified badge to set. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setBadgeNumber(count: number): Promise { - return; - } - - /** - * Returns the current badge number. - * - * @param {function(badgeNumber)} success The function to call on success. - * @param {int} success.badgeNumber The current application badge number. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - getBadgeNumber(): Promise { - return; - } - - /** - * Clears the badge. - * - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - resetBadge(): Promise { - return; - } - - /** - * Sets the iOS notification types. Specify the combination of - * badges, sound and alerts that are desired. - * - * @param types specified notification types. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setNotificationTypes(types: NotificationType): Promise { - return; - } - - /** - * Sets the iOS presentation options. Specify the combination of - * badges, sound and alerts that are desired. - * - * @param options types specified presentation options. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setPresentationOptions(options: PresentationOptions): Promise { - return; - } - - // Android only - - /** - * Checks if notification sound is enabled or not. - * - * @param {function(enabled)} success Success callback. - * @param {boolean} success.enabled Flag indicating if sound is enabled or not. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - isSoundEnabled(): Promise { - return; - } - - /** - * Enables or disables notification sound. - * - * @param {boolean} enabled true to enable sound, false to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setSoundEnabled(enabled: boolean): Promise { - return; - } - - /** - * Checks if notification vibration is enabled or not. - * - * @param {function(enabled)} success Success callback. - * @param {boolean} success.enabled Flag indicating if vibration is enabled or not. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - isVibrateEnabled(): Promise { - return; - } - - /** - * Enables or disables notification vibration. - * - * @param {boolean} enabled true to enable vibration, false to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - setVibrateEnabled(enabled: boolean): Promise { - return; - } - - /** - * Adds a custom event. - * - * @param {object} event The custom event object. - * @param {string} event.name The event's name. - * @param {number} [event.value] The event's value. - * @param {string} [event.transactionId] The event's transaction ID. - * @param {object} [event.properties] The event's properties. Only numbers, booleans, strings, and array of strings are supported. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - */ - @Cordova() - addCustomEvent(event: object): Promise { - return; - } - - /** - * Initiates screen tracking for a specific app screen, must be called once per tracked screen. - * - * @param {string} screen The screen's string identifier. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @since 11.0.0 - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - trackScreen(screen: string): Promise { - return; - } - - /** - * Enables features, adding them to the set of currently enabled features. - * - * @param {Array} features The features to enable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @since 13.0.0 - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - enableFeature(features: string[]): Promise { - return; - } - - /** - * Disables features, removing them from the set of currently enabled features. - * - * @param {Array} features The features to disable. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @since 13.0.0 - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - disableFeature(features: string[]): Promise { - return; - } - - /** - * Sets the current enabled features, replacing any currently enabled features with the given set. - * - * @param {Array} features The features to set as enabled. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @since 13.0.0 - */ - setEnabledFeatures(features: string[]): Promise { - return; - } - - /** - * Gets the current enabled features. - * - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @since 13.0.0 - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - getEnabledFeatures(): Promise { - return; - } - - /** - * Checks if all of the given features are enabled. - * - * @param {Array} features The features to check. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @since 13.0.0 - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - isFeatureEnabled(features: string[]): Promise { - return; - } - - /** - * Returns the configuration of the Preference Center with the given ID trough a callback method. - * - * @param {string} preferenceCenterId The preference center ID. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @since 13.3.0 - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - getPreferenceCenterConfig(preferenceCenterId: string): Promise { - return; - } - - /** - * Opens the Preference Center with the given preferenceCenterId. - * - * @param {string} prenferenceCenterId The preference center ID. - * @param {Function} [success] Success callback. - * @param {function(message)} [failure] Failure callback. - * @param {string} failure.message The error message. - * @since 13.0.0 - */ - @Cordova({ - successIndex: 1, - errorIndex: 2, - }) - openPreferenceCenter(prenferenceCenterId: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/usabilla-cordova-sdk/index.ts b/src/@awesome-cordova-plugins/plugins/usabilla-cordova-sdk/index.ts deleted file mode 100644 index dc90337e..00000000 --- a/src/@awesome-cordova-plugins/plugins/usabilla-cordova-sdk/index.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; - -export interface UsabillaResult { - completed: boolean | string; -} - -export interface UbCampaignResult { - completed: { - result: UbResult; - isRedirectToAppStoreEnabled?: boolean; - }; -} - -export interface UbResult { - rating: number; - abandonedPageIndex: number; - sent: boolean; -} - -/** - * @name Usabilla - * @description - * Usabilla SDK is designed and developed to collect feedback from your users with great ease and flexibility through your mobile application. - * This document describes library integration steps for your Cordova project. - * - * For more info see [Cordova plugin docs](https://github.com/usabilla/usabilla-u4a-cordova) - * @usage - * ```typescript - * import { Usabilla } from '@awesome-cordova-plugins/usabilla-cordova-sdk/ngx'; - * - * - * constructor(private usabilla: Usabilla) { } - * - * ... - * - * - * this.usabilla.initialize( - * appID: '', - * custom_vars: { - * "key": "value" - * }); - * - * this.usabilla.loadFeedbackForm( - * formID : '' - * ); - * - * ``` - */ - -@Plugin({ - pluginName: 'usabilla-cordova', - plugin: 'usabilla-cordova', - pluginRef: 'Usabilla', - repo: 'https://github.com/usabilla/usabilla-u4a-cordova', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Usabilla extends AwesomeCordovaNativePlugin { - /** - * Initializes Usabilla sdk for capturing feedbacks. - * - * @name initialize - * @param {appId} APP_ID unique app id to initialize - * @param appId - * @param customVars - * @param {customVars} CUSTOM_VARIABLES for target based event trigger - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - initialize(appId: string, customVars: any): Promise { - return; - } - - /** - * Displays Feedback form based on unique form id after sdk initialization. - * - * @name loadFeedbackForm - * @param formId - * @param {formId} FORM_ID to display Feedback form for - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - loadFeedbackForm(formId: string): Promise { - return; - } - - /** - * Displays Feedback form with current screen's snapshot and based on unique form id, after sdk initialization. - * - * @name loadFeedbackFormWithCurrentViewScreenshot - * @param formId - * @param {formId} FORM_ID to display Feedback form for - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - loadFeedbackFormWithCurrentViewScreenshot(formId: string): Promise { - return; - } - - /** - * Displays Campaign banner targetted based on specific event and variables, after sdk initialization. - * - * @name sendEvent - * @param eventId - * @param {eventId} EVENT_ID to display Campaign banner for - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - sendEvent(eventId: string): Promise { - return; - } - - /** - * Reset Campaign for next trigger. - * - * @name resetCampaignData - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - resetCampaignData(): Promise { - return; - } - - /** - * Dismiss or removes the Form/Banner from the view. - * - * @name dismiss - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - dismiss(): Promise { - return; - } - - /** - * Get default masking strategy to be applied for data masking. - * - * @name getDefaultDataMasks - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - getDefaultDataMasks(): Promise { - return; - } - - /** - * Set masking strategy for data masking. - * - * @name setDataMasking - * @param {masks} Format regex to be applied for masking. - * @param masks - * @param maskCharacter - * @param {maskCharacter} Character to be used as a masking character - */ - @Cordova({ - successIndex: 0, - errorIndex: 1, - }) - setDataMasking(masks: any, maskCharacter: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/vibes/index.ts b/src/@awesome-cordova-plugins/plugins/vibes/index.ts deleted file mode 100644 index c8739e1d..00000000 --- a/src/@awesome-cordova-plugins/plugins/vibes/index.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface DeviceResponse { - device_id?: string; -} - -export interface DeviceInfoResponse extends DeviceResponse { - push_token?: string; -} - -export interface PersonResponse { - person_key?: string; - mdn?: string; - external_person_id?: string; -} - -export interface InboxMessage { - content?: string; - created_at?: string; - expires_at?: string; - message_uid?: string; - read?: boolean; - subject?: string; - detail?: string; - collapse_key?: string; - apprefdata?: any; - images?: any; - inbox_custom_data: any; -} -/** - * @name Vibes - * @description - * This plugin enables integration with the Vibes Push SDK to your Cordova project with Android and iOS supported. - * @usage - * ```typescript - * import { Vibes } from '@awesome-cordova-plugins/vibes/ngx'; - * - * - * constructor(private vibes: Vibes) { } - * - * ... - * - * - * this.vibes.registerDevice() - * .then((res: any) => console.log(`device registration success: ${res}`)) // retrieve and save the device_id from `res` JSON object - * .catch((error: any) => console.error('Error registering device', error)); - * - * this.vibes.registerPush() - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error('Error registering push', error)); - * - * this.vibes.getVibesDeviceInfo() - * .then((res: any) => console.log(res)) // retrieve the `device_id` and `push_token` from the JSON object - * .catch((error: any) => console.error('Error retrieving deviceinfo', error)); - * - * this.vibes.fetchInboxMessages() - * .then((res: any) => console.log(res)) // fetches inbox messages for this person. - * .catch((error: any) => console.error('Error fetching inbox messages for this person', error)); - * ``` - */ -@Plugin({ - pluginName: 'Vibes', - plugin: 'vibes-cordova', - pluginRef: 'Vibes', - repo: 'https://github.com/vibes/vibes-cordova.git', - install: - 'ionic cordova plugin add vibes-cordova --variable VIBES_APP_ID=MY_APP_ID --variable VIBES_API_URL=MY_ENVIRONMENT_URL', - installVariables: ['VIBES_APP_ID', 'VIBES_API_URL'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Vibes extends AwesomeCordovaNativePlugin { - /** - * Register this device with the Vibes platform - * - * @returns {Promise} - */ - @Cordova() - registerDevice(): Promise { - return; - } - - /** - * Unregister this device with the Vibes platform - * - * @returns {Promise} - */ - @Cordova() - unregisterDevice(): Promise { - return; - } - - /** - * Associate an external ID with the current person. - * - * @param {string} externalPersonId - * @returns {Promise} - */ - @Cordova() - associatePerson(externalPersonId: string): Promise { - return; - } - - /** - * Register this device to receive push notifications - * - * @returns {Promise} - */ - @Cordova() - registerPush(): Promise { - return; - } - - /** - * Unregister the device from receiving push notifications - * - * @returns {Promise} - */ - @Cordova() - unregisterPush(): Promise { - return; - } - /** - * Fetches a DeviceInfoResponse with details about the Vibes Device ID and Push Token - * - * @returns {Promise} - */ - @Cordova() - getVibesDeviceInfo(): Promise { - return; - } - - /** - * Fetches the PersonResponse associated with this device currently - * - * @returns {Promise} - */ - @Cordova() - getPerson(): Promise { - return; - } - - /** - * Get notified when the user opens a notification - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - onNotificationOpened(): Observable { - return; - } - - /** - * Fetches an array of inbox messages for the person associated with this device. - * - * @returns {Promise} - */ - @Cordova() - fetchInboxMessages(): Promise { - return; - } - - /** - * Fetches a single inbox message by it's id. - * - * @param {string} message_uid - * @returns {Promise} - */ - @Cordova() - fetchInboxMessage(message_uid: string): Promise { - return; - } - - /** - * Marks an inbox message as expired using message_uid and the expiry date supplied. Uses current date if null or invalid date is supplied. - * - * @param {string} message_uid - * @param {string} An ISO-8601 formatted date string. - * @param date - * @returns {Promise} an updated version of the InboxMessage with expires_at date updated - */ - @Cordova() - expireInboxMessage(message_uid: string, date: string): Promise { - return; - } - - /** - * Marks an inbox message as read. - * - * @param {string} message_uid - * @returns {Promise} an updated version of the InboxMessage with read field updated - */ - @Cordova() - markInboxMessageAsRead(message_uid: string): Promise { - return; - } - - /** - * Records an event for when the user opens an inbox message. - * - * @param inbox_message_stringified stringified version of the InboxMessage - * @returns {Promise} - */ - @Cordova() - onInboxMessageOpen(inbox_message_stringified: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/vibration/index.ts b/src/@awesome-cordova-plugins/plugins/vibration/index.ts deleted file mode 100644 index 90d2c5f2..00000000 --- a/src/@awesome-cordova-plugins/plugins/vibration/index.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Vibration - * @premier vibration - * @description Vibrates the device - * @usage - * ```typescript - * import { Vibration } from '@awesome-cordova-plugins/vibration/ngx'; - * - * constructor(private vibration: Vibration) { } - * - * ... - * - * // Vibrate the device for a second - * // Duration is ignored on iOS. - * this.vibration.vibrate(1000); - * - * // Vibrate 2 seconds - * // Pause for 1 second - * // Vibrate for 2 seconds - * // Patterns work on Android and Windows only - * this.vibration.vibrate([2000,1000,2000]); - * - * // Stop any current vibrations immediately - * // Works on Android and Windows only - * this.vibration.vibrate(0); - * ``` - */ -@Plugin({ - pluginName: 'Vibration', - plugin: 'cordova-plugin-vibration', - pluginRef: 'navigator', - repo: 'https://github.com/apache/cordova-plugin-vibration', - platforms: ['Android', 'iOS', 'Windows'], -}) -@Injectable() -export class Vibration extends AwesomeCordovaNativePlugin { - /** - * Vibrates the device for given amount of time. - * - * @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. - */ - @Cordova({ - sync: true, - }) - vibrate(time: number | number[]) {} -} diff --git a/src/@awesome-cordova-plugins/plugins/video-editor/index.ts b/src/@awesome-cordova-plugins/plugins/video-editor/index.ts deleted file mode 100644 index a5fc4732..00000000 --- a/src/@awesome-cordova-plugins/plugins/video-editor/index.ts +++ /dev/null @@ -1,213 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface TranscodeOptions { - /** The path to the video on the device. */ - fileUri: string; - - /** The file name for the transcoded video */ - outputFileName: string; - - /** Instructions on how to encode the video. Android is always mp4 */ - outputFileType?: number; - - /** Should the video be processed with quailty or speed in mind. iOS only */ - optimizeForNetworkUse?: number; - - /** Save the new video the library. Not supported in windows. Defaults to true */ - saveToLibrary?: boolean; - - /** Delete the original video. Android only. Defaults to false */ - deleteInputFile?: boolean; - - /** iOS only. Defaults to true */ - maintainAspectRatio?: boolean; - - /** Width of the result */ - width?: number; - - /** Height of the result */ - height?: number; - - /** Bitrate in bits. Defaults to 1 megabit (1000000). */ - videoBitrate?: number; - - /** Frames per second of the result. Android only. Defaults to 24. */ - fps?: number; - - /** Number of audio channels. iOS only. Defaults to 2. */ - audioChannels?: number; - - /* Sample rate for the audio. iOS only. Defaults to 44100*/ - audioSampleRate?: number; - - /** Sample rate for the audio. iOS only. Defaults to 128 kilobits (128000). */ - audioBitrate?: number; - - /** Not supported in windows, progress on the transcode. info will be a number from 0 to 100 */ - progress?: (info: number) => void; -} - -export interface TrimOptions { - /** Path to input video. */ - fileUri: string; - - /** Time to start trimming in seconds */ - trimStart: number; - - /** Time to end trimming in seconds */ - trimEnd: number; - - /** Output file name */ - outputFileName: string; - - /** Progress on transcode. info will be a number from 0 to 100 */ - progress?: (info: any) => void; -} - -export interface CreateThumbnailOptions { - /** The path to the video on the device */ - fileUri: string; - - /** The file name for the JPEG image */ - outputFileName: string; - - /** Location in the video to create the thumbnail (in seconds) */ - atTime?: number; - - /** Width of the thumbnail. */ - width?: number; - - /** Height of the thumbnail. */ - height?: number; - - /** Quality of the thumbnail (between 1 and 100). */ - quality?: number; -} - -export interface GetVideoInfoOptions { - /** The path to the video on the device. */ - fileUri: string; -} - -export interface VideoInfo { - /** Width of the video in pixels. */ - width: number; - - /** Height of the video in pixels. */ - height: number; - - /** Orientation of the video. Will be either portrait or landscape. */ - orientation: 'portrait' | 'landscape'; - - /** Duration of the video in seconds. */ - duration: number; - - /** Size of the video in bytes. */ - size: number; - - /** Bitrate of the video in bits per second. */ - bitrate: number; -} - -/** - * @name Video Editor - * @description Edit videos using native device APIs - * @usage - * ```typescript - * import { VideoEditor } from '@awesome-cordova-plugins/video-editor/ngx'; - * - * constructor(private videoEditor: VideoEditor) { } - * - * ... - * - * this.videoEditor.transcodeVideo({ - * fileUri: '/path/to/input.mov', - * outputFileName: 'output.mp4', - * outputFileType: VideoEditor.OutputFileType.MPEG4 - * }) - * .then((fileUri: string) => console.log('video transcode success', fileUri)) - * .catch((error: any) => console.log('video transcode error', error)); - * - * ``` - * @interfaces - * TranscodeOptions - * TrimOptions - * CreateThumbnailOptions - * GetVideoInfoOptions - * VideoInfo - */ -@Plugin({ - pluginName: 'VideoEditor', - plugin: 'cordova-plugin-video-editor', - pluginRef: 'VideoEditor', - repo: 'https://github.com/jbavari/cordova-plugin-video-editor', - platforms: ['Android', 'iOS', 'Windows', 'Windows Phone 8'], -}) -@Injectable() -export class VideoEditor extends AwesomeCordovaNativePlugin { - OptimizeForNetworkUse = { - NO: 0, - YES: 1, - }; - - OutputFileType = { - M4V: 0, - MPEG4: 1, - M4A: 2, - QUICK_TIME: 3, - }; - - /** - * Transcode a video - * - * @param options {TranscodeOptions} Options - * @returns {Promise} Returns a promise that resolves to the path of the transcoded video - */ - @Cordova({ - callbackOrder: 'reverse', - }) - transcodeVideo(options: TranscodeOptions): Promise { - return; - } - - /** - * Trim a video - * - * @param options {TrimOptions} Options - * @returns {Promise} Returns a promise that resolves to the path of the trimmed video - */ - @Cordova({ - callbackOrder: 'reverse', - platforms: ['iOS'], - }) - trim(options: TrimOptions): Promise { - return; - } - - /** - * Create a JPEG thumbnail from a video - * - * @param options {CreateThumbnailOptions} Options - * @returns {Promise} Returns a promise that resolves to the path to the jpeg image on the device - */ - @Cordova({ - callbackOrder: 'reverse', - }) - createThumbnail(options: CreateThumbnailOptions): Promise { - return; - } - - /** - * Get info on a video (width, height, orientation, duration, size, & bitrate) - * - * @param options {GetVideoInfoOptions} Options - * @returns {Promise} Returns a promise that resolves to an object containing info on the video - */ - @Cordova({ - callbackOrder: 'reverse', - }) - getVideoInfo(options: GetVideoInfoOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/video-player/index.ts b/src/@awesome-cordova-plugins/plugins/video-player/index.ts deleted file mode 100644 index b48d2ff5..00000000 --- a/src/@awesome-cordova-plugins/plugins/video-player/index.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * Options for the video playback using the `play` function. - */ -export interface VideoOptions { - /** - * Set the initial volume of the video playback, where 0.0 is 0% volume and 1.0 is 100%. - * For example: for a volume of 30% set the value to 0.3. - */ - volume?: number; - /** - * There are two options for the scaling mode. SCALE_TO_FIT which is default and SCALE_TO_FIT_WITH_CROPPING. - * These strings are the only ones which can be passed as option. - */ - scalingMode?: number; -} - -/** - * @name Video Player - * @description - * A Cordova plugin that simply allows you to immediately play a video in fullscreen mode. - * - * Requires Cordova plugin: `com.moust.cordova.videoplayer`. For more info, please see the [VideoPlayer plugin docs](https://github.com/moust/cordova-plugin-videoplayer). - * @usage - * ```typescript - * import { VideoPlayer } from '@awesome-cordova-plugins/video-player/ngx'; - * - * constructor(private videoPlayer: VideoPlayer) { } - * - * ... - * - * // Playing a video. - * this.videoPlayer.play('file:///android_asset/www/movie.mp4').then(() => { - * console.log('video completed'); - * }).catch(err => { - * console.log(err); - * }); - * - * ``` - * @interfaces - * VideoOptions - */ -@Plugin({ - pluginName: 'VideoPlayer', - plugin: 'https://github.com/moust/cordova-plugin-videoplayer.git', - pluginRef: 'VideoPlayer', - repo: 'https://github.com/moust/cordova-plugin-videoplayer', - platforms: ['Android'], -}) -@Injectable() -export class VideoPlayer extends AwesomeCordovaNativePlugin { - /** - * Plays the video from the passed url. - * - * @param fileUrl {string} File url to the video. - * @param options {VideoOptions?} Optional video playback settings. See options above. - * @returns {Promise} Resolves promise when the video was played successfully. - */ - @Cordova() - play(fileUrl: string, options?: VideoOptions): Promise { - return; - } - - /** - * Stops the video playback immediatly. - */ - @Cordova({ sync: true }) - close(): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/web-intent/index.ts b/src/@awesome-cordova-plugins/plugins/web-intent/index.ts deleted file mode 100644 index ab03dfb3..00000000 --- a/src/@awesome-cordova-plugins/plugins/web-intent/index.ts +++ /dev/null @@ -1,304 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface IntentClipItem { - uri: string; - type?: string; - extension?: string; -} - -export interface Intent { - action: string; - clipItems: IntentClipItem[]; - component: string; - extras: object; - flags: number; - type: string; -} - -export interface RegisterBroadcastReceiverOptions { - filterActions?: string[]; - filterCategories?: string[]; - filterDataSchemes?: string[]; -} - -export interface IntentOptions { - requestCode?: number; - type?: string; - package?: string; - url?: string; - extras?: object; - action?: string; - component?: { - package: string; - class: string; - }; - flags?: number[]; -} - -/** - * @name Web Intent - * @description - * This Plugin provides a general purpose shim layer for the Android intent mechanism, exposing various ways to handle sending and receiving intents. - * @usage - * For usage information please refer to the plugin's Github repo. - * - * ```typescript - * import { WebIntent } from '@awesome-cordova-plugins/web-intent/ngx'; - * - * constructor(private webIntent: WebIntent) { } - * - * ... - * - * const options = { - * action: this.webIntent.ACTION_VIEW, - * url: 'path/to/file', - * type: 'application/vnd.android.package-archive' - * } - * - * this.webIntent.startActivity(options).then(onSuccess, onError); - * - * ``` - * @interfaces - * IntentOptions - */ -@Plugin({ - pluginName: 'WebIntent', - plugin: 'com-darryncampbell-cordova-plugin-intent', - pluginRef: 'plugins.intentShim', - repo: 'https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent', - platforms: ['Android'], -}) -@Injectable() -export class WebIntent extends AwesomeCordovaNativePlugin { - /** - * Convenience constant for actions - * - * @type {string} - */ - @CordovaProperty() - ACTION_SEND: string; - - /** - * Convenience constant for actions - * - * @type {string} - */ - @CordovaProperty() - ACTION_VIEW: string; - - /** - * Convenience constant for extras - * - * @type {string} - */ - @CordovaProperty() - EXTRA_TEXT: string; - - /** - * Convenience constant for extras - * - * @type {string} - */ - @CordovaProperty() - EXTRA_SUBJECT: string; - - /** - * Convenience constant for extras - * - * @type {string} - */ - @CordovaProperty() - EXTRA_STREAM: string; - - /** - * Convenience constant for extras - * - * @type {string} - */ - @CordovaProperty() - EXTRA_EMAIL: string; - - /** - * Convenience constant for actions - * - * @type {string} - */ - @CordovaProperty() - ACTION_CALL: string; - - /** - * Convenience constant for actions - * - * @type {string} - */ - @CordovaProperty() - ACTION_SENDTO: string; - - /** - * Convenience constant for actions - * - * @type {string} - */ - @CordovaProperty() - ACTION_GET_CONTENT: string; - - /** - * Convenience constant for actions - * - * @type {string} - */ - @CordovaProperty() - ACTION_PICK: string; - - /** - * Convenience constant for actions - * - * @type {string} - */ - @CordovaProperty() - ACTION_INSTALL_PACKAGE: string; - - /** - * Convenience constant for actions - * - * @type {string} - */ - @CordovaProperty() - ACTION_UNINSTALL_PACKAGE: string; - - /** - * Launches an Android intent - * - * @param options {IntentOptions} - * @returns {Promise} - */ - @Cordova() - startActivity(options: IntentOptions): Promise { - return; - } - - /** - * Starts a new activity and return the result to the application - * - * @param options {IntentOptions} - * @returns {Promise} - */ - @Cordova() - startActivityForResult(options: IntentOptions): Promise { - return; - } - - /** - * Checks if this app was invoked with specified extra - * - * @param extra {string} - * @returns {Promise} - */ - @Cordova() - hasExtra(extra: string): Promise { - return; - } - - /** - * Gets the extra that this app was invoked with - * - * @param extra {string} - * @returns {Promise} - */ - @Cordova() - getExtra(extra: string): Promise { - return; - } - - /** - * Gets the Uri the app was invoked with - * - * @returns {Promise} - */ - @Cordova() - getUri(): Promise { - return; - } - - /** - * Returns the content of the intent used whenever the application activity is launched - * - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - onIntent(): Observable { - return; - } - - /** - * Sends a custom intent passing optional extras - * - * @param options {IntentOptions} - * @returns {Promise} - */ - @Cordova() - sendBroadcast(options: IntentOptions): Promise { - return; - } - - /** - * Request that a given application service be started - * - * @param options {IntentOptions} - * @returns {Promise} - */ - @Cordova() - startService(options: IntentOptions): Promise { - return; - } - - /** - * Registers a broadcast receiver for the specified filters - * - * @param filters {RegisterBroadcastReceiverOptions} - * @returns {Observable} - */ - @Cordova({ - observable: true, - }) - registerBroadcastReceiver(filters: RegisterBroadcastReceiverOptions): Observable { - return; - } - - /** - * Unregisters a broadcast receiver - */ - @Cordova({ sync: true }) - unregisterBroadcastReceiver(): void {} - - /** - * - */ - @Cordova({ sync: true }) - onActivityResult(): void {} - - /** - * @returns {Promise} - */ - @Cordova() - getIntent(): Promise { - return; - } - - /** - * Send a result back to the Intent that started this Activity. - * The data can be passed using 'extras'. - * - * @param root0 - * @param root0.extras - * @returns {Promise} - */ - @Cordova() - sendResult({ extras: {} }): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/web-server/index.ts b/src/@awesome-cordova-plugins/plugins/web-server/index.ts deleted file mode 100644 index 2ee759b6..00000000 --- a/src/@awesome-cordova-plugins/plugins/web-server/index.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface Response { - status: number; - body?: string; - path?: string; - headers: { [key: string]: string }; -} - -export interface Request { - requestId: string; - body: string; - headers: string; - method: 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE'; - path: string; - query: string; -} - -/** - * @name Web Server - * @description - * This plugin allows you to start a local dynamic content web server for android and iOS devices. - * @usage - * ```typescript - * import { WebServer } from '@awesome-cordova-plugins/web-server/ngx'; - * - * - * constructor(private webServer: WebServer) { } - * - * ... - * - * this.webServer.onRequest().subscribe(data => { - * console.log(data); - * const res: Response = { - * status: 200, - * body: '', - * headers: { - * 'Content-Type': 'text/html' - * } - * }; - * - * this.webServer.sendResponse(data.requestId, res) - * .catch((error: any) => console.error(error)); - * }); - * - * this.webServer.start(80) - * .catch((error: any) => console.error(error)); - * - * ``` - * @interfaces - * Response - * Request - */ -@Plugin({ - pluginName: 'WebServer', - plugin: 'cordova-plugin-webserver2', - pluginRef: 'window.webserver', - repo: 'https://github.com/nguyenthanh1995/cordova-plugin-webserver2.git', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class WebServer extends AwesomeCordovaNativePlugin { - /** - * This method will start your webserver. - * - * @param port {number} Port number (default to 8080) - */ - @Cordova({ - callbackOrder: 'reverse', - }) - start(port?: number): Promise { - return; - } - - /** - * This method will stop your webserver. - */ - @Cordova() - stop(): Promise { - return; - } - - /** - * This method returns an observable that streams HTTP requests to an observer. - * - * @returns {Observable} Returns an observable to resolve as a Request object - */ - @Cordova({ - callbackOrder: 'reverse', - observable: true, - clearFunction: 'stop', - }) - onRequest(): Observable { - return; - } - - /** - * This method sends a response to a request. - * - * @param requestId {string} Request ID to respond to - * @param responseObject {Response} Response object - * @returns {Promise} Returns a promise that resolves when something happens - */ - @Cordova() - sendResponse(requestId: string, responseObject: Response): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/web-socket-server/index.ts b/src/@awesome-cordova-plugins/plugins/web-socket-server/index.ts deleted file mode 100644 index e45cc470..00000000 --- a/src/@awesome-cordova-plugins/plugins/web-socket-server/index.ts +++ /dev/null @@ -1,214 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -declare const window: any; - -export interface WebSocketInterfaces { - [key: string]: WebSocketInterface; -} - -export interface WebSocketInterface { - ipv4Addresses: string[]; - ipv6Addresses: string[]; -} - -export interface WebSocketOptions { - origins?: string[]; - protocols?: string[]; - tcpNoDelay?: boolean; -} - -export interface WebSocketIdentifier { - uuid: string; -} - -export interface WebSocketServerDetails { - addr: string; - port: number; -} - -export interface WebSocketFailure extends WebSocketServerDetails { - reason: string; -} - -export interface WebSocketMessage { - conn: WebSocketConnection; - msg: string; -} - -export interface WebSocketClose { - conn: WebSocketConnection; - code: number; - reason: string; - wasClean: boolean; -} - -export interface WebSocketConnection extends WebSocketIdentifier { - remoteAttr: string; - state: 'open' | 'closed'; - httpFields: HttpFields; - resource: string; -} - -export interface HttpFields { - 'Accept-Encoding': string; - 'Accept-Language': string; - 'Cache-Control': string; - Connection: string; - Host: string; - Origin: string; - Pragma: string; - 'Sec-WebSocket-Extensions': string; - 'Sec-WebSocket-Key': string; - 'Sec-WebSocket-Version': string; - Upgrade: string; - 'User-Agent': string; -} - -/** - * @name WebSocket Server - * @description - * This plugin allows you to run a single, lightweight, barebone WebSocket Server. - * @usage - * ```typescript - * import { WebSocketServer } from '@awesome-cordova-plugins/web-socket-server'; - * - * constructor(private wsserver: WebSocketServer) { } - * - * ... - * - * // start websocket server - * this.wsserver.start(8888, {}).subscribe({ - * next: server => console.log(`Listening on ${server.addr}:${server.port}`), - * error: error => console.log(`Unexpected error`, error); - * }); - * - * // watch for any messages - * this.wsserver.watchMessage().subscribe(result => { - * console.log(`Received message ${result.msg} from ${result.conn.uuid}`); - * }); - * - * // send message to connection with specified uuid - * this.wsserver.send({ uuid: '8e7c4f48-de68-4b6f-8fca-1067a353968d' }, 'Hello World'); - * - * // stop websocket server - * this.wsserver.stop().then(server => { - * console.log(`Stop listening on ${server.addr}:${server.port}`); - * }); - * - * ``` - */ -@Plugin({ - pluginName: 'WebSocketServer', - plugin: 'cordova-plugin-websocket-server', - pluginRef: 'cordova.plugins.wsserver', - repo: 'https://github.com/becvert/cordova-plugin-websocket-server', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class WebSocketServer extends AwesomeCordovaNativePlugin { - /** - * Return this device's interfaces - * - * @returns {Promise} - */ - @Cordova() - getInterfaces(): Promise { - return; - } - - /** - * Start websocket server - * - * @param port {number} Local port on which the service runs. (0 means any free port) - * @param options {WebSocketOptions} Additional options for websocket - * @returns {Observable} Returns Observable where all generic error can be catched (mostly JSONExceptions) - */ - @Cordova({ - observable: true, - clearFunction: 'stop', - }) - start(port: number, options: WebSocketOptions): Observable { - return; - } - - private onFunctionToObservable(fnName: string) { - return new Observable((observer) => { - const id = window.cordova.plugins.wsserver[fnName](observer.next.bind(observer), observer.error.bind(observer)); - - return () => window.cordova.plugins.wsserver.removeCallback(id); - }); - } - - /** - * Watches for new messages - * - * @returns {Observable} - */ - watchMessage(): Observable { - return this.onFunctionToObservable('onMessage'); - } - - /** - * Watches for new opened connections - * - * @returns {Observable} - */ - watchOpen(): Observable { - return this.onFunctionToObservable('onOpen'); - } - - /** - * Watches for closed connections - * - * @returns {Observable} - */ - watchClose(): Observable { - return this.onFunctionToObservable('onClose'); - } - - /** - * Watches for any websocket failures - * - * @returns {Observable} - */ - watchFailure(): Observable { - return this.onFunctionToObservable('onFailure'); - } - - /** - * Stop websocket server and closes all connections - * - * @returns {Promise} - */ - @Cordova() - stop(): Promise { - return; - } - - /** - * Send Message to a connected device - * - * @param conn {WebSocketIdentifier} Connection to send message to - * @param msg {string} Message to send - * @returns {Promise} - */ - @Cordova() - send(conn: WebSocketIdentifier, msg: string): Promise { - return; - } - - /** - * Close specific connection using uuid - * - * @param conn {WebSocketIdentifier} Connection to close - * @param code {number} Close code, determines if it was clean - * @param reason {string} Reason for closing - * @returns {Promise} - */ - @Cordova() - close(conn: WebSocketIdentifier, code: number, reason: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/webengage/index.ts b/src/@awesome-cordova-plugins/plugins/webengage/index.ts deleted file mode 100644 index 645c0e40..00000000 --- a/src/@awesome-cordova-plugins/plugins/webengage/index.ts +++ /dev/null @@ -1,210 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Webengage - * @description - * Awesome Cordova Plugins wrapper that wraps Webengage Cordova plugin for Android and iOS - * @usage - * ```typescript - * import { Webengage, WebengageUser, WebengagePush, WebengageNotification } from '@awesome-cordova-plugins/webengage/ngx'; - * - * - * constructor(private webengage: Webengage, private webengageUser: WebengageUser, private webengagePush: WebengagePush, private webengageNotification: WebengageNotification ) { } - * - * ... - * - * this.webengage.engage(); - * ``` - */ -@Plugin({ - pluginName: 'Webengage', - plugin: 'cordova-plugin-webengage', - pluginRef: 'webengage', - repo: 'https://github.com/WebEngage/cordova-plugin', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Webengage extends AwesomeCordovaNativePlugin { - /** - * Initializes WebEngage SDK - * - * @param {any} [config] - * @returns {Promise} - */ - @Cordova() - engage(config?: any): Promise { - return; - } - - /** - * Sets WebEngage SDK configuration - * - * @param {string} key - * @param {any} value - * @returns {Promise} - */ - @Cordova() - options(key: string, value: any): Promise { - return; - } - - /** - * Tracks event - * - * @param {string} eventName - * @param {any} [attributes] - * @returns {Promise} - */ - @Cordova() - track(eventName: string, attributes?: any): Promise { - return; - } - - /** - * Tracks screen - * - * @param {string} eventName - * @param screenName - * @param {any} [screenData] - * @returns {Promise} - */ - @Cordova() - screen(screenName: string, screenData?: any): Promise { - return; - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'Webengage', - plugin: 'cordova-plugin-webengage', - pluginRef: 'webengage.user', -}) -@Injectable() -export class WebengageUser extends AwesomeCordovaNativePlugin { - /** - * Logs user in - * - * @param {string} userId - * @returns {Promise} - */ - @Cordova() - login(userId: string): Promise { - return; - } - - /** - * Logs user out - * - * @returns {Promise} - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * Sets user attribute - * - * @param {string} key - * @param {any} value - * @returns {Promise} - */ - @Cordova() - setAttribute(key: string, value: any): Promise { - return; - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'Webengage', - plugin: 'cordova-plugin-webengage', - pluginRef: 'webengage.push', -}) -@Injectable() -export class WebengagePush extends AwesomeCordovaNativePlugin { - /** - * Callback function is invoked when a push notification is clicked - * - * @param {any} callback - * @returns {Promise} - */ - @Cordova() - onClick(callback: any): Promise { - return; - } - - /** - * Sets push notification configuration - * - * @param {string} key - * @param {any} value - * @returns {Promise} - */ - @Cordova() - options(key: string, value: any): Promise { - return; - } -} - -/** - * @hidden - */ -@Plugin({ - pluginName: 'Webengage', - plugin: 'cordova-plugin-webengage', - pluginRef: 'webengage.notification', -}) -@Injectable() -export class WebengageNotification extends AwesomeCordovaNativePlugin { - /** - * Callback function is invoked when a in-app notification is shown - * - * @param {any} callback - * @returns {Promise} - */ - @Cordova() - onShown(callback: any): Promise { - return; - } - - /** - * Callback function is invoked when a in-app notification is clicked - * - * @param {any} callback - * @returns {Promise} - */ - @Cordova() - onClick(callback: any): Promise { - return; - } - - /** - * Callback function is invoked when a in-app notification is dismissed - * - * @param {any} callback - * @returns {Promise} - */ - @Cordova() - onDismiss(callback: any): Promise { - return; - } - - /** - * Sets in-app notification configuration - * - * @param {string} key - * @param {any} value - * @returns {Promise} - */ - @Cordova() - options(key: string, value: any): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/webim/index.ts b/src/@awesome-cordova-plugins/plugins/webim/index.ts deleted file mode 100644 index a058efab..00000000 --- a/src/@awesome-cordova-plugins/plugins/webim/index.ts +++ /dev/null @@ -1,297 +0,0 @@ -import { Injectable } from '@angular/core'; -import { AwesomeCordovaNativePlugin, Cordova, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface InitParams { - accountName: string; - closeWithClearVisitorData: boolean; - storeHistoryLocally: boolean; - pushToken: string; - location: string; - visitorFields: string; -} - -export interface DefaultResponse { - result: string; -} - -export interface Quote { - state: string; - id: string; - text: string; - url: string; - timestamp: string; - senderName: string; - authorID: string; -} - -export interface Employee { - id: string; - firstname: string; - avatar: string; -} - -export interface Keyboard { - state: string; - buttons: Array; - keyboardResponse: KeyboardResponse; -} - -export interface KeyboardRequest { - messageID: string; - button: KeyboardButton; -} - -export interface KeyboardButton { - text: string; - id: string; -} - -export interface KeyboardResponse { - buttonID: string; - messageID: string; -} - -export interface Message { - id: string; - currentChatID: string; - text: string; - url: string; - imageWidth: number; - imageHeight: number; - thumbUrl: string; - timestamp: string; - sender: string; - quote: Quote; - operator: Employee; - keyboard: Keyboard; - keyboardRequest: KeyboardRequest; - isFirst: boolean; - isReadByOperator: boolean; - canBeReplied: boolean; -} - -export interface DialogState { - employee: Employee; -} - -export type MessagesHistoryResponse = Array; -export type MessageResponse = Message; -export type DialogStateResponse = DialogState; - -/** - * @name Webim - * @description - * A cordova plugin, a JS version of Webim SDK - * @usage - * ```typescript - * import { Webim } from '@awesome-cordova-plugins/webim/ngx'; - * - * - * constructor(private webim: Webim) { } - * - * ... - * - * - * this.webim.functionName('Hi bro', 42) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'Webim', - plugin: 'ru.webim.sdk', - pluginRef: 'webimsdk', - repo: 'https://github.com/webim/webim-cordova-plugin.git', - install: 'cordova plugin add https://github.com/webim/webim-cordova-plugin.git', - platforms: ['Android', 'iOS', 'Browser'], -}) -@Injectable() -export class Webim extends AwesomeCordovaNativePlugin { - @Cordova() - init(params: InitParams): Promise { - return; - } - - @Cordova() - requestDialog(): Promise { - return; - } - - @Cordova() - getMessagesHistory(limit: number, offset: number): Promise { - return; - } - - @Cordova() - typingMessage(message: string): Promise { - return; - } - - @Cordova() - sendMessage(message: string): Promise { - return; - } - - @Cordova() - replyMessage(message: string, repliedMessage: Message): Promise { - return; - } - - @Cordova() - sendFile(filePath: string): Promise { - return; - } - - @Cordova() - sendSurveyAnswer(surveyAnswer: string): Promise { - return; - } - - @Cordova() - cancelSurvey(): Promise { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onMessage(): Observable { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onDeletedMessage(): Observable { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onFile(message: string): Observable { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onTyping(): Observable { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onConfirm(): Observable { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onDialog(): Observable { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onBan(): Observable { - return; - } - - @Cordova() - close(): Promise { - return; - } - - @Cordova() - rateOperator(id: string, rating: number): Promise { - return; - } - - @Cordova() - rateOperatorWithNote(id: string, rating: number, note: string): Promise { - return; - } - - @Cordova() - sendDialogToEmailAddress(emailAddress: string): Promise { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onUnreadByVisitorMessageCount(): Observable { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onSurvey(): Observable { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onNextQuestion(): Observable { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onSurveyCancel(): Observable { - return; - } - - @Cordova() - getUnreadByVisitorMessageCount(): Promise { - return; - } - - @Cordova() - sendKeyboardRequest(): Promise { - return; - } - - @Cordova() - setChatRead(): Promise { - return; - } - - @Cordova() - getShowEmailButton(): Promise { - return; - } - - @Cordova() - showRateOperatorWindow(): Promise { - return; - } - - @Cordova({ - observable: true, - clearFunction: 'close', - }) - onLogging(): Observable { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/wechat/index.ts b/src/@awesome-cordova-plugins/plugins/wechat/index.ts deleted file mode 100644 index f2e08e53..00000000 --- a/src/@awesome-cordova-plugins/plugins/wechat/index.ts +++ /dev/null @@ -1,200 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Wechat - * @description - * A cordova plugin, a JS version of Wechat SDK - * @usage - * ```typescript - * import { Wechat } from '@awesome-cordova-plugins/wechat/ngx'; - * - * - * constructor(private wechat: Wechat) { } - * - * ... - * - * - * this.wechat.functionName('Hello', 123) - * .then((res: any) => console.log(res)) - * .catch((error: any) => console.error(error)); - * - * ``` - */ -@Plugin({ - pluginName: 'Wechat', - plugin: 'cordova-plugin-wechat', - pluginRef: 'Wechat', - repo: 'https://github.com/xu-li/cordova-plugin-wechat.git', - install: 'cordova plugin add cordova-plugin-wechat --variable wechatappid=YOUR_WECHAT_APPID', - installVariables: ['wechatappid'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Wechat extends AwesomeCordovaNativePlugin { - Scene: { - SESSION: 0; // 聊天界面 - TIMELINE: 1; // 朋友圈 - FAVORITE: 2; // 收藏 - }; - - Type: { - APP: 1; - EMOTION: 2; - FILE: 3; - IMAGE: 4; - MUSIC: 5; - VIDEO: 6; - WEBPAGE: 7; - }; - - Mini: { - RELEASE: 0; // 正式版 - TEST: 1; // 测试版 - PREVIEW: 2; // 体验版 - }; - - @Cordova() - isInstalled(): Promise { - return; - } - - /** - * Share a message to wechat app - * - * @param params - * @example - * - * this.wechat.share({ - * message: { - * title: "Message Title", - * description: "Message Description(optional)", - * mediaTagName: "Media Tag Name(optional)", - * thumb: "http://YOUR_THUMBNAIL_IMAGE", - * media: { - * type: Wechat.Type.WEBPAGE, // webpage - * webpageUrl: "https://github.com/xu-li/cordova-plugin-wechat" // webpage - * } - * }, - * scene: this.wechat.Scene.TIMELINE // share to Timeline - * }.then(() => { - * console.log('share success'); - * }) - * .catch(error => { - * console.log(error); - * }); - * - */ - @Cordova() - share(params: any): Promise { - return; - } - - /** - * Sending an auth request to Wechat - * - * @param scope - * @param state - * @example - * - * this.wechat.auth.then((res) => { alert(res.code); }); - * - */ - @Cordova() - auth(scope: any, state: any): Promise { - return; - } - - /** - * Send a payment request - * - * @param params - * @link https://pay.weixin.qq.com/wiki/doc/api/app.php?chapter=9_1 - * @example - * - * var params = { - * mch_id: '10000100', // merchant id - * prepay_id: 'wx201411101639507cbf6ffd8b0779950874', // prepay id returned from server - * nonce: '1add1a30ac87aa2db72f57a2375d8fec', // nonce string returned from server - * timestamp: '1439531364', // timestamp - * sign: '0CB01533B8C1EF103065174F50BCA001', // signed string - * }; - * this.wechat.sendPaymentRequest(params).then(() => { - * console.log("Success"); - * }).catch(error => { - * console.log(error); - * }); - * - */ - @Cordova() - sendPaymentRequest(params: any): Promise { - return; - } - - /** - * jumpToBizProfile (跳转到某个微信公众号)2016-11-11 测试是失效的,囧 - * - * @param url - * @link https://segmentfault.com/a/1190000007204624 - * @link https://segmentfault.com/q/1010000003907796 - * @example - * - * var params = { - * info: 'gh_xxxxxxx', // 公众帐号原始ID - * type: 'Normal' // 普通号 - * } - * or - * var params = { - * info: 'extMsg', // 相关的硬件二维码串 - * type: 'Device' // 硬件号 - * }; - * this.wechat.jumpToBizProfile(params).then(()=> { - * console.log("Success"); - * }).catch(error => { - * console.log(error); - * }); - * - */ - @Cordova() - jumpToWechat(url: string): Promise { - return; - } - - /** - * chooseInvoiceFromWX exq:choose invoices from Wechat card list - * - * @param params - * @example - * - * params: signType, cardSign, nonceStr, timeStamp all required - * this.wechat.chooseInvoiceFromWX(params).then(() => { - * console.log("Success"); - * }).catch(error => { - * console.log(error); - * }); - * - */ - @Cordova() - chooseInvoiceFromWX(params: any): Promise { - return; - } - - /** - * openMiniProgram exq:app opens wechat mini program - * - * @param params - * @example - * - * params: userName, path, miniprogramType all required - * Wechat.openMiniProgram(params, function (data) { - * alert(data.extMsg); - * }, function (reason) { - * alert("Failed: " + reason); - * }); - * - */ - @Cordova() - openMiniProgram(params: any): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/wheel-selector/index.ts b/src/@awesome-cordova-plugins/plugins/wheel-selector/index.ts deleted file mode 100644 index 49f05699..00000000 --- a/src/@awesome-cordova-plugins/plugins/wheel-selector/index.ts +++ /dev/null @@ -1,204 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface WheelSelectorItem { - description?: string; -} - -export interface DefaultItem { - index: number; - value: string; -} - -export interface WheelSelectorOptions { - /** - * The title of the selector's input box - */ - title: string; - - /** - * The items to display (array of items). - */ - items: WheelSelectorItem[][]; - - /** - * Which items to display by default. - */ - defaultItems?: DefaultItem[]; - - /** - * The 'ok' button text - * Default: Done - */ - positiveButtonText?: string; - - /** - * The 'cancel' button text - * Default: Cancel - */ - negativeButtonText?: string; - - /** - * Android only - theme color, 'light' or 'dark'. - * Default: light - */ - theme?: 'light' | 'dark'; - - /** - * Whether to have the wheels 'wrap' (Android only) - * Default: false - */ - wrapWheelText?: boolean; - - /** - * The json key to display, by default it is description, this allows for setting any - * key/value to be displayed - * Default: description - */ - displayKey?: string; -} - -export interface WheelSelectorData { - data: any; -} - -/** - * @beta - * @name WheelSelector Plugin - * @description Native wheel selector for Cordova (Android/iOS). - * @usage - * ``` - * import { WheelSelector } from '@awesome-cordova-plugins/wheel-selector/ngx'; - * - * - * constructor(private selector: WheelSelector) { } - * - * ... - * - * const jsonData = { - * numbers: [ - * { description: "1" }, - * { description: "2" }, - * { description: "3" } - * ], - * fruits: [ - * { description: "Apple" }, - * { description: "Banana" }, - * { description: "Tangerine" } - * ], - * firstNames: [ - * { name: "Fred", id: '1' }, - * { name: "Jane", id: '2' }, - * { name: "Bob", id: '3' }, - * { name: "Earl", id: '4' }, - * { name: "Eunice", id: '5' } - * ], - * lastNames: [ - * { name: "Johnson", id: '100' }, - * { name: "Doe", id: '101' }, - * { name: "Kinishiwa", id: '102' }, - * { name: "Gordon", id: '103' }, - * { name: "Smith", id: '104' } - * ] - * } - * - * ... - * - * // basic number selection, index is always returned in the result - * selectANumber() { - * this.selector.show({ - * title: "How Many?", - * items: [ - * this.jsonData.numbers - * ], - * }).then( - * result => { - * console.log(result[0].description + ' at index: ' + result[0].index); - * }, - * err => console.log('Error: ', err) - * ); - * } - * - * ... - * - * // basic selection, setting initial displayed default values: '3' 'Banana' - * selectFruit() { - * this.selector.show({ - * title: "How Much?", - * items: [ - * this.jsonData.numbers, this.jsonData.fruits - * ], - * positiveButtonText: "Ok", - * negativeButtonText: "Nope", - * defaultItems: [ - * {index:0, value: this.jsonData.numbers[2].description}, - * {index: 1, value: this.jsonData.fruits[3].description} - * ] - * }).then( - * result => { - * console.log(result[0].description + ' ' + result[1].description); - * }, - * err => console.log('Error: ' + JSON.stringify(err)) - * ); - * } - * - * ... - * - * // more complex as overrides which key to display - * // then retrieve properties from original data - * selectNamesUsingDisplayKey() { - * this.selector.show({ - * title: "Who?", - * items: [ - * this.jsonData.firstNames, this.jsonData.lastNames - * ], - * displayKey: 'name', - * defaultItems: [ - * {index:0, value: this.jsonData.firstNames[2].name}, - * {index: 0, value: this.jsonData.lastNames[3].name} - * ] - * }).then( - * result => { - * console.log(result[0].name + ' (id= ' + this.jsonData.firstNames[result[0].index].id + '), ' + - * result[1].name + ' (id=' + this.jsonData.lastNames[result[1].index].id + ')'); - * }, - * err => console.log('Error: ' + JSON.stringify(err)) - * ); - * } - * - * ``` - * @interfaces - * WheelSelectorOptions - */ -@Plugin({ - pluginName: 'WheelSelector', - plugin: 'cordova-wheel-selector-plugin', - pluginRef: 'SelectorCordovaPlugin', - repo: 'https://github.com/jasonmamy/cordova-wheel-selector-plugin', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class WheelSelector extends AwesomeCordovaNativePlugin { - /** - * Shows the wheel selector - * - * @param {WheelSelectorOptions} options Options for the wheel selector - * @returns {Promise} Returns a promise that resolves with the selected items, or an error. - */ - @Cordova() - show(options: WheelSelectorOptions): Promise { - return; - } - - /** - * Hide the selector - * - * @returns {Promise} - */ - @Cordova({ - platforms: ['iOS'], - }) - hideSelector(): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/wifi-wizard-2/index.ts b/src/@awesome-cordova-plugins/plugins/wifi-wizard-2/index.ts deleted file mode 100644 index e89d410c..00000000 --- a/src/@awesome-cordova-plugins/plugins/wifi-wizard-2/index.ts +++ /dev/null @@ -1,915 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, CordovaFunctionOverride, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface WifiConfig { - SSID: string; - isHiddenSSID: boolean; - auth: { - algorithm: string; - password?: string; - }; -} - -export interface WifiScanResultsOptions { - numLevels: number; -} - -export interface WifiScanOptions extends WifiScanResultsOptions { - [key: string]: any; -} - -/** - * @name WifiWizard2 - * @description - * WifiWizard2 enables Wifi management for both Android and iOS applications within Cordova/Phonegap projects. - * - * This project is a fork of the WifiWizard plugin with fixes and updates, as well as patches taken from the Cordova Network Manager plugin. - * @usage - * ```typescript - * import { WifiWizard2 } from '@awesome-cordova-plugins/wifi-wizard-2/ngx'; - * - * - * constructor(private wifiWizard2: WifiWizard2) { } - * - * - * # Global Functions - * These are functions that can be used by both Android and iOS applications - * ```typescript - * this.wifiWizard2.getConnectedSSID() - * ``` - * - Returns connected network SSID (only if connected) in success callback, otherwise fail callback will be called (if not connected or unable to retrieve) - * - This does **NOT** return the BSSID if unable to obtain SSID (like original WifiWizard did) - * ```typescript - * this.wifiWizard2.getConnectedBSSID() - * ``` - * - Same as above, except BSSID (mac) is returned - * - * ```typescript - * this.wifiWizard2.timeout(delay) - * ``` - * - `delay` should be time in milliseconds to delay - * - Helper async timeout delay, `delay` is optional, default is 2000ms = 2 seconds - * - This method always returns a resolved promise after the delay, it will never reject or throw an error - * - * Example inside async function** - * ```typescript - * async function example(){ - * await this.wifiWizard2.timeout(4000); - * // do something after 4 seconds - * } - * ``` - * - * Example inside standard non-async function** - * ```typescript - * function example(){ - * this.wifiWizard2.timeout(4000).then( function(){ - * // do something after waiting 4 seconds - * }): - * } - * ``` - * - * Thrown Errors** - * - * - `TIMEOUT_WAITING_FOR_SCAN` on timeout waiting for scan 10 seconds + - * - `SCAN_FAILED` if unable to start scan - * - * # iOS Functions - * For functionality, you need to note the following: - * - Connect/Disconnect only works for iOS11+ - * - Can't run in the simulator so you need to attach an actual device when building with xCode - * - Will ensure 'HotspotConfiguration' and 'NetworkExtensions' capabilities are added to your xCode project - * - To connect to open network omit `ssidPassword` or call with `false` - * - * ```typescript - * this.wifiWizard2.iOSConnectNetwork(ssid, ssidPassword) - * ``` - * ```typescript - * this.wifiWizard2.iOSDisconnectNetwork(ssid) - * ``` - * - * # Android Functions - * - **WifiWizard2** *will automagically try to enable WiFi if it's disabled when calling any android related methods that require WiFi to be enabled* - * - * ## Connect vs Enable - * When writing Android Java code, there is no `connect` methods, you basically either `enable` or `disable` a network. In the original versions of WifiWizard the `connect` method would basically just call `enable` in Android. - * I have changed the way this works in WifiWizard2 version 3.0.0+, converting it to a helper method to eliminate having to call `formatWifiConfig` then `add` and then `enable` ... the `connect` method will now automatically call `formatWifiConfig`, then call `add` to either add or update the network configuration, and then call `enable`. - * If the connect method is unable to update existing network configuration (added by user or other apps), but there is a valid network ID, it will still attempt to enable that network ID. - * - * ```typescript - * this.wifiWizard2.connect(ssid, bindAll, password, algorithm, isHiddenSSID) - * ``` - * - `ssid` should be the SSID to connect to *required* - * - `bindAll` should be set to `true` to tell Android to route all connections from your Android app, through the wifi connection (default is `false`) *optional* - * - See `WifiWizard2.enable` for more details regarding `bindAll` feature - * - `algorithm` and `password` is not required if connecting to an open network - * - Currently `WPA` and `WEP` are only supported algorithms - * - For `WPA2` just pass `WPA` as the algorithm - * - Set `isHiddenSSID` to `true` if the network you're connecting to is hidden - * - These arguments are the same as for `formatWifiConfig` - * - This method essentially calls `formatWifiConfig` then `add` then `enable` - * - If unable to update network configuration (was added by user or other app), but a valid network ID exists, this method will still attempt to enable the network - * - Promise will not be returned until method has verified that connection to WiFi was in completed state (waits up to 60 seconds) - * - * Thrown Errors** - * - * - * - `CONNECT_FAILED_TIMEOUT` unable to verify connection, timed out after 60 seconds - * - `INVALID_NETWORK_ID_TO_CONNECT` Unable to connect based on generated wifi config - * - `INTERPUT_EXCEPT_WHILE_CONNECTING` Interupt exception while waiting for connection - * - * - * - * ## Disconnect vs Disable - * Same as above for Connect vs Enable, except in this situation, `disconnect` will first disable the network, and then attempt to remove it (if SSID is passed) - * - * ```typescript - * this.wifiWizard2.disconnect(ssid) - * ``` - * - `ssid` can either be an SSID (string) or a network ID (integer) - * - `ssid` is **OPTIONAL** .. if not passed, will disconnect current WiFi (almost all Android versions now will just automatically reconnect to last wifi after disconnecting) - * - If `ssid` is provided, this method will first attempt to `disable` and then `remove` the network - * - If you do not want to remove network configuration, use `disable` instead - * - * Thrown Errors** - * - * - `DISCONNECT_NET_REMOVE_ERROR` Android returned error when removing wifi configuration - * - `DISCONNECT_NET_DISABLE_ERROR` Unable to connect based on generated wifi config - * - `DISCONNECT_NET_ID_NOT_FOUND` Unable to determine network ID to disconnect/remove (from passed SSID) - * - `ERROR_DISCONNECT` - Android error disconnecting wifi (only when SSID is not passed) - * - * ```typescript - * this.wifiWizard2.formatWifiConfig(ssid, password, algorithm, isHiddenSSID) - * ``` - * - `algorithm` and `password` is not required if connecting to an open network - * - Currently `WPA` and `WEP` are only supported algorithms - * - For `WPA2` just pass `WPA` as the algorithm - * - Set `isHiddenSSID` to `true` if the network you're connecting to is hidden - * ```typescript - * this.wifiWizard2.formatWPAConfig(ssid, password, isHiddenSSID) - * ``` - * - This is just a helper method that calls `WifiWizard2.formatWifiConfig( ssid, password, 'WPA', isHiddenSSID );` - * - * ```typescript - * this.wifiWizard2.add(wifi) - * ``` - * - `wifi` must be an object formatted by `formatWifiConfig`, this **must** be done before calling `enable` - * - * Thrown Errors** - * - * - `AUTH_TYPE_NOT_SUPPORTED` - Invalid auth type specified - * - `ERROR_ADDING_NETWORK` - Android returned `-1` specifying error adding network - * - `ERROR_UPDATING_NETWORK` - Same as above, except an existing network ID was found, and unable to update it - * - * ```typescript - * this.wifiWizard2.remove(ssid) - * ``` - * - `ssid` can either be an SSID (string) or a network ID (integer) - * - Please note, most newer versions of Android will only allow wifi to be removed if created by your application - * - * Thrown Errors** - * - * - `UNABLE_TO_REMOVE` Android returned failure in removing network - * - `REMOVE_NETWORK_NOT_FOUND` Unable to determine network ID from passed SSID - * - * - * ```typescript - * this.wifiWizard2.listNetworks() - * ``` - * - * ```typescript - * this.wifiWizard2.scan([options]) - * ``` - * - Same as calling `startScan` and then `getScanResults`, except this method will only resolve the promise after the scan completes and returns the results. - * - * ```typescript - * this.wifiWizard2.startScan() - * ``` - * - It is recommended to just use the `scan` method instead of `startScan` - * - * Thrown Errors** - * - * - `STARTSCAN_FAILED` Android returned failure in starting scan - * - * - * ```typescript - * this.wifiWizard2.getScanResults([options]) - * ``` - * - `getScanResults` should only be called after calling `startScan` (it is recommended to use `scan` instead as this starts the scan, then returns the results) - * - `[options]` is optional, if you do not want to specify, just pass `success` callback as first parameter, and `fail` callback as second parameter - * - Retrieves a list of the available networks as an array of objects and passes them to the function listHandler. The format of the array is: - * ```typescript - * networks = [ - * { "level": signal_level, // raw RSSI value - * "SSID": ssid, // SSID as string, with escaped double quotes: "\"ssid name\"" - * "BSSID": bssid // MAC address of WiFi router as string - * "frequency": frequency of the access point channel in MHz - * "capabilities": capabilities // Describes the authentication, key management, and encryption schemes supported by the access point. - * "timestamp": timestamp // timestamp of when the scan was completed - * "channelWidth": - * "centerFreq0": - * "centerFreq1": - * } - * ] - * ``` - * - `channelWidth` `centerFreq0` and `centerFreq1` are only supported on API > 23 (Marshmallow), any older API will return null for these values - * - * An options object may be passed. Currently, the only supported option is `numLevels`, and it has the following behavior: - * - * - if `(n == true || n < 2)`, `*.getScanResults({numLevels: n})` will return data as before, split in 5 levels; - * - if `(n > 1)`, `*.getScanResults({numLevels: n})` will calculate the signal level, split in n levels; - * - if `(n == false)`, `*.getScanResults({numLevels: n})` will use the raw signal level; - * - * ```typescript - * this.wifiWizard2.isWifiEnabled() - * ``` - * - Returns boolean value of whether Wifi is enabled or not - * ```typescript - * this.wifiWizard2.setWifiEnabled(enabled) - * ``` - * - Pass `true` for `enabled` parameter to set Wifi enabled - * - You do not need to call this function to set WiFi enabled to call other methods that require wifi enabled. This plugin will automagically enable WiFi if a method is called that requires WiFi to be enabled. - * - * Thrown Errors** - * - * - `ERROR_SETWIFIENABLED` wifi state does not match call (enable or disable) - * - * ```typescript - * this.wifiWizard2.getConnectedNetworkID() - * ``` - * - Returns currently connected network ID in success callback (only if connected), otherwise fail callback will be called - * - * **Thrown Errors** - * - * - `GET_CONNECTED_NET_ID_ERROR` Unable to determine currently connected network ID (may not be connected) - * - * ## New to 3.1.1+ - * ```typescript - * this.wifiWizard2.resetBindAll() - * ``` - * - Disable bindAll to WiFi network without disconnecting from WiFi - * - * ```typescript - * this.wifiWizard2.setBindAll() - * ``` - * - Enable bindAll to WiFi network without disconnecting from WiFi - * - * ```typescript - * this.wifiWizard2.canConnectToInternet() - * ``` - * - * - Returns boolean, true or false, if device is able to connect to https://www.google.com via HTTP connection (since ping is unreliable) - * - Unknown errors will still be thrown like all other async functions - * - If you called `connect` or `enable` and passed `true` for `bindAll`, your application will force the ping through wifi connection. - * - If you did not pass `true` (or passed `false`) for `bindAll`, and the wifi does not have internet connection, Android Lollipop+ (API 21+) will use cell connection to ping (due to Android using cell connection when wifi does not have internet) [More Details](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html) - * - * - * ```typescript - * this.wifiWizard2.canConnectToRouter() - * ``` - * - As `canPingWifiRouter` is notoriously unreliable, this method uses HTTP connection to test if able to connect to router (as most routers should have web server running on port 80) - * - Unknown errors will still be thrown like all other async functions - * - This is useful for testing to make sure that your Android app is able to connect to the private network after connecting to WiFi - * - This was added for testing the `bindAll` feature to support issues with Android Lollipop+ (API 21+) not routing calls through WiFi if WiFi does not have internet connection [See Android Blog](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html) - * - Attempts to connect router IP HTTP server on port 80 (example: `http://192.168.0.1/` where `192.168.0.1` is the automatically detected IP address) - * - * ## New to 3.0.0+ - * ```typescript - * this.wifiWizard2.isConnectedToInternet() - * ``` - * - * - Returns boolean, true or false, if device is able to ping 8.8.8.8 - * - Unknown errors will still be thrown like all other async functions - * - If you called `connect` or `enable` and passed `true` for `bindAll`, your application will force the ping through wifi connection. - * - If you did not pass `true` (or passed `false`) for `bindAll`, and the wifi does not have internet connection, Android Lollipop+ (API 21+) will use cell connection to ping (due to Android using cell connection when wifi does not have internet) [More Details](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html) - * - * ```typescript - * this.wifiWizard2.canPingWifiRouter() - * ``` - * - * - Returns boolean, true or false, if device is able to ping the connected WiFi router IP (obtained from DHCP info) - * - Version 3.1.1+ uses HTTP connection to test if able to connect to router (as ping previous did not work) - * - Unknown errors will still be thrown like all other async functions - * - This is useful for testing to make sure that your Android app is able to connect to the private network after connecting to WiFi - * - This was added for testing the `bindAll` feature to support issues with Android Lollipop+ (API 21+) not routing calls through WiFi if WiFi does not have internet connection [See Android Blog](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html) - * - * ```typescript - * this.wifiWizard2.enableWifi() - * ``` - * - * ```typescript - * this.wifiWizard2.disableWifi() - * ``` - * - * ```typescript - * this.wifiWizard2.getWifiIP() - * ``` - * - Returns IPv4 address of currently connected WiFi, or rejects promise if IP not found or wifi not connected - * - * ```typescript - * this.wifiWizard2.getWifiRouterIP() - * ``` - * - Returns IPv4 WiFi router IP from currently connected WiFi, or rejects promise if unable to determine, or wifi not connected - * - * **Thrown Errors** - * - * - `NO_VALID_IP_IDENTIFIED` if unable to determine a valid IP (ip returned from device is `0.0.0.0`) - * - * ```typescript - * this.wifiWizard2.getWifiIPInfo() - * ``` - * - Returns a JSON object with IPv4 address and subnet `{"ip": "192.168.1.2", "subnet": "255.255.255.0" }` or rejected promise if not found or not connected - * **Thrown Errors** - * - * - `NO_VALID_IP_IDENTIFIED` if unable to determine a valid IP (ip returned from device is `0.0.0.0`) - * - * ```typescript - * this.wifiWizard2.reconnect() - * ``` - * - Reconnect to the currently active access point, **if we are currently disconnected.** - * - * **Thrown Errors** - * - * - `ERROR_RECONNECT` Android returned error when reconnecting - * - * ```typescript - * this.wifiWizard2.reassociate() - * ``` - * - Reconnect to the currently active access point, **even if we are already connected.** - * - * **Thrown Errors** - * - * - `ERROR_REASSOCIATE` Android returned error when reassociating - * - * - * ```typescript - * this.wifiWizard2.getSSIDNetworkID(ssid) - * ``` - * - Get Android Network ID from passed SSID - * - * ```typescript - * this.wifiWizard2.disable(ssid) - * ``` - * - `ssid` can either be an SSID (string) or a network ID (integer) - * - Disable the passed SSID network - * - Please note that most newer versions of Android will only allow you to disable networks created by your application - * - * **Thrown Errors** - * - * - `UNABLE_TO_DISABLE` Android returned failure in disabling network - * - `DISABLE_NETWORK_NOT_FOUND` Unable to determine network ID from passed SSID to disable - * - * - * ```typescript - * this.wifiWizard2.requestPermission() - * ``` - * - Request `ACCESS_FINE_LOCATION` permssion - * - This Android permission is required to run `scan`, `startStart` and `getScanResults` - * - You can request permission by running this function manually, or WifiWizard2 will automagically request permission when one of the functions above is called - * - * **Thrown Errors** - * - * - `PERMISSION_DENIED` user denied permission on device - * - * - * ```typescript - * this.wifiWizard2.enable(ssid, bindAll, waitForConnection) - * ``` - * - `ssid` can either be an SSID (string) or a network ID (integer) - * - `bindAll` should be set to `true` to tell Android to route all connections from your Android app, through the wifi connection - * - Android Lollipop+ (API 21+) will not route connections to the WiFi device if it does not have internet connection. Passing `true` to `bindAll` will force Android to route connections from your Android app through Wifi, regardless of internet connection. - * - If you are having problems connecting to a local IP through WiFi because it does not have internet, try enabling `bindAll` and this should fix the problem. - * - During my testing, some versions of Android (5.0 - 7.1.2) would still route connections through WiFi without internet, but it was random that some versions would and would not work. - * - Testing Android Oreo+ (8.0.0+) if wifi does not have internet, 100% of the time it would NOT route connections through WiFi, so you *must* enable this for Oreo or newer to route connections from your application through wifi without internet. - * - When `bindAll` is enabled, *ALL* connections from your app will be routed through WiFi, until you call `disconnect` or `disable` - * - See the Google Android Blog for [More Details](https://android-developers.googleblog.com/2016/07/connecting-your-app-to-wi-fi-device.html) - * - This feature *ONLY* works for Android Lollipop+ (API 21+), if device is running API older than 21, `bindall` will be ignored (as API older than 21 does this by default) - * - Enable the passed SSID network - * - You **MUST** call `WifiWizard2.add(wifi)` before calling `enable` as the wifi configuration must exist before you can enable it (or previously used `connect` without calling `disconnect`) - * - This method does NOT wait or verify connection to wifi network, pass `true` to `waitForConnection` to only return promise once connection is verified in COMPLETED state to specific `ssid` - * - * **Thrown Errors** - * - * `UNABLE_TO_ENABLE` - Android returned `-1` signifying failure enabling - * - * # Installation - * - * ## Master - * - * Run ```cordova plugin add https://github.com/tripflex/wifiwizard2``` - * - * To install from the master branch (latest on GitHub) - * - * To install a specific branch (add `#tag` replacing `tag` with tag from this repo, example: - * ```cordova plugin add https://github.com/tripflex/wifiwizard2#v3.1.1``` - * - * Find available tags here: - * https://github.com/tripflex/WifiWizard2/tags - * - * - * If you are wanting to have the latest and greatest stable version, then run the 'Releases' command below. - * - * ## Releases - * Run ```cordova plugin add cordova-plugin-wifiwizard2``` - * - * ## Meteor - * To install and use this plugin in a Meteor project, you have to specify the exact version from NPM repository: - * [https://www.npmjs.com/package/cordova-plugin-wifiwizard2](https://www.npmjs.com/package/cordova-plugin-wifiwizard2) - * - * As of April 4th 2019, the latest version is 3.1.1: - * - * ```meteor add cordova:cordova-plugin-wifiwizard2@3.1.1``` - * - * # Errors/Rejections - * Methods now return formatted string errors as detailed below, instead of returning generic error messages. This allows you to check yourself what specific error was returned, and customize the error message. - * In an upcoming release I may add easy ways to override generic messages, or set your own, but for now, errors returned can be found below each method/function. - * - * ## Generic **Thrown Errors** - * `WIFI_NOT_ENABLED` - * ``` - */ -@Plugin({ - pluginName: 'WifiWizard2', - plugin: 'cordova-plugin-wifiwizard2', - pluginRef: 'WifiWizard2', - repo: 'https://github.com/tripflex/WifiWizard2', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class WifiWizard2 extends AwesomeCordovaNativePlugin { - /** - * Connect to network on iOS device - * - * @param ssid - * @param ssidPassword Password if connecting to WPA/WPA2 network (omit or use false to connect to open network) - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['iOS'], - }) - iOSConnectNetwork(ssid: string, ssidPassword: string): Promise { - return; - } - - /** - * Disconnect from SSID on iOS device - * - * @param ssid - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['iOS'], - }) - iOSDisconnectNetwork(ssid: string): Promise { - return; - } - - /** - * Add wifi network configuration - * - * @param wifiConfig Must be object created by formatWifiConfig() - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - add(wifiConfig: WifiConfig): Promise { - return; - } - - /** - * Remove wifi network configuration - * - * @param {string|number} [ssid] - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - remove(ssid: string | number): Promise { - return; - } - - /** - * Connect network with specified SSID - * - * This method will first add the wifi configuration, then enable the network, returning promise when connection is verified. - * - * @param {string|number} [ssid] - * @param {boolean} [bindAll=false] - Whether or not to bind all connections from app, through WiFi connection - * @param {string} [password=] - * @param password - * @param {string} [algorithm=NONE] - WPA, WPA (for WPA2), WEP or NONE (NONE by default) - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['Android'], - }) - connect(ssid: string | number, bindAll?: boolean, password?: string, algorithm?: string): Promise { - return; - } - - /** - * Disconnect (current if SSID not supplied) - * - * This method, if passed an SSID, will first disable the network, and then remove it from the device. To only "disconnect" (ie disable in android), - * call WifiWizard2.disable() instead of disconnect. - * - * @param {string|number} [ssid=all] - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['Android'], - }) - disconnect(ssid: string | number): Promise { - return; - } - - /** - * Enable Network - * - * @param {string|number} [ssid] - * @param {boolean} [bindAll=false] - Whether or not to bind all network requests to this wifi network - * @param {boolean} [waitForConnection=false] - Whether or not to wait before resolving promise until connection to wifi is verified - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['Android'], - }) - enable(ssid: string | number, bindAll?: boolean, waitForConnection?: boolean): Promise { - return; - } - - /** - * Disable Network - * - * @param {string|number} [ssid] - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['Android'], - }) - disable(ssid: string | number): Promise { - return; - } - - /** - * Reconnect to the currently active access point, even if we are already connected. - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['Android'], - }) - reassociate(): Promise { - return; - } - - /** - * Reconnect to the currently active access point, if we are currently disconnected. - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['Android'], - }) - reconnect(): Promise { - return; - } - - /** - * Returns currently configured networks - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - listNetworks(): Promise { - return; - } - - /** - * Start network scan and return results - * - * @param options - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - scan(options?: WifiScanOptions): Promise { - return; - } - - /** - * Start wifi network scan (results can be retrieved with getScanResults) - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - startScan(): Promise { - return; - } - - /** - * Get wifi scan results (must call startScan first, or just use scan()) - * - * @param options - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - getScanResults(options: WifiScanResultsOptions): Promise { - return; - } - - /** - * Check if WiFi is enabled - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - isWifiEnabled(): Promise { - return; - } - - /** - * Enable or Disable WiFi - * - * @param enabled - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['Android'], - }) - setWifiEnabled(enabled: boolean): Promise { - return; - } - - /** - * Enable WiFi - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['Android'], - }) - enableWifi(): Promise { - return; - } - - /** - * Disable WiFi - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - platforms: ['Android'], - }) - disableWifi(): Promise { - return; - } - - /** - * Unbind Network - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - resetBindAll(): Promise { - return; - } - - /** - * Bind Network - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - setBindAll(): Promise { - return; - } - - /** - * Get Wifi Router IP from DHCP - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - getWifiRouterIP(): Promise { - return; - } - - /** - * Get Wifi IP - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - getWifiIP(): Promise { - return; - } - - /** - * Get Wifi IP and Subnet Address - * - * This method returns a JSON object similar to: { "ip": "0.0.0.0", "subnet": "0.0.0.0" } - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - getWifiIPInfo(): Promise { - return; - } - - /** - * Get Network ID from SSID - * - * @param {string|number} [ssid] - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - getSSIDNetworkID(ssid: string | number): Promise { - return; - } - - /** - * Get currently connected network ID - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - getConnectedNetworkID(): Promise { - return; - } - - /** - * Get currently connected network SSID - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - getConnectedSSID(): Promise { - return; - } - - /** - * Get currently connected network BSSID/MAC - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - getConnectedBSSID(): Promise { - return; - } - - /** - * Check if current WiFi connection has connection to the internet - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - isConnectedToInternet(): Promise { - return; - } - - /** - * Check if we can ping current WiFi router IP address - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - canPingWifiRouter(): Promise { - return; - } - - /** - * Check if we can connect via HTTP current WiFi router IP address - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - canConnectToRouter(): Promise { - return; - } - - /** - * Check if current WiFi connection can connect to internet (checks connection to google.com) - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - canConnectToInternet(): Promise { - return; - } - - /** - * Request ACCESS_FINE_LOCATION permission - * - * This permission is required by Android to return scan results, you can manually request it prior to running `scan` - * or this plugin will automatically do it when the scan is ran. - * - * @returns {Promise} - */ - @Cordova({ - otherPromise: true, - }) - requestPermission(): Promise { - return; - } - - /** - * Format WiFi configuration for Android Devices - * - * @param {string|number} [ssid] - * @param {string} [password] - * @param {string} [algorithm] - * @param {boolean} [isHiddenSSID] - * @returns {WifiConfig|boolean} - */ - @CordovaFunctionOverride() - formatWifiConfig( - ssid: string | number, - password: string, - algorithm: string, - isHiddenSSID: boolean - ): WifiConfig | boolean { - return; - } - - /** - * Format WPA WiFi configuration for Android Devices - * - * @param {string|number} [ssid] - * @param {string} password - * @param {boolean} isHiddenSSID - * @returns {WifiConfig|boolean} - */ - @CordovaFunctionOverride() - formatWPAConfig(ssid: string | number, password: string, isHiddenSSID: boolean): WifiConfig | boolean { - return; - } - - /** - * Format WiFi SSID String - * - * @param ssid - * @returns {*} - */ - @CordovaFunctionOverride() - formatWifiString(ssid: string | number): string | number { - return; - } - - /** - * Synchronous Sleep/Timeout `await this.timeout()` - * - * @param delay the amount of time to wait (default 2 seconds) - */ - @CordovaFunctionOverride() - timeout(delay?: number): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/wonderpush/index.ts b/src/@awesome-cordova-plugins/plugins/wonderpush/index.ts deleted file mode 100644 index a8c251c2..00000000 --- a/src/@awesome-cordova-plugins/plugins/wonderpush/index.ts +++ /dev/null @@ -1,736 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Plugin, Cordova, AwesomeCordovaNativePlugin, getPromise } from '@awesome-cordova-plugins/core'; - -export interface WonderPushDelegate { - urlForDeepLink(url: string, callback: (url?: string) => void): void; -} - -export interface WonderPushChannel { - id: string; - groupId?: string; - name?: string; - description?: string; - bypassDnd?: boolean; - showBadge?: boolean; - importance?: number; - lights?: boolean; - lightColor?: number; - vibrate?: boolean; - sound?: boolean; - soundUri?: string; - lockscreenVisibility?: number; - vibrateInSilentMode?: boolean; - color?: number; - localOnly?: boolean; -} - -export interface WonderPushChannelGroup { - id: string; - name?: string; -} - -class NestedObject { - pluginObj: any; - constructor(pluginObj: any) { - this.pluginObj = pluginObj; - } - - wrap(functionName: string, args: any[]): Promise { - const plugin = WonderPush.getPlugin(); - const userPreferences = plugin ? plugin.UserPreferences : null; - if (!plugin || !userPreferences || !userPreferences[functionName]) { - return getPromise((res, rej) => { - rej(new Error('Could not find plugin')); - }); - } - return getPromise((res, rej) => { - userPreferences[functionName].apply(userPreferences, [...args, res]); - }); - } -} - -export class UserPreferencesMethods extends NestedObject { - /** - * Get the default channel id - * - * @returns {Promise} - */ - getDefaultChannelId(): Promise { - return this.wrap('getDefaultChannelId', []); - } - - /** - * Set the default channel id - * - * @param {string} id - * @returns {Promise} - */ - setDefaultChannelId(id: string): Promise { - return this.wrap('setDefaultChannelId', [id]); - } - - /** - * Get a channel group - * - * @param {string} groupId - * @returns {Promise} - */ - getChannelGroup(groupId: string): Promise { - return this.wrap('getChannelGroup', [groupId]); - } - - /** - * Get a channel - * - * @param {string} channelId - * @returns {Promise} - */ - getChannel(channelId: string): Promise { - return this.wrap('getChannel', [channelId]); - } - - /** - * Create, update and remove channel existing groups to match the given channel groups - * - * @param {WonderPushChannelGroup[]} channelGroups - * @returns {Promise} - */ - setChannelGroups(channelGroups: WonderPushChannelGroup[]): Promise { - return this.wrap('setChannelGroups', [channelGroups]); - } - - /** - * Create, update and remove channels to match the given channels - * - * @param {WonderPushChannel[]} channels - * @returns {Promise} - */ - setChannels(channels: WonderPushChannel[]): Promise { - return this.wrap('setChannels', [channels]); - } - - /** - * Create or update a channel group - * - * @param {WonderPushChannelGroup} channelGroup - * @returns {Promise} - */ - putChannelGroup(channelGroup: WonderPushChannelGroup): Promise { - return this.wrap('putChannelGroup', [channelGroup]); - } - - /** - * Create or update a channel - * - * @param {WonderPushChannel} channel - * @returns {Promise} - */ - putChannel(channel: WonderPushChannel): Promise { - return this.wrap('putChannel', [channel]); - } - - /** - * Remove a channel group - * - * @param {string} groupId - * @returns {Promise} - */ - removeChannelGroup(groupId: string): Promise { - return this.wrap('removeChannelGroup', [groupId]); - } - - /** - * Remove a channel - * - * @param {string} channelId - * @returns {Promise} - */ - removeChannel(channelId: string): Promise { - return this.wrap('removeChannel', [channelId]); - } -} - -/** - * @name Push Notifications - WonderPush - * @description - * - * Send unlimited push notifications to iOS and Android devices. - * - * Get started in minutes: [Ionic Quickstart Guide](https://docs.wonderpush.com/docs/ionic-quickstart). - * - * Advanced segmentation, automation and personalization of push messages for €1 per 1000 subscribers. - * - * Requires the Cordova plugin `wonderpush-cordova-sdk`. - * - * [WonderPush push notifications](https://www.wonderpush.com) are the most effective way - * to retain your users and grow your audience while remaining fully GDPR compliant. - * @usage - * ```typescript - * import { WonderPush } from '@awesome-cordova-plugins/wonderpush'; - * - * - * constructor(private wonderPush: WonderPush) { } - * - * ... - * - * // Subscribe user - * this.wonderPush.subscribeToNotifications() - * .then(() => console.log("User subscribed to notifications")) - * .catch((error: any) => console.error(error)); - * - * - * // Send an event (a purchase in this example) - * this.wonderPush.sendEvent('purchase', { - * float_price: 12.99, - * string_sku: "X123456" - * }); - * - * // Tag users (as customers) - * this.wonderPush.addTag('customer'); - * - * // Personalize - * // 1. Store user details. - * // 2. Use those details to create segments. - * // 3. Include those details in your notifications. - * this.wonderPush.putProperties({ - * string_name: 'John D.', - * int_age: 24 - * }); - * - * // GDPR - * // 1. set REQUIRES_USER_CONSENT=true to enable GDPR compliance. - * // 2. WonderPush doesn't start until setUserConsent(true) is called. - * const onClick = (userConsent: boolean) => this.wonderPush.setUserConsent(userConsent); - * - * // Listen to notification clicks - * document.addEventListener('wonderpush.notificationOpen', function(event) { - * console.log('Notification opened', event.notification); - * if (event.notificationType === 'data') { - * console.log('Silent notification', event.notification); - * } - * }); - * ``` - * @interfaces - * WonderPushChannel - * WonderPushChannelGroup - */ -@Plugin({ - pluginName: 'WonderPush', - plugin: 'wonderpush-cordova-sdk', - pluginRef: 'WonderPush', - repo: 'https://github.com/wonderpush/wonderpush-cordova-sdk', - install: - 'ionic cordova plugin add wonderpush-cordova-sdk --variable CLIENT_ID=YOUR_CLIENT_ID --variable CLIENT_SECRET=YOUR_CLIENT_SECRET ', - installVariables: ['CLIENT_ID', 'CLIENT_SECRET'], - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class WonderPush extends AwesomeCordovaNativePlugin { - /** - * Sets the user id, used to identify a single identity across multiple devices, - * and to correctly identify multiple users on a single device. - * - * If not called, the last used user id it assumed. Defaulting to `null` if none is known. - * - * Upon changing userId, the access token is wiped, so avoid unnecessary calls, like calling with `null` - * just before calling with a user id. - * - * @param {?string} userId - The user id, unique to your application. - * Use `null` for anonymous users. - * - * You are strongly encouraged to use your own unique internal identifier. - * @returns {Promise} - */ - - @Cordova() - setUserId(userId: string | null): Promise { - return; - } - - /** - * Controls native SDK logging. - * - * @param {boolean} enabled - Whether to enable logs. - * @returns {Promise} - */ - @Cordova() - setLogging(enabled: boolean): Promise { - return; - } - - /** - * Sets up a delegate for tighter integration, or removes it. - * - * @param {?WonderPushDelegate} delegate - The delegate to set, or `null` to remove it. - * @returns {Promise} - */ - @Cordova() - setDelegate(delegate: WonderPushDelegate | null): Promise { - return; - } - - /** - * Gets the current delegate. - * - * @returns {Promise} A promise with the delegate of null - */ - @Cordova() - getDelegate(): Promise { - return; - } - - /** - * Returns the userId currently in use, `null` by default. - * - * @returns {Promise} A promise with the user ID or null - */ - @Cordova() - getUserId(): Promise { - return; - } - - /** - * Returns the installationId identifying your application on a device, bond to a specific userId. - * If you want to store this information on your servers, keep the corresponding userId with it. - * Will return `null` until the SDK is properly initialized. - * - * @returns {Promise} A promise with the installation ID or null - */ - @Cordova() - getInstallationId(): Promise { - return; - } - - /** - * Returns the unique device identifier - * - * @returns {Promise} A promise with the device ID or null - */ - @Cordova() - getDeviceId(): Promise { - return; - } - - /** - * Returns the push token. - * - * @returns {Promise} A promise with the push token or `null` - */ - @Cordova() - getPushToken(): Promise { - return; - } - - /** - * Returns the currently used access token. - * Returns `null` until the SDK is properly initialized. - * This together with your client secret gives entire control to the current installation and associated user, you should not disclose it unnecessarily. - * - * @returns {Promise} - */ - @Cordova() - getAccessToken(): Promise { - return; - } - - /** - * Send an event to be tracked to WonderPush. - * - * @param {string} type - The event type, or name. Event types starting with an `@` character are reserved. - * @param {?object} [attributes] - An object containing custom properties to be attached to the event. - * The keys should be prefixed according to the type of their values. - * You can find the details in the [Concepts > Custom fields](https://www.wonderpush.com/docs/guide/custom-fields) section of the documentation. - * @returns {Promise} - */ - @Cordova() - trackEvent(type: string, attributes: { [key: string]: any }): Promise { - return; - } - - /** - * Adds one or more tags to the installation. - * - * @param {string|string[]} tag - The tags to add to the installation. You can use either a single string argument or an array of strings. - * @returns {Promise} - */ - @Cordova() - addTag(tag: string | string[]): Promise { - return; - } - - /** - * Removes one or more tags from the installation. - * - * @param {string|string[]} tag - The tags to remove from the installation. You can use either a single string argument or an array of strings. - * @returns {Promise} - */ - @Cordova() - removeTag(tag: string | string[]): Promise { - return; - } - - /** - * Removes all tags from the installation. - * - * @returns {Promise} - */ - @Cordova() - removeAllTags(): Promise { - return; - } - - /** - * Returns all the tags of the installation. - * - * @returns {Promise} - */ - @Cordova() - getTags(): Promise { - return; - } - - /** - * Tests whether the installation has the given tag attached to it. - * - * @param {string} tag - The tag to test. - * @returns {Promise} - */ - @Cordova() - hasTag(tag: string): Promise { - return; - } - - /** - * Sets the value to a given installation property. - * - * The previous value is replaced entirely. - * Setting `undefined` or `null` has the same effect as {@link cordova.plugins.WonderPush#unsetProperty}. - * - * @param {string} field - The name of the property to set - * @param value - * @returns {Promise} - */ - @Cordova() - setProperty(field: string, value: any): Promise { - return; - } - - /** - * Removes the value of a given installation property. - * - * The previous value is replaced with `null`. - * - * @param {string} field - The name of the property - * @returns {Promise} - */ - @Cordova() - unsetProperty(field: string): Promise { - return; - } - - /** - * Adds the value to a given installation property. - * - * The stored value is made an array if not already one. - * If the given value is an array, all its values are added. - * If a value is already present in the stored value, it won't be added. - * - * @param {string} field - The name of the property - * @param value - * @returns {Promise} - */ - @Cordova() - addProperty(field: string, value: any): Promise { - return; - } - - /** - * Removes the value from a given installation property. - * - * The stored value is made an array if not already one. - * If the given value is an array, all its values are removed. - * If a value is present multiple times in the stored value, they will all be removed. - * - * @param {string} field - The name of the property - * @param value - * @returns {Promise} - */ - @Cordova() - removeProperty(field: string, value: any): Promise { - return; - } - - /** - * Returns the value of a given installation property. - * - * If the property stores an array, only the first value is returned. - * This way you don't have to deal with potential arrays if that property is not supposed to hold one. - * Returns `null` if the property is absent or has an empty array value. - * - * @param {string} field - The name of the property to read values from - * @returns {Promise} - */ - @Cordova() - getPropertyValue(field: string): Promise { - return; - } - - /** - * Returns an array of the values of a given installation property. - * - * If the property does not store an array, an array is returned nevertheless. - * This way you don't have to deal with potential scalar values if that property is supposed to hold an array. - * Returns an empty array instead of `null` if the property is absent. - * Returns an array wrapping any scalar value held by the property. - * - * @param {string} field - The name of the property to read values from - * @returns {Promise} - */ - @Cordova() - getPropertyValues(field: string): Promise { - return; - } - - /** - * Returns the latest known custom properties attached to the current installation object stored by WonderPush. - * - * @returns {Promise<{[p: string]: any}>} - */ - @Cordova() - getProperties(): Promise<{ [key: string]: any }> { - return; - } - - /** - * Updates the properties attached to the current installation object stored by WonderPush. - * - * In order to remove a value, use `null`. - * - * @param {{[p: string]: any}} properties. The keys should be prefixed according to the type of their values. You can find the details in the [Segmentation > Properties](https://docs.wonderpush.com/docs/properties#section-custom-properties) section of the documentation. - * @returns {Promise} - */ - @Cordova() - putProperties(properties: { [key: string]: any }): Promise { - return; - } - - /** - * Subscribes to push notification and registers the device token with WondePush. - * - * On iOS, you **must** call the following method at least once to make the notification visible to the user. - * - * - You can call this method multiple times. The user is only prompted for permission by iOS once. - * - There is no need to call this method if the permission has already been granted, but it does not harm either. - * - If the permission has been denied in the OS, the user will stay soft opt-out. - * - * Because in iOS you only have *one* chance for prompting the user, you should find a good timing for that. - * For a start, you can systematically call it when the application starts, so that the user will be prompted directly at the first launch. - * - * @returns {Promise} Returns a promise that resolves upon successful subscription - */ - @Cordova() - subscribeToNotifications(): Promise { - return; - } - - /** - * Returns whether the notifications are enabled. - * - * @returns {Promise} - */ - @Cordova() - isSubscribedToNotifications(): Promise { - return; - } - - /** - * Unsubscribes from push notification. - * This method marks the user as soft opt-out. - * - * @returns {Promise} - */ - @Cordova() - unsubscribeFromNotifications(): Promise { - return; - } - - /** - * Reads user consent state. - * Returns undefined if no explicit consent was set. - * - * @returns {Promise} - */ - @Cordova() - getUserConsent(): Promise { - return; - } - - /** - * Provides or withdraws user consent. - * If the `requiresUserConsent` initialization option is true, - * the whole SDK is paused and no data is sent to WonderPush, until consent is provided. - * - * @param {boolean} consent - - * @returns {Promise} - */ - @Cordova() - setUserConsent(consent: boolean): Promise { - return; - } - - /** - * Remove any local storage and ask the WonderPush servers to delete any data associated with the all local installations and related users. - * - * @returns {Promise} - */ - @Cordova() - clearAllData(): Promise { - return; - } - - /** - * Ask the WonderPush servers to delete any event associated with the all local installations. - * - * @returns {Promise} - */ - @Cordova() - clearEventsHistory(): Promise { - return; - } - - /** - * Ask the WonderPush servers to delete any custom data associated with the all local installations and related users. - * - * @returns {Promise} - */ - @Cordova() - clearPreferences(): Promise { - return; - } - - /** - * Initiates the download of all user remote and local data. - * - * @returns {Promise} - */ - @Cordova() - downloadAllData(): Promise { - return; - } - - UserPreferences = new UserPreferencesMethods(this); - - /** - * Gets the user's country, either as previously stored, or as guessed from the system. - * @returns {Promise} - */ - @Cordova() - getCountry(): Promise { - return; - } - - /** - * Overrides the user's country. You should use an ISO 3166-1 alpha-2 country code. Defaults to getting the country code from the system default locale. - * Use `null` to disable the override. - * @param {string} country - * @returns {Promise} - */ - @Cordova() - setCountry(country: string): Promise { - return; - } - - /** - * Gets the user's currency, either as previously stored, or as guessed from the system. - * @returns {Promise} - */ - @Cordova() - getCurrency(): Promise { - return; - } - - /** - * Overrides the user's currency. You should use an ISO 4217 currency code. Defaults to getting the currency code from the system default locale. - * Use `null` to disable the override. - * @param {string} currency - - * @returns {Promise} - */ - @Cordova() - setCurrency(currency: string): Promise { - return; - } - - /** - * Gets the user's locale, either as previously stored, or as guessed from the system. - * @returns {Promise} - */ - @Cordova() - getLocale(): Promise { - return; - } - - /** - * Overrides the user's locale. - * You should use an `xx-XX` form of RFC 1766, composed of a lowercase ISO 639-1 language code, an underscore or a dash, and an uppercase ISO 3166-1 alpha-2 country code. - * Defaults to getting the locale code from the system default locale. - * Use `null` to disable the override. - * @param {string} locale - - * @returns {Promise} - */ - @Cordova() - setLocale(locale: string): Promise { - return; - } - - /** - * Gets the user's time zone, either as previously stored, or as guessed from the system. - * @returns {Promise} - */ - @Cordova() - getTimeZone(): Promise { - return; - } - - /** - * You should use an IANA time zone database codes, `Continent/Country` style preferably, abbreviations like `CET`, `PST`, `UTC`, which have the drawback of changing on daylight saving transitions. - * Defaults to getting the time zone code from the system default locale. - * Use `null` to disable the override. - * @param {string} timeZone - - * @returns {Promise} - */ - @Cordova() - setTimeZone(timeZone: string): Promise { - return; - } - - /** - * Enables the collection of the user's geolocation. - * @returns {Promise} - */ - @Cordova() - enableGeolocation(): Promise { - return; - } - - /** - * Disables the collection of the user's geolocation. - * @returns {Promise} - */ - @Cordova() - disableGeolocation(): Promise { - return; - } - - /** - * Overrides the user's geolocation. - * Using this method you can have the user's location be set to wherever you want. - * This may be useful to use a pre-recorded location. - * @param {number} latitude - * @param {number} longitude - * @returns {Promise} - */ - @Cordova() - setGeolocation(latitude: number, longitude: number): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/youtube-video-player/index.ts b/src/@awesome-cordova-plugins/plugins/youtube-video-player/index.ts deleted file mode 100644 index 8b301f32..00000000 --- a/src/@awesome-cordova-plugins/plugins/youtube-video-player/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -/** - * @name Youtube Video Player - * @description - * Plays YouTube videos in Native YouTube App - * @usage - * For Android 5.0+ you will need to add the following to config.xml - * ```xml - * - * ``` - * For more information: https://developers.google.com/youtube/v3/getting-started - * - * - * ```typescript - * import { YoutubeVideoPlayer } from '@awesome-cordova-plugins/youtube-video-player/ngx'; - * - * constructor(private youtube: YoutubeVideoPlayer) { } - * - * ... - * - * - * this.youtube.openVideo('myvideoid'); - * - * ``` - */ -@Plugin({ - pluginName: 'YoutubeVideoPlayer', - plugin: 'cordova-plugin-youtube-video-player', - pluginRef: 'YoutubeVideoPlayer', - repo: 'https://github.com/ihadeed/CordovaYoutubeVideoPlayer', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class YoutubeVideoPlayer extends AwesomeCordovaNativePlugin { - /** - * Plays a YouTube video - * - * @param videoId {string} Video ID - */ - @Cordova({ sync: true }) - openVideo(videoId: string): void {} -} diff --git a/src/@awesome-cordova-plugins/plugins/zbar/index.ts b/src/@awesome-cordova-plugins/plugins/zbar/index.ts deleted file mode 100644 index 974c7d61..00000000 --- a/src/@awesome-cordova-plugins/plugins/zbar/index.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -export interface ZBarOptions { - /** - * A string representing the title text (Android only). - * Default: "Scan QR Code" - */ - text_title?: string; - - /** - * A string representing the instruction text (Android only). - * Default: "Please point your camera at the QR code." - */ - text_instructions?: string; - - /** - * A string defining the active camera when opening the scanner. - * Possible values: "front", "back" - * Default: "back" - */ - camera?: string; - - /** - * A string defining the state of the flash. - * Possible values: "on", "off", "auto" - * Default: "auto" - */ - flash?: string; - - /** - * A boolean to show or hide a line in the center of the scanner. - * Default: true - */ - drawSight?: boolean; -} - -/** - * @name ZBar - * @description - * The ZBar Scanner Plugin allows you to scan 2d barcodes. - * - * Requires Cordova plugin: `cordova-plugin-cszbar`. For more info, please see the [zBar plugin docs](https://github.com/tjwoon/csZBar). - * @usage - * ```typescript - * import { ZBar, ZBarOptions } from '@awesome-cordova-plugins/zbar/ngx'; - * - * constructor(private zbar: ZBar) { } - * - * ... - * - * let options: ZBarOptions = { - * flash: 'off', - * drawSight: false - * } - * - * this.zbar.scan(options) - * .then(result => { - * console.log(result); // Scanned code - * }) - * .catch(error => { - * console.log(error); // Error message - * }); - * - * ``` - * @interfaces - * ZBarOptions - */ -@Plugin({ - pluginName: 'ZBar', - plugin: 'cordova-plugin-cszbar', - pluginRef: 'cloudSky.zBar', - repo: 'https://github.com/tjwoon/csZBar', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class ZBar extends AwesomeCordovaNativePlugin { - /** - * Open the scanner - * - * @param options { ZBarOptions } Scan options - * @returns {Promise} Returns a Promise that resolves with the scanned string, or rejects with an error. - */ - @Cordova() - scan(options: ZBarOptions): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/zeroconf/index.ts b/src/@awesome-cordova-plugins/plugins/zeroconf/index.ts deleted file mode 100644 index b6082990..00000000 --- a/src/@awesome-cordova-plugins/plugins/zeroconf/index.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; -import { Observable } from 'rxjs'; - -export interface ZeroconfService { - domain: string; - type: string; - name: string; - port: number; - hostname: string; - ipv4Addresses: string[]; - ipv6Addresses: string[]; - txtRecord: any; -} - -export interface ZeroconfResult { - action: 'registered' | 'added' | 'removed' | 'resolved'; - service: ZeroconfService; -} - -/** - * @name Zeroconf - * @description - * This plugin allows you to browse and publish Zeroconf/Bonjour/mDNS services. - * @usage - * ```typescript - * import { Zeroconf } from '@awesome-cordova-plugins/zeroconf/ngx'; - * - * constructor(private zeroconf: Zeroconf) { } - * - * ... - * - * // watch for services of a specified type - * this.zeroconf.watch('_http._tcp.', 'local.').subscribe(result => { - * if (result.action == 'added') { - * console.log('service added', result.service); - * } else { - * console.log('service removed', result.service); - * } - * }); - * - * // publish a zeroconf service of your own - * this.zeroconf.register('_http._tcp.', 'local.', 'Becvert\'s iPad', 80, { - * 'foo': 'bar' - * }).then(result => { - * console.log('Service registered', result.service); - * }); - * - * - * // unregister your service - * this.zeroconf.unregister('_http._tcp.', 'local.', 'Becvert\'s iPad'); - * ``` - */ -@Plugin({ - pluginName: 'Zeroconf', - plugin: 'cordova-plugin-zeroconf', - pluginRef: 'cordova.plugins.zeroconf', - repo: 'https://github.com/becvert/cordova-plugin-zeroconf', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Zeroconf extends AwesomeCordovaNativePlugin { - /** - * Returns this device's hostname. - * - * @returns {Promise} - */ - @Cordova() - getHostname(): Promise { - return; - } - - /** - * Publishes a new service. - * - * @param type {string} Service type name, e.g. "_http._tcp". - * @param domain {string} Domain scope of the service, typically "local.". - * @param name {string} Unqualified service instance name. - * @param port {number} Local port on which the service runs. - * @param txtRecord {any} Arbitrary key/value pairs describing the service. - * @returns {Promise} Returns a Promise that resolves with the registered service. - */ - @Cordova() - register(type: string, domain: string, name: string, port: number, txtRecord: any): Promise { - return; - } - - /** - * Unregisters a service. - * - * @param type {string} Service type name, e.g. "_http._tcp". - * @param domain {string} Domain scope of the service, typically "local.". - * @param name {string} Unqualified service instance name. - * @returns {Promise} - */ - @Cordova() - unregister(type: string, domain: string, name: string): Promise { - return; - } - - /** - * Unregisters all published services. - * - * @returns {Promise} - */ - @Cordova() - stop(): Promise { - return; - } - - /** - * Starts watching for services of the specified type. - * - * @param type {string} Service type name, e.g. "_http._tcp". - * @param domain {string} Domain scope of the service, typically "local.". - * @returns {Observable} Returns an Observable that notifies of each service added or removed. - */ - @Cordova({ - observable: true, - clearFunction: 'unwatch', - clearWithArgs: true, - }) - watch(type: string, domain: string): Observable { - return; - } - - /** - * Stops watching for services of the specified type. - * - * @param type {string} Service type name, e.g. "_http._tcp". - * @param domain {string} Domain scope of the service, typically "local.". - * @returns {Promise} - */ - @Cordova() - unwatch(type: string, domain: string): Promise { - return; - } - - /** - * Closes the service browser and stops watching. - * - * @returns {Promise} - */ - @Cordova() - close(): Promise { - return; - } - - /** - * Re-initializes the plugin to clean service & browser state. - * - * @returns {Promise} - */ - @Cordova() - reInit(): Promise { - return; - } - /** - * Family of addresses to register: ipv4, ipv6 or any. - */ - registerAddressFamily: 'ipv4' | 'ipv6' | 'any'; - /** - * Family of addresses to watch for: ipv4, ipv6 or any. - */ - watchAddressFamily: 'ipv4' | 'ipv6' | 'any'; -} diff --git a/src/@awesome-cordova-plugins/plugins/zip/index.ts b/src/@awesome-cordova-plugins/plugins/zip/index.ts deleted file mode 100644 index cf6cd4fb..00000000 --- a/src/@awesome-cordova-plugins/plugins/zip/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { AwesomeCordovaNativePlugin, Cordova, Plugin } from '@awesome-cordova-plugins/core'; - -import { Injectable } from '@angular/core'; - -/** - * @name Zip - * @description - * A Cordova plugin to unzip files in Android and iOS. - * @usage - * ```typescript - * import { Zip } from '@awesome-cordova-plugins/zip/nx' - * ... - * - * const result = await Zip.unzip('path/to/source.zip', 'path/to/dest', (progress) => - * console.log('Unzipping, ' + Math.round((progress.loaded / progress.total) * 100) + '%') - * ); - * - * if(result === 0) console.log('SUCCESS'); - * if(result === -1) console.log('FAILED'); - * - * ``` - */ -@Plugin({ - pluginName: 'Zip', - plugin: 'cordova-plugin-zip', - pluginRef: 'zip', - repo: 'https://github.com/MobileChromeApps/cordova-plugin-zip', - platforms: ['Android', 'iOS'], -}) -@Injectable() -export class Zip extends AwesomeCordovaNativePlugin { - /** - * Extracts files from a ZIP archive - * @param {string} sourceZip Source ZIP file - * @param {string} destFolder Destination folder - * @param {Function} onProgress optional callback to be called on progress update - * @returns {Promise} returns a promise that resolves with a number. 0 is success, -1 is error - */ - @Cordova() - unzip(sourceZip: string, destFolder: string, onProgress?: Function): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/plugins/zoom/index.ts b/src/@awesome-cordova-plugins/plugins/zoom/index.ts deleted file mode 100755 index 5d71603f..00000000 --- a/src/@awesome-cordova-plugins/plugins/zoom/index.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; - -/** - * @name Zoom - * @description - * A Cordova plugin to use Zoom Video Conferencing services on Cordova applications. - * @usage - * ```typescript - * import { Zoom } from '@awesome-cordova-plugins/zoom'; - * - * - * constructor(private zoomService: Zoom) { } - * - * ... - * - * // Initialize Zoom SDK, need to be called when app fired up. - * this.zoomService.initialize(API_KEY, API_SECRET) - * .then((success: any) => console.log(success)) - * .catch((error: any) => console.log(error)); - * - * // Log user in with Zoom username and password. - * this.zoomService.login(userName, password) - * .then((success: any) => console.log(success)) - * .catch((error: any) => console.log(error)); - * - * // Log user out. - * this.zoomService.logout() - * .then((success: boolean) => console.log(success)) - * .catch((error: any) => console.log(error)); - * - * // Check whether user is logged in. - * this.zoomService.isLoggedIn() - * .then((success: boolean) => console.log(success)) - * .catch((error: any) => console.log(error)); - * - * // meeting options (Only available for Android) - * let options = { - * "no_driving_mode":true, - * "no_invite":true, - * "no_meeting_end_message":true, - * "no_titlebar":false, - * "no_bottom_toolbar":false, - * "no_dial_in_via_phone":true, - * "no_dial_out_to_phone":true, - * "no_disconnect_audio":true, - * "no_share":true, - * "no_audio":true, - * "no_video":true, - * "no_meeting_error_message":true - * }; - * - * // Join meeting. - * this.zoomService.joinMeeting(meetingNumber, meetingPassword, displayName, options) - * .then((success: any) => console.log(success)) - * .catch((error: any) => console.log(error)); - * - * // Start an existing meeting for non-login user. - * this.zoomService.startMeetingWithZAK(meetingNumber, displayName, zoomToken, zoomAccessToken, userId, options) - * .then((success: any) => console.log(success)) - * .catch((error: any) => console.log(error)); - * - * // Start an existing meeting for logged in user. - * this.zoomService.startMeeting(meetingNumber, vanityId, options) - * .then((success: any) => console.log(success)) - * .catch((error: any) => console.log(error)); - * - * // Start an instant meeting for logged in user. - * this.zoomService.startInstantMeeting() - * .then((success: anu) => console.log(success)) - * .catch((error: any) => console.log(error)); - * - * // Set language. - * this.zoomService.setLanguage("en-US") - * .then((success: any) => console.log(success)) - * .catch((error: any) => console.log(error)); - * ``` - */ -@Plugin({ - pluginName: 'Zoom', - plugin: 'cordova.plugin.zoom', // npm package name, example: cordova-plugin-camera - pluginRef: 'cordova.plugins.Zoom', // the variable reference to call the plugin, example: navigator.geolocation - repo: 'https://github.com/zoom/zoom-sdk-ionic', // the github repository URL for the plugin - platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] -}) -@Injectable() -export class Zoom extends AwesomeCordovaNativePlugin { - /** - * Initialize Zoom SDK. - * - * @param appKey Zoom SDK app key. - * @param appSecret Zoom SDK app secret. - * @returns {Promise} - */ - @Cordova() - initialize(appKey: string, appSecret: string): Promise { - return; - } - - /** - * Log user in with Zoom username and password. - * - * @param username user's Zoom username. - * @param password user's Zoom password. - * @returns {Promise} - */ - @Cordova() - login(username: string, password: string): Promise { - return; - } - - /** - * Log user out. - * - * @returns {Promise} true if logout success / false if failed. - */ - @Cordova() - logout(): Promise { - return; - } - - /** - * Check whether the user is logged in. - * - * @returns {Promise} true if is logged in / false if not. - */ - @Cordova() - isLoggedIn(): Promise { - return; - } - - /** - * Join a meeting for logged in user. - * - * @param meetingNo meeting number. - * @param meetingPassword meeting password. - * @param displayName - * @param options meeting options. - * @returns {Promise} - */ - @Cordova() - joinMeeting(meetingNo: string, meetingPassword: string, displayName: string, options: any): Promise { - return; - } - - /** - * Start a meeting for non-login user. - * - * @param meetingNo meeting number. - * @param displayName display name shown in meeting. - * @param zoomToken zoom token retrieved from Zoom Rest API. - * @param zoomAccessToken zoom access token retrieved from Zoom Rest API. - * @param userId user ID retrieved from Zoom Rest API. - * @param options meeting options. - * @returns {Promise} - */ - @Cordova() - startMeetingWithZAK( - meetingNo: string, - displayName: string, - zoomToken: string, - zoomAccessToken: string, - userId: string, - options: any - ): Promise { - return; - } - - /** - * Start a meeting for logged in user. - * - * @param meetingNo meeting number. - * @param options meeting option. - * @returns {Promise} - */ - @Cordova() - startMeeting(meetingNo: string, options: any): Promise { - return; - } - - /** - * Start an instant meeting for logged in user. - * - * @param options meeting option. - * @returns {Promise} - */ - @Cordova() - startInstantMeeting(options: any): Promise { - return; - } - - /** - * Set language. - * - * @param languageTag language name. - * @returns {Promise} - */ - @Cordova() - setLocale(languageTag: string): Promise { - return; - } -} diff --git a/src/@awesome-cordova-plugins/shuto/app-minimize/index.ts b/src/@awesome-cordova-plugins/shuto/app-minimize/index.ts new file mode 100644 index 00000000..7080de5f --- /dev/null +++ b/src/@awesome-cordova-plugins/shuto/app-minimize/index.ts @@ -0,0 +1,55 @@ +/** + * This is a template for new plugin wrappers + * + * TODO: + * - Add/Change information below + * - Document usage (importing, executing main functionality) + * - Remove any imports that you are not using + * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs and any other docs you added + * - Remove this note + * + */ +import { Injectable } from '@angular/core'; +import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; + +/** + * @name app-minimize + * @description + * This plugin does something + * + * @usage + * ```typescript + * import { AppMinimize } from '@awesome-cordova-plugins/app-minimize'; + * + * + * constructor(private app-minimize: app-minimize) { } + * + * ... + * + * + * this.app-minimize.functionName('Hello', 123) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +@Plugin({ + pluginName: 'AppMinimize', + plugin: 'cordova-plugin-appminimize', // npm package name, example: cordova-plugin-camera + pluginRef: 'plugins.appMinimize', // the variable reference to call the plugin, example: navigator.geolocation + repo: 'https://github.com/tomloprod/cordova-plugin-appminimize', // the github repository URL for the plugin + platforms: ['Android'], // Array of platforms supported, example: ['Android', 'iOS'] +}) +@Injectable() +export class AppMinimize extends AwesomeCordovaNativePlugin { + /** + * This function does something + * @param arg1 {string} Some param to configure something + * @param arg2 {number} Another param to configure something + * @return {Promise} Returns a promise that resolves when something happens + */ + @Cordova() + minimize(): Promise { + return; // We add return; here to avoid any IDE / Compiler errors + } +} diff --git a/src/@awesome-cordova-plugins/shuto/j-push/index.ts b/src/@awesome-cordova-plugins/shuto/j-push/index.ts new file mode 100644 index 00000000..06ecece6 --- /dev/null +++ b/src/@awesome-cordova-plugins/shuto/j-push/index.ts @@ -0,0 +1,230 @@ +export interface TagOptions { + sequence: number; + tags?: Array; +} +export interface AliasOptions { + sequence: number; + alias?: string; +} +import { Injectable } from '@angular/core'; +import { + Plugin, + Cordova, + CordovaProperty, + CordovaInstance, + InstanceProperty, + AwesomeCordovaNativePlugin, +} from '@awesome-cordova-plugins/core'; +import { Observable } from 'rxjs'; + +/** + * @name J Push + * @description + * This plugin does something + * + * @usage + * ```typescript + * import { JPush } from '@awesome-cordova-plugins/j-push'; + * + * + * constructor(private jPush: JPush) { } + * + * ... + * + * + * this.jPush.functionName('Hello', 123) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +@Plugin({ + pluginName: 'JPush', + plugin: 'jpush-phonegap-plugin', // npm package name, example: cordova-plugin-camera + pluginRef: 'JPush', // the variable reference to call the plugin, example: navigator.geolocation + repo: 'git+https://github.com/jpush/jpush-phonegap-plugin.git', // the github repository URL for the plugin + install: 'cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_jpush_appkey', // OPTIONAL install command, in case the plugin requires variables + installVariables: ['APP_KEY'], // OPTIONAL the plugin requires variables + platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] +}) +@Injectable() +export class JPush extends AwesomeCordovaNativePlugin { + /** + * This function does something + * @param arg1 {string} Some param to configure something + * @param arg2 {number} Another param to configure something + * @return {Promise} Returns a promise that resolves when something happens + */ + @Cordova() + functionName(arg1: string, arg2: number): Promise { + return; // We add return; here to avoid any IDE / Compiler errors + } + + @Cordova() + init(): void {} + + @Cordova() + setDebugMode(enable: boolean): void {} + @Cordova() + async getRegistrationID(): Promise { + return; + } + @Cordova() + async stopPush(): Promise { + return; + } + @Cordova() + async resumePush(): Promise { + return; + } + @Cordova() + async isPushStopped(): Promise { + return; + } + @Cordova() + async setTags(params: TagOptions): Promise { + return; + } + @Cordova() + async addTags(params: TagOptions): Promise { + return; + } + @Cordova() + async deleteTags(params: TagOptions): Promise { + return; + } + @Cordova() + async cleanTags(params: TagOptions): Promise { + return; + } + @Cordova() + async getAllTags(params: TagOptions): Promise { + return; + } + /** + * @param params { sequence: number, tag: string } + */ + @Cordova() + async checkTagBindState(params: { sequence: number; tag: string }): Promise { + return; + } + @Cordova() + async setAlias(params: AliasOptions): Promise { + return; + } + @Cordova() + async deleteAlias(params: AliasOptions): Promise { + return; + } + @Cordova() + async getAlias(params: AliasOptions): Promise { + return; + } + /** + * Determinate whether the application notification has been opened. + * + * iOS: 0: closed; >1: opened. + * UIRemoteNotificationTypeNone = 0, + * UIRemoteNotificationTypeBadge = 1 << 0, + * UIRemoteNotificationTypeSound = 1 << 1, + * UIRemoteNotificationTypeAlert = 1 << 2, + * UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3 + * + * Android: 0: closed; 1: opened. + */ + @Cordova() + async getUserNotificationSettings(): Promise { + return; + } + @Cordova() + async clearLocalNotifications(): Promise { + return; + } + @Cordova() + setBadge(badge: number): void {} + @Cordova() + resetBadge(): void {} + @Cordova() + setApplicationIconBadgeNumber(badge: number): void {} + @Cordova() + async getApplicationIconBadgeNumber(): Promise { + return; + } + @Cordova() + addLocalNotificationForIOS( + delayTime: number, + content: string, + badge: number, + identifierKey: string, + extras?: object + ): void {} + @Cordova() + deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: string): void {} + @Cordova() + addDismissActions(actions: Array, categoryId: string): void {} + @Cordova() + addNotificationActions(actions: Array, categoryId: string): void {} + @Cordova() + setLocation(latitude: number, longitude: number): void {} + @Cordova() + startLogPageView(pageName: string): void {} + @Cordova() + stopLogPageView(pageName: string): void {} + @Cordova() + beginLogPageView(pageName: string, duration: number): void {} + @Cordova() + async getConnectionState(): Promise { + return; + } + @Cordova() + async setBasicPushNotificationBuilder(): Promise { + return; + } + @Cordova() + async setCustomPushNotificationBuilder(): Promise { + return; + } + @Cordova() + async clearAllNotification(): Promise { + return; + } + @Cordova() + async clearNotificationById(id: number): Promise { + return; + } + @Cordova() + async setLatestNotificationNum(num: number): Promise { + return; + } + @Cordova() + async addLocalNotification( + builderId: number, + content: string, + title: string, + notificationId: number, + broadcastTime: number, + extras?: string + ): Promise { + return; + } + @Cordova() + async removeLocalNotification(notificationId: number): Promise { + return; + } + @Cordova() + async reportNotificationOpened(msgId: number): Promise { + return; + } + @Cordova() + async requestPermission(): Promise { + return; + } + @Cordova() + async setSilenceTime(startHour: number, startMinute: number, endHour: number, endMinute: number): Promise { + return; + } + @Cordova() + async setPushTime(weekdays: Array, startHour: number, endHour: number): Promise { + return; + } +} diff --git a/src/@awesome-cordova-plugins/shuto/sangforvpn/index.ts b/src/@awesome-cordova-plugins/shuto/sangforvpn/index.ts new file mode 100644 index 00000000..72c283c7 --- /dev/null +++ b/src/@awesome-cordova-plugins/shuto/sangforvpn/index.ts @@ -0,0 +1,147 @@ +/** + * This is a template for new plugin wrappers + * + * TODO: + * - Add/Change information below + * - Document usage (importing, executing main functionality) + * - Remove any imports that you are not using + * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs and any other docs you added + * - Remove this note + * + */ +import { Injectable } from '@angular/core'; +import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; + +/** + * @name Shuto SangforVpnPlugin + * @description + * This plugin does something + * + * @usage + * ```typescript + * import { ShutoZip } from '@shuto-cordova-plugins/zip'; + *import { SFSmsMessage } from 'src/@awesome-cordova-plugins/shuto/sangforvpn/index'; + + * + * constructor(private shutoZip: ShutoZip) { } + * + * ... + * + * + * this.shutoZip.functionName('Hello', 123) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +@Plugin({ + pluginName: 'SangforVpnPlugin', + plugin: 'cordova-plugin-sangforvpn', + pluginRef: 'SangforVpnPlugin', + repo: 'https://m.shuto.cn:8681/public/cordova-plugin-sangforvpn.git', + platforms: ['Android', 'iOS'], +}) +@Injectable() +export class SangforVpnPlugin extends AwesomeCordovaNativePlugin { + SFLogoutType: SFLogoutType; + SFAuthType: SFAuthType; + /** + * 用户名密码认证 + * @param {string} username + * @param {string} password + */ + @Cordova() + startPasswordAuth(username: string, password: string) { + // no code; + } + + onAuthSuccess(callback: (message: SFBaseMessage) => {}) { + window.addEventListener('sangforvpn.onAuthSuccess', callback as any); + } + onAuthFailed(callback: (message: SFBaseMessage) => {}) { + window.addEventListener('sangforvpn.onAuthFailed', callback as any); + } + onAuthProgress(callback: (message: SFBaseMessage & { sfAuthType: number }) => {}) { + window.addEventListener('sangforvpn.onAuthProgress', callback as any); + } + onLogout(callback: (message: SFBaseMessage & { sfLogoutType: number }) => {}) { + window.addEventListener('sangforvpn.onLogout', callback as any); + } + @Cordova() + async startAutoTicket(): Promise<{ success: boolean }> { + return { success: false }; + } + + @Cordova() + async reGetSmsCode(): Promise { + return {} as any as SFSmsMessage; + } + @Cordova() + async reGetRandCode(): Promise { + return ''; + } + @Cordova() + async doSecondAuth(type: number, code: string) { + // no code; + } +} + +export interface SFBaseMessage { + mErrCode: number; + mErrStr: string; + mServerInfo: string; + currentAuthType: number; +} +export interface SFSmsMessage extends SFBaseMessage { + phoneNum: string; + countDown: number; + smsApps: string; + stillValid: boolean; +} + +export class SFLogoutType { + LOGOUT_TYPE_USER_ACTIVE = 0; + LOGOUT_TYPE_TCIKET_AUTH_ERROR = 1; + LOGOUT_TYPE_SERVER_SHUTDOWN = 2; + LOGOUT_TYPE_AUTHOR_ERROR = 3; + LOGOUT_TYPE_OTHERS = 100; +} + +export class SFAuthType { + AUTH_TYPE_UNKNOWN = -1; + AUTH_TYPE_CERTIFICATE = 0; + AUTH_TYPE_PASSWORD = 1; + AUTH_TYPE_SMS = 2; + AUTH_TYPE_SMS2 = 3; + AUTH_TYPE_HARDID = 4; + AUTH_TYPE_SESSION = 16; + AUTH_TYPE_NONE = 17; + AUTH_TYPE_RENEW_PASSWORD = 18; + AUTH_TYPE_RAND = 22; + AUTH_TYPE_SANGFORID = 23; + AUTH_TYPE_QYWECHAT = 24; + AUTH_TYPE_TOKEN_TOTP = 25; + AUTH_TYPE_TOKEN_RADIUS = 26; + AUTH_TYPE_TOKEN_HTTPS = 27; + AUTH_TYPE_AUTH_CHECK = 28; + AUTH_TYPE_PURE_BIND_AUTH_DEVICE = 29; + AUTH_TYPE_APPLY_BIND_AUTH_DEVICE = 30; + AUTH_TYPE_UNBIND_AUTH_DEVICE = 31; + AUTH_TYPE_PURE_TRUST_DEVICE = 32; + AUTH_TYPE_APPLY_TRUST_DEVICE = 33; + AUTH_TYPE_UNBIND_TRUST_DEVICE = 34; + AUTH_TYPE_PRE_ENHANCED = 35; + AUTH_TYPE_FORGET_PWD_PRE = 36; + AUTH_TYPE_FORGET_PWD = 37; + AUTH_TYPE_RESET_PWD = 38; + AUTH_TYPE_CAS = 39; + AUTH_TYPE_CAS_PRE = 40; + AUTH_TYPE_PRIMARY_SMS_PRE = 41; + AUTH_TYPE_PRIMARY_SMS = 42; + AUTH_TYPE_THIRD_CODE = 43; + AUTH_TYPE_TICKET = 2048; + AUTH_TYPE_DINGDING_CODE = 11; + AUTH_TYPE_AUTHOR = 10; + AUTH_TYPE_TOKEN = 7; + AUTH_TYPE_RADIUS = 6; +} diff --git a/src/@awesome-cordova-plugins/shuto/zebra-printer/index.ts b/src/@awesome-cordova-plugins/shuto/zebra-printer/index.ts new file mode 100644 index 00000000..270969e8 --- /dev/null +++ b/src/@awesome-cordova-plugins/shuto/zebra-printer/index.ts @@ -0,0 +1,85 @@ +/** + * This is a template for new plugin wrappers + * + * TODO: + * - Add/Change information below + * - Document usage (importing, executing main functionality) + * - Remove any imports that you are not using + * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs and any other docs you added + * - Remove this note + * + */ +import { Injectable } from '@angular/core'; +import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; + +/** + * @name Shuto ZebraPrinter + * @description + * This plugin does something + * + * @usage + * ```typescript + * import { ShutoZip } from '@shuto-cordova-plugins/zip'; + * + * + * constructor(private shutoZip: ShutoZip) { } + * + * ... + * + * + * this.shutoZip.functionName('Hello', 123) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +export interface Printer { + name: string; + address: string; +} +export interface PrinterStatus { + connected: boolean; + isReadyToPrint?: boolean; + isPaused?: boolean; + isReceiveBufferFull?: boolean; + isRibbonOut?: boolean; + isPaperOut?: boolean; + isHeadTooHot?: boolean; + isHeadOpen?: boolean; + isHeadCold?: boolean; + isPartialFormatInProgress?: boolean; +} +@Plugin({ + pluginName: 'ZebraPrinter', + plugin: 'ca-cleversolutions-zebraprinter', + pluginRef: 'ZebraPrinter', + repo: 'https://m.shuto.cn:8681/public/cordova-zebra-printer.git', + platforms: ['Android', 'iOS'], +}) +@Injectable() +export class ZebraPrinter extends AwesomeCordovaNativePlugin { + @Cordova() + async discover(): Promise> { + return []; + } + @Cordova() + async print(cpcl: string): Promise { + return; + } + @Cordova() + async isConnected(): Promise { + return false; + } + @Cordova() + async printerStatus(): Promise { + return null; + } + @Cordova() + async connect(adress: string): Promise { + return; + } + @Cordova() + async disconnect(): Promise { + return; + } +} diff --git a/src/@awesome-cordova-plugins/plugins/shuto-zip/index.ts b/src/@awesome-cordova-plugins/shuto/zip/index.ts similarity index 95% rename from src/@awesome-cordova-plugins/plugins/shuto-zip/index.ts rename to src/@awesome-cordova-plugins/shuto/zip/index.ts index 3b9a3908..a5e13193 100644 --- a/src/@awesome-cordova-plugins/plugins/shuto-zip/index.ts +++ b/src/@awesome-cordova-plugins/shuto/zip/index.ts @@ -19,7 +19,7 @@ import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-pl * * @usage * ```typescript - * import { ShutoZip } from '@awesome-cordova-plugins/shuto-zip'; + * import { ShutoZip } from '@shuto-cordova-plugins/zip'; * * * constructor(private shutoZip: ShutoZip) { } @@ -34,7 +34,7 @@ import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-pl * ``` */ @Plugin({ - pluginName: 'ShutoZip', + pluginName: 'Zip', plugin: 'cordova-plugin-zip', pluginRef: 'zip', repo: 'https://m.shuto.cn:8681/public/zip-cordova-plugin.git',