-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
45 lines (42 loc) · 1.06 KB
/
index.js
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
45
var application = require('application');
var platform = require('platform');
var exports = {};
if (platform.isAndroid) {
exports.showDoorbellFeedback = function(appId, appKey, properties = null) {
const feedback = new io.doorbell.android.Doorbell(
application.android.startActivity,
parseInt(appId),
appKey
);
if (properties) {
for (var p in properties) {
feedback.addProperty(p, properties[p]);
}
}
feedback.show();
};
} else {
exports.showDoorbellFeedback = function(
appId,
appKey,
viewController,
properties = null,
animated = true
) {
const feedback = Doorbell.alloc().initWithApiKeyAppId(appKey, appId);
feedback.animated = animated;
if (properties) {
for (var p in properties) {
feedback.addPropertyWithNameAndValue(p, properties[p]);
}
}
if (viewController) {
feedback.showFeedbackDialogInViewControllerCompletion(viewController, error => {
if (error) {
throw error;
}
});
}
};
}
module.exports = exports;