From 54ca5c1fabcc2ff8f7f921f320d214344f8d5fde Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 2 Aug 2019 14:01:56 +0530 Subject: [PATCH 01/32] feat(unvired-cordova-sdk): support login via email --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 94d5717f65..f065b1270e 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -117,6 +117,11 @@ export enum LoginType { * ``` */ sap = 'SAP', + /** + * EMAIL + * Set the type to email to login based on email id. + */ + email = 'EMAIL', /** * TODO: */ From 54266e96cf7a8fa184a2b42ecf2e53ad206eb9cf Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 2 Aug 2019 14:03:55 +0530 Subject: [PATCH 02/32] fix(unvired-cordova-sdk): return typed promise object for user settings --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index f065b1270e..74d3b523ee 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -560,7 +560,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Get User settings. */ @Cordova() - userSettings(): Promise { + userSettings(): Promise { return; } From adda8b967eed4fb6ea4c696d370e2b18229570cd Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 2 Aug 2019 14:05:01 +0530 Subject: [PATCH 03/32] fix(unvired-cordova-sdk): change return type to string for guid() --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 74d3b523ee..68a040c38b 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -608,8 +608,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Get a random id to use as guid. */ - @Cordova() - guid() { + @Cordova({ sync: true }) + guid(): string { return; } From a3c61549268dda4ddcb1dbf09f9ed1136ea0bdfa Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 6 Aug 2019 15:28:12 +0530 Subject: [PATCH 04/32] doc(unvired-cordova-sdk): doc update --- .../plugins/unvired-cordova-sdk/index.ts | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 68a040c38b..c078fc6448 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -688,10 +688,11 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Mobile: Or a Sqlite whereClause ( without the 'where' keyword ) * Example: * ``` - * # Mobile: Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * this.unviredSDK.dbSelect('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'") - * # Browser & Mobile: Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * this.unviredSDK.dbSelect('FORM_HEADER', {"FORM_ID": "5caed815892215034dacad56"}) + * Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 + * # Mobile + * this.unviredSDK.dbDelete('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'") + * # Browser & Mobile + * this.unviredSDK.dbDelete('FORM_HEADER', {"FORM_ID": "5caed815892215034dacad56"}) * ``` */ @Cordova() @@ -702,15 +703,16 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Update records in database. * @param tableName Name of the table - * @param updatedObject JSON object containing name-value pairs. + * @param updatedObject JSON object containing updateds name-value pairs. * @param whereClause {Object} Browser: JSON object containing name-value pairs. * Mobile: Or a Sqlite where Clause ( without the 'where' keyword ) * Example: * ``` - * # Mobile: Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * this.unviredSDK.dbSelect('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'") - * # Mobile & Browser: Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * this.unviredSDK.dbSelect('FORM_HEADER', {"FORM_ID": "5caed815892215034dacad56"}) + * Update NAME & NO from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 + * # Mobile + * this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"TARAK","NO":"0039"}, "FORM_ID = '5caed815892215034dacad56'") + * # Mobile & Browser + * this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"TARAK","NO":"0039"}, {"FORM_ID": "5caed815892215034dacad56"}) * ``` */ @Cordova() @@ -881,14 +883,14 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * For PA functions which do not accept any input, set an empty string for this parameter. * Example: If Header datastructure needs to be sent, make sure the header datastructure is in the following format: * ``` - * {"CUSTOMER_HEADER": {field_name : field_value,...}} + * {"CUSTOMER_HEADER": {"field1" : "value1", "field2" : "value2"}} * ``` * @param customData {Object} This depends on the PA function. This is useful if you want to send custom data to a PA function. * Example: You can also use this parameter to send header datastrucrture provided the data structure is formatted like this. * ``` * { * "CATEGORY_BE": [{ - * "CATEGORY_HEADER": {field_name : field_value,...} + * "CATEGORY_HEADER": {"field1" : "value1", "field2" : "value2"} * }] * } * ``` @@ -908,14 +910,14 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * For PA functions which do not accept any input, set an empty string for this parameter. * Example: If Header datastructure needs to be sent, make sure the header datastructure is in the following format: * ``` - * {"CUSTOMER_HEADER": {field_name : field_value,...}} + * {"CUSTOMER_HEADER": {"field1" : "value1", "field2" : "value2"}} * ``` * @param customData {Object} This depends on the PA function. This is useful if you want to send custom data to a PA function. * Example: You can also use this parameter to send header datastrucrture provided the data structure is formatted like this. * ``` * { * "CATEGORY_BE": [{ - * "CATEGORY_HEADER": {field_name : field_value,...} + * "CATEGORY_HEADER": {"field1" : "value1", "field2" : "value2"} * }] * } * ``` From 08418d9b437a141ca9f181dfa61fe1edb353b374 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 20 Aug 2019 18:49:36 +0530 Subject: [PATCH 05/32] doc(unvired-cordova-sdk): update doc --- .../plugins/unvired-cordova-sdk/index.ts | 190 ++++++++++++++---- 1 file changed, 146 insertions(+), 44 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index c078fc6448..583ff8a055 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -1,38 +1,10 @@ -/** - * @name Unvired Cordova S D K - * @description - * This plugin can be used to connect to UMP ( Unvired Mobile Platform ). This plugin has a dependency on the following Cocoapod. In your iOS project, first install the dependent pod and then install the plugin. - * ``` - * pod 'UnviredCordovaSDK' - * ``` - * @usage - * ```typescript - * import { UnviredCordovaSDK } from '@ionic-native/unvired-cordova-sdk/ngx'; - * - * - * constructor(private unviredCordovaSDK: UnviredCordovaSDK) { } - * - * ... - * // Login - * let loginParameters = new LoginParameters() - * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' - * loginParameters.metadataPath = '../assets/metadata.json' - * loginParameters.loginType = LoginType.unvired - * let loginResult: LoginResult = await this.unviredCordovaSDK.login(loginParameters) - * - * // Make a Sync call. - * let result = await this.unviredCordovaSDK.syncForeground(RequestType.QUERY, null, inputObj, 'UNVIRED_DIGITAL_FORMS_PA_MOBILE_GET_USERS', true) - * // Make Async call. - * let result = await this.unviredCordovaSDK.syncBackground(RequestType.QUERY, null, inputObj, 'UNVIRED_DIGITAL_FORMS_PA_MOBILE_GET_USERS', 'INPUT_GET_USERS', 'GUID', false) - * // Write Logs - * this.unviredCordovaSDK.logInfo("AppComponent", "Initialize", " Some String") - * ``` - */ - import { Injectable } from '@angular/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs'; +/** + * AuthenticateAndActivateResultType Some Documentation + */ export enum AuthenticateAndActivateResultType { /** * This value indicates that UMP was able to validate users credentials & activation of the user is complete. @@ -144,26 +116,26 @@ 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 = 0, + 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 = '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 = '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 = '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 = 'REQ' } export enum NotificationListenerType { @@ -358,9 +330,139 @@ export class AuthenticateLocalResult extends UnviredResult { type: AuthenticateLocalResultType; } +/** + * @name Unvired Cordova SDK + * @description + * This plugin lets you build apps which connect to Unvired Mobile Platform (UMP). + * - + * iOS Requirements + * - + * This plugin uses Cocoapods to install dependent libraries. Please make sure you have a valid Cocoapods installation. + * Once you have it ready, do update the cocoapods repo by running the following command before you install this plugin. + * ``` + * pod repo update + * ``` + * @usage + * ```typescript + * import { UnviredCordovaSDK } from '@ionic-native/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 + * // Make sync call. + * let result = await this.unviredSDK.syncForeground(RequestType.QUERY, null, {"CUSTOMER_HEADER": {"field1" : "value1", "field2" : "value2"}}, 'UNVIRED_DIGITAL_FORMS_PA_MOBILE_GET_USERS', true) + * + * // Make async call. + * let result = await this.unviredSDK.syncBackground(RequestType.QUERY, null, inputObj, 'UNVIRED_DIGITAL_FORMS_PA_MOBILE_GET_USERS', 'INPUT_GET_USERS', 'GUID', false) + * // 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":"USER","NO":"0039"}, true); + * + * // Update a record in database + * this.unviredSDK.dbUpdate('CUSTOMER_HEADER', {"NAME":"UPDATED_USER","NO":"UPDATED_NO"}, "FORM_ID = '5caed815892215034dacad56'") + * + * // Delete a record in database + * this.unviredSDK.dbDelete('CUSTOMER_HEADER', "FORM_ID = '5caed815892215034dacad56'") + * + * // Execute a SQL Query + * this.unviredSDK.dbExecuteStatement('SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = "0039"') + */ @Plugin({ pluginName: 'UnviredCordovaSDK', - plugin: 'cordova-plugin-unvired-sdk', // npm package name, example: cordova-plugin-camera + plugin: 'https://github.com/unvired/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 @ionic-native/unvired-cordova-sdk', // OPTIONAL install command, in case the plugin requires variables @@ -656,7 +758,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Example: * ``` * # Insert CUSTOMER_HEADER Datastructure into DB. - * this.unviredsdk.dbInsert("CUSTOMER_HEADER", {"NAME":"TARAK","NO":"0039"}, true); + * this.unviredsdk.dbInsert("CUSTOMER_HEADER", {"NAME":"USER","NO":"0039"}, true); * ``` */ @Cordova() @@ -672,8 +774,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param isHeader {boolean} - is DataStructure a header or item? * Example: * ``` - * # Insert or update a CUSTOMER_HEADER with NAME as TARAK and NO as '0039' - * this.unviredsdk.dbInsertOrUpdate("CUSTOMER_HEADER",{"NAME":"TARAK","NO":"0039"},true); + * # 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() @@ -703,16 +805,16 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Update records in database. * @param tableName Name of the table - * @param updatedObject JSON object containing updateds name-value pairs. + * @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 * # Mobile - * this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"TARAK","NO":"0039"}, "FORM_ID = '5caed815892215034dacad56'") + * this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"UPDATED_USER","UPDATED_NO":"0039"}, "FORM_ID = '5caed815892215034dacad56'") * # Mobile & Browser - * this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"TARAK","NO":"0039"}, {"FORM_ID": "5caed815892215034dacad56"}) + * this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"UPDATED_USER","UPDATED_NO":"0039"}, {"FORM_ID": "5caed815892215034dacad56"}) * ``` */ @Cordova() @@ -846,7 +948,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param structureObject {Object} JSON object containing name-value pairs. * Example: * ``` - * {'F_NAME':'TARAK','EMP_NO':'0039'} + * {'F_NAME':'USER','EMP_NO':'0039'} * ``` */ @Cordova() From 05e984bfc7552dc1642fed193c759e863846f123 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 22 Aug 2019 13:25:06 +0530 Subject: [PATCH 06/32] feat(unvired-cordova-sdk): add support for metadata JSON --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 583ff8a055..288b867719 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -317,6 +317,11 @@ export class LoginParameters { * TODO: */ autoSyncTime: string; + + /** + * Specify the metadata as a JSON string. This will override metadata.xml set at platform level. + */ + metadataJSON: string; } export class LoginResult extends UnviredResult { type: LoginListenerType; From dece93b41d65ce853b037dd13c3a5083f7f6125e Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 30 Aug 2019 15:58:59 +0530 Subject: [PATCH 07/32] doc(unvired-cordova-sdk): update doc --- .../plugins/unvired-cordova-sdk/index.ts | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 288b867719..23bc9fd968 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -44,7 +44,7 @@ export enum LoginListenerType { */ login_success = 4, /** - * TODO + * 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 } @@ -53,7 +53,6 @@ export enum LoginType { /** * This value represents authentication using Unvired ID. * Example: - * If you plan to authenticate using Unvired ID, you need to send the following parameters: * ``` * loginParameters.username = 'USER_NAME' * loginParameters.password = 'password' @@ -65,7 +64,6 @@ export enum LoginType { /** * This value represents authentication using Active Directory Service (ADS). * Example: - * If you plan to authenticate using Unvired ID, you need to send the following parameters: * ``` * loginParameters.username = 'USER_NAME' * loginParameters.password = 'password' @@ -78,7 +76,6 @@ export enum LoginType { /** * This value represents authentication using SAP ID. * Example: - * If you plan to authenticate using Unvired ID, you need to send the following parameters: * ``` * loginParameters.username = 'USER_NAME' * loginParameters.password = 'password' @@ -309,12 +306,20 @@ export class LoginParameters { isRequiredAttachmentBase64: boolean; /** - * TODO: + * 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; /** - * TODO: + * 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; @@ -322,6 +327,17 @@ export class LoginParameters { * Specify the metadata as a JSON string. This will override metadata.xml set at platform level. */ metadataJSON: string; + + /* + * Set this value to true to persist web application database. By default, this value is false. + */ + persistWebDb: boolean; + /* + * Optional jwt token parameter. Please check with your Unvired Admin for this value. + * For Example: + * loginParameters.jwtOptions = {"app": "myapp"}; + */ + jwtOptions: object; } export class LoginResult extends UnviredResult { type: LoginListenerType; @@ -531,7 +547,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO: + * Returns the contents of the log file as a string. */ @Cordova() logRead(): Promise { @@ -539,7 +555,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO: + * Resets the log file. */ @Cordova() logDelete(): Promise { @@ -547,7 +563,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO: + * Sends log file to server. The log file can be viewed under Settings > Device & Data in UMP Admin Cockpit. */ @Cordova() sendLogToServer(): Promise { @@ -555,7 +571,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO: + * Send logs via email interface. Calling this function opens up the default email interface with the log file as an attachment. */ @Cordova() sendLogViaEmail(): Promise { @@ -579,7 +595,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO: + * Logs out the last active user. */ @Cordova() logout(): Promise { @@ -1081,7 +1097,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Places a request to download all pending messages for the logged in user in UMP. + * 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() From c5b2a4e751fa79dd5af9f2d6419547374c6ee72c Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 17 Sep 2019 19:00:57 +0530 Subject: [PATCH 08/32] doc(unvired-cordova-sdk): update doc --- .../plugins/unvired-cordova-sdk/index.ts | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 23bc9fd968..076f9da6b8 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -964,12 +964,29 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Copy attachment file to application folder and insert attachment item to database with updated local path. - * @param tableName Table name of attachment item. - * @param structureObject {Object} JSON object containing name-value pairs. + * 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: * ``` - * {'F_NAME':'USER','EMP_NO':'0039'} + * // 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() From 5a665784367647a413c787a757ae6798de77c04a Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 22 Oct 2019 15:43:34 +0530 Subject: [PATCH 09/32] feat(unvired-cordova-sdk): add methods to get and set log level --- .../plugins/unvired-cordova-sdk/index.ts | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 076f9da6b8..511cac4e0e 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -2,6 +2,15 @@ import { Injectable } from '@angular/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs'; +/** + * Log levels supported in the sdk. + */ +export enum LogLevel { + important = 7, + error = 8, + debug = 9 +} + /** * AuthenticateAndActivateResultType Some Documentation */ @@ -578,6 +587,23 @@ export class UnviredCordovaSDK extends IonicNativePlugin { return; } + /** + * Returns the current log level. + */ + @Cordova() + getLogLevel(): 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() @@ -1071,6 +1097,21 @@ export class UnviredCordovaSDK extends IonicNativePlugin { 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 @@ -1205,7 +1246,26 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * 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; + } } From c8521c653a3a5550203a51700c1f24387e67589d Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Wed, 23 Oct 2019 18:40:49 +0530 Subject: [PATCH 10/32] fix(unvired-cordova-sdk): update the return type for getLog() --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 511cac4e0e..df76bced12 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -238,6 +238,11 @@ export class UnviredResult { errorDetail: string; } +export class LogResult extends UnviredResult { + type: ResultType; + data: LogLevel; +} + export class NotifResult extends UnviredResult { type: NotificationListenerType; } @@ -591,7 +596,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Returns the current log level. */ @Cordova() - getLogLevel(): Promise { + getLogLevel(): Promise { return; } From 112a9e52b746f5bb3aac774f95e8737c5e05da2e Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 25 Oct 2019 11:42:14 +0530 Subject: [PATCH 11/32] feat(unvired-cordova-sdk): return platform name --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index df76bced12..9bd06934fe 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -1273,4 +1273,13 @@ export class UnviredCordovaSDK extends IonicNativePlugin { startDataSender(): Promise { return; } + + /** + * Returns platform name + * Ex: ios, android, windows, browser + */ + @Cordova() + platform(): Promise { + return; + } } From cbd12011d04a2ca3a5da2d657ff2690d4b716599 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 7 Nov 2019 17:00:08 +0530 Subject: [PATCH 12/32] feat(unvired-cordova-sdk): add method to get log file path --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 9bd06934fe..880af1ca8a 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -600,6 +600,14 @@ export class UnviredCordovaSDK extends IonicNativePlugin { 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 From b8e8f6fe8d7aad13f3bce169409528c3ff6c2e6f Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 7 Nov 2019 17:52:08 +0530 Subject: [PATCH 13/32] feat(unvired-cordova-sdk): test push notifications --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 880af1ca8a..ffadc193b0 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -1290,4 +1290,13 @@ export class UnviredCordovaSDK extends IonicNativePlugin { platform(): Promise { return; } + + /** + * Mobile Platform only. + * Test whether push notifications can be received on the device + */ + @Cordova() + testPushNotification(): Promise { + return; + } } From d382ceb5fac7a4ed694783790055ff3d8229876b Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Mon, 11 Nov 2019 19:24:05 +0530 Subject: [PATCH 14/32] fix(unvired-cordova-sdk): define return for logRead --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index ffadc193b0..b19658c7aa 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -243,6 +243,11 @@ export class LogResult extends UnviredResult { data: LogLevel; } +export class LogDataResult extends UnviredResult { + type: ResultType; + data: string; +} + export class NotifResult extends UnviredResult { type: NotificationListenerType; } @@ -564,7 +569,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Returns the contents of the log file as a string. */ @Cordova() - logRead(): Promise { + logRead(): Promise { return; } From d7006531fbca1bf26db29367db7aa48a16ab8e1e Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 5 Dec 2019 17:37:04 +0530 Subject: [PATCH 15/32] doc(unvired-cordova-sdk): remove mobile only restriction for some apis --- .../plugins/unvired-cordova-sdk/index.ts | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index b19658c7aa..216977bab2 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -803,10 +803,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Mobile: Or a Sqlite whereClause ( without the 'where' keyword ) * Example: * ``` - * # Mobile: Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 + * # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 * this.unviredSDK.dbSelect('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'") - * # Mobile & Browser: Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * this.unviredSDK.dbSelect('FORM_HEADER', {"FORM_ID": "5caed815892215034dacad56"}) * ``` */ @Cordova() @@ -855,11 +853,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Mobile: Or a Sqlite whereClause ( without the 'where' keyword ) * Example: * ``` - * Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * # Mobile + * # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 * this.unviredSDK.dbDelete('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'") - * # Browser & Mobile - * this.unviredSDK.dbDelete('FORM_HEADER', {"FORM_ID": "5caed815892215034dacad56"}) * ``` */ @Cordova() @@ -875,11 +870,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Mobile: Or a Sqlite where Clause ( without the 'where' keyword ) * Example: * ``` - * Update NAME & NO from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 - * # Mobile + * # 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'") - * # Mobile & Browser - * this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"UPDATED_USER","UPDATED_NO":"0039"}, {"FORM_ID": "5caed815892215034dacad56"}) * ``` */ @Cordova() @@ -888,12 +880,11 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in mobile only. - * Execute SQL Statement + * Execute a SQL statement * @param query {string} SQL Statement. * Example: * ``` - * this.unviredSDK.dbExecuteStatement('SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = 39') + * this.unviredSDK.dbExecuteStatement("SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = '39'") * ``` */ @Cordova() @@ -902,7 +893,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in mobile only. * Create Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) * @param savePoint {string} Name of savepoint * Example: @@ -916,7 +906,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in mobile only. * Release Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) * @param savePoint {string} Name of savepoint * ``` @@ -929,7 +918,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in mobile only. * Rollback Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) * @param savePoint {string} Name of the savepoint * Example: @@ -943,7 +931,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in mobile only. * Begin database transaction. * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) * Example: @@ -957,7 +944,6 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in mobile only. * End database transaction. * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) * Example: From e0afe811e5c1a24e5bedb4c10cbee01f3efab937 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Wed, 29 Jan 2020 14:26:09 +0530 Subject: [PATCH 16/32] feat(unvired-cordova-sdk): add new property containing HTTP status code. --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 216977bab2..4bf069fb61 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -259,6 +259,10 @@ export class SettingsResult extends UnviredResult { 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 { From af3c82dd62f9b5099fd795abc5db5bcc56ee3bc0 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 27 Feb 2020 15:17:31 +0530 Subject: [PATCH 17/32] feat(unvired-cordova-sdk): add new functions to lock & unlock sending of data --- .../plugins/unvired-cordova-sdk/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index ca1fc7a136..077552b067 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -1328,4 +1328,23 @@ export class UnviredCordovaSDK extends IonicNativePlugin { 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; + } } From 4af32cd0619c14efcf96cb64fbdfb6a5592caa06 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 27 Feb 2020 15:41:34 +0530 Subject: [PATCH 18/32] fix(unvired-cordova-sdk): update the return type for lock and unlock functions. --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 077552b067..c036e07b60 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -1335,7 +1335,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param beLid LID of the Business Entity */ @Cordova() - lockDataSender(beLid: string): Promise { + lockDataSender(beLid: string): Promise { return; } @@ -1344,7 +1344,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Release any locks applied for sending data (DataSender Thread) to the server. */ @Cordova() - unlockDataSender(): Promise { + unlockDataSender(): Promise { return; } } From 8d064923b0160d3a9c05a05f82dcf3c5287789bf Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 27 Feb 2020 18:07:54 +0530 Subject: [PATCH 19/32] fix(unvired-cordova-sdk): change the return type for lockDataSender api --- .../plugins/unvired-cordova-sdk/index.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index c036e07b60..80ddb3f963 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -2,6 +2,15 @@ import { Injectable } from '@angular/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs'; +/** + * Outbox Lock Result States + */ +export enum OutboxLockStatus { + LockApplied = 0, + DataBeingSent = 1, + DataNotInQueue = 2 +} + /** * Log levels supported in the sdk. */ @@ -243,6 +252,10 @@ export class UnviredResult { errorDetail: string; } +export class OutboxLockResult extends UnviredResult { + type: OutboxLockStatus; +} + export class LogResult extends UnviredResult { type: ResultType; data: LogLevel; @@ -1335,7 +1348,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param beLid LID of the Business Entity */ @Cordova() - lockDataSender(beLid: string): Promise { + lockDataSender(beLid: string): Promise { return; } From 5f19cb14b696df99c8b13ecb4011ab698b2a359f Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Sat, 29 Feb 2020 16:56:26 +0530 Subject: [PATCH 20/32] fix(unvired-cordova-sdk): fix the data type for ResultType and OutboxLockStatus --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 80ddb3f963..39060951cc 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -253,7 +253,8 @@ export class UnviredResult { } export class OutboxLockResult extends UnviredResult { - type: OutboxLockStatus; + type: ResultType; + data: OutboxLockStatus; } export class LogResult extends UnviredResult { From 52df88db7996c488f0039ba36bc1934b64b9b763 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 25 Jun 2020 13:10:06 +0530 Subject: [PATCH 21/32] doc(unvired-cordova-sdk): Update doc --- .../plugins/unvired-cordova-sdk/index.ts | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 39060951cc..954c31f63d 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -64,7 +64,7 @@ export enum LoginListenerType { /** * 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 + app_requires_current_account = 6, /** * This value indicates app can proceed with demo mode. @@ -412,10 +412,19 @@ export class AuthenticateLocalResult extends UnviredResult { * - * iOS Requirements * - - * This plugin uses Cocoapods to install dependent libraries. Please make sure you have a valid Cocoapods installation. - * Once you have it ready, do update the cocoapods repo by running the following command before you install this plugin. + * Update your Cocoapods repo before you install the plugin. * ``` - * pod repo update + * $ 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 @@ -1098,10 +1107,10 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * 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 data would be available in the Promise. - * Apps typically block UI during a SYNC call so that there are user-actions when the SYNC call is active. + * 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. * @param reqype RequestType for the message. Please check RequestType to select the right request type. - * @param header {Object} Header datastructure to be sent to UMP. Header datastructure is mandatory of the request type is RQST. + * @param header {Object} Header datastructure to be sent to UMP. Header datastructure is mandatory if the request type is RQST. * For PA functions which do not accept any input, set an empty string for this parameter. * Example: If Header datastructure needs to be sent, make sure the header datastructure is in the following format: * ``` From fc8854f03ef717ba05daa548b890524e1ebf9e43 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 25 Jun 2020 16:44:19 +0530 Subject: [PATCH 22/32] doc(unvired-cordova-sdk): Update doc --- .../plugins/unvired-cordova-sdk/index.ts | 154 +++++++++++++----- 1 file changed, 110 insertions(+), 44 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 954c31f63d..acdc526be8 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -138,9 +138,9 @@ export enum RequestType { */ 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 + * 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', /** @@ -148,7 +148,7 @@ export enum RequestType { */ 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. + * 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', @@ -310,7 +310,7 @@ export class LoginParameters { password: string; /** - * UMP URL. For example: http://192.168.98.160:8080/UMP + * UMP URL. For example: https://umpdev.unvired.io/UMP */ url: string; @@ -507,11 +507,26 @@ export class AuthenticateLocalResult extends UnviredResult { * * * // Synchronization APIs - * // Make sync call. - * let result = await this.unviredSDK.syncForeground(RequestType.QUERY, null, {"CUSTOMER_HEADER": {"field1" : "value1", "field2" : "value2"}}, 'UNVIRED_DIGITAL_FORMS_PA_MOBILE_GET_USERS', true) + * // 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) + * ``` * - * // Make async call. - * let result = await this.unviredSDK.syncBackground(RequestType.QUERY, null, inputObj, 'UNVIRED_DIGITAL_FORMS_PA_MOBILE_GET_USERS', 'INPUT_GET_USERS', 'GUID', false) * // 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 => { @@ -533,16 +548,16 @@ export class AuthenticateLocalResult extends UnviredResult { * * // Database APIs * // Insert a record onto database - * this.unviredsdk.dbInsert("CUSTOMER_HEADER", {"NAME":"USER","NO":"0039"}, true); + * this.unviredsdk.dbInsert("CUSTOMER_HEADER", {"NAME":"James Bond","CUST_NO":"007"}, true); * * // Update a record in database - * this.unviredSDK.dbUpdate('CUSTOMER_HEADER', {"NAME":"UPDATED_USER","NO":"UPDATED_NO"}, "FORM_ID = '5caed815892215034dacad56'") + * this.unviredSDK.dbUpdate('CUSTOMER_HEADER', {"NAME":"John Doe","CUST_NO":"008"}, "CUST_NO = '007'") * * // Delete a record in database - * this.unviredSDK.dbDelete('CUSTOMER_HEADER', "FORM_ID = '5caed815892215034dacad56'") + * this.unviredSDK.dbDelete('CUSTOMER_HEADER', "CUST_NO = '007'") * * // Execute a SQL Query - * this.unviredSDK.dbExecuteStatement('SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = "0039"') + * this.unviredSDK.dbExecuteStatement('SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = "007"') */ @Plugin({ pluginName: 'UnviredCordovaSDK', @@ -1069,14 +1084,14 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * 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.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. + * 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) * ``` */ @@ -1107,24 +1122,50 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * 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. + * 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. - * @param reqype RequestType for the message. Please check RequestType to select the right request type. - * @param header {Object} Header datastructure to be sent to UMP. Header datastructure is mandatory if the request type is RQST. - * For PA functions which do not accept any input, set an empty string for this parameter. - * Example: If Header datastructure needs to be sent, make sure the header datastructure is in the following format: + * + * 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) * ``` - * {"CUSTOMER_HEADER": {"field1" : "value1", "field2" : "value2"}} + * + * Example 2: Make a QUERY / PULL call * ``` - * @param customData {Object} This depends on the PA function. This is useful if you want to send custom data to a PA function. - * Example: You can also use this parameter to send header datastrucrture provided the data structure is formatted like this. + * 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 * { - * "CATEGORY_BE": [{ - * "CATEGORY_HEADER": {"field1" : "value1", "field2" : "value2"} - * }] + * "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. */ @@ -1134,28 +1175,53 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Sends data to UMP in ASYNC mode. This means user can make this call and continue with other program execution. + * Sends data to UMP in Async mode. This means user can make this call and continue with other program execution. * The result of the call would be notified through the observable returned for the function registerNotifListener(). - * @param reqype RequestType for the message. Please check RequestType to select the right request type. - * @param header {Object} Header datastructure to be sent to UMP. Header datastructure is mandatory of the request type is RQST. - * For PA functions which do not accept any input, set an empty string for this parameter. - * Example: If Header datastructure needs to be sent, make sure the header datastructure is in the following format: + * + * Example 1: Make a RQST call + * ``` + * await this.unviredSDK.syncBackground(RequestType.RQST, {"CUSTOMER_HEADER": {"CUST_NO" : "007", "CUST_NAME" : "James Bond"}}, '', 'PA_GET_CUSTOMER_DETAILS', 'CUSTOMER', beLID, false) * ``` - * {"CUSTOMER_HEADER": {"field1" : "value1", "field2" : "value2"}} + * Example 2: Make a QUERY / PULL call * ``` - * @param customData {Object} This depends on the PA function. This is useful if you want to send custom data to a PA function. - * Example: You can also use this parameter to send header datastrucrture provided the data structure is formatted like this. + * 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 * { - * "CATEGORY_BE": [{ - * "CATEGORY_HEADER": {"field1" : "value1", "field2" : "value2"} - * }] + * "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 - * @param belid LID of the Header datastructure - * @param bypassAttachment Set this flag to false if you want to upload attachments first and then make the server call. + * @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 { From 9ca13e3daa199fcd9c68ab64397e259a38a6d9e0 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 7 Aug 2020 13:53:55 +0530 Subject: [PATCH 23/32] feat(unvired-cordova-sdk): Added new notification type --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index acdc526be8..7d6ad7cbe1 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -202,7 +202,12 @@ export enum NotificationListenerType { /** * Notify attachment downloads completed */ - attachmentDownloadCompleted = 10 + attachmentDownloadCompleted = 10, + + /** + * Notify when the sent item count changes. + */ + SentItemChanged = 11 } export enum AttachmentItemStatus { @@ -1297,7 +1302,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Subscribe to this observable to listen for life-cyle events in the case of an async message. - * Only one class can subscribe to notifications are any point of time. + * Only one class can subscribe to notifications at any point of time. */ @Cordova({ observable: true From aa34d6aeb4d21f0ce677044bbc8238af5c45bd71 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 16 Oct 2020 18:34:38 +0530 Subject: [PATCH 24/32] feat(unvired-cordova-sdk): delete outbox item based on lid --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 05cde5d54d..2582af43f4 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -1451,4 +1451,13 @@ export class UnviredCordovaSDK extends IonicNativePlugin { unlockDataSender(): Promise { return; } + + /** + * Mobile Platform only. + * Delete an outbox item based on header's lid. + */ + @Cordova() + removeOutObjectBasedOnLid(lid: string): Promise { + return; + } } From c5409071aacf69b28b26308dc3c5e89cb4159799 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 8 Dec 2020 15:00:10 +0530 Subject: [PATCH 25/32] fix(unvired-cordova-sdk): Update doc --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 2582af43f4..a09eff3bda 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -563,7 +563,7 @@ export class AuthenticateLocalResult extends UnviredResult { */ @Plugin({ pluginName: 'UnviredCordovaSDK', - plugin: 'https://github.com/unvired/cordova-plugin-unvired-sdk', // npm package name, example: cordova-plugin-camera + 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 @ionic-native/unvired-cordova-sdk', // OPTIONAL install command, in case the plugin requires variables From 75f0fe782905382fede48d308e6e752acb2aac26 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Mon, 11 Jan 2021 19:54:36 +0530 Subject: [PATCH 26/32] doc(unvired-cordova-sdk): Update doc for userSettings() --- .../plugins/unvired-cordova-sdk/index.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index a09eff3bda..6cab6a5497 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -206,7 +206,7 @@ export enum NotificationListenerType { /** * Notify when the sent item count changes. */ - SentItemChanged = 11 + SentItemChanged = 11, } export enum AttachmentItemStatus { @@ -802,6 +802,21 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * 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 { From 2cde98cedde96afef3394b29d36f0b689e5b7b5b Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 2 Mar 2021 19:52:15 +0530 Subject: [PATCH 27/32] feat(unvired-cordova-sdk): add new discovery api --- .../plugins/unvired-cordova-sdk/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 6cab6a5497..849bb36fb4 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -1475,4 +1475,23 @@ export class UnviredCordovaSDK extends IonicNativePlugin { removeOutObjectBasedOnLid(lid: string): Promise { return; } + + /** + * Returns an observable containing the following information about a UMP server in the same network. + * Clients can use this information to allow users to select UMP servers in login page. + * ``` + * { + * "name": "Chyme 98", + * "url": "http://192.168.98.98:8080/UMP/", + * "root": "UNVIRED", + * "type": "DEVELOPMENT" + * } + * ``` + */ + @Cordova({ + observable: true, + }) + startDiscoveryService(): Observable { + return; + } } From af13cc1790fdab43b4c76fa601d7dfcf47c7ebae Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 5 Mar 2021 16:03:59 +0530 Subject: [PATCH 28/32] fix(unvired-cordova-sdk): rename the property --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 849bb36fb4..d45423d633 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -229,7 +229,7 @@ export class Settings { ADS_USER_ID: string; SAP_USER_ID: string; FULL_NAME: string; - URL: string; + SERVER_URL: string; USER_ID: string; } From 7d0c8965ce9b0fd25b1b939944cd9e504e40571d Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 30 Mar 2021 17:17:47 +0530 Subject: [PATCH 29/32] doc(unvired-cordova-sdk): Doc update --- .../plugins/unvired-cordova-sdk/index.ts | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index d45423d633..762ac441d1 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -388,12 +388,19 @@ export class LoginParameters { * Set this value to true to persist web application database. By default, this value is false. */ persistWebDb: boolean; + /* * Optional jwt token parameter. Please check with your Unvired Admin for this value. * For Example: * 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'. + */ + languageCode: string; } export class LoginResult extends UnviredResult { type: LoginListenerType; @@ -1197,12 +1204,22 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Sends data to UMP in Async mode. This means user can make this call and continue with other program execution. + * 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 * ``` - * await this.unviredSDK.syncBackground(RequestType.RQST, {"CUSTOMER_HEADER": {"CUST_NO" : "007", "CUST_NAME" : "James Bond"}}, '', 'PA_GET_CUSTOMER_DETAILS', 'CUSTOMER', beLID, false) + * 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 * ``` @@ -1477,21 +1494,24 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Returns an observable containing the following information about a UMP server in the same network. + * Returns an observable to return the UMP URLs which are discoverable within the network. * Clients can use this information to allow users to select UMP servers in login page. * ``` - * { - * "name": "Chyme 98", - * "url": "http://192.168.98.98:8080/UMP/", - * "root": "UNVIRED", - * "type": "DEVELOPMENT" - * } + * this.unviredSDK.startDiscoveryService().subscribe( (result) => { + * if (result.type == ResultType.success) { + * console.log('Discovered URLs: ' + JSON.stringify(result.data)) + * // {"name":"Chyme 98","url":"http://192.168.98.98:8080/UMP/","root":"UNVIRED","type":"DEVELOPMENT"} + * } + * else { + * console.log('Error in discovering URLs: ' + result.error) + * } + * }) * ``` */ @Cordova({ observable: true, }) - startDiscoveryService(): Observable { + startDiscoveryService(): Observable { return; } } From 82cf2176e60b4ddf27e6c68ec381e5fa886142a0 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 6 Apr 2021 11:25:03 +0530 Subject: [PATCH 30/32] fix(unvired-cordova-sdk): Update the return type for startDiscoveryService api --- .../plugins/unvired-cordova-sdk/index.ts | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 762ac441d1..d40c4f01e7 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -1494,24 +1494,23 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Returns an observable to return the UMP URLs which are discoverable within the network. - * Clients can use this information to allow users to select UMP servers in login page. + * 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. * ``` - * this.unviredSDK.startDiscoveryService().subscribe( (result) => { - * if (result.type == ResultType.success) { - * console.log('Discovered URLs: ' + JSON.stringify(result.data)) - * // {"name":"Chyme 98","url":"http://192.168.98.98:8080/UMP/","root":"UNVIRED","type":"DEVELOPMENT"} - * } - * else { - * console.log('Error in discovering URLs: ' + result.error) - * } - * }) + * 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({ - observable: true, - }) - startDiscoveryService(): Observable { + @Cordova() + startDiscoveryService(): Promise { return; } } From b698a19526227759ce8e6582fddc97eafbe937c6 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 6 Apr 2021 12:52:13 +0530 Subject: [PATCH 31/32] doc(unvired-cordova-sdk): Rename the loginParameter languageCode to loginLanguage. --- src/@ionic-native/plugins/unvired-cordova-sdk/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index d40c4f01e7..d95f21978b 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -400,7 +400,7 @@ export class LoginParameters { * Language code to be sent to UMP. Specify a two-letter language code. * The default value of this is 'en'. */ - languageCode: string; + loginLanguage: string; } export class LoginResult extends UnviredResult { type: LoginListenerType; From 77d38a0623ebf0594b04222abec842704a9bd659 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 6 Apr 2021 13:00:46 +0530 Subject: [PATCH 32/32] changes after doing npm install --- package-lock.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1dd4bd3ccc..a6fc47521c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1222,7 +1222,7 @@ }, "@types/cordova": { "version": "0.0.34", - "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz", + "resolved": "http://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz", "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ=", "dev": true }, @@ -1695,7 +1695,7 @@ }, "ansi-colors": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "dev": true, "requires": { @@ -2943,7 +2943,7 @@ }, "colors": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -4031,7 +4031,7 @@ }, "typescript": { "version": "1.8.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.8.10.tgz", + "resolved": "http://registry.npmjs.org/typescript/-/typescript-1.8.10.tgz", "integrity": "sha1-tHXW4N/wv1DyluXKbvn7tccyDx4=", "dev": true } @@ -4590,7 +4590,7 @@ }, "expand-range": { "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "resolved": "http://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "dev": true, "requires": { @@ -10400,7 +10400,7 @@ }, "nunjucks": { "version": "2.5.2", - "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-2.5.2.tgz", + "resolved": "http://registry.npmjs.org/nunjucks/-/nunjucks-2.5.2.tgz", "integrity": "sha1-6n00bnhbikh0Zmw8yp4YxXf7oiw=", "dev": true, "requires": { @@ -11786,7 +11786,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -12030,7 +12030,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -12231,7 +12231,7 @@ }, "pretty-hrtime": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", "dev": true }, @@ -12971,7 +12971,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -13418,7 +13418,7 @@ }, "spdx-license-list": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdx-license-list/-/spdx-license-list-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/spdx-license-list/-/spdx-license-list-2.1.0.tgz", "integrity": "sha1-N4j/tcgLJK++goOTTp5mhOpqIY0=", "dev": true }, @@ -13954,7 +13954,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -15453,7 +15453,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": {