feat(urbanairship): add new methods: onDeepLink, onRegistration, onInboxUpdated, onShowInbox, onPushReceived, onNotificationOpened, onNotificationOptInStatus; fix return type for reattach method (#3705)

This commit is contained in:
MaximBelov 2021-08-02 23:38:20 +03:00 committed by GitHub
parent 0c505f9748
commit 815d1bb1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<any> {
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<any> {
return;
}
/**
* Event fired when the inbox is updated.
*
* @event inbox_updated
*/
@Cordova({
eventObservable: true,
event: 'urbanairship.inbox_updated',
element: 'document',
})
onInboxUpdated(): Observable<any> {
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<any> {
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<any> {
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<any> {
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<any> {
return;
}
/**
* Re-attaches document event listeners in this webview
*/
@Cordova()
reattach(): Promise<any> {
@Cordova({
sync: true,
})
reattach(): void {
return;
}