feat(fcm): add requestPushPermissionIOS and createNotificationChannelAndroid functions (#3430)
This commit is contained in:
parent
324334eb28
commit
ef17dc5d07
@ -16,6 +16,60 @@ export interface NotificationData {
|
|||||||
[name: string]: any;
|
[name: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IRequestPushPermissionIOSOptions {
|
||||||
|
/**
|
||||||
|
* Options exclusive for iOS 9 support
|
||||||
|
*/
|
||||||
|
ios9Support?: {
|
||||||
|
/**
|
||||||
|
* How long it will wait for a decision from the user before returning `false`, defaults to 10
|
||||||
|
*/
|
||||||
|
timeout?: number;
|
||||||
|
/**
|
||||||
|
* How long between each permission verification, defaults to 0.3
|
||||||
|
*/
|
||||||
|
interval?: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IChannelConfiguration {
|
||||||
|
/**
|
||||||
|
* Channel id, used in the android_channel_id push payload key
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Channel name, visible for the user
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* Channel description, visible for the user
|
||||||
|
*/
|
||||||
|
description?: string;
|
||||||
|
/**
|
||||||
|
* Importance for notifications of this channel
|
||||||
|
* https://developer.android.com/guide/topics/ui/notifiers/notifications#importance
|
||||||
|
*/
|
||||||
|
importance?: 'none' | 'min' | 'low' | 'default' | 'high';
|
||||||
|
/**
|
||||||
|
* Visibility for notifications of this channel
|
||||||
|
* https://developer.android.com/training/notify-user/build-notification#lockscreenNotification
|
||||||
|
*/
|
||||||
|
visibility?: 'public' | 'private' | 'secret';
|
||||||
|
/**
|
||||||
|
* Default sound resource for notifications of this channel
|
||||||
|
* The file should located as resources/raw/[resource name].mp3
|
||||||
|
*/
|
||||||
|
sound?: string;
|
||||||
|
/**
|
||||||
|
* Enable lights for notifications of this channel
|
||||||
|
*/
|
||||||
|
lights?: boolean;
|
||||||
|
/**
|
||||||
|
* Enable vibration for notifications of this channel
|
||||||
|
*/
|
||||||
|
vibration?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name FCM
|
* @name FCM
|
||||||
* @capacitorincompatible true
|
* @capacitorincompatible true
|
||||||
@ -61,6 +115,8 @@ export interface NotificationData {
|
|||||||
* ```
|
* ```
|
||||||
* @interfaces
|
* @interfaces
|
||||||
* NotificationData
|
* NotificationData
|
||||||
|
* IRequestPushPermissionIOSOptions
|
||||||
|
* IChannelConfiguration
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
pluginName: 'FCM',
|
pluginName: 'FCM',
|
||||||
@ -163,4 +219,32 @@ export class FCM extends IonicNativePlugin {
|
|||||||
clearAllNotifications(): void {
|
clearAllNotifications(): void {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request push notification permission, alerting the user if it not have yet decided
|
||||||
|
*
|
||||||
|
* @param {IRequestPushPermissionIOSOptions} options Options for push request
|
||||||
|
*
|
||||||
|
* @returns {Promise<boolean>} Returns a Promise that resolves with the permission status
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
requestPushPermissionIOS(options?: IRequestPushPermissionIOSOptions): Promise<boolean> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For Android, some notification properties are only defined programmatically.
|
||||||
|
*
|
||||||
|
* Channel can define the default behavior for notifications on Android 8.0+.
|
||||||
|
*
|
||||||
|
* Once a channel is created, it stays unchangeable until the user uninstalls the app.
|
||||||
|
*
|
||||||
|
* @param channelConfig
|
||||||
|
*
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
createNotificationChannelAndroid(channelConfig: IChannelConfiguration): void {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user