-
Notifications
You must be signed in to change notification settings - Fork 3
/
Smartlook.IOS.cs
368 lines (283 loc) · 13.9 KB
/
Smartlook.IOS.cs
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
#if UNITY_IOS
namespace SmartlookUnity {
using System.Runtime.InteropServices;
using UnityEngine;
using System.Collections;
using AOT;
public partial class Smartlook {
[DllImport("__Internal")]
static extern void SmartlookSetupAndStartRecording(string key);
static partial void SetupAndStartRecordingInternal(string key) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetupAndStartRecording(key);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetupAndStartRecordingWithFramerate(string key, int frameRate);
static partial void SetupAndStartRecordingInternal(string key, int frameRate) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetupAndStartRecordingWithFramerate(key, frameRate);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetupAndStartRecordingWithOptions(string setupOptions);
static partial void SetupAndStartRecordingInternal(SetupOptions setupOptions) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetupAndStartRecordingWithOptions(JsonUtility.ToJson(setupOptions));
}
}
[DllImport("__Internal")]
static extern void SmartlookSetup(string key);
static partial void SetupInternal(string key) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetup(key);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetupWithFramerate(string key, int frameRate);
static partial void SetupInternal(string key, int frameRate) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetupWithFramerate(key, frameRate);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetupWithOptions(string setupOptions);
static partial void SetupInternal(SetupOptions setupOptions) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetupWithOptions(JsonUtility.ToJson(setupOptions));
}
}
[DllImport("__Internal")]
static extern void SmartlookStartRecording();
static partial void StartRecordingInternal() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookStartRecording();
}
}
[DllImport("__Internal")]
static extern void SmartlookStopRecording();
static partial void StopRecordingInternal() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookStopRecording();
}
}
[DllImport("__Internal")]
static extern void SmartlookStartFullscreenSensitiveMode();
static partial void StartFullscreenSensitiveModeInternal() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookStartFullscreenSensitiveMode();
}
}
[DllImport("__Internal")]
static extern void SmartlookStopFullscreenSensitiveMode();
static partial void StopFullscreenSensitiveModeInternal() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookStopFullscreenSensitiveMode();
}
}
[DllImport("__Internal")]
static extern void SmartlookSetReferrer(string referrer, string source);
static partial void SetReferrerInternal(string referrer, string source) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetReferrer(referrer, source);
}
}
[DllImport("__Internal")]
static extern void SmartlookTrackCustomEvent(string eventName);
static partial void TrackCustomEventInternal(string eventName) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookTrackCustomEvent(eventName);
}
}
[DllImport("__Internal")]
static extern void SmartlookTrackCustomEventWithProperties(string eventName, string properties);
static partial void TrackCustomEventInternal(string eventName, string properties) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookTrackCustomEventWithProperties(eventName, properties);
}
}
[DllImport("__Internal")]
static extern void SmartlookTrackNavigationEvent(string screenName, int direction);
static partial void TrackNavigationEventInternal(string screenName, int direction) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookTrackNavigationEvent(screenName, direction);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetUserIdentifier(string userIdentifier);
static partial void SetUserIdentifierInternal(string userIdentifier) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetUserIdentifier(userIdentifier);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetUserIdentifierWithProperties(string userIdentifier, string properties);
static partial void SetUserIdentifierInternal(string userIdentifier, string properties) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetUserIdentifierWithProperties(userIdentifier, properties);
}
}
[DllImport("__Internal")]
static extern bool SmartlookIsRecording();
public static bool IsRecordingInternalIOS() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
return SmartlookIsRecording();
}
return false;
}
[DllImport("__Internal")]
static extern string SmartlookGetDashboardSessionUrl();
public static string GetDashboardSessionUrlInternalIOS() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
return SmartlookGetDashboardSessionUrl();
}
return null;
}
[DllImport("__Internal")]
static extern string SmartlookGetDashboardVisitorUrl();
public static string GetDashboardVisitorUrlInternalIOS() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
return SmartlookGetDashboardVisitorUrl();
}
return null;
}
[DllImport("__Internal")]
static extern void SmartlookEnableCrashlytics(bool enable);
static partial void EnableCrashlyticsInternal(bool enable) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookEnableCrashlytics(enable);
}
}
[DllImport("__Internal")]
static extern string SmartlookStartTimedCustomEvent(string eventName);
public static string StartTimedCustomEventInternalIOS(string eventName) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
return SmartlookStartTimedCustomEvent(eventName);
}
return null;
}
[DllImport("__Internal")]
static extern string SmartlookStartTimedCustomEventWithProperties(string eventName, string properties);
public static string StartTimedCustomEventInternalIOS(string eventName, string properties) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
return SmartlookStartTimedCustomEventWithProperties(eventName, properties);
}
return null;
}
[DllImport("__Internal")]
static extern void SmartlookStopTimedCustomEvent(string eventId);
static partial void StopTimedCustomEventInternal(string eventId) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookStopTimedCustomEvent(eventId);
}
}
[DllImport("__Internal")]
static extern void SmartlookStopTimedCustomEventWithProperties(string eventId, string properties);
static partial void StopTimedCustomEventInternal(string eventId, string properties) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookStopTimedCustomEventWithProperties(eventId, properties);
}
}
[DllImport("__Internal")]
static extern void SmartlookCancelTimedCustomEvent(string eventId, string reason);
static partial void CancelTimedCustomEventInternal(string eventId, string reason) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookCancelTimedCustomEvent(eventId, reason);
}
}
[DllImport("__Internal")]
static extern void SmartlookCancelTimedCustomEventWithProperties(string eventId, string reason, string properties);
static partial void CancelTimedCustomEventInternal(string eventId, string reason, string properties) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookCancelTimedCustomEventWithProperties(eventId, reason, properties);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetGlobalEventProperty(string key, string value, bool immutable);
static partial void SetGlobalEventPropertyInternal(string key, string value, bool immutable) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetGlobalEventProperty(key, value, immutable);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetGlobalEventProperties(string properties, bool immutable);
static partial void SetGlobalEventPropertiesInternal(string properties, bool immutable) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetGlobalEventProperties(properties, immutable);
}
}
[DllImport("__Internal")]
static extern void SmartlookRemoveGlobalEventProperty(string key);
static partial void RemoveGlobalEventPropertyInternal(string key) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookRemoveGlobalEventProperty(key);
}
}
[DllImport("__Internal")]
static extern void SmartlookRemoveAllGlobalEventProperties();
static partial void RemoveAllGlobalEventPropertiesInternal() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookRemoveAllGlobalEventProperties();
}
}
[DllImport("__Internal")]
static extern void SmartlookResetSession(bool resetUser);
static partial void ResetSessionInternal(bool resetUser) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookResetSession(resetUser);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetRenderingMode(int renderingMode);
static partial void SetRenderingModeInternal(int renderingMode) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetRenderingMode(renderingMode);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetEventTrackingMode(string eventTrackingMode);
static partial void SetEventTrackingModeInternal(string eventTrackingMode)
{
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetEventTrackingMode(eventTrackingMode);
}
}
[DllImport("__Internal")]
static extern void SmartlookSetEventTrackingModes(string eventTrackingModes);
static partial void SetEventTrackingModesInternal(string eventTrackingModes)
{
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookSetEventTrackingModes(eventTrackingModes);
}
}
private static IntegrationListener privateIntegrationListener;
private delegate void DelegateMessage(string message);
[MonoPInvokeCallback(typeof(DelegateMessage))]
private static void delegateVisitorUrlChanged(string message) {
privateIntegrationListener.onVisitorReady(message);
}
[MonoPInvokeCallback(typeof(DelegateMessage))]
private static void delegateSessionUrlChanged(string message) {
privateIntegrationListener.onSessionReady(message);
}
[DllImport("__Internal")]
static extern void SmartlookSetDashboardSessionUrlListener(DelegateMessage callback);
[DllImport("__Internal")]
static extern void SmartlookSetDashboardVisitorUrlListener(DelegateMessage callback);
public static void RegisterIntegrationListenerInternalIOS(IntegrationListener integrationListener) {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
privateIntegrationListener = integrationListener;
SmartlookSetDashboardSessionUrlListener(delegateSessionUrlChanged);
SmartlookSetDashboardVisitorUrlListener(delegateVisitorUrlChanged);
}
}
[DllImport("__Internal")]
static extern void SmartlookUnregisterDashboardListener();
static partial void UnregisterIntegrationListenerInternal() {
if (Application.platform == RuntimePlatform.IPhonePlayer) {
SmartlookUnregisterDashboardListener();
}
}
}
}
#endif