From 3ba983aa7f8a3ce382c164929cda37921056cfcc Mon Sep 17 00:00:00 2001 From: sebastian-student <65391737+sebastian-student@users.noreply.github.com> Date: Sun, 3 Dec 2023 20:34:48 +0100 Subject: [PATCH] fix(diagnostic): add LIMITED permissionStatus (#4645) * feat(diagnostics): add missing constants and methods for latest plugin version (#4600) * feat(cordova-plugin-firebase-model): Add new plugin to download and process ML model hosted in firebase. (#4608) * feat(unvired-cordova-sdk): Add new function to regenrate the JWT Token * feat(unvired-cordova-sdk): Add couple of properties to login parameters. * feat(cordova-plugin-firebase-model): Add new plugin for downloading and processing ML model hosted in Firebase. * fix(cordova-plugin-unvired-sdk): revert last set of changes. * fix(cordova-plugin-unvired-sdk): Add two new login properties. * fix(cordova-plugin-firebase-model): Delete the previously added plugin. * Revert "fix(cordova-plugin-firebase-model): Delete the previously added plugin." This reverts commit 86f39dc7e83d82a707c74034a1384602531b34e9. * Revert "fix(cordova-plugin-unvired-sdk): Add two new login properties." This reverts commit a79f31e12e1025b9fdde736e4933ee3a749c18bb. * feat(clevertap): support clevertap-cordova 2.7.0 (#4617) [skip ci] * feat(clevertap): add CleverTap plugin * style(clevertap): cleanup stray lint error * refactor * feat(clevertap): update for latest CleverTap Cordova plugin * chore: Update Repo from Ionic Native Repo * fix: Code Changes for parity SDK-155 * fix: Indentation fixes for SDK-155 * fix: Code Repo fix while updating fork branch * fix: Remove unnecessary adder .scripts Folder * fix: Remove unwanted added folder .circleci * fix: Remove unwanted added File .npmrc * fix: Revert .Github Folder Changes to as per Ionic-Native master * fix: Update changes as per ionic-native master * fix: Code Repo fix while updating fork branch fix: Remove unnecessary adder .scripts Folder fix: Remove unwanted added folder .circleci fix: Remove unwanted added File .npmrc fix: Revert .Github Folder Changes to as per Ionic-Native master fix: Update changes as per ionic-native master * fix(CleverTap): Fix for missing methods issue #3491 * refactor(profile): remove setProfile methods for fb and google * refactor(dynamic variables): remove Product A/B Testing (Dynamic Variables) code * fix(product config): add key param to product config getters * feat(identity): add a new public method getCleverTapID and deprecate existing CleverTapID methods * feat(profile): add public methods to increment/decrement values set via User properties * feat(profile): add public methods to increment/decrement values set via User properties * feat(inapp): add public methods for suspending/discarding & resuming InApp Notifications * feat(inbox): add new api for iOS to delete bulk inbox messages for given message ids * refactor(xiaomi-push): add region as an extra mandatory parameter to setPushXiaomiToken * Update index.ts to support cordova 2.7.0 * Update index.ts --------- Co-authored-by: Peter Wilkniss Co-authored-by: Daniel Sogl Co-authored-by: Darshan Pania Co-authored-by: Surya Co-authored-by: SuryaClevertap <63039490+SuryaClevertap@users.noreply.github.com> Co-authored-by: Piyush Kukadiya Co-authored-by: piyush-kukadiya <61137760+piyush-kukadiya@users.noreply.github.com> * feat(save-dialog): add plugin (#4618) * smtp-client * fix plugin ref * cloud settings * + save-dialog --------- Co-authored-by: Daniel Sogl * fix(diagnostic): fix typo * fix(diagnostic): add LIMITED to permissionStatus --------- Co-authored-by: Dave Alden Co-authored-by: Srinidhi Co-authored-by: AishwaryaNanna <97506871+AishwaryaNanna@users.noreply.github.com> Co-authored-by: Peter Wilkniss Co-authored-by: Daniel Sogl Co-authored-by: Darshan Pania Co-authored-by: Surya Co-authored-by: SuryaClevertap <63039490+SuryaClevertap@users.noreply.github.com> Co-authored-by: Piyush Kukadiya Co-authored-by: piyush-kukadiya <61137760+piyush-kukadiya@users.noreply.github.com> Co-authored-by: marysuon Co-authored-by: Daniel Sogl --- docs/SUMMARY.md | 1 + docs/plugins/save-dialog.md | 18 ++ docs/plugins/save-dialog/README.md | 20 ++ docs/plugins/smtp-client/README.md | 5 +- .../plugins/clevertap/index.ts | 153 +++++++++++++++ .../plugins/diagnostic/index.ts | 180 ++++++++++++++++-- .../plugins/firebase-model/index.ts | 122 ++++++++++++ .../plugins/save-dialog/index.ts | 42 ++++ 8 files changed, 517 insertions(+), 24 deletions(-) create mode 100644 docs/plugins/save-dialog.md create mode 100644 docs/plugins/save-dialog/README.md create mode 100644 src/@awesome-cordova-plugins/plugins/firebase-model/index.ts create mode 100644 src/@awesome-cordova-plugins/plugins/save-dialog/index.ts diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 08169bcc85..2c8170a1d0 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -219,6 +219,7 @@ * [GCDWebServer](plugins/gcdwebserver.md) * [Smtp Client](plugins/smtp-client.md) * [Cashfree PG](plugins/cashfree-pg/README.md) + * [Save Dialog](plugins/save-dialog/README.md) * [Installation](installation.md) * [FAQ](faq.md) diff --git a/docs/plugins/save-dialog.md b/docs/plugins/save-dialog.md new file mode 100644 index 0000000000..d667a7657f --- /dev/null +++ b/docs/plugins/save-dialog.md @@ -0,0 +1,18 @@ +# Save Dialog + +```text +$ ionic cordova plugin add cordova-plugin-save-dialog +$ npm install @awesome-cordova-plugins/save-dialog +``` + +## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/save-dialog/) + +Plugin Repo: [https://github.com/Amphiluke/cordova-plugin-save-dialog](https://github.com/Amphiluke/cordova-plugin-save-dialog) + +This Cordova plugin displays the native Save dialog which allows users to store a file in the selected location. + +## Supported platforms + +* Android +* iOS + diff --git a/docs/plugins/save-dialog/README.md b/docs/plugins/save-dialog/README.md new file mode 100644 index 0000000000..d19e9a0553 --- /dev/null +++ b/docs/plugins/save-dialog/README.md @@ -0,0 +1,20 @@ +# Save Dialog + +```text +$ ionic cordova plugin add cordova-plugin-save-dialog +$ npm install @awesome-cordova-plugins/save-dialog +``` + +## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/save-dialog/) + +Plugin Repo: [https://github.com/Amphiluke/cordova-plugin-save-dialog](https://github.com/Amphiluke/cordova-plugin-save-dialog) + +This Cordova plugin displays the native Save dialog which allows users to store a file in the selected location. + +## Supported platforms + +* Android +* iOS + + + diff --git a/docs/plugins/smtp-client/README.md b/docs/plugins/smtp-client/README.md index 7f57fb7a05..564b8ebc4f 100644 --- a/docs/plugins/smtp-client/README.md +++ b/docs/plugins/smtp-client/README.md @@ -14,7 +14,4 @@ Plugin Repo: [https://github.com/CWBudde/cordova-plugin-smtp-client](https://git ## Supported platforms - Android - - iOS - - - +- iOS diff --git a/src/@awesome-cordova-plugins/plugins/clevertap/index.ts b/src/@awesome-cordova-plugins/plugins/clevertap/index.ts index 5ad10be292..20734b5d84 100644 --- a/src/@awesome-cordova-plugins/plugins/clevertap/index.ts +++ b/src/@awesome-cordova-plugins/plugins/clevertap/index.ts @@ -826,7 +826,28 @@ export class CleverTap extends AwesomeCordovaNativePlugin { markReadInboxMessageForId(messageId: string): Promise { return; } + + /** + * Call this to Mark Read Inbox Messages For Ids in bulk + * + * @param messageIds {any} array of strings + * @returns {Promise} + */ + @Cordova() + markReadInboxMessagesForIds(messageIds: any): Promise { + return; + } + /** + * Call this to dismiss Inbox + * + * @returns {Promise} + */ + @Cordova() + dismissInbox(): Promise { + return; + } + /** * Call this to Mark Push Inbox Notification Viewed Event for Id * @@ -893,6 +914,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this to Get Feature Flag for key * * @param key {string} @@ -905,6 +927,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this to Set Defaults for Product Config * * @param defaults {any} @@ -916,6 +939,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this for Product Config Fetch * * @param defaults {any} @@ -927,6 +951,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this for Product Config Fetch with Min Interval * * @param timeInterval {number} @@ -938,6 +963,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this for Product Config Activate * * @returns {Promise} @@ -948,6 +974,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this for Product Config Fetch and Activate * * @returns {Promise} @@ -958,6 +985,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this to set Product Config Fetch with Min Interval * * @param timeInterval {number} @@ -969,6 +997,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this to Get Last Fetch Time Interval * * @returns {Promise} @@ -979,6 +1008,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this to Get String * * @param key {string} @@ -990,6 +1020,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this to Get Boolean * * @param key {string} @@ -1001,6 +1032,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this to Get Long * * @param key {string} @@ -1012,6 +1044,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this to Get Double * * @param key {string} @@ -1023,6 +1056,7 @@ export class CleverTap extends AwesomeCordovaNativePlugin { } /** + * @deprecated - Since version 2.7.0 and will be removed in the future versions of this SDK. * Call this to Reset Product Config * * @returns {Promise} @@ -1032,6 +1066,125 @@ export class CleverTap extends AwesomeCordovaNativePlugin { return; } + /**************************** + * Product Experiences methods + ****************************/ + + /** + * + * Uploads variables to the server. Requires Development/Debug build/configuration. + * @returns {Promise} + */ + @Cordova() + syncVariables(): Promise { + return; + } + + /** + * Uploads variables to the server. + * @param {boolean} isProduction Provide `true` if variables must be sync in Productuon build/configuration. + * @returns {Promise} + * + * + * Note: This is NO-OP in Android + */ + @Cordova() + syncVariablesinProd(isProduction: boolean): Promise { + return; + } + + /** + * Forces variables to update from the server. + * @returns {Promise} + */ + @Cordova() + fetchVariables(): Promise { + return; + } + + /** + * Create variables. + * @returns {Promise} + * @param {object} variables The JSON Object specifying the varibles to be created. + */ + @Cordova() + defineVariables(variables: any): Promise { + return; + } + + /** + * Get a variable or a group for the specified name. + * @param {string} name - name. + * @returns {Promise} + */ + @Cordova() + getVariable(name: string): Promise { + return; + } + + /** + * Get all variables via a JSON object. + * @returns {Promise} + */ + @Cordova() + getVariables(): Promise { + return; + } + + /** + * Adds a callback to be invoked when variables are initialised with server values. Will be called each time new values are fetched. + * @returns {Promise} + */ + @Cordova() + onVariablesChanged(): Promise { + return; + } + + /** + * Called when the value of the variable changes. + * @param {name} string the name of the variable + * @returns {Promise} + */ + @Cordova() + onValueChanged(name: string): Promise { + return; + } + + /**************************** + * Android 13 Push Primer + ****************************/ + + /** + * Method to prompt the push primer for android 13 onwards. + * @param {object} value - key-value belongs to the localInApp properties. Refer documentation for details. + * @returns {Promise} + */ + @Cordova() + promptPushPrimer(localInAppObject: any): Promise { + return; + } + + /** + * Method to prompt the hard permission dialog directly, if the push primer is not required. + * @param {string} showFallbackSettings - If the value is true then SDK shows an alert dialog which routes to app's notification settings page. + * @returns {Promise} + */ + @Cordova() + promptForPushPermission(showFallbackSettings: boolean): Promise { + return; + } + + /** + * Returns true/false based on whether push permission is granted or denied. + * + * @returns {Promise} + */ + @Cordova() + isPushPermissionGranted(): Promise { + return; + } + + /******************* * Developer Options ******************/ diff --git a/src/@awesome-cordova-plugins/plugins/diagnostic/index.ts b/src/@awesome-cordova-plugins/plugins/diagnostic/index.ts index 77bb656029..897aeae101 100644 --- a/src/@awesome-cordova-plugins/plugins/diagnostic/index.ts +++ b/src/@awesome-cordova-plugins/plugins/diagnostic/index.ts @@ -42,33 +42,46 @@ import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@a @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', + ACCEPT_HANDOVER: 'ACCEPT_HANDOVER', + ACCESS_BACKGROUND_LOCATION: 'ACCESS_BACKGROUND_LOCATION', ACCESS_COARSE_LOCATION: 'ACCESS_COARSE_LOCATION', - RECORD_AUDIO: 'RECORD_AUDIO', - READ_PHONE_STATE: 'READ_PHONE_STATE', - CALL_PHONE: 'CALL_PHONE', + ACCESS_FINE_LOCATION: 'ACCESS_FINE_LOCATION', + ACCESS_MEDIA_LOCATION: 'ACCESS_MEDIA_LOCATION', + ACTIVITY_RECOGNITION: 'ACTIVITY_RECOGNITION', ADD_VOICEMAIL: 'ADD_VOICEMAIL', - USE_SIP: 'USE_SIP', + ANSWER_PHONE_CALLS: 'ANSWER_PHONE_CALLS', + BLUETOOTH_ADVERTISE: 'BLUETOOTH_ADVERTISE', + BLUETOOTH_CONNECT: 'BLUETOOTH_CONNECT', + BLUETOOTH_SCAN: 'BLUETOOTH_SCAN', + BODY_SENSORS: 'BODY_SENSORS', + BODY_SENSORS_BACKGROUND: 'BODY_SENSORS_BACKGROUND', + CALL_PHONE: 'CALL_PHONE', + CAMERA: 'CAMERA', + GET_ACCOUNTS: 'GET_ACCOUNTS', + NEARBY_WIFI_DEVICES: 'NEARBY_WIFI_DEVICES', + POST_NOTIFICATIONS: 'POST_NOTIFICATIONS', PROCESS_OUTGOING_CALLS: 'PROCESS_OUTGOING_CALLS', + READ_CALENDAR: 'READ_CALENDAR', READ_CALL_LOG: 'READ_CALL_LOG', - WRITE_CALL_LOG: 'WRITE_CALL_LOG', - SEND_SMS: 'SEND_SMS', - RECEIVE_SMS: 'RECEIVE_SMS', + READ_CONTACTS: 'READ_CONTACTS', + READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE', + READ_MEDIA_AUDIO: 'READ_MEDIA_AUDIO', + READ_MEDIA_IMAGES: 'READ_MEDIA_IMAGES', + READ_MEDIA_VIDEO: 'READ_MEDIA_VIDEO', + READ_PHONE_NUMBERS: 'READ_PHONE_NUMBERS', + READ_PHONE_STATE: 'READ_PHONE_STATE', READ_SMS: 'READ_SMS', - RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH', RECEIVE_MMS: 'RECEIVE_MMS', + RECEIVE_SMS: 'RECEIVE_SMS', + RECEIVE_WAP_PUSH: 'RECEIVE_WAP_PUSH', + RECORD_AUDIO: 'RECORD_AUDIO', + SEND_SMS: 'SEND_SMS', + USE_SIP: 'USE_SIP', + UWB_RANGING: 'UWB_RANGING', + WRITE_CALENDAR: 'WRITE_CALENDAR', + WRITE_CALL_LOG: 'WRITE_CALL_LOG', + WRITE_CONTACTS: 'WRITE_CONTACTS', 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() @@ -83,6 +96,9 @@ export class Diagnostic extends AwesomeCordovaNativePlugin { DENIED_ALWAYS: string; RESTRICTED: string; GRANTED_WHEN_IN_USE: string; + EPHEMERAL: string; + PROVISIONAL: string; + LIMITED: string; }; locationAuthorizationMode = { @@ -146,6 +162,25 @@ export class Diagnostic extends AwesomeCordovaNativePlugin { POWERING_OFF: string; }; + @CordovaProperty() + cpuArchitecture: { + MIPS: string; + MIPS_64: string; + UNKNOWN: string; + ARMv6: string; + ARMv7: string; + ARMv8: string; + X86: string; + X86_64: string; + }; + + @CordovaProperty() + remoteNotificationType: { + ALERT: string; + SOUND: string; + BADGE: string; + }; + @CordovaProperty() motionStatus: { NOT_REQUESTED: string; @@ -272,8 +307,18 @@ export class Diagnostic extends AwesomeCordovaNativePlugin { return; } + // ANDROID AND IOS ONLY + /** + * Enables debug mode, which logs native plugin debug messages to the native and JS consoles. + * Debug mode is initially disabled on plugin initialisation. + */ + @Cordova({ platforms: ['Android', 'iOS'] }) + enableDebug(): Promise { + return; + } + /** * 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. * @@ -305,6 +350,17 @@ export class Diagnostic extends AwesomeCordovaNativePlugin { return; } + /** + * Returns the individual location authorization status for each type of location access (FINE, COARSE and BACKGROUND). + * + * @returns {Promise} + */ + @Cordova({ platforms: ['Android', 'iOS'] }) + getLocationAuthorizationStatuses(): 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. @@ -514,8 +570,42 @@ export class Diagnostic extends AwesomeCordovaNativePlugin { @Cordova({ platforms: ['Android', 'iOS'], sync: true }) registerLocationStateChangeHandler(handler: Function): void {} + /** + * Returns CPU architecture of the current device. + * + * @returns {Promise} + */ + @Cordova({ platforms: ['Android', 'iOS'] }) + getArchitecture(): Promise { + return; + } + + /** + * Returns the current battery level of the device as a percentage. + * + * @returns {Promise} + */ + @Cordova({ platforms: ['Android', 'iOS'] }) + getCurrentBatteryLevel(): Promise { + return; + } + // ANDROID ONLY + /** + * Restarts the application. + * By default, a "warm" restart will be performed in which the main Cordova activity is immediately restarted, causing the Webview instance to be recreated. + * However, if the `cold` parameter is set to true, then the application will be "cold" restarted, meaning a system exit will be performed, causing the entire application to be restarted. + * This is useful if you want to fully reset the native application state but will cause the application to briefly disappear and re-appear.. + * + * @returns {Promise} + */ + @Cordova({ platforms: ['Android'], callbackOrder: 'reverse' }) + restart(cold: boolean): Promise { + return; + } + + /** * 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. @@ -564,6 +654,26 @@ export class Diagnostic extends AwesomeCordovaNativePlugin { return; } + /** + * Checks if airplane mode is enabled on device. + * + * @returns {Promise} + */ + @Cordova({ platforms: ['Android'] }) + isAirplaneModeEnabled(): Promise { + return; + } + + /** + * Checks if mobile data is enabled on device. + * + * @returns {Promise} + */ + @Cordova({ platforms: ['Android'] }) + isMobileDataEnabled(): Promise { + return; + } + /** * Returns the current location mode setting for the device. * @@ -574,6 +684,26 @@ export class Diagnostic extends AwesomeCordovaNativePlugin { return; } + /** + * Returns details of the OS of the device on which the app is currently running + * + * @returns {Promise} + */ + @Cordova({ platforms: ['Android'] }) + getDeviceOSVersion(): Promise { + return; + } + + /** + * Returns details of the SDK levels used to build the app. + * + * @returns {Promise} + */ + @Cordova({ platforms: ['Android'] }) + getBuildOSVersion(): 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. @@ -901,6 +1031,16 @@ export class Diagnostic extends AwesomeCordovaNativePlugin { return; } + /** + * Presents limited library picker UI on iOS 14+ + * + * @returns {Promise} + */ + @Cordova({ platforms: ['iOS'] }) + presentLimitedLibraryPicker(): Promise { + return; + } + /** * Checks if remote (push) notifications are enabled. * diff --git a/src/@awesome-cordova-plugins/plugins/firebase-model/index.ts b/src/@awesome-cordova-plugins/plugins/firebase-model/index.ts new file mode 100644 index 0000000000..d84441bfbe --- /dev/null +++ b/src/@awesome-cordova-plugins/plugins/firebase-model/index.ts @@ -0,0 +1,122 @@ +import { Injectable } from '@angular/core'; +import { + Plugin, + Cordova, + CordovaProperty, + CordovaInstance, + InstanceProperty, + IonicNativePlugin, +} from '@ionic-native/core'; +import { Observable } from 'rxjs'; + +export enum FirebaseModelStatus { + downloading = 'downloading', + completed = 'completed', +} + +export enum FirebaseModelInputType { + path = 'path', + base64string = 'base64string', + blob = 'blob', +} + +export class FirebaseModelConfigResult { + /** + * Returns the current status of the model. + */ + status: FirebaseModelStatus; + /** + * Returns the current progress of the downloading model. + */ + progress: number; +} + +export class FirebaseModelClassifyResult { + /** + * Return the identified image label name. + */ + label: string; + /** + * Returns the confidence score of the identified image. + */ + score: number; +} + +export class FirebaseModelInput { + /** + * Set the one of the input types defined in FirebaseModelInputType enum. + */ + inputType: FirebaseModelInputType; + /** + * Set the input as string | Blob based on the `inputType` + */ + input: string | Blob; +} + +/** + * @name Firebase Model + * @description This plugin downloads the TensorFlow model from firebase and classify the images. + * + * ```typescript + * import { FirebaseModel } from '@ionic-native/ionic-native-firebase-model'; + * + * + * constructor(private firebaseModel: FirebaseModel) { } + * + * ... + * + * + * this.firebaseModel.configure('Sample_Model') + * .subscribe((res: FirebaseModelConfigResult) => console.log(res.status + " - " + res.progress)) + * .catch((error: any) => console.error(error)); + * + * + * try { + * var result:FirebaseModelClassifyResult = await this.firebaseModel.classify("/Documents/input_image.png") + * console.log(result.label + " - " + result.score) + * + * } + * catch (e) { + * console.log(e) + * } + * + * + * ``` + */ +@Plugin({ + pluginName: 'FirebaseModel', + plugin: 'cordova-plugin-firebase-model', // npm package name, example: cordova-plugin-camera + pluginRef: 'FirebaseModel', // the variable reference to call the plugin, example: navigator.geolocation + repo: '', // the github repository URL for the plugin + install: 'ionic cordova plugin add cordova-plugin-firebase-model', // OPTIONAL install command, in case the plugin requires variables + installVariables: [], // OPTIONAL the plugin requires variables + platforms: ['iOS'], // Array of platforms supported, example: ['Android', 'iOS'] +}) +@Injectable() +export class FirebaseModel extends IonicNativePlugin { + /** + * This function configure the Firebase TFLite model and downloads. + * @param {string} arg1 Name of the TFLite model which is uploaded in the Firebase console + * @returns {Observable} Returns a observable that gives the callback for downloading progress and status. + * + */ + @Cordova({ + successIndex: 1, + errorIndex: 2, + observable: true, + }) + configure(arg1: string): Observable { + return; + } + + /** + * This function identify the image using the Firebase TFLite model which is configured. + * @param {FirebaseModelInput} arg1 Base64 string of the input image or . + * @returns {Promise} Returns a promise that resolves the classification result. + * + */ + @Cordova() + classify(arg1: FirebaseModelInput): Promise { + return; + } +} diff --git a/src/@awesome-cordova-plugins/plugins/save-dialog/index.ts b/src/@awesome-cordova-plugins/plugins/save-dialog/index.ts new file mode 100644 index 0000000000..e857039d56 --- /dev/null +++ b/src/@awesome-cordova-plugins/plugins/save-dialog/index.ts @@ -0,0 +1,42 @@ +import { Injectable } from '@angular/core'; +import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; + +/** + * @name SaveDialog + * @description + * Plugin displays the native Save dialog which allows users to store a file in the selected location. + * @usage + * ```typescript + * import { SaveDialog } from '@awesome-cordova-plugins/save-dialog'; + * + * constructor(private saveDialog: SaveDialog) { } + * + * ... + * + * this.saveDialog.saveFile(blob, fileName); + * + * ``` + */ +@Plugin({ + pluginName: 'SaveDialog', + plugin: 'cordova-plugin-save-dialog', + pluginRef: 'SaveDialog', + repo: 'https://github.com/Amphiluke/cordova-plugin-save-dialog', + platforms: ['Android', 'iOS'], +}) +@Injectable({ + providedIn: 'root', +}) +export class SaveDialog 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 }) + saveFile(blob: Blob, fileName?: string): Promise { + return; + } +}