From b75f40c76e551d9170b43ec929e84da4da5b8659 Mon Sep 17 00:00:00 2001 From: Srinidhi Rao Date: Fri, 14 Jun 2019 13:41:48 +0530 Subject: [PATCH 1/9] feat(unvired-cordova-sdk): add plugin --- .../plugins/unvired-cordova-sdk/index.ts | 449 ++++++++++++++++++ 1 file changed, 449 insertions(+) create mode 100644 src/@ionic-native/plugins/unvired-cordova-sdk/index.ts diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts new file mode 100644 index 000000000..dc3a230d3 --- /dev/null +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -0,0 +1,449 @@ +/** + * @name Unvired Cordova S D K + * @description + * This plugin can be used to connect to UMP ( Unvired Mobile Platform ). + * + * iOS Notes + * - + * 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' + * 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'; + +export enum LoginListenerType { + auth_activation_required = 0, + app_requires_login, + auth_activation_success, + auth_activation_error, + login_success, + login_error, + app_requires_current_account +} + +export enum LoginType { + unvired = "UNVIRED_ID", + ads = "ADS", + sap = "SAP", + custom = "CUSTOM" +} + +export enum ResultType { + success = 0, + error +} + +export enum RequestType { + RQST = 0, + PULL, + PUSH, + QUERY, + REQ +} + +export enum NotificationListenerType { + dataSend = 0, // Notify successful asynchronous send of data to the server. + dataChanged = 1, // Notify data changes for each BusinessEntity when received data from server. + dataReceived = 2, // Notify data receive completion on receive of all BusinessEntity + appReset = 3, // Notify application data reset. + attachmentDownloadSuccess = 4, // Notify application with error message and attchment item on attachment download error + attachmentDownloadError = 5, // Notify application with error message and attchment item on attachment download success + incomingDataProcessingFinished = 6, // Notify application when incoming data handling finished + attachmentDownloadWaiting = 7, // Notify application when attachment download is waiting on the server + infoMessage = 8, // Notify application with any InfoMessages + serverError = 9, // Notify application with Server errors + attachmentDownloadCompleted = 10 // Notify attachment downloads completed +} + +export enum AttachmentItemStatus { + DEFAULT = 0, + QUEUED_FOR_DOWNLOAD, + DOWNLOADED, + ERROR_IN_DOWNLOAD, + SAVED_FOR_UPLOAD, + UPLOADED, + ERROR_IN_UPLOAD, + MARKED_FOR_DELETE, + EXTERNAL +} + +export class Settings { + loginType: LoginType + ADS_DOMAIN: string + SAP_PORT_NAME: string + EMAIL: string + ADS_USER_ID: string + SAP_USER_ID: string + FULL_NAME: string + URL: string + USER_ID: string +} + +export class UnviredResult { + data: any + message: string + type: number + error: string + errorDetail: string +} + +export class NotifResult extends UnviredResult { + type: NotificationListenerType +} + +export class SettingsResult extends UnviredResult { + data: Settings + type: ResultType +} + +export class SyncResult extends UnviredResult { + type: ResultType +} + +export class DbResult extends UnviredResult { + type: ResultType +} + +export class LoginParameters { + appName: string + company: string + username: string + password: string + url: string + domain: string + loginType: LoginType + feUserId: string + port: string + metadataPath: string + isRequiredAttachmentBase64: boolean + autoSendTime: string + autoSyncTime: string +} +export class LoginResult extends UnviredResult { + type: LoginListenerType +} +@Plugin({ + pluginName: 'UnviredCordovaSDK', + plugin: 'cordova-plugin-unvired-sdk', // npm package name, example: cordova-plugin-camera + pluginRef: 'ump', // the variable reference to call the plugin, example: navigator.geolocation + repo: 'https://github.com/unvired/cordova-plugin-unvired-sdk/', // the github repository URL for the plugin + install: 'ionic cordova plugin add @ionic-native/unvired-cordova-sdk', // 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 UnviredCordovaSDK extends IonicNativePlugin { + + loginParameters: LoginParameters; + + @Cordova() + logDebug(sourceClass: string, method: string, message: string): Promise { + return; + } + + @Cordova() + logError(sourceClass: string, method: string, message: string): Promise { + return; + } + + @Cordova() + logInfo(sourceClass: string, method: string, message: string): Promise { + return; + } + + @Cordova() + logRead(): Promise { + return; + } + + @Cordova() + logDelete(): Promise { + return; + } + + @Cordova() + sendLogToServer(): Promise { + return; + } + + @Cordova() + sendLogViaEmail(): Promise { + return; + } + + /** + * This api initiatilizes the Unvired Application. + * @param loginParameters + */ + @Cordova() + login(loginParameters: LoginParameters): Promise { + return; + } + + @Cordova() + logout(): Promise { + return; + } + + /** + * Authenticates & activates the app against UMP + * @param loginParameters Send username & Password through loginParameters + */ + @Cordova() + authenticateAndActivate(loginParameters: LoginParameters): Promise { + return; + } + + /** + * Authenticates the user against the locally saved username & password. + * For ADS Login, authentication is performed with the ADS Server. + * @param loginParameters Send username & Password through loginParameters + */ + @Cordova() + authenticateLocal(loginParameters: LoginParameters): Promise { + return; + } + + @Cordova() + getAllAccounts(): Promise { + return; + } + + @Cordova() + switchAccount(account: any): Promise { + return; + } + + @Cordova() + deleteAccount(account: any): Promise { + return; + } + + @Cordova() + getInfoMessages(headerName: string, lid: string): Promise { + return; + } + + @Cordova() + showSettings(): Promise { + return; + } + + @Cordova() + userSettings(): Promise { + return; + } + + @Cordova() + updateSystemCredentials(credentials: any): Promise { + return; + } + + @Cordova() + getSystemCredentials(): Promise { + return; + } + + @Cordova() + getVersionNumbers(): Promise { + return; + } + + @Cordova() + clearData(): Promise { + return; + } + + @Cordova() + hasInternet(): Promise { + return; + } + + @Cordova() + guid() { + return; + } + + @Cordova() + dbSelect(tableName: string, whereClause: string): Promise { + return; + } + + @Cordova() + dbInsert(tableName: string, structureObject: any, isHeader: boolean): Promise { + return; + } + + @Cordova() + dbInsertOrUpdate(tableName: string, structureObject: any, isHeader: boolean): Promise { + return; + } + + @Cordova() + dbDelete(tableName: string, whereClause: string): Promise { + return; + } + + @Cordova() + dbUpdate(tableName: string, updatedObject: any, whereClause: string): Promise { + return; + } + + @Cordova() + dbExecuteStatement(query: string): Promise { + return; + } + + @Cordova() + dbCreateSavePoint(savePoint: string): Promise { + return; + } + + @Cordova() + dbReleaseSavePoint(savePoint: string): Promise { + return; + } + + @Cordova() + dbRollbackToSavePoint(savePoint: string): Promise { + return; + } + + @Cordova() + dbBeginTransaction(): Promise { + return; + } + + @Cordova() + dbEndTransaction(): Promise { + return; + } + + @Cordova() + launchFile(filePath: string): Promise { + return; + } + + @Cordova() + launchBase64(base64string: string, fileName: string, extension: string): Promise { + return; + } + + @Cordova() + unzip(srcPath: string, destPath: string) { + return; + } + + @Cordova() + getAttachmentFolderPath(): Promise { + return; + } + + @Cordova() + createAttachmentItem(tableName: string, structureObject: any): Promise { + return; + } + + @Cordova() + uploadAttachment(tableName: string, structureObject: any, isAsync: boolean): Promise { + return; + } + + @Cordova() + downloadAttachment(tableName: string, structureObject: any): Promise { + return; + } + + @Cordova() + syncForeground(reqype: any, header: any, customData: any, paFunction: string, autoSave: boolean): Promise { + return; + } + + @Cordova() + syncBackground(reqype: any, header: any, customData: any, paFunction: string, beName: string, belid: string, bypassAttachment: boolean): Promise { + return; + } + + @Cordova() + getMessages() { + return; + } + + @Cordova({ + observable: true, + clearFunction: 'unRegisterNotifListener' + }) + registerNotifListener(): Observable { + return; + } + + @Cordova() + unRegisterNotifListener(): Promise { + return; + } + + @Cordova() + isInOutBox(beLid: string): Promise { + return; + } + + @Cordova() + outBoxItemCount(): Promise { + return; + } + + @Cordova() + isInSentItem(beLid: string): Promise { + return; + } + + @Cordova() + sentItemCount(): Promise { + return; + } + + @Cordova() + inBoxItemCount(): Promise { + return; + } + + @Cordova() + deleteOutBoxEntry(beLid: string): Promise { + return; + } + + @Cordova() + resetApplicationSyncData(): Promise { + return; + } +} From 1b6024780767f5d6de008136359db48b237c489d Mon Sep 17 00:00:00 2001 From: Srinidhi Rao Date: Fri, 14 Jun 2019 14:08:58 +0530 Subject: [PATCH 2/9] style(unvired-cordova-sdk): fix style --- .../plugins/unvired-cordova-sdk/index.ts | 94 +++++++++---------- 1 file changed, 42 insertions(+), 52 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index dc3a230d3..d7f668695 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -1,16 +1,10 @@ /** * @name Unvired Cordova S D K * @description - * This plugin can be used to connect to UMP ( Unvired Mobile Platform ). - * - * iOS Notes - * - - * This plugin has a dependency on the following Cocoapod. In your iOS project, first install the dependent pod and then install the plugin. + * 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'; @@ -19,7 +13,6 @@ * constructor(private unviredCordovaSDK: UnviredCordovaSDK) { } * * ... - * * // Login * let loginParameters = new LoginParameters() * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' @@ -27,13 +20,10 @@ * * // 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") - * * ``` */ @@ -52,10 +42,10 @@ export enum LoginListenerType { } export enum LoginType { - unvired = "UNVIRED_ID", - ads = "ADS", - sap = "SAP", - custom = "CUSTOM" + unvired = 'UNVIRED_ID', + ads = 'ADS', + sap = 'SAP', + custom = 'CUSTOM' } export enum ResultType { @@ -77,8 +67,8 @@ export enum NotificationListenerType { dataReceived = 2, // Notify data receive completion on receive of all BusinessEntity appReset = 3, // Notify application data reset. attachmentDownloadSuccess = 4, // Notify application with error message and attchment item on attachment download error - attachmentDownloadError = 5, // Notify application with error message and attchment item on attachment download success - incomingDataProcessingFinished = 6, // Notify application when incoming data handling finished + attachmentDownloadError = 5, // Notify application with error message and attchment item on attachment download success + incomingDataProcessingFinished = 6, // Notify application when incoming data handling finished attachmentDownloadWaiting = 7, // Notify application when attachment download is waiting on the server infoMessage = 8, // Notify application with any InfoMessages serverError = 9, // Notify application with Server errors @@ -98,59 +88,59 @@ export enum AttachmentItemStatus { } export class Settings { - loginType: LoginType - ADS_DOMAIN: string - SAP_PORT_NAME: string - EMAIL: string - ADS_USER_ID: string - SAP_USER_ID: string - FULL_NAME: string - URL: string - USER_ID: string + loginType: LoginType; + ADS_DOMAIN: string; + SAP_PORT_NAME: string; + EMAIL: string; + ADS_USER_ID: string; + SAP_USER_ID: string; + FULL_NAME: string; + URL: string; + USER_ID: string; } export class UnviredResult { - data: any - message: string - type: number - error: string - errorDetail: string + data: any; + message: string; + type: number; + error: string; + errorDetail: string; } export class NotifResult extends UnviredResult { - type: NotificationListenerType + type: NotificationListenerType; } export class SettingsResult extends UnviredResult { - data: Settings - type: ResultType + data: Settings; + type: ResultType; } export class SyncResult extends UnviredResult { - type: ResultType + type: ResultType; } export class DbResult extends UnviredResult { - type: ResultType + type: ResultType; } export class LoginParameters { - appName: string - company: string - username: string - password: string - url: string - domain: string - loginType: LoginType - feUserId: string - port: string - metadataPath: string - isRequiredAttachmentBase64: boolean - autoSendTime: string - autoSyncTime: string + appName: string; + company: string; + username: string; + password: string; + url: string; + domain: string; + loginType: LoginType; + feUserId: string; + port: string; + metadataPath: string; + isRequiredAttachmentBase64: boolean; + autoSendTime: string; + autoSyncTime: string; } export class LoginResult extends UnviredResult { - type: LoginListenerType + type: LoginListenerType; } @Plugin({ pluginName: 'UnviredCordovaSDK', @@ -202,8 +192,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * This api initiatilizes the Unvired Application. - * @param loginParameters + * This api initiatilizes the Unvired Application. + * @param loginParameters */ @Cordova() login(loginParameters: LoginParameters): Promise { From 2ca8bda8f7e2ed7caeafb312f3ceff234ebceece Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Thu, 4 Jul 2019 18:12:29 +0530 Subject: [PATCH 3/9] doc(unvired-cordova-sdk): add doc --- .../plugins/unvired-cordova-sdk/index.ts | 578 +++++++++++++++++- 1 file changed, 549 insertions(+), 29 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index d7f668695..d87dbb94c 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -16,6 +16,8 @@ * // 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. @@ -31,48 +33,179 @@ import { Injectable } from '@angular/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs'; +export enum AuthenticateAndActivateResultType { + /** + * This value indicates that UMP was able to validate users credentials & activation of the user is complete. + * In mobile apps, this also means database is created & apps can proceed with their custom logic. + */ + auth_activation_success = 2, + /** + * This value indicates that UMP was unable to validate users credentials. + */ + auth_activation_error = 3 +} + +export enum AuthenticateLocalResultType { + /** + * This value indicates that UnviredCordovaSDK was able to validate users credentials and apps can proceed with their custom logic. + */ + login_success = 4, + /** + * This value indicates that UnviredCordovaSDK was unable to validate users credentials. You can retrieve the error information from AuthenticateLocalResult. + */ + login_error = 5 +} + export enum LoginListenerType { + /** + * This value indicates that there is no user account exists and user needs to authenticate & activate. Call authenticateAndActivate() api to activate the user. + */ auth_activation_required = 0, - app_requires_login, - auth_activation_success, - auth_activation_error, - login_success, - login_error, - app_requires_current_account + /** + * Applicable for iOS, Android & Windows. + * This value indicates user needs to login before using the app. This depends on the setting LOCAL_PASSWORD which is set in UMP Admin Cockpit. + * If LOCAL_PASSWORD is set to true, this type is set everytime user opens the app. + */ + app_requires_login = 1, + /** + * This value indicates app can proceed with its custom logic. + */ + login_success = 4, + /** + * TODO + */ + app_requires_current_account = 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' + loginParameters.company = 'unvired' + loginParameters.loginType = LoginType.unvired + * ``` + */ unvired = 'UNVIRED_ID', + /** + * 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' + loginParameters.company = 'unvired' + loginParameters.domain = 'ADS_DOMAIN' + loginParameters.loginType = LoginType.ads + * ``` + */ ads = 'ADS', + /** + * 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' + loginParameters.company = 'unvired' + loginParameters.port = 'SAP_PORT_NAME' + loginParameters.domain = 'SAP_DOMAIN' + loginParameters.loginType = LoginType.sap + * ``` + */ sap = 'SAP', + /** + * TODO: + */ custom = 'CUSTOM' } export enum ResultType { + /** + * This value indicates a succesful operation. + */ success = 0, + /** + * This value indicates an error. + */ error } export enum RequestType { + /** + * Set this type if the data exchange with UMP is 1:1. The header datastructure needs to be sent which also should be present in database prior to the call. + * You can use UnviredCordovaSDK's db methods to insert data into database. + */ RQST = 0, + /** + * 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, + /** + * 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, + /** + * 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, + /** + * Set this type if the data exchange with UMP is 1:0. This handles the case where no server response is expected. + */ REQ } export enum NotificationListenerType { - dataSend = 0, // Notify successful asynchronous send of data to the server. - dataChanged = 1, // Notify data changes for each BusinessEntity when received data from server. - dataReceived = 2, // Notify data receive completion on receive of all BusinessEntity - appReset = 3, // Notify application data reset. - attachmentDownloadSuccess = 4, // Notify application with error message and attchment item on attachment download error - attachmentDownloadError = 5, // Notify application with error message and attchment item on attachment download success - incomingDataProcessingFinished = 6, // Notify application when incoming data handling finished - attachmentDownloadWaiting = 7, // Notify application when attachment download is waiting on the server - infoMessage = 8, // Notify application with any InfoMessages - serverError = 9, // Notify application with Server errors - attachmentDownloadCompleted = 10 // Notify attachment downloads completed + /** + * Notify successful asynchronous send of data to the server. This type indicates that data has moved from outbox to sent items. + */ + dataSend = 0, + /** + * Notify data changes for each BusinessEntity when received data from server. This type indicates when data is removed from sent items table. + */ + dataChanged = 1, + /** + * Notify data receive completion on receiving of all BusinessEntities from server. Data would get processed after this step. + */ + dataReceived = 2, + /** + * Notify application data reset. + */ + appReset = 3, + /** + * Notify application with error message and attchment item on attachment download success + */ + attachmentDownloadSuccess = 4, + /** + * Notify application with error message and attchment item on attachment download error + */ + attachmentDownloadError = 5, + /** + * Notify application when incoming data handling finished + */ + incomingDataProcessingFinished = 6, + /** + * Notify application when incoming data handling finished + */ + attachmentDownloadWaiting = 7, + /** + * Notify application with any InfoMessages + */ + infoMessage = 8, + /** + * Notify application with Server errors + */ + serverError = 9, + /** + * Notify attachment downloads completed + */ + attachmentDownloadCompleted = 10 } export enum AttachmentItemStatus { @@ -100,10 +233,25 @@ export class Settings { } export class UnviredResult { + /** + * The data returned in response to the api call. + */ data: any; + /** + * The informational message returned in lieu of data. + */ message: string; + /** + * Refer to the overrided property in subclasses. + */ type: number; + /** + * Contains the error information which the apps can convey to the users. + */ error: string; + /** + * Contains the detailed error information which the apps can convey to the users. + */ errorDetail: string; } @@ -125,23 +273,86 @@ export class DbResult extends UnviredResult { } export class LoginParameters { + /** + * Set the application name as configured in UMP. + */ appName: string; + + /** + * Company name as configured in UMP. + */ company: string; + + /** + * Username of the user trying to login. + */ username: string; + + /** + * Password of the user trying to login. + */ password: string; + + /** + * UMP URL. For example: http://192.168.98.160:8080/UMP + */ url: string; + + /** + * Domain name. Required only if the login type is ADS or SAP. + */ domain: string; + + /** + * Set this value to one of the allowed login types for your app as configured in UMP. + */ loginType: LoginType; + + /** + * FrontEndUserId: This id uniquely identifies the user across devices of same type. If the Unvired user has multiple front end ids for a device type, you need to set this value. + * If the Unvired user has only one front end id, leave this field blank. + */ feUserId: string; + + /** + * Required only if the loginType is 'sap'. This sets the SAP Port Name. + */ port: string; + + /** + * Required for Browser Platform. + * For iOS Platform include the metadata.xml file as part of App Bundle + * For Android Platform include the metadata.xml file in src > res > raw + */ metadataPath: string; + + /** + * This is required for Android only. Setting this value would save the attachments as Base64 string for easy access. + */ isRequiredAttachmentBase64: boolean; + + /** + * TODO: + */ autoSendTime: string; + + /** + * TODO: + */ autoSyncTime: string; } export class LoginResult extends UnviredResult { type: LoginListenerType; } + +export class AuthenticateActivateResult extends UnviredResult { + type: AuthenticateAndActivateResultType; +} + +export class AuthenticateLocalResult extends UnviredResult { + type: AuthenticateLocalResultType; +} + @Plugin({ pluginName: 'UnviredCordovaSDK', plugin: 'cordova-plugin-unvired-sdk', // npm package name, example: cordova-plugin-camera @@ -149,246 +360,518 @@ export class LoginResult extends UnviredResult { 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 installVariables: [], // OPTIONAL the plugin requires variables - platforms: ['iOS'] // Array of platforms supported, example: ['Android', 'iOS'] + platforms: ['iOS', 'Android', 'Browser'] // Array of platforms supported, example: ['Android', 'iOS'] }) @Injectable() export class UnviredCordovaSDK extends IonicNativePlugin { loginParameters: LoginParameters; + /** + * Write debug logs. + * @param sourceClass + * @param method + * @param message + * Example: + * this.unviredSDK.logDebug("Class Name", "Method Name", "Log Message") + * would produce the log message like this + * 01-07-2019 15:52 | DEBUG | Class Name | Method Name | Log Message + */ @Cordova() logDebug(sourceClass: string, method: string, message: string): Promise { return; } + /** + * Write error logs. + * @param sourceClass + * @param method + * @param message + * Example: + * this.unviredSDK.logError("Class Name", "Method Name", "Log Message") + * would produce the log message like this + * 01-07-2019 15:52 | ERROR | Class Name | Method Name | Log Message + */ @Cordova() logError(sourceClass: string, method: string, message: string): Promise { return; } + /** + * Write Info logs. + * @param sourceClass + * @param method + * @param message + * Example: + * this.unviredSDK.logInfo("Class Name", "Method Name", "Log Message") + * would produce the log message like this + * 01-07-2019 15:52 | IMPORTANT | Class Name | Method Name | Log Message + */ @Cordova() logInfo(sourceClass: string, method: string, message: string): Promise { return; } + /** + * TODO: + */ @Cordova() logRead(): Promise { return; } + /** + * TODO: + */ @Cordova() logDelete(): Promise { return; } + /** + * TODO: + */ @Cordova() sendLogToServer(): Promise { return; } + /** + * TODO: + */ @Cordova() sendLogViaEmail(): Promise { return; } /** - * This api initiatilizes the Unvired Application. - * @param loginParameters - */ + * This api initializes the Unvired Application. + * @param loginParameters Set of parameters to be passed the login() + * For Example: + * ``` + * let loginParameters = new LoginParameters() + * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' + * loginParameters.metadataPath = '../assets/metadata.json' + * loginParameters.loginType = LoginType.unvired + * ``` + */ @Cordova() login(loginParameters: LoginParameters): Promise { return; } + /** + * TODO: + */ @Cordova() logout(): Promise { return; } /** - * Authenticates & activates the app against UMP - * @param loginParameters Send username & Password through loginParameters + * Authenticates ( With the Unvired Server ) & activates ( Receives Framework Settings ) the app against UMP + * Example: + * ``` + * let loginParameters = new LoginParameters() + * loginParameters.username = 'MY_USERNAME' + * loginParameters.password = 'MY_PASSWORD' + * await this.unviredSDK.authenticateAndActivate(loginParameters) + * ``` + * @param loginParameters LoginParamerter instance used to send username / password. */ @Cordova() - authenticateAndActivate(loginParameters: LoginParameters): Promise { + authenticateAndActivate(loginParameters: LoginParameters): Promise { return; } /** - * Authenticates the user against the locally saved username & password. + * Authenticates the user against the previously saved username & password. * For ADS Login, authentication is performed with the ADS Server. - * @param loginParameters Send username & Password through loginParameters + * @param loginParameters Send username & Password through LoginParameters + * Example: + * ``` + * let loginParameters = new LoginParameters() + * loginParameters.username = 'MY_USERNAME' + * loginParameters.password = 'MY_PASSWORD' + * await this.unviredSDK.authenticateLocal(loginParameters) */ @Cordova() - authenticateLocal(loginParameters: LoginParameters): Promise { + authenticateLocal(loginParameters: LoginParameters): Promise { return; } + /** + * Returns all the accounts configured on the device. + * TODO + */ @Cordova() getAllAccounts(): Promise { return; } + /** + * TODO + */ @Cordova() switchAccount(account: any): Promise { return; } + /** + * TODO + */ @Cordova() deleteAccount(account: any): Promise { return; } + /** + * TODO + */ @Cordova() getInfoMessages(headerName: string, lid: string): Promise { return; } + /** + * TODO + */ @Cordova() showSettings(): Promise { return; } + /** + * TODO + */ @Cordova() userSettings(): Promise { return; } + /** + * TODO + */ @Cordova() updateSystemCredentials(credentials: any): Promise { return; } + /** + * TODO + */ @Cordova() getSystemCredentials(): Promise { return; } + /** + * TODO + */ @Cordova() getVersionNumbers(): Promise { return; } + /** + * TODO + */ @Cordova() clearData(): Promise { return; } + /** + * TODO + */ @Cordova() hasInternet(): Promise { return; } + /** + * TODO + */ @Cordova() guid() { return; } + /** + * Select records from Database + * @param tableName table name. Example: CUSTOMER_HEADER + * @param whereClause JSON object containing name-value pairs. + * Example: + * ``` + * {'F_NAME':'TARAK','EMP_NO':'0039'} + * ``` + */ @Cordova() dbSelect(tableName: string, whereClause: string): Promise { return; } + /** + * TODO + */ @Cordova() dbInsert(tableName: string, structureObject: any, isHeader: boolean): Promise { return; } + /** + * TODO + * @param tableName + * @param structureObject + * @param isHeader + */ @Cordova() dbInsertOrUpdate(tableName: string, structureObject: any, isHeader: boolean): Promise { return; } + /** + * TODO + * @param tableName + * @param whereClause + */ @Cordova() dbDelete(tableName: string, whereClause: string): Promise { return; } + /** + * TODO + * @param tableName + * @param updatedObject + * @param whereClause + */ @Cordova() dbUpdate(tableName: string, updatedObject: any, whereClause: string): Promise { return; } + /** + * Supported in iOS, Android & Windows only. + * Execute SQL Statement + * @param query SQL Statement. Example: SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = 39 + */ @Cordova() dbExecuteStatement(query: string): Promise { return; } + /** + * TODO + * @param savePoint + */ @Cordova() dbCreateSavePoint(savePoint: string): Promise { return; } + /** + * TODO + * @param savePoint + */ @Cordova() dbReleaseSavePoint(savePoint: string): Promise { return; } + /** + * TODO + * @param savePoint + */ @Cordova() dbRollbackToSavePoint(savePoint: string): Promise { return; } + /** + * TODO + */ @Cordova() dbBeginTransaction(): Promise { return; } + /** + * TODO + */ @Cordova() dbEndTransaction(): Promise { return; } + /** + * TODO + */ @Cordova() launchFile(filePath: string): Promise { return; } + /** + * TODO + */ @Cordova() launchBase64(base64string: string, fileName: string, extension: string): Promise { return; } + /** + * TODO + */ @Cordova() unzip(srcPath: string, destPath: string) { return; } + /** + * TODO + */ @Cordova() getAttachmentFolderPath(): Promise { return; } + /** + * TODO + */ @Cordova() createAttachmentItem(tableName: string, structureObject: any): Promise { return; } + /** + * TODO + */ @Cordova() uploadAttachment(tableName: string, structureObject: any, isAsync: boolean): Promise { return; } + /** + * TODO + */ @Cordova() downloadAttachment(tableName: string, structureObject: any): Promise { return; } + /** + * Sends data to UMP in SYNC mode. This means user has to wait until the duration of SYNC call. Only one SYNC call can be active at any point of time. Once the call completes, the result 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. + * @param reqype RequestType for the message. Please check RequestType to select the right request type. + * @param header 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: + * ``` + * {"CUSTOMER_HEADER": {field_name : field_value,...}} + * ``` + * @param customData 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,...} + }] + } + * ``` + * @param paFunction Name of the Process Agent function to be executed. Example: PA_MOBILE_EXECUTE_SALES_ORDER. + * @param autoSave This defines whether to save the response to database. + */ @Cordova() - syncForeground(reqype: any, header: any, customData: any, paFunction: string, autoSave: boolean): Promise { + syncForeground(reqype: RequestType, header: any, customData: any, paFunction: string, autoSave: boolean): Promise { return; } + /** + * 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 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: + * ``` + * {"CUSTOMER_HEADER": {field_name : field_value,...}} + * ``` + * @param customData 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,...} + }] + } + * ``` + * @param paFunction Name of the Process Agent function to be executed. Example: PA_MOBILE_EXECUTE_SALES_ORDER. + * @param beName + * @param belid + * @param bypassAttachment + */ @Cordova() - syncBackground(reqype: any, header: any, customData: any, paFunction: string, beName: string, belid: string, bypassAttachment: boolean): Promise { + syncBackground(reqype: RequestType, header: any, customData: any, paFunction: string, beName: string, belid: string, bypassAttachment: boolean): Promise { return; } + /** + * For Browser platform only. + * Reinitialize web db. Use this api to initialize db from persisted local storage db + * TODO: + */ + @Cordova() + dbReload() { + return + } + + /** + * For Browser platform only. + * Generate Unvired BusinessEntity json from header and items + * @param headerName Header Table Name + * @param header Header Datastructure object + * @param itemName Item Table Name + * @param items Array of Item Structures. + */ + @Cordova() + generateUBJson(headerName: string, header: any, itemName: string, items: any) { + return; + } + + /** + * For Browser platform only. + * parseRawUBJson - Parse response json returned from syncForeground api. + * @param json JSON string + */ + @Cordova() + parseRawUBJson(json: string) { + return; + } + + /** + * For Browser platform only. + * Returns a collection of all entities which belong to |tableName| + * @param tableName Name of the table Exanple: CUSTOMER_HEADER + */ + @Cordova() + dbGetCollection(tableName: string) { + return; + } + + /** + * Places a request to download all pending messages for the logged in user in UMP. + * To keep track of returned data, you would need to register a notification listener (registerNotifListener()) & subscribe to the observable. + */ @Cordova() getMessages() { return; } + /** + * Subscribe to this observable to listen for life-cyle events in the case of an async message. + * Only one class can subscribe to notifications are any point of time. + */ @Cordova({ observable: true, clearFunction: 'unRegisterNotifListener' @@ -397,43 +880,80 @@ export class UnviredCordovaSDK extends IonicNativePlugin { return; } + /** + * Unregister the notification listener previously registered. + */ @Cordova() unRegisterNotifListener(): Promise { return; } + /** + * Check whether a Header datastructure is in outbox. + * @param beLid LID of the Header datastructure. + */ @Cordova() isInOutBox(beLid: string): Promise { return; } + /** + * Returns the count of outbox items. + */ @Cordova() outBoxItemCount(): Promise { return; } + /** + * Checks whether a Header datastructure is in sent and is waiting for response. + * Typically you would use before allowing the user to update the Header datastructure. + * @param beLid + */ @Cordova() isInSentItem(beLid: string): Promise { return; } + /** + * Returns the count of sent items. + */ @Cordova() sentItemCount(): Promise { return; } + /** + * Returns the count of Inbox items. + */ @Cordova() inBoxItemCount(): Promise { return; } + /** + * Delete outbox entry for a Header datastructure. + * @param beLid + */ @Cordova() deleteOutBoxEntry(beLid: string): Promise { return; } + /** + * Resets sync data with the application such as outbox, inbox & sent item entries. + * You may want to call this function before switching account. + */ @Cordova() resetApplicationSyncData(): Promise { return; } + + /** + * For Browser platform only + * Helps in updating application database without reauthenticating with server which requires to drop both app and framework database. + */ + reCreateAppDB(): Promise { + return; + } } From afe95a67526db94b24e857061a2070f1c1a46ecb Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 5 Jul 2019 13:15:01 +0530 Subject: [PATCH 4/9] doc(unvired-cordova-sdk): update doc --- .../plugins/unvired-cordova-sdk/index.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index d87dbb94c..b1c853976 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -597,6 +597,22 @@ export class UnviredCordovaSDK extends IonicNativePlugin { return; } + /** + * For Debugging Only. pull database file to "temp" folder for development purpose only. + */ + @Cordova() + pullDb(): Promise { + return + } + + /** + * For Debugging Only. ush updated database file from "temp" folder to application directory for development purpose only + */ + @Cordova() + pushDb(): Promise { + return + } + /** * Select records from Database * @param tableName table name. Example: CUSTOMER_HEADER @@ -889,6 +905,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** + * Supported in iOS, Android & Windows only * Check whether a Header datastructure is in outbox. * @param beLid LID of the Header datastructure. */ @@ -898,6 +915,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** + * Supported in iOS, Android & Windows only * Returns the count of outbox items. */ @Cordova() @@ -906,6 +924,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** + * Supported in iOS, Android & Windows only * Checks whether a Header datastructure is in sent and is waiting for response. * Typically you would use before allowing the user to update the Header datastructure. * @param beLid @@ -916,6 +935,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** + * Supported in iOS, Android & Windows only * Returns the count of sent items. */ @Cordova() @@ -924,6 +944,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** + * Supported in iOS, Android & Windows only * Returns the count of Inbox items. */ @Cordova() @@ -932,6 +953,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** + * Supported in iOS, Android & Windows only * Delete outbox entry for a Header datastructure. * @param beLid */ From 55fb503d818f6243608fbb27efece3148dfa2451 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 5 Jul 2019 15:16:14 +0530 Subject: [PATCH 5/9] style(unvired-cordova-sdk): fix style --- .../plugins/unvired-cordova-sdk/index.ts | 272 ++++++++++-------- 1 file changed, 156 insertions(+), 116 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index b1c853976..76ea2b188 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -16,7 +16,7 @@ * // Login * let loginParameters = new LoginParameters() * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' - * loginParameters.metadataPath = '../assets/metadata.json' + * loginParameters.metadataPath = '../assets/metadata.json' * loginParameters.loginType = LoginType.unvired * let loginResult: LoginResult = await this.unviredCordovaSDK.login(loginParameters) * @@ -80,40 +80,40 @@ export enum LoginListenerType { export enum LoginType { /** * This value represents authentication using Unvired ID. - * Example: + * Example: * If you plan to authenticate using Unvired ID, you need to send the following parameters: * ``` * loginParameters.username = 'USER_NAME' - loginParameters.password = 'password' - loginParameters.company = 'unvired' - loginParameters.loginType = LoginType.unvired + * loginParameters.password = 'password' + * loginParameters.company = 'unvired' + * loginParameters.loginType = LoginType.unvired * ``` */ unvired = 'UNVIRED_ID', /** * This value represents authentication using Active Directory Service (ADS). - * Example: + * Example: * If you plan to authenticate using Unvired ID, you need to send the following parameters: * ``` - loginParameters.username = 'USER_NAME' - loginParameters.password = 'password' - loginParameters.company = 'unvired' - loginParameters.domain = 'ADS_DOMAIN' - loginParameters.loginType = LoginType.ads + * loginParameters.username = 'USER_NAME' + * loginParameters.password = 'password' + * loginParameters.company = 'unvired' + * loginParameters.domain = 'ADS_DOMAIN' + * loginParameters.loginType = LoginType.ads * ``` */ ads = 'ADS', /** * This value represents authentication using SAP ID. - * Example: + * Example: * If you plan to authenticate using Unvired ID, you need to send the following parameters: * ``` * loginParameters.username = 'USER_NAME' - loginParameters.password = 'password' - loginParameters.company = 'unvired' - loginParameters.port = 'SAP_PORT_NAME' - loginParameters.domain = 'SAP_DOMAIN' - loginParameters.loginType = LoginType.sap + * loginParameters.password = 'password' + * loginParameters.company = 'unvired' + * loginParameters.port = 'SAP_PORT_NAME' + * loginParameters.domain = 'SAP_DOMAIN' + * loginParameters.loginType = LoginType.sap * ``` */ sap = 'SAP', @@ -320,7 +320,7 @@ export class LoginParameters { port: string; /** - * Required for Browser Platform. + * Required for Browser Platform. * For iOS Platform include the metadata.xml file as part of App Bundle * For Android Platform include the metadata.xml file in src > res > raw */ @@ -369,13 +369,15 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Write debug logs. - * @param sourceClass - * @param method - * @param message + * @param sourceClass Name of the class + * @param method Name of the method + * @param message The actual message * Example: - * this.unviredSDK.logDebug("Class Name", "Method Name", "Log Message") + * ``` + * this.unviredSDK.logDebug("Class Name", "Method Name", "Log Message") + * ``` * would produce the log message like this - * 01-07-2019 15:52 | DEBUG | Class Name | Method Name | Log Message + * 01-07-2019 15:52 | DEBUG | Class Name | Method Name | Log Message */ @Cordova() logDebug(sourceClass: string, method: string, message: string): Promise { @@ -384,13 +386,13 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Write error logs. - * @param sourceClass - * @param method - * @param message + * @param sourceClass Name of the class + * @param method Name of the method + * @param message The actual message * Example: - * this.unviredSDK.logError("Class Name", "Method Name", "Log Message") + * this.unviredSDK.logError("Class Name", "Method Name", "Log Message") * would produce the log message like this - * 01-07-2019 15:52 | ERROR | Class Name | Method Name | Log Message + * 01-07-2019 15:52 | ERROR | Class Name | Method Name | Log Message */ @Cordova() logError(sourceClass: string, method: string, message: string): Promise { @@ -399,13 +401,13 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Write Info logs. - * @param sourceClass - * @param method - * @param message + * @param sourceClass Name of the class + * @param method Name of the method + * @param message The actual message * Example: - * this.unviredSDK.logInfo("Class Name", "Method Name", "Log Message") + * this.unviredSDK.logInfo("Class Name", "Method Name", "Log Message") * would produce the log message like this - * 01-07-2019 15:52 | IMPORTANT | Class Name | Method Name | Log Message + * 01-07-2019 15:52 | IMPORTANT | Class Name | Method Name | Log Message */ @Cordova() logInfo(sourceClass: string, method: string, message: string): Promise { @@ -445,16 +447,16 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * This api initializes the Unvired Application. - * @param loginParameters Set of parameters to be passed the login() - * For Example: - * ``` - * let loginParameters = new LoginParameters() - * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' - * loginParameters.metadataPath = '../assets/metadata.json' - * loginParameters.loginType = LoginType.unvired - * ``` - */ + * This api initializes the Unvired Application. + * @param loginParameters Set of parameters to be passed the login() + * For Example: + * ``` + * let loginParameters = new LoginParameters() + * loginParameters.appName = 'UNVIRED_DIGITAL_FORMS' + * loginParameters.metadataPath = '../assets/metadata.json' + * loginParameters.loginType = LoginType.unvired + * ``` + */ @Cordova() login(loginParameters: LoginParameters): Promise { return; @@ -470,7 +472,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Authenticates ( With the Unvired Server ) & activates ( Receives Framework Settings ) the app against UMP - * Example: + * Example: * ``` * let loginParameters = new LoginParameters() * loginParameters.username = 'MY_USERNAME' @@ -488,7 +490,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Authenticates the user against the previously saved username & password. * For ADS Login, authentication is performed with the ADS Server. * @param loginParameters Send username & Password through LoginParameters - * Example: + * Example: * ``` * let loginParameters = new LoginParameters() * loginParameters.username = 'MY_USERNAME' @@ -501,8 +503,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Returns all the accounts configured on the device. - * TODO + * Get all the accounts configured on the device. */ @Cordova() getAllAccounts(): Promise { @@ -510,7 +511,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Switch account + * @param account The account to switch to */ @Cordova() switchAccount(account: any): Promise { @@ -518,7 +520,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Delete account + * @param account The account to delete */ @Cordova() deleteAccount(account: any): Promise { @@ -526,7 +529,9 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Get all InfoMessages linked to the header. + * @param headerName Name of the header. Example: CUSTOMER_HEADER + * @param lid LID of the header. */ @Cordova() getInfoMessages(headerName: string, lid: string): Promise { @@ -534,7 +539,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Supported for iOS, Android & Windows Platforms. + * Display framework settings. */ @Cordova() showSettings(): Promise { @@ -542,7 +548,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Get User settings. */ @Cordova() userSettings(): Promise { @@ -550,7 +556,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Update System Credential + * @param credentials The credential to update to */ @Cordova() updateSystemCredentials(credentials: any): Promise { @@ -558,7 +565,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Get all system credentials. */ @Cordova() getSystemCredentials(): Promise { @@ -566,7 +573,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Get version number of unvired-cordova-sdk. */ @Cordova() getVersionNumbers(): Promise { @@ -574,7 +581,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Delete all data from the device. */ @Cordova() clearData(): Promise { @@ -582,7 +589,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Check whether the device has internet. */ @Cordova() hasInternet(): Promise { @@ -590,7 +597,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Get a random id to use as guid. */ @Cordova() guid() { @@ -602,7 +609,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { */ @Cordova() pullDb(): Promise { - return + return; } /** @@ -610,25 +617,30 @@ export class UnviredCordovaSDK extends IonicNativePlugin { */ @Cordova() pushDb(): Promise { - return + return; } /** * Select records from Database * @param tableName table name. Example: CUSTOMER_HEADER - * @param whereClause JSON object containing name-value pairs. + * @param whereClause JSON object containing name-value pairs. * Example: * ``` * {'F_NAME':'TARAK','EMP_NO':'0039'} * ``` - */ + */ @Cordova() - dbSelect(tableName: string, whereClause: string): Promise { + dbSelect(tableName: string, whereClause: any): Promise { return; } /** - * TODO + * Insert record into database. + * In browser platform this function always inserts or updates based on GID. + * Example - this.unviredsdk.dbInsert("CUSTOMER_HEADER",{"NAME":"TARAK","NO":"0039"....},true); + * @param tableName Name of the table. + * @param structureObject - JSON object containing name-value pairs. + * @param isHeader - is DataStructure a header or item? */ @Cordova() dbInsert(tableName: string, structureObject: any, isHeader: boolean): Promise { @@ -636,10 +648,12 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO - * @param tableName - * @param structureObject - * @param isHeader + * insert or update the record ( if record exists ) into database. + * In browser insert always inserts or updates based on gid + * Example - this.unviredsdk.dbInsertOrUpdate("CUSTOMER_HEADER",{"NAME":"TARAK","NO":"0039"....},true); + * @param tableName Name of the table + * @param structureObject - JSON object containing name-value pairs. + * @param isHeader - is DataStructure a header or item? */ @Cordova() dbInsertOrUpdate(tableName: string, structureObject: any, isHeader: boolean): Promise { @@ -647,23 +661,31 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO - * @param tableName - * @param whereClause + * Delete records from the database. + * @param tableName Name of the table + * @param whereClause JSON object containing name-value pairs. + * Example: + * ``` + * {'F_NAME':'TARAK','EMP_NO':'0039'} + * ``` */ @Cordova() - dbDelete(tableName: string, whereClause: string): Promise { + dbDelete(tableName: string, whereClause: any): Promise { return; } /** - * TODO - * @param tableName - * @param updatedObject - * @param whereClause + * Update records in database. + * @param tableName Name of the table + * @param updatedObject JSON object containing name-value pairs. + * @param whereClause JSON object containing name-value pairs. + * Example: + * ``` + * {'F_NAME':'TARAK','EMP_NO':'0039'} + * ``` */ @Cordova() - dbUpdate(tableName: string, updatedObject: any, whereClause: string): Promise { + dbUpdate(tableName: string, updatedObject: any, whereClause: any): Promise { return; } @@ -678,8 +700,9 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO - * @param savePoint + * Supported in iOS, Android & Windows only. + * Create Savepoint + * @param savePoint Name of savepoint */ @Cordova() dbCreateSavePoint(savePoint: string): Promise { @@ -687,8 +710,9 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO - * @param savePoint + * Supported in iOS, Android & Windows only. + * Release Savepoint + * @param savePoint Name of savepoint */ @Cordova() dbReleaseSavePoint(savePoint: string): Promise { @@ -696,8 +720,9 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO - * @param savePoint + * Supported in iOS, Android & Windows only. + * Rollback Savepoint + * @param savePoint Name of the savepoint */ @Cordova() dbRollbackToSavePoint(savePoint: string): Promise { @@ -705,7 +730,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Begin database transaction. */ @Cordova() dbBeginTransaction(): Promise { @@ -713,7 +738,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * End database transaction. */ @Cordova() dbEndTransaction(): Promise { @@ -721,7 +746,9 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Supported in Android & Windows only. + * Launch a file from a file path + * @param filePath file path */ @Cordova() launchFile(filePath: string): Promise { @@ -729,7 +756,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Supported in Android & Windows only. + * Write Base64 string to a file and launch. */ @Cordova() launchBase64(base64string: string, fileName: string, extension: string): Promise { @@ -737,7 +765,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Supported in Windows Only + * Unzip file. */ @Cordova() unzip(srcPath: string, destPath: string) { @@ -745,7 +774,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Get the path for the folder where attachments are stored. + * Apps can combine this with the attachment filename to construct absolute path to an attachment file. */ @Cordova() getAttachmentFolderPath(): Promise { @@ -753,7 +783,13 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * 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 JSON object containing name-value pairs. + * Example: + * ``` + * {'F_NAME':'TARAK','EMP_NO':'0039'} + * ``` */ @Cordova() createAttachmentItem(tableName: string, structureObject: any): Promise { @@ -761,7 +797,10 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Upload attachment item to server. + * @param tableName Table name of attachment item. + * @param structureObject JSON object containing name-value pairs. + * @param isAsync Flag which indicates whether the upload should happen in async. */ @Cordova() uploadAttachment(tableName: string, structureObject: any, isAsync: boolean): Promise { @@ -769,7 +808,9 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * TODO + * Download attachment from server. + * @param tableName Table name of attachment item. + * @param structureObject JSON object containing name-value pairs. */ @Cordova() downloadAttachment(tableName: string, structureObject: any): Promise { @@ -780,7 +821,7 @@ 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. * @param reqype RequestType for the message. Please check RequestType to select the right request type. - * @param header Header datastructure to be sent to UMP. Header datastructure is mandatory of the request type is RQST. + * @param header 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: * ``` @@ -789,11 +830,11 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param customData 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_BE": [{ + * "CATEGORY_HEADER": {field_name : field_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. @@ -807,7 +848,7 @@ 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. * 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 Header datastructure to be sent to UMP. Header datastructure is mandatory of the request type is RQST. + * @param header 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: * ``` @@ -815,17 +856,17 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * ``` * @param customData 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_BE": [{ + * "CATEGORY_HEADER": {field_name : field_value,...} + * }] + * } * ``` * @param paFunction Name of the Process Agent function to be executed. Example: PA_MOBILE_EXECUTE_SALES_ORDER. - * @param beName - * @param belid - * @param bypassAttachment + * @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. */ @Cordova() syncBackground(reqype: RequestType, header: any, customData: any, paFunction: string, beName: string, belid: string, bypassAttachment: boolean): Promise { @@ -835,11 +876,10 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * For Browser platform only. * Reinitialize web db. Use this api to initialize db from persisted local storage db - * TODO: */ @Cordova() dbReload() { - return + return; } /** @@ -857,9 +897,9 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * For Browser platform only. - * parseRawUBJson - Parse response json returned from syncForeground api. - * @param json JSON string - */ + * parseRawUBJson - Parse response json returned from syncForeground api. + * @param json JSON string + */ @Cordova() parseRawUBJson(json: string) { return; @@ -887,7 +927,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. - */ + */ @Cordova({ observable: true, clearFunction: 'unRegisterNotifListener' @@ -927,7 +967,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Supported in iOS, Android & Windows only * Checks whether a Header datastructure is in sent and is waiting for response. * Typically you would use before allowing the user to update the Header datastructure. - * @param beLid + * @param beLid LID of the Business Entity */ @Cordova() isInSentItem(beLid: string): Promise { @@ -955,7 +995,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Supported in iOS, Android & Windows only * Delete outbox entry for a Header datastructure. - * @param beLid + * @param beLid LID of the Business Entity */ @Cordova() deleteOutBoxEntry(beLid: string): Promise { From f576c5f11e16ff8155b252bd63efa2ea167d571a Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 5 Jul 2019 17:14:52 +0530 Subject: [PATCH 6/9] doc(unvired-cordova-sdk): fix readme errors --- .../plugins/unvired-cordova-sdk/index.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 76ea2b188..46827cb93 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -360,7 +360,7 @@ export class AuthenticateLocalResult extends UnviredResult { 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 installVariables: [], // OPTIONAL the plugin requires variables - platforms: ['iOS', 'Android', 'Browser'] // Array of platforms supported, example: ['Android', 'iOS'] + platforms: ['iOS', 'Android', 'Windows', 'Browser'] // Array of platforms supported, example: ['Android', 'iOS'] }) @Injectable() export class UnviredCordovaSDK extends IonicNativePlugin { @@ -623,7 +623,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Select records from Database * @param tableName table name. Example: CUSTOMER_HEADER - * @param whereClause JSON object containing name-value pairs. + * @param whereClause {Object} JSON object containing name-value pairs. * Example: * ``` * {'F_NAME':'TARAK','EMP_NO':'0039'} @@ -663,7 +663,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Delete records from the database. * @param tableName Name of the table - * @param whereClause JSON object containing name-value pairs. + * @param whereClause {Object} JSON object containing name-value pairs. * Example: * ``` * {'F_NAME':'TARAK','EMP_NO':'0039'} @@ -678,7 +678,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Update records in database. * @param tableName Name of the table * @param updatedObject JSON object containing name-value pairs. - * @param whereClause JSON object containing name-value pairs. + * @param whereClause {Object} JSON object containing name-value pairs. * Example: * ``` * {'F_NAME':'TARAK','EMP_NO':'0039'} @@ -785,7 +785,7 @@ 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 JSON object containing name-value pairs. + * @param structureObject {Object} JSON object containing name-value pairs. * Example: * ``` * {'F_NAME':'TARAK','EMP_NO':'0039'} @@ -821,13 +821,13 @@ 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. * @param reqype RequestType for the message. Please check RequestType to select the right request type. - * @param header 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 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: * ``` * {"CUSTOMER_HEADER": {field_name : field_value,...}} * ``` - * @param customData This depends on the PA function. This is useful if you want to send custom data to a PA function. + * @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. * ``` * { @@ -848,13 +848,13 @@ 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. * 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 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 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: * ``` * {"CUSTOMER_HEADER": {field_name : field_value,...}} * ``` - * @param customData This depends on the PA function. This is useful if you want to send custom data to a PA function. + * @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. * ``` * { From 28ce96267730fa179d77fce2681bd33e383d1482 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Fri, 12 Jul 2019 14:57:43 +0530 Subject: [PATCH 7/9] doc(unvired-cordova-sdk): update doc --- .../plugins/unvired-cordova-sdk/index.ts | 70 +++++++++++++++---- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index 46827cb93..a1dfd7f4b 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -390,7 +390,9 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param method Name of the method * @param message The actual message * Example: + * ``` * this.unviredSDK.logError("Class Name", "Method Name", "Log Message") + * ``` * would produce the log message like this * 01-07-2019 15:52 | ERROR | Class Name | Method Name | Log Message */ @@ -405,7 +407,9 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param method Name of the method * @param message The actual message * Example: + * ``` * this.unviredSDK.logInfo("Class Name", "Method Name", "Log Message") + * ``` * would produce the log message like this * 01-07-2019 15:52 | IMPORTANT | Class Name | Method Name | Log Message */ @@ -626,7 +630,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param whereClause {Object} JSON object containing name-value pairs. * Example: * ``` - * {'F_NAME':'TARAK','EMP_NO':'0039'} + * # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 + * this.unviredSDK.dbSelect('FORM_HEADER', {"FORM_ID": "5caed815892215034dacad56"}) * ``` */ @Cordova() @@ -637,10 +642,14 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Insert record into database. * In browser platform this function always inserts or updates based on GID. - * Example - this.unviredsdk.dbInsert("CUSTOMER_HEADER",{"NAME":"TARAK","NO":"0039"....},true); * @param tableName Name of the table. * @param structureObject - JSON object containing name-value pairs. - * @param isHeader - is DataStructure a header or item? + * @param isHeader {boolean} - is DataStructure a header or item? + * Example: + * ``` + * # Insert CUSTOMER_HEADER Datastructure into DB. + * this.unviredsdk.dbInsert("CUSTOMER_HEADER", {"NAME":"TARAK","NO":"0039"}, true); + * ``` */ @Cordova() dbInsert(tableName: string, structureObject: any, isHeader: boolean): Promise { @@ -650,10 +659,14 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * insert or update the record ( if record exists ) into database. * In browser insert always inserts or updates based on gid - * Example - this.unviredsdk.dbInsertOrUpdate("CUSTOMER_HEADER",{"NAME":"TARAK","NO":"0039"....},true); * @param tableName Name of the table * @param structureObject - JSON object containing name-value pairs. - * @param isHeader - is DataStructure a header or item? + * @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); + * ``` */ @Cordova() dbInsertOrUpdate(tableName: string, structureObject: any, isHeader: boolean): Promise { @@ -666,7 +679,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param whereClause {Object} JSON object containing name-value pairs. * Example: * ``` - * {'F_NAME':'TARAK','EMP_NO':'0039'} + * # Delete CUSTOMER_HEADER where F_NAME equals TARAK + * this.unviredSDK.dbDelete('CUSTOMER_HEADER', {'F_NAME':'TARAK'}) * ``` */ @Cordova() @@ -681,7 +695,8 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * @param whereClause {Object} JSON object containing name-value pairs. * Example: * ``` - * {'F_NAME':'TARAK','EMP_NO':'0039'} + * # Update TEAM_NAME of TEAMS_HEADER for team matching TEAM_ID = 8B75B4DB7F134DE08CF446889433B9CC + * this.unviredSDK.dbUpdate('TEAMS_HEADER', {'TEAM_NAME': 'SUPPORT'}, {'TEAM_ID': '8B75B4DB7F134DE08CF446889433B9CC' }) * ``` */ @Cordova() @@ -692,7 +707,11 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Supported in iOS, Android & Windows only. * Execute SQL Statement - * @param query SQL Statement. Example: SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = 39 + * @param query {string} SQL Statement. + * Example: + * ``` + * this.unviredSDK.dbExecuteStatement('SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = 39') + * ``` */ @Cordova() dbExecuteStatement(query: string): Promise { @@ -701,8 +720,12 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Supported in iOS, Android & Windows only. - * Create Savepoint - * @param savePoint Name of savepoint + * Create Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) + * @param savePoint {string} Name of savepoint + * Example: + * ``` + * this.unviredSDK.dbCreateSavePoint('MySavePointName') + * ``` */ @Cordova() dbCreateSavePoint(savePoint: string): Promise { @@ -711,8 +734,11 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Supported in iOS, Android & Windows only. - * Release Savepoint - * @param savePoint Name of savepoint + * Release Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) + * @param savePoint {string} Name of savepoint + * ``` + * this.unviredSDK.dbReleaseSavePoint('MySavePointName') + * ``` */ @Cordova() dbReleaseSavePoint(savePoint: string): Promise { @@ -721,8 +747,12 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Supported in iOS, Android & Windows only. - * Rollback Savepoint - * @param savePoint Name of the savepoint + * Rollback Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) + * @param savePoint {string} Name of the savepoint + * Example: + * ``` + * this.unviredSDK.dbRollbackToSavePoint('MySavePointName') + * ``` */ @Cordova() dbRollbackToSavePoint(savePoint: string): Promise { @@ -730,7 +760,13 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** + * Supported in iOS, Android & Windows only. * Begin database transaction. + * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) + * Example: + * ``` + * this.unviredSDK.dbBeginTransaction() + * ``` */ @Cordova() dbBeginTransaction(): Promise { @@ -738,7 +774,13 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** + * Supported in iOS, Android & Windows only. * End database transaction. + * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) + * Example: + * ``` + * this.unviredSDK.dbEndTransaction() + * ``` */ @Cordova() dbEndTransaction(): Promise { From 767391a4b47737c9cf4d8a46b7bdf7b0109eae74 Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Sun, 21 Jul 2019 19:27:25 +0530 Subject: [PATCH 8/9] doc(unvired-cordova-sdk): improve doc --- .../plugins/unvired-cordova-sdk/index.ts | 53 +++++++++++-------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts index a1dfd7f4b..d248fd1de 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -62,7 +62,7 @@ export enum LoginListenerType { */ auth_activation_required = 0, /** - * Applicable for iOS, Android & Windows. + * Applicable for mobile. * This value indicates user needs to login before using the app. This depends on the setting LOCAL_PASSWORD which is set in UMP Admin Cockpit. * If LOCAL_PASSWORD is set to true, this type is set everytime user opens the app. */ @@ -543,7 +543,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported for iOS, Android & Windows Platforms. + * Supported for mobile Platforms. * Display framework settings. */ @Cordova() @@ -627,10 +627,13 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Select records from Database * @param tableName table name. Example: CUSTOMER_HEADER - * @param whereClause {Object} JSON object containing name-value pairs. + * @param whereClause {Object} Browser: JSON object containing name-value pairs. + * Mobile: Or a Sqlite whereClause ( without the 'where' keyword ) * Example: * ``` - * # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 + * # 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"}) * ``` */ @@ -676,11 +679,14 @@ export class UnviredCordovaSDK extends IonicNativePlugin { /** * Delete records from the database. * @param tableName Name of the table - * @param whereClause {Object} JSON object containing name-value pairs. + * @param whereClause {Object} Browser: JSON object containing name-value pairs. + * Mobile: Or a Sqlite whereClause ( without the 'where' keyword ) * Example: * ``` - * # Delete CUSTOMER_HEADER where F_NAME equals TARAK - * this.unviredSDK.dbDelete('CUSTOMER_HEADER', {'F_NAME':'TARAK'}) + * # 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"}) * ``` */ @Cordova() @@ -692,11 +698,14 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Update records in database. * @param tableName Name of the table * @param updatedObject JSON object containing name-value pairs. - * @param whereClause {Object} JSON object containing 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 TEAM_NAME of TEAMS_HEADER for team matching TEAM_ID = 8B75B4DB7F134DE08CF446889433B9CC - * this.unviredSDK.dbUpdate('TEAMS_HEADER', {'TEAM_NAME': 'SUPPORT'}, {'TEAM_ID': '8B75B4DB7F134DE08CF446889433B9CC' }) + * # 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"}) * ``` */ @Cordova() @@ -705,7 +714,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only. + * Supported in mobile only. * Execute SQL Statement * @param query {string} SQL Statement. * Example: @@ -719,7 +728,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only. + * 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: @@ -733,7 +742,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only. + * 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 * ``` @@ -746,7 +755,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only. + * 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: @@ -760,7 +769,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only. + * Supported in mobile only. * Begin database transaction. * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) * Example: @@ -774,7 +783,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only. + * Supported in mobile only. * End database transaction. * For more info, consult SQLite documentation ( https://www.sqlite.org/lang_transaction.html ) * Example: @@ -987,7 +996,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only + * Supported in mobile only * Check whether a Header datastructure is in outbox. * @param beLid LID of the Header datastructure. */ @@ -997,7 +1006,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only + * Supported in mobile only * Returns the count of outbox items. */ @Cordova() @@ -1006,7 +1015,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only + * Supported in mobile only * Checks whether a Header datastructure is in sent and is waiting for response. * Typically you would use before allowing the user to update the Header datastructure. * @param beLid LID of the Business Entity @@ -1017,7 +1026,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only + * Supported in mobile only * Returns the count of sent items. */ @Cordova() @@ -1026,7 +1035,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only + * Supported in mobile only * Returns the count of Inbox items. */ @Cordova() @@ -1035,7 +1044,7 @@ export class UnviredCordovaSDK extends IonicNativePlugin { } /** - * Supported in iOS, Android & Windows only + * Supported in mobile only * Delete outbox entry for a Header datastructure. * @param beLid LID of the Business Entity */ From a0779de633b917fbddf1a525264db7a37072f5fe Mon Sep 17 00:00:00 2001 From: Srinidhi Anand Rao Date: Tue, 23 Jul 2019 13:57:37 +0530 Subject: [PATCH 9/9] doc(unvired-cordova-sdk): remove clearFunction --- .../plugins/unvired-cordova-sdk/index.ts | 11 +---------- 1 file changed, 1 insertion(+), 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 d248fd1de..94d5717f6 100644 --- a/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts +++ b/src/@ionic-native/plugins/unvired-cordova-sdk/index.ts @@ -980,21 +980,12 @@ export class UnviredCordovaSDK extends IonicNativePlugin { * Only one class can subscribe to notifications are any point of time. */ @Cordova({ - observable: true, - clearFunction: 'unRegisterNotifListener' + observable: true }) registerNotifListener(): Observable { return; } - /** - * Unregister the notification listener previously registered. - */ - @Cordova() - unRegisterNotifListener(): Promise { - return; - } - /** * Supported in mobile only * Check whether a Header datastructure is in outbox.