-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestPush.js
More file actions
44 lines (34 loc) · 1.06 KB
/
TestPush.js
File metadata and controls
44 lines (34 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// set up push notification backends
var Push = require("Firebase/Notifications");
var Environment = require('FuseJS/Environment');
var pushTopic = "na"
if(Environment.ios) { pushTopic = "ios"; }
if(Environment.android) { pushTopic = "android"; }
// set up everything else
var Observable = require("FuseJS/Observable");
var Model = require("UserData");
var status = Observable("-");
var message = Observable("-no message yet-");
// push fns
Push.onRegistrationSucceeded = function(regID) {
status.value = "onRegistrationSucceeded: " + regID;
Push.subscribeToTopic(pushTopic);
};
Push.onRegistrationFailed = function(reason) {
};
Push.onReceivedMessage = function(payload, fromNotificationBar) {
message.value = payload;
};
var clearBadgeNumber = function() {
Push.clearBadgeNumber();
}
var clearAllNotifications = function() {
Push.clearAllNotifications();
}
module.exports = {
clearBadgeNumber: clearBadgeNumber,
clearAllNotifications: clearAllNotifications,
message: message,
status: status,
userData: Model.getUserData()
};