From 815d1bb1f8c6128203d2b0e2be70765718f88d7d Mon Sep 17 00:00:00 2001 From: MaximBelov Date: Mon, 2 Aug 2021 23:38:20 +0300 Subject: [PATCH] feat(urbanairship): add new methods: onDeepLink, onRegistration, onInboxUpdated, onShowInbox, onPushReceived, onNotificationOpened, onNotificationOptInStatus; fix return type for reattach method (#3705) --- .../plugins/urbanairship/index.ts | 138 +++++++++++++++++- 1 file changed, 136 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/urbanairship/index.ts b/src/@ionic-native/plugins/urbanairship/index.ts index faa2a7ce1..dec330db0 100644 --- a/src/@ionic-native/plugins/urbanairship/index.ts +++ b/src/@ionic-native/plugins/urbanairship/index.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Observable } from 'rxjs'; export interface TagGroupEditor { addTags(): void; @@ -62,11 +63,144 @@ export enum PresentationOptions { }) @Injectable() export class UrbanAirShip extends IonicNativePlugin { + /** + * Event fired when a new deep link is received. + * + * @event deep_link + * @type {object} + * @param {string} [deepLink] The deep link. + */ + @Cordova({ + eventObservable: true, + event: 'urbanairship.deep_link', + element: 'document', + }) + onDeepLink(): Observable { + return; + } + + /** + * Event fired when a channel registration occurs. + * + * @event registration + * @type {object} + * @param {string} [channelID] The channel ID. + * @param {string} [registrationToken] The deviceToken on iOS, and the FCM/ADM token on Android. + * @param {string} [error] Error message if an error occurred. + */ + @Cordova({ + eventObservable: true, + event: 'urbanairship.registration', + element: 'document', + }) + onRegistration(): Observable { + return; + } + + /** + * Event fired when the inbox is updated. + * + * @event inbox_updated + */ + @Cordova({ + eventObservable: true, + event: 'urbanairship.inbox_updated', + element: 'document', + }) + onInboxUpdated(): Observable { + return; + } + + /** + * Event fired when the inbox needs to be displayed. This event is only emitted if auto + * launch message center is disabled. + * + * @event show_inbox + * @type {object} + * @param {string} [messageId] The optional message ID. + */ + @Cordova({ + eventObservable: true, + event: 'urbanairship.show_inbox', + element: 'document', + }) + onShowInbox(): Observable { + return; + } + + /** + * Event fired when a push is received. + * + * @event push + * @type {object} + * @param {string} message The push alert message. + * @param {string} title The push title. + * @param {string} subtitle The push subtitle. + * @param {object} extras Any push extras. + * @param {object} aps The raw aps dictionary (iOS only) + * @param {number} [notification_id] The Android notification ID. Deprecated in favor of notificationId. + * @param {string} [notificationId] The notification ID. + */ + @Cordova({ + eventObservable: true, + event: 'urbanairship.push', + element: 'document', + }) + onPushReceived(): Observable { + return; + } + + /** + * Event fired when notification opened. + * + * @event notification_opened + * @type {object} + * @param {string} message The push alert message. + * @param {object} extras Any push extras. + * @param {number} [notification_id] The Android notification ID. Deprecated in favor of notificationId. + * @param {string} [notificationId] The notification ID. + * @param {string} [actionID] The ID of the notification action button if available. + * @param {boolean} isForeground Will always be true if the user taps the main notification. Otherwise its defined by the notification action button. + */ + @Cordova({ + eventObservable: true, + event: 'urbanairship.notification_opened', + element: 'document', + }) + onNotificationOpened(): Observable { + return; + } + + /** + * Event fired when the user notification opt-in status changes. + * + * @event notification_opt_in_status + * @type {object} + * @param {boolean} optIn If the user is opted in or not to user notifications. + * @param {object} [authorizedNotificationSettings] iOS only. A map of authorized settings. + * @param {boolean} authorizedNotificationSettings.alert If alerts are authorized. + * @param {boolean} authorizedNotificationSettings.sound If sounds are authorized. + * @param {boolean} authorizedNotificationSettings.badge If badges are authorized. + * @param {boolean} authorizedNotificationSettings.carPlay If car play is authorized. + * @param {boolean} authorizedNotificationSettings.lockScreen If the lock screen is authorized. + * @param {boolean} authorizedNotificationSettings.notificationCenter If the notification center is authorized. + */ + @Cordova({ + eventObservable: true, + event: 'urbanairship.notification_opt_in_status', + element: 'document', + }) + onNotificationOptInStatus(): Observable { + return; + } + /** * Re-attaches document event listeners in this webview */ - @Cordova() - reattach(): Promise { + @Cordova({ + sync: true, + }) + reattach(): void { return; }