-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainView.js
More file actions
44 lines (35 loc) · 1.07 KB
/
MainView.js
File metadata and controls
44 lines (35 loc) · 1.07 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
var Environment = require('FuseJS/Environment');
var APNS = require("APNS");
var FNotify = require("Firebase/Notifications");
var Push = null;
if(Environment.ios)
Push = APNS;
else
Push = FNotify;
var Observable = require("FuseJS/Observable");
var status = Observable("-");
var message = Observable("-no message yet-");
Push.onRegistrationSucceeded = function(regID) {
console.log ("Reg Succeeded: " + regID);
status.value = "onRegistrationSucceeded: " + regID;
};
Push.onRegistrationFailed = function(reason) {
console.log ("Reg Failed: " + reason);
};
Push.onReceivedMessage = function(payload, fromNotificationBar) {
console.log ("Recieved Push Notification: " + payload);
console.log ("fromNotificationBar="+fromNotificationBar);
message.value = payload;
};
var clearBadgeNumber = function() {
Push.clearBadgeNumber();
}
var clearAllNotifications = function() {
Push.clearAllNotifications();
}
module.exports = {
clearBadgeNumber: clearBadgeNumber,
clearAllNotifications: clearAllNotifications,
message: message,
status: status
};