|
1 | | -import { __decorate } from "tslib"; |
2 | | -import { Injectable } from '@angular/core'; |
3 | | -import { Plugin } from '@ionic-native/core'; |
4 | | -import { Subject } from 'rxjs'; |
5 | | -var FCM = (function () { |
6 | | - function FCM() { |
| 1 | +import { __decorate } from 'tslib' |
| 2 | +import { Injectable } from '@angular/core' |
| 3 | +import { Plugin } from '@ionic-native/core' |
| 4 | +import { Subject } from 'rxjs' |
| 5 | + |
| 6 | +function FCM() {} |
| 7 | +FCM.prototype.clearAllNotifications = function () { |
| 8 | + return window.FCM.clearAllNotifications() |
| 9 | +} |
| 10 | +FCM.prototype.createNotificationChannel = function (channelConfig) { |
| 11 | + return window.FCM.createNotificationChannel(channelConfig) |
| 12 | +} |
| 13 | +FCM.prototype.getAPNSToken = function () { |
| 14 | + return window.FCM.getAPNSToken() |
| 15 | +} |
| 16 | +FCM.prototype.getInitialPushPayload = function () { |
| 17 | + return window.FCM.getInitialPushPayload() |
| 18 | +} |
| 19 | +FCM.prototype.getToken = function () { |
| 20 | + return window.FCM.getToken() |
| 21 | +} |
| 22 | +FCM.prototype.hasPermission = function () { |
| 23 | + return window.FCM.hasPermission() |
| 24 | +} |
| 25 | +FCM.prototype.onNotification = function (options) { |
| 26 | + var observable = new Subject() |
| 27 | + var handler = function (payload) { |
| 28 | + return observable.next(payload) |
7 | 29 | } |
8 | | - FCM.prototype.clearAllNotifications = function () { |
9 | | - return window.FCM.clearAllNotifications(); |
10 | | - }; |
11 | | - FCM.prototype.createNotificationChannel = function (channelConfig) { |
12 | | - return window.FCM.createNotificationChannel(channelConfig); |
13 | | - }; |
14 | | - FCM.prototype.getAPNSToken = function () { |
15 | | - return window.FCM.getAPNSToken(); |
16 | | - }; |
17 | | - FCM.prototype.getInitialPushPayload = function () { |
18 | | - return window.FCM.getInitialPushPayload(); |
19 | | - }; |
20 | | - FCM.prototype.getToken = function () { |
21 | | - return window.FCM.getToken(); |
22 | | - }; |
23 | | - FCM.prototype.hasPermission = function () { |
24 | | - return window.FCM.hasPermission(); |
25 | | - }; |
26 | | - FCM.prototype.onNotification = function (options) { |
27 | | - var observable = new Subject(); |
28 | | - var handler = function (payload) { return observable.next(payload); }; |
29 | | - window.FCM.onNotification(handler, options); |
30 | | - return observable; |
31 | | - }; |
32 | | - FCM.prototype.onTokenRefresh = function (options) { |
33 | | - var observable = new Subject(); |
34 | | - window.FCM.onTokenRefresh(function (token) { return observable.next(token); }, options); |
35 | | - return observable; |
36 | | - }; |
37 | | - FCM.prototype.requestPushPermission = function (options) { |
38 | | - return window.FCM.requestPushPermission(options); |
39 | | - }; |
40 | | - FCM.prototype.subscribeToTopic = function (topic) { |
41 | | - return window.FCM.subscribeToTopic(topic); |
42 | | - }; |
43 | | - FCM.prototype.unsubscribeFromTopic = function (topic) { |
44 | | - return window.FCM.unsubscribeFromTopic(topic); |
45 | | - }; |
46 | | - FCM = __decorate([ |
| 30 | + window.FCM.onNotification(handler, options) |
| 31 | + return observable |
| 32 | +} |
| 33 | +FCM.prototype.onTokenRefresh = function (options) { |
| 34 | + var observable = new Subject() |
| 35 | + window.FCM.onTokenRefresh(function (token) { |
| 36 | + return observable.next(token) |
| 37 | + }, options) |
| 38 | + return observable |
| 39 | +} |
| 40 | +FCM.prototype.requestPushPermission = function (options) { |
| 41 | + return window.FCM.requestPushPermission(options) |
| 42 | +} |
| 43 | +FCM.prototype.subscribeToTopic = function (topic) { |
| 44 | + return window.FCM.subscribeToTopic(topic) |
| 45 | +} |
| 46 | +FCM.prototype.unsubscribeFromTopic = function (topic) { |
| 47 | + return window.FCM.unsubscribeFromTopic(topic) |
| 48 | +} |
| 49 | +FCM = __decorate( |
| 50 | + [ |
47 | 51 | Plugin({ |
48 | 52 | pluginName: 'FCM', |
49 | 53 | plugin: 'cordova-plugin-fcm-with-dependecy-updated', |
50 | 54 | pluginRef: 'FCM', |
51 | 55 | repo: 'https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated', |
52 | | - platforms: ['Android', 'iOS'], |
| 56 | + platforms: ['Android', 'iOS'] |
53 | 57 | }), |
54 | 58 | Injectable() |
55 | | - ], FCM); |
56 | | - return FCM; |
57 | | -}()); |
58 | | -export { FCM }; |
| 59 | + ], |
| 60 | + FCM |
| 61 | +) |
| 62 | + |
| 63 | +export { FCM } |
0 commit comments