From 08fe04e87eada6f416ce2909b8e79776eb7825a8 Mon Sep 17 00:00:00 2001 From: Aaron Czichon Date: Mon, 25 Jul 2016 15:52:17 +0200 Subject: [PATCH] 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 --- src/plugins/onesignal.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/onesignal.ts b/src/plugins/onesignal.ts index 4ab9afe1d..379d4bd51 100644 --- a/src/plugins/onesignal.ts +++ b/src/plugins/onesignal.ts @@ -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 { return; } + }): Observable { return; } /** @@ -253,4 +253,4 @@ export class OneSignal { visualLevel: number }): void { } -} +} \ No newline at end of file