-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAppsee.js
More file actions
137 lines (109 loc) · 3.61 KB
/
Copy pathAppsee.js
File metadata and controls
137 lines (109 loc) · 3.61 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
'use strict';
var { Platform, NativeModules, findNodeHandle, InteractionManager } = require('react-native');
var AppseeBridge = NativeModules.Appsee;
class Appsee {
static start(apiKey) {
AppseeBridge.start(apiKey);
}
static stop() {
AppseeBridge.stop();
}
static pause() {
AppseeBridge.pause();
}
static resume() {
AppseeBridge.resume();
}
static finishSession(verifyBackground, shouldUpload) {
if (verifyBackground == null || shouldUpload == null) {
console.log('appsee : finishSession params are invalid');
return;
}
AppseeBridge.finishSession(verifyBackground, shouldUpload);
}
static forceNewSession() {
AppseeBridge.forceNewSession();
}
static upload() {
AppseeBridge.upload();
}
static addEvent(eventName, properties) {
if (!eventName) {
console.log('appsee : addEvent params are invalid');
return;
}
properties = (properties == null) ? {} : properties;
AppseeBridge.addEvent(eventName, properties);
}
static startScreen(screenName) {
if (!screenName) {
console.log('appsee : startScreen params are invalid');
return;
}
AppseeBridge.startScreen(screenName);
}
static setUserId(userId) {
if (!userId) {
console.log('appsee : setUserId params are invalid');
return;
}
AppseeBridge.setUserId(userId);
}
static setLocation(latitude, longitude, horizontalAccuracy, verticalAccuracy) {
if (latitude == null ||
longitude == null ||
horizontalAccuracy == null ||
verticalAccuracy == null) {
console.log('appsee : setLocation params are invalid');
return;
}
AppseeBridge.setLocation(latitude, longitude, horizontalAccuracy, verticalAccuracy);
}
static setLocationDescription(description) {
if (!description) {
console.log('appsee : setLocationDescription can\'t be empty');
return;
}
AppseeBridge.setLocationDescription(description);
}
static setOptOutStatus(status) {
if (status == null) {
console.log('appsee : setOptOutStatus params are invalid');
return;
}
AppseeBridge.setOptOutStatus(status);
}
static markViewAsSensitive(ref) {
if (ref == null) {
console.log('appsee : Can\'t mark a null ref as sensitive (are you sure the component has a ref?)');
return;
}
if (Platform.OS === 'android') {
setTimeout(
function() {
requestAnimationFrame(function() {
AppseeBridge.markViewAsSensitive(findNodeHandle(ref));
});
}, 0);
} else {
console.log('appsee : markViewAsSensitive is not implemented for iOS yet');
}
}
static unmarkViewAsSensitive(ref) {
if (ref == null) {
console.log('appsee : Can\'t mark a null ref as sensitive (are you sure the component has a ref?)');
return;
}
if (Platform.OS === 'android') {
setTimeout(
function() {
requestAnimationFrame(function() {
AppseeBridge.unmarkViewAsSensitive(findNodeHandle(ref));
});
}, 0);
} else {
console.log('appsee : unmarkViewAsSensitive is not implemented for iOS yet');
}
}
}
module.exports = Appsee;