mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
fix(one-signal): return Observable instead of promise (#352)
* Added OneSignal wrapper * documentation * Changes for callback of notification revieced * fixes for @Cordova decorators without Promise return * Merge * Improvements to OneSignal extended init function with notificationOpenedCallback as an optional parameter * Platforms removed OneSignal supports more than only these 3 platforms. It's available to nearly all Cordova platforms. * Init method turned into observable
This commit is contained in:
parent
8b9e317519
commit
08fe04e87e
@ -1,4 +1,5 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
|
||||
/**
|
||||
@ -28,8 +29,7 @@ import { Cordova, Plugin } from './plugin';
|
||||
@Plugin({
|
||||
plugin: 'onesignal-cordova-plugin',
|
||||
pluginRef: 'plugins.OneSignal',
|
||||
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||
repo: 'https://github.com/OneSignal/OneSignal-Cordova-SDK'
|
||||
})
|
||||
export class OneSignal {
|
||||
|
||||
@ -38,14 +38,14 @@ export class OneSignal {
|
||||
*
|
||||
* @param {appId} Your AppId from your OneSignal app
|
||||
* @param {options} The Google Project Number (which you can get from the Google Developer Potal) and the autoRegister option.
|
||||
* @returns {Promise} Returns a Promise that resolves when remote notification was recieved.
|
||||
* @returns {Observable} when a notification is received. Handle your notification action here.
|
||||
*/
|
||||
@Cordova()
|
||||
@Cordova({ observable: true })
|
||||
static init(appId: string,
|
||||
options: {
|
||||
googleProjectNumber: string,
|
||||
autoRegister: boolean
|
||||
}): Promise<any> { return; }
|
||||
}): Observable<any> { return; }
|
||||
|
||||
|
||||
/**
|
||||
@ -253,4 +253,4 @@ export class OneSignal {
|
||||
visualLevel: number
|
||||
}): void { }
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user