From 7a19f7d7747857cab3feb62d524f66e34cad022d Mon Sep 17 00:00:00 2001 From: Srinidhi Date: Fri, 8 Oct 2021 12:13:24 +0530 Subject: [PATCH] feat(unvired-cordova-sdk): Add a new function to register and receive push notifications. (#3802) * feat(unvired-cordova-sdk): support login via email * fix(unvired-cordova-sdk): return typed promise object for user settings * fix(unvired-cordova-sdk): change return type to string for guid() * doc(unvired-cordova-sdk): doc update * doc(unvired-cordova-sdk): update doc * feat(unvired-cordova-sdk): add support for metadata JSON * doc(unvired-cordova-sdk): update doc * doc(unvired-cordova-sdk): update doc * feat(unvired-cordova-sdk): add methods to get and set log level * fix(unvired-cordova-sdk): update the return type for getLog() * feat(unvired-cordova-sdk): return platform name * feat(unvired-cordova-sdk): add method to get log file path * feat(unvired-cordova-sdk): test push notifications * fix(unvired-cordova-sdk): define return for logRead * doc(unvired-cordova-sdk): remove mobile only restriction for some apis * feat(unvired-cordova-sdk): add new property containing HTTP status code. * feat(unvired-cordova-sdk): add new functions to lock & unlock sending of data * fix(unvired-cordova-sdk): update the return type for lock and unlock functions. * fix(unvired-cordova-sdk): change the return type for lockDataSender api * fix(unvired-cordova-sdk): fix the data type for ResultType and OutboxLockStatus * doc(unvired-cordova-sdk): Update doc * doc(unvired-cordova-sdk): Update doc * feat(unvired-cordova-sdk): Added new notification type * feat(unvired-cordova-sdk): delete outbox item based on lid * fix(unvired-cordova-sdk): Update doc * doc(unvired-cordova-sdk): Update doc for userSettings() * feat(unvired-cordova-sdk): add new discovery api * fix(unvired-cordova-sdk): rename the property * doc(unvired-cordova-sdk): Doc update * fix(unvired-cordova-sdk): Update the return type for startDiscoveryService api * doc(unvired-cordova-sdk): Rename the loginParameter languageCode to loginLanguage. * changes after doing npm install * feat(unvired-cordova-sdk): Add a new login parameter to send jwt options. * feat(unvired-cordova-sdk): add new function to cache website data * feat(unvired-cordova-sdk): new function to export the database for browser platform * fix(unvired-cordova-sdk): fix method names * feat(unvired-cordova-sdk): add new function 'setClientCredentials' * doc(unvired-cordova-sdk): Update doc * fix(unvired-cordova-sdk): Create a new Credential object and pass that as an input to the setClientCredentials() function. * fix(unvired-cordova-sdk): Fix the typo in the function parameter. * fix(unvired-cordova-sdk): Changed the type of port to string. * feat(unvired-cordova-sdk): add methods to encrypt and decrypt the string. * Delete package-lock.json removed the package-locj.json from the PR * Update package-lock.json fix(unvired-cordova-sdk): Update package-lock.json corresponding to version 5.35.0 * doc(unvired-cordova-sdk) Updated document for the new function Co-authored-by: Srinidhi Anand Rao --- .../plugins/unvired-cordova-sdk/index.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts b/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts index b1bc3f146..ae2d739ad 100644 --- a/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts +++ b/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts @@ -1635,4 +1635,32 @@ export class UnviredCordovaSDK extends AwesomeCordovaNativePlugin { decrypt(stringToBeDecrypted: string): Promise { return; } + + /** + * Supported in browser platform only. + * You can make use of this api in order to receive push notifications. No input required. + * Upon succesful registration you will get a |evtSource| object on which various events are received. + * Usage: + * ``` + * this.unviredSDK.registerForPushNotification((evtSource) => { + * evtSource.onopen = function(event) { + * console.log(" onopen registerForPushNotification ==========") + * }; + * evtSource.onerror = function(err) { + * console.log(" onerror registerForPushNotification ==========") + * }; + * evtSource.onmessage = function(event) { + * console.log(" onmessage registerForPushNotification ==========") + * } + * }, + * (error) => { + * console.log(" error registerForPushNotification ==========") + * console.log(error) + * }); + * ``` + */ + @Cordova() + registerForPushNotification(): Promise { + return; + } }