react-native-ux-cam 5.4.16 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/RNUxcam.podspec +22 -3
- package/android/build.gradle +39 -5
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradlew +240 -0
- package/android/gradlew.bat +91 -0
- package/android/src/main/java/com/uxcam/RNUxViewFinder.java +7 -0
- package/android/src/main/java/com/uxcam/RNUxcamModuleImpl.java +446 -0
- package/android/src/main/java/com/uxcam/RNUxcamPackage.java +33 -18
- package/android/src/newarch/java/com/uxcam/RNUxcamModule.java +208 -0
- package/android/src/oldarch/java/com/uxcam/RNUxcamModule.java +205 -0
- package/ios/RNUxcam/RNUxcam.h +16 -0
- package/ios/RNUxcam/RNUxcam.mm +526 -0
- package/package.json +36 -32
- package/src/NativeRNUxcam.ts +60 -0
- package/src/UXCam.js +343 -0
- package/src/UXCamOcclusion.tsx +29 -0
- package/{index.d.ts → src/index.d.ts} +9 -130
- package/src/index.js +3 -0
- package/src/types.ts +19 -0
- package/UXCam.js +0 -570
- package/UXCamOcclusion.tsx +0 -36
- package/android/.classpath +0 -6
- package/android/src/main/java/com/uxcam/RNUxcamModule.java +0 -559
- package/index.js +0 -3
- package/ios/RNUxcam.h +0 -19
- package/ios/RNUxcam.m +0 -670
- package/ios/RNUxcam.xcodeproj/project.pbxproj +0 -266
- package/ios/RNUxcam.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/RNUxcam.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- /package/{jest.config.js → src/jest.config.js} +0 -0
- /package/{tsconfig.json → src/tsconfig.json} +0 -0
package/ios/RNUxcam.m
DELETED
|
@@ -1,670 +0,0 @@
|
|
|
1
|
-
#import "RNUxcam.h"
|
|
2
|
-
@import UXCam;
|
|
3
|
-
|
|
4
|
-
#import <React/RCTUIManager.h>
|
|
5
|
-
#import <React/RCTUIManagerUtils.h>
|
|
6
|
-
|
|
7
|
-
static NSString* const RNUxcam_VerifyEvent_Name = @"UXCam_Verification_Event";
|
|
8
|
-
|
|
9
|
-
// Configuration Keys
|
|
10
|
-
static NSString* const RNUxcam_AppKey = @"userAppKey";
|
|
11
|
-
static NSString* const RNUxcam_MultiSession = @"enableMultiSessionRecord";
|
|
12
|
-
static NSString* const RNUxcam_CrashHandling = @"enableCrashHandling";
|
|
13
|
-
static NSString* const RNUxcam_ScreenTag = @"enableAutomaticScreenNameTagging";
|
|
14
|
-
static NSString* const RNUxcam_AdvancedGestures = @"enableAdvancedGestureRecognition";
|
|
15
|
-
static NSString* const RNUxcam_EnableNetworkLogs = @"enableNetworkLogging";
|
|
16
|
-
|
|
17
|
-
static NSString* const RNUxcam_Occlusion = @"occlusions";
|
|
18
|
-
static NSString* const RNUxcam_OccludeScreens = @"screens";
|
|
19
|
-
static NSString* const RNUxcam_ExcludeScreens = @"excludeMentionedScreens";
|
|
20
|
-
static NSString* const RNUxcam_OcclusionType = @"type";
|
|
21
|
-
static NSString* const RNUxcam_BlurName = @"name";
|
|
22
|
-
static NSString* const RNUxcam_BlurRadius = @"blurRadius";
|
|
23
|
-
static NSString* const RNUxcam_HideGestures = @"hideGestures";
|
|
24
|
-
static NSString* const RNUxcam_OverlayColor = @"color";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@interface RNUxcam ()
|
|
28
|
-
@property (atomic, strong) NSNumber* lastVerifyResult;
|
|
29
|
-
@property (atomic, assign) NSInteger numEventListeners;
|
|
30
|
-
@end
|
|
31
|
-
|
|
32
|
-
@implementation RNUxcam
|
|
33
|
-
|
|
34
|
-
RCT_EXPORT_MODULE();
|
|
35
|
-
|
|
36
|
-
/// Made the module a singleton when we added event sending - otherwise it threw an error on CMD+R reload
|
|
37
|
-
+ (id)allocWithZone:(NSZone *)zone
|
|
38
|
-
{
|
|
39
|
-
static RNUxcam *sharedInstance = nil;
|
|
40
|
-
static dispatch_once_t onceToken;
|
|
41
|
-
dispatch_once(&onceToken, ^{
|
|
42
|
-
sharedInstance = [super allocWithZone:zone];
|
|
43
|
-
});
|
|
44
|
-
return sharedInstance;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/// TODO: Investigate if we can remove this and run on a general background Q
|
|
48
|
-
- (dispatch_queue_t)methodQueue
|
|
49
|
-
{
|
|
50
|
-
return dispatch_get_main_queue();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
#pragma mark The main entry point - start the UXCam system with the provided configuration
|
|
54
|
-
RCT_EXPORT_METHOD(startWithConfiguration:(NSDictionary *)config)
|
|
55
|
-
{
|
|
56
|
-
self.lastVerifyResult = nil;
|
|
57
|
-
[UXCam pluginType:@"react-native" version:@"5.4.16"];
|
|
58
|
-
|
|
59
|
-
NSString *userAppKey = config[RNUxcam_AppKey];
|
|
60
|
-
if (!userAppKey || ![userAppKey isKindOfClass:NSString.class])
|
|
61
|
-
{
|
|
62
|
-
NSLog(@"UXCam: Please provide valid app key");
|
|
63
|
-
[self verifyEventSender:NO];
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
UXCamConfiguration *configuration = [[UXCamConfiguration alloc] initWithAppKey:userAppKey];
|
|
67
|
-
[self updateConfiguration:configuration fromDict:config];
|
|
68
|
-
|
|
69
|
-
[UXCam startWithConfiguration:configuration completionBlock:^(BOOL started)
|
|
70
|
-
{
|
|
71
|
-
self.lastVerifyResult = @(started);
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
RCT_EXPORT_METHOD(configurationForUXCam:(RCTPromiseResolveBlock)resolve
|
|
77
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
78
|
-
{
|
|
79
|
-
UXCamConfiguration *configuration = UXCam.configuration;
|
|
80
|
-
|
|
81
|
-
if (configuration)
|
|
82
|
-
{
|
|
83
|
-
NSDictionary *configDict = @{
|
|
84
|
-
RNUxcam_AppKey: configuration.userAppKey,
|
|
85
|
-
RNUxcam_MultiSession: @(configuration.enableMultiSessionRecord),
|
|
86
|
-
RNUxcam_CrashHandling: @(configuration.enableCrashHandling),
|
|
87
|
-
RNUxcam_ScreenTag: @(configuration.enableAutomaticScreenNameTagging),
|
|
88
|
-
RNUxcam_AdvancedGestures: @(configuration.enableAdvancedGestureRecognition),
|
|
89
|
-
RNUxcam_EnableNetworkLogs: @(configuration.enableNetworkLogging)
|
|
90
|
-
};
|
|
91
|
-
resolve(configDict);
|
|
92
|
-
}
|
|
93
|
-
else
|
|
94
|
-
{
|
|
95
|
-
NSString *code = @"no_configuration";
|
|
96
|
-
NSString *message = @"Please start UXCam with startWithConfiguration first to get configuration";
|
|
97
|
-
NSError *error = [NSError errorWithDomain:@"RNUXCam" code:1 userInfo:nil];
|
|
98
|
-
|
|
99
|
-
reject(code, message, error);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
RCT_EXPORT_METHOD(updateConfiguration:(NSDictionary *)config)
|
|
104
|
-
{
|
|
105
|
-
UXCamConfiguration *configuration = UXCam.configuration;
|
|
106
|
-
if (!configuration)
|
|
107
|
-
{
|
|
108
|
-
NSLog(@"Please start UXCam with startWithConfiguration first before updating configuration");
|
|
109
|
-
return;
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
[self updateConfiguration:configuration fromDict:config];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
- (void)updateConfiguration:(UXCamConfiguration *)configuration fromDict:(NSDictionary *)config
|
|
116
|
-
{
|
|
117
|
-
NSNumber *enableMultiSessionRecord = config[RNUxcam_MultiSession];
|
|
118
|
-
if (enableMultiSessionRecord && [self isBoolNumber:enableMultiSessionRecord])
|
|
119
|
-
{
|
|
120
|
-
configuration.enableMultiSessionRecord = [enableMultiSessionRecord boolValue];
|
|
121
|
-
}
|
|
122
|
-
NSNumber *enableCrashHandling = config[RNUxcam_CrashHandling];
|
|
123
|
-
if (enableCrashHandling && [self isBoolNumber:enableCrashHandling])
|
|
124
|
-
{
|
|
125
|
-
configuration.enableCrashHandling = [enableCrashHandling boolValue];
|
|
126
|
-
}
|
|
127
|
-
NSNumber *enableAutomaticScreenNameTagging = config[RNUxcam_ScreenTag];
|
|
128
|
-
if (enableAutomaticScreenNameTagging && [self isBoolNumber:enableAutomaticScreenNameTagging])
|
|
129
|
-
{
|
|
130
|
-
configuration.enableAutomaticScreenNameTagging = [enableAutomaticScreenNameTagging boolValue];
|
|
131
|
-
}
|
|
132
|
-
NSNumber *enableAdvancedGestureRecognition = config[RNUxcam_AdvancedGestures];
|
|
133
|
-
if (enableAdvancedGestureRecognition && [self isBoolNumber:enableAdvancedGestureRecognition])
|
|
134
|
-
{
|
|
135
|
-
configuration.enableAdvancedGestureRecognition = [enableAdvancedGestureRecognition boolValue];
|
|
136
|
-
}
|
|
137
|
-
NSNumber *enableNetworkLogging = config[RNUxcam_EnableNetworkLogs];
|
|
138
|
-
if (enableNetworkLogging && [self isBoolNumber:enableNetworkLogging])
|
|
139
|
-
{
|
|
140
|
-
configuration.enableNetworkLogging = [enableNetworkLogging boolValue];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
NSArray *occlusionList = config[RNUxcam_Occlusion];
|
|
144
|
-
if (occlusionList && ![occlusionList isKindOfClass:NSNull.class]) {
|
|
145
|
-
UXCamOcclusion *occlusion = [[UXCamOcclusion alloc] init];
|
|
146
|
-
for (NSDictionary *occlusionJson in occlusionList) {
|
|
147
|
-
id <UXCamOcclusionSetting> setting = [self getOcclusionSettingFromJson:occlusionJson];
|
|
148
|
-
if (setting)
|
|
149
|
-
{
|
|
150
|
-
NSArray *screens = occlusionJson[RNUxcam_OccludeScreens];
|
|
151
|
-
BOOL excludeMentionedScreens = [occlusionJson[RNUxcam_ExcludeScreens] boolValue];
|
|
152
|
-
[occlusion applySettings:@[setting] screens:screens excludeMentionedScreens: excludeMentionedScreens];
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
configuration.occlusion = occlusion;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
- (id<UXCamOcclusionSetting>)getOcclusionSettingFromJson:(NSDictionary *)json
|
|
160
|
-
{
|
|
161
|
-
NSNumber *type = json[RNUxcam_OcclusionType];
|
|
162
|
-
UXOcclusionType occlusionType = type.integerValue ?: UXOcclusionTypeBlur;
|
|
163
|
-
|
|
164
|
-
switch (occlusionType) {
|
|
165
|
-
case UXOcclusionTypeBlur:
|
|
166
|
-
{
|
|
167
|
-
NSString *name = json[RNUxcam_BlurName];
|
|
168
|
-
UXBlurType blurType = [UXCamOcclusion getBlurTypeFromName:name];
|
|
169
|
-
NSNumber *radiusValue = json[RNUxcam_BlurRadius];
|
|
170
|
-
int radius = radiusValue.intValue ?: 10;
|
|
171
|
-
UXCamBlurSetting *blur = [[UXCamBlurSetting alloc] initWithBlurType:blurType radius:radius];
|
|
172
|
-
NSNumber *hideGestures = json[RNUxcam_HideGestures];
|
|
173
|
-
if (hideGestures) {
|
|
174
|
-
blur.hideGestures = hideGestures.boolValue;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return blur;
|
|
178
|
-
}
|
|
179
|
-
case UXOcclusionTypeOverlay:
|
|
180
|
-
{
|
|
181
|
-
UXCamOverlaySetting *overlay = [[UXCamOverlaySetting alloc] init];
|
|
182
|
-
NSNumber *colorCode = json[RNUxcam_OverlayColor];
|
|
183
|
-
if (colorCode)
|
|
184
|
-
{
|
|
185
|
-
int colorValue = colorCode.intValue;
|
|
186
|
-
float redValue = (colorValue >> 16 & 0xff) / 0xff;
|
|
187
|
-
float greenValue = (colorValue >> 8 & 0xff) / 0xff;
|
|
188
|
-
float blueValue = (colorValue & 0xff) / 0xff;
|
|
189
|
-
|
|
190
|
-
UIColor *color = [UIColor colorWithRed:redValue green:greenValue blue:blueValue alpha: 1];
|
|
191
|
-
overlay.color = color;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
NSNumber *hideGestures = json[RNUxcam_HideGestures];
|
|
195
|
-
if (hideGestures) {
|
|
196
|
-
overlay.hideGestures = hideGestures.boolValue;
|
|
197
|
-
}
|
|
198
|
-
return overlay;
|
|
199
|
-
}
|
|
200
|
-
case UXOcclusionTypeOccludeAllTextFields:
|
|
201
|
-
{
|
|
202
|
-
UXCamOccludeAllTextFields *occlude = [[UXCamOccludeAllTextFields alloc] init];
|
|
203
|
-
return occlude;
|
|
204
|
-
}
|
|
205
|
-
default:
|
|
206
|
-
return nil;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
RCT_EXPORT_METHOD(applyOcclusion:(NSDictionary *)occlusion)
|
|
211
|
-
{
|
|
212
|
-
if (occlusion && ![occlusion isKindOfClass:NSNull.class]) {
|
|
213
|
-
id <UXCamOcclusionSetting> setting = [self getOcclusionSettingFromJson:occlusion];
|
|
214
|
-
if (setting)
|
|
215
|
-
{
|
|
216
|
-
[UXCam applyOcclusion:setting];
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
RCT_EXPORT_METHOD(removeOcclusion:(NSDictionary *)occlusion)
|
|
222
|
-
{
|
|
223
|
-
if (occlusion && ![occlusion isKindOfClass:NSNull.class]) {
|
|
224
|
-
id <UXCamOcclusionSetting> setting = [self getOcclusionSettingFromJson:occlusion];
|
|
225
|
-
if (setting)
|
|
226
|
-
{
|
|
227
|
-
[UXCam removeOcclusionOfType:setting.type];
|
|
228
|
-
}
|
|
229
|
-
else
|
|
230
|
-
{
|
|
231
|
-
[UXCam removeOcclusion];
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
RCT_EXPORT_METHOD(startWithKey:(NSString *)userAppKey)
|
|
237
|
-
{
|
|
238
|
-
NSDictionary *config = @{RNUxcam_AppKey: userAppKey};
|
|
239
|
-
[self startWithConfiguration:config];
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
#pragma mark Event related methods
|
|
243
|
-
- (NSArray<NSString *> *)supportedEvents
|
|
244
|
-
{
|
|
245
|
-
return @[RNUxcam_VerifyEvent_Name];
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/// Will be called when this module's first listener is added.
|
|
249
|
-
-(void)startObserving
|
|
250
|
-
{
|
|
251
|
-
// Set up any upstream listeners or background tasks as necessary
|
|
252
|
-
if (self.numEventListeners == 0)
|
|
253
|
-
{
|
|
254
|
-
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addObserverForVerificationNotification:) name:RNUxcam_VerifyEvent_Name object:nil];
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
self.numEventListeners++;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/// Will be called when this module's last listener is removed, or on dealloc.
|
|
261
|
-
-(void)stopObserving
|
|
262
|
-
{
|
|
263
|
-
self.numEventListeners--;
|
|
264
|
-
if (self.numEventListeners == 0)
|
|
265
|
-
{
|
|
266
|
-
[[NSNotificationCenter defaultCenter] removeObserver:self name:RNUxcam_VerifyEvent_Name object:nil];
|
|
267
|
-
}
|
|
268
|
-
else if (self.numEventListeners < 0)
|
|
269
|
-
{
|
|
270
|
-
NSLog(@"RNUxcam: Removed more event listeners than were added.");
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
- (void)addObserverForVerificationNotification:(NSNotification *)notification
|
|
275
|
-
{
|
|
276
|
-
if (![notification.name isEqualToString:RNUxcam_VerifyEvent_Name])
|
|
277
|
-
{
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
BOOL started = [notification.userInfo[@"started"] boolValue];
|
|
281
|
-
[self verifyEventSender:started];
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
- (void)verifyEventSender:(BOOL)verifyResult
|
|
285
|
-
{
|
|
286
|
-
if (self.numEventListeners > 0)
|
|
287
|
-
{
|
|
288
|
-
NSDictionary* eventBody = @{@"success": @(verifyResult)};
|
|
289
|
-
if (verifyResult == FALSE)
|
|
290
|
-
{
|
|
291
|
-
NSString *message = @"UXCam session verification failed"; /// TODO: Localise
|
|
292
|
-
NSError *error = [NSError errorWithDomain:@"RNUXCam" code:1 userInfo:@{NSLocalizedDescriptionKey : message}];
|
|
293
|
-
|
|
294
|
-
eventBody = @{@"success": @(verifyResult), @"error": error};
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
[self sendEventWithName:RNUxcam_VerifyEvent_Name body:eventBody];
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/// Interpret the 'tag' passed in (result of findNodeFromHandle) which used to be just an NSNumber view tag, but now comes in as a full dictionary. Change in some random RN version?
|
|
302
|
-
- (NSNumber*)tagNumberFromTag:(id)tag
|
|
303
|
-
{
|
|
304
|
-
NSNumber* reactTag = nil;
|
|
305
|
-
if ([tag isKindOfClass:NSDictionary.class])
|
|
306
|
-
{
|
|
307
|
-
reactTag = tag[@"_nativeTag"];
|
|
308
|
-
}
|
|
309
|
-
else if ([tag isKindOfClass:NSNumber.class])
|
|
310
|
-
{
|
|
311
|
-
reactTag = tag;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return reactTag;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
- (BOOL)isBoolNumber:(NSNumber *)num
|
|
318
|
-
{
|
|
319
|
-
CFTypeID boolID = CFBooleanGetTypeID(); // the type ID of CFBoolean
|
|
320
|
-
CFTypeID numID = CFGetTypeID((__bridge CFTypeRef)(num)); // the type ID of num
|
|
321
|
-
return numID == boolID;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
#pragma mark General UXCam SDK method mappings
|
|
325
|
-
RCT_EXPORT_METHOD(stopSessionAndUploadData)
|
|
326
|
-
{
|
|
327
|
-
[UXCam stopSessionAndUploadData];
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
RCT_EXPORT_METHOD(restartSession)
|
|
331
|
-
{
|
|
332
|
-
[UXCam startNewSession];
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
RCT_EXPORT_METHOD(allowShortBreakForAnotherApp:(BOOL)continueSession)
|
|
336
|
-
{
|
|
337
|
-
[UXCam allowShortBreakForAnotherApp:continueSession];
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
RCT_EXPORT_METHOD(allowShortBreakForAnotherAppInMillis:(double)duration)
|
|
341
|
-
{
|
|
342
|
-
[UXCam allowShortBreakForAnotherApp:true];
|
|
343
|
-
[UXCam setAllowShortBreakMaxDuration:duration];
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
RCT_EXPORT_METHOD(startNewSession)
|
|
347
|
-
{
|
|
348
|
-
[UXCam startNewSession];
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
RCT_EXPORT_METHOD(cancelCurrentSession)
|
|
352
|
-
{
|
|
353
|
-
[UXCam cancelCurrentSession];
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
RCT_EXPORT_METHOD(setMultiSessionRecord:(BOOL)recordMultipleSessions)
|
|
357
|
-
{
|
|
358
|
-
UXCam.configuration.enableMultiSessionRecord = recordMultipleSessions;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
RCT_EXPORT_METHOD(pauseScreenRecording)
|
|
362
|
-
{
|
|
363
|
-
[UXCam pauseScreenRecording];
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
RCT_EXPORT_METHOD(resumeScreenRecording)
|
|
367
|
-
{
|
|
368
|
-
[UXCam resumeScreenRecording];
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
RCT_EXPORT_METHOD(disableCrashHandling:(BOOL)disable)
|
|
372
|
-
{
|
|
373
|
-
UXCam.configuration.enableCrashHandling = !disable;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
RCT_EXPORT_METHOD(occludeSensitiveScreen:(BOOL)hideScreen)
|
|
377
|
-
{
|
|
378
|
-
[UXCam occludeSensitiveScreen:hideScreen hideGestures:true];
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
RCT_EXPORT_METHOD(occludeSensitiveScreen:(BOOL)hideScreen hideGestures:(BOOL) hideGesture)
|
|
382
|
-
{
|
|
383
|
-
[UXCam occludeSensitiveScreen:hideScreen hideGestures:hideGesture];
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
RCT_EXPORT_METHOD(occludeAllTextFields:(BOOL)occludeAll)
|
|
387
|
-
{
|
|
388
|
-
[UXCam occludeAllTextFields:occludeAll];
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
RCT_EXPORT_METHOD(setUserIdentity:(NSString*)userIdentity)
|
|
392
|
-
{
|
|
393
|
-
[UXCam setUserIdentity:userIdentity];
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
RCT_EXPORT_METHOD(setUserProperty:(NSString*)propertyName value:(id)value)
|
|
397
|
-
{
|
|
398
|
-
[UXCam setUserProperty:propertyName value:value];
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
RCT_EXPORT_METHOD(setSessionProperty:(NSString*)propertyName value:(id)value)
|
|
402
|
-
{
|
|
403
|
-
[UXCam setSessionProperty:propertyName value:value];
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
RCT_EXPORT_METHOD(logEvent:(NSString*)eventName)
|
|
407
|
-
{
|
|
408
|
-
[UXCam logEvent:eventName];
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
RCT_EXPORT_METHOD(logEvent:(NSString*)eventName withProperties:(nullable NSDictionary<NSString*, id>*)properties)
|
|
412
|
-
{
|
|
413
|
-
[UXCam logEvent:eventName withProperties:properties];
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
RCT_EXPORT_METHOD(urlForCurrentUser:(RCTPromiseResolveBlock)resolve
|
|
417
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
418
|
-
{
|
|
419
|
-
NSString *url = [UXCam urlForCurrentUser];
|
|
420
|
-
|
|
421
|
-
if (url)
|
|
422
|
-
{
|
|
423
|
-
resolve(url);
|
|
424
|
-
}
|
|
425
|
-
else
|
|
426
|
-
{
|
|
427
|
-
NSString *code = @"no_url";
|
|
428
|
-
NSString *message = @"Could not retrieve the url for the current user.";
|
|
429
|
-
NSError *error = [NSError errorWithDomain:@"RNUXCam" code:1 userInfo:nil];
|
|
430
|
-
|
|
431
|
-
reject(code, message, error);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
RCT_EXPORT_METHOD(urlForCurrentSession:(RCTPromiseResolveBlock)resolve
|
|
436
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
437
|
-
{
|
|
438
|
-
NSString *url = [UXCam urlForCurrentSession];
|
|
439
|
-
|
|
440
|
-
if (url)
|
|
441
|
-
{
|
|
442
|
-
resolve(url);
|
|
443
|
-
}
|
|
444
|
-
else
|
|
445
|
-
{
|
|
446
|
-
NSString *code = @"no_url";
|
|
447
|
-
NSString *message = @"Could not retrieve the url for the current session.";
|
|
448
|
-
NSError *error = [NSError errorWithDomain:@"RNUXCam" code:2 userInfo:nil];
|
|
449
|
-
|
|
450
|
-
reject(code, message, error);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
RCT_EXPORT_METHOD(optOutOverall)
|
|
455
|
-
{
|
|
456
|
-
[UXCam optOutOverall];
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
RCT_EXPORT_METHOD(optOutOfSchematicRecordings)
|
|
460
|
-
{
|
|
461
|
-
[UXCam optOutOfSchematicRecordings];
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
RCT_EXPORT_METHOD(optInOverall)
|
|
465
|
-
{
|
|
466
|
-
[UXCam optInOverall];
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
RCT_EXPORT_METHOD(optIntoSchematicRecordings)
|
|
470
|
-
{
|
|
471
|
-
[UXCam optIntoSchematicRecordings];
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
RCT_EXPORT_METHOD(optInOverallStatus:(RCTPromiseResolveBlock)resolve
|
|
475
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
476
|
-
{
|
|
477
|
-
resolve(@(UXCam.optInOverallStatus));
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
RCT_EXPORT_METHOD(optInSchematicRecordingStatus:(RCTPromiseResolveBlock)resolve
|
|
481
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
482
|
-
{
|
|
483
|
-
resolve(@(UXCam.optInSchematicRecordingStatus));
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
RCT_EXPORT_METHOD(isRecording:(RCTPromiseResolveBlock)resolve
|
|
487
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
488
|
-
{
|
|
489
|
-
resolve(@(UXCam.isRecording));
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
RCT_EXPORT_METHOD(getMultiSessionRecord:(RCTPromiseResolveBlock)resolve
|
|
493
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
494
|
-
{
|
|
495
|
-
resolve(@(UXCam.configuration.enableMultiSessionRecord));
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
RCT_EXPORT_METHOD(pendingSessionCount:(RCTPromiseResolveBlock)resolve
|
|
499
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
500
|
-
{
|
|
501
|
-
resolve(@(UXCam.pendingUploads));
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
RCT_EXPORT_METHOD(deletePendingUploads)
|
|
505
|
-
{
|
|
506
|
-
[UXCam deletePendingUploads];
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
RCT_EXPORT_METHOD(uploadPendingSession)
|
|
510
|
-
{
|
|
511
|
-
[UXCam uploadingPendingSessions:nil];
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
RCT_EXPORT_METHOD(resumeShortBreakForAnotherApp)
|
|
515
|
-
{
|
|
516
|
-
// A do nothing method on iOS - used in Android
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
RCT_EXPORT_METHOD(occludeSensitiveView: (id) tag)
|
|
520
|
-
{
|
|
521
|
-
NSNumber* reactTag = [self tagNumberFromTag:tag];
|
|
522
|
-
if (reactTag)
|
|
523
|
-
{
|
|
524
|
-
// Very convoluted way to get the occlusion to not run until the UIManager has completed any pending operations - without this the current view being setup in something like
|
|
525
|
-
// <Text ref={(view) => RNUxcam.occludeSensitiveView(view)}>Occluded text</Text>
|
|
526
|
-
// wont be found in the registry and so wont be occluded
|
|
527
|
-
dispatch_async(RCTGetUIManagerQueue(), ^
|
|
528
|
-
{
|
|
529
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry)
|
|
530
|
-
{
|
|
531
|
-
UIView* view = viewRegistry[reactTag];
|
|
532
|
-
if (view)
|
|
533
|
-
{
|
|
534
|
-
[UXCam occludeSensitiveView:view];
|
|
535
|
-
}
|
|
536
|
-
else
|
|
537
|
-
{
|
|
538
|
-
NSLog(@"RNUXCam:occludeSensitiveView - unable to find view for reactTag %@", reactTag);
|
|
539
|
-
}
|
|
540
|
-
}];
|
|
541
|
-
});
|
|
542
|
-
}
|
|
543
|
-
else
|
|
544
|
-
{
|
|
545
|
-
NSLog(@"RNUXCam:occludeSensitiveView - unable to find reactTag from %@", tag);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
RCT_EXPORT_METHOD(unOccludeSensitiveView: (id) tag)
|
|
550
|
-
{
|
|
551
|
-
NSNumber* reactTag = [self tagNumberFromTag:tag];
|
|
552
|
-
if (reactTag)
|
|
553
|
-
{
|
|
554
|
-
// Very convoluted way to get the occlusion to not run until the UIManager has completed any pending operations - without this the current view
|
|
555
|
-
// might not be found in the registry and so wont be unoccluded. Probably less of a problem with unOcclusion, but left to mirror the other methods
|
|
556
|
-
dispatch_async(RCTGetUIManagerQueue(), ^
|
|
557
|
-
{
|
|
558
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry)
|
|
559
|
-
{
|
|
560
|
-
UIView* view = viewRegistry[reactTag];
|
|
561
|
-
if (view)
|
|
562
|
-
{
|
|
563
|
-
[UXCam unOccludeSensitiveView:view];
|
|
564
|
-
}
|
|
565
|
-
else
|
|
566
|
-
{
|
|
567
|
-
NSLog(@"RNUXCam:unOccludeSensitiveView - unable to find view for reactTag %@", reactTag);
|
|
568
|
-
}
|
|
569
|
-
}];
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
else
|
|
573
|
-
{
|
|
574
|
-
NSLog(@"RNUXCam:unOccludeSensitiveView - unable to find reactTag from %@", tag);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
RCT_EXPORT_METHOD(occludeSensitiveViewWithoutGesture: (id) tag)
|
|
579
|
-
{
|
|
580
|
-
NSNumber* reactTag = [self tagNumberFromTag:tag];
|
|
581
|
-
if (reactTag)
|
|
582
|
-
{
|
|
583
|
-
// Very convoluted way to get the occlusion to not run until the UIManager has completed any pending operations - without this the current view being setup in something like
|
|
584
|
-
// <Text ref={(view) => RNUxcam.occludeSensitiveViewWithoutGesture(view)}>Occluded text</Text>
|
|
585
|
-
// wont be found in the registry and so wont be occluded
|
|
586
|
-
dispatch_async(RCTGetUIManagerQueue(), ^
|
|
587
|
-
{
|
|
588
|
-
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry)
|
|
589
|
-
{
|
|
590
|
-
UIView* view = viewRegistry[reactTag];
|
|
591
|
-
if (view)
|
|
592
|
-
{
|
|
593
|
-
[UXCam occludeSensitiveViewWithoutGesture:view];
|
|
594
|
-
}
|
|
595
|
-
else
|
|
596
|
-
{
|
|
597
|
-
NSLog(@"RNUXCam:occludeSensitiveViewWithoutGesture - unable to find view for reactTag %@", reactTag);
|
|
598
|
-
}
|
|
599
|
-
}];
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
else
|
|
603
|
-
{
|
|
604
|
-
NSLog(@"RNUXCam:occludeSensitiveViewWithoutGesture - unable to find reactTag from %@", tag);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
#pragma mark Screen name methods
|
|
609
|
-
RCT_EXPORT_METHOD(setAutomaticScreenNameTagging:(BOOL)enable)
|
|
610
|
-
{
|
|
611
|
-
UXCam.configuration.enableAutomaticScreenNameTagging = enable;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
RCT_EXPORT_METHOD(tagScreenName:(NSString*)screenName)
|
|
615
|
-
{
|
|
616
|
-
[UXCam tagScreenName:screenName];
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
RCT_EXPORT_METHOD(addScreenNameToIgnore:(NSString*)screenName)
|
|
620
|
-
{
|
|
621
|
-
[UXCam addScreenNameToIgnore:screenName];
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
RCT_EXPORT_METHOD(addScreenNamesToIgnore:(NSArray<NSString*>*)screenNames)
|
|
625
|
-
{
|
|
626
|
-
[UXCam addScreenNamesToIgnore:screenNames];
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
RCT_EXPORT_METHOD(removeScreenNameToIgnore:(NSString*)screenName)
|
|
630
|
-
{
|
|
631
|
-
[UXCam removeScreenNameToIgnore:screenName];
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
RCT_EXPORT_METHOD(removeScreenNamesToIgnore:(NSArray<NSString*>*)screenNames)
|
|
635
|
-
{
|
|
636
|
-
[UXCam removeScreenNamesToIgnore:screenNames];
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
RCT_EXPORT_METHOD(removeAllScreenNamesToIgnore)
|
|
640
|
-
{
|
|
641
|
-
[UXCam removeAllScreenNamesToIgnore];
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
RCT_EXPORT_METHOD(screenNamesBeingIgnored:(RCTPromiseResolveBlock)resolve
|
|
645
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
646
|
-
{
|
|
647
|
-
resolve(UXCam.screenNamesBeingIgnored);
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
RCT_EXPORT_METHOD(setPushNotificationToken:(NSString*)pushToken)
|
|
651
|
-
{
|
|
652
|
-
[UXCam setPushNotificationToken:pushToken];
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
RCT_EXPORT_METHOD(reportBugEvent:(nullable NSString*)name)
|
|
656
|
-
{
|
|
657
|
-
[UXCam reportBugEvent:name properties:nil];
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
RCT_EXPORT_METHOD(reportBugEvent:(NSString*)name properties:(nullable NSDictionary<NSString*, id>*)properties)
|
|
661
|
-
{
|
|
662
|
-
[UXCam reportBugEvent:name properties:properties];
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
RCT_EXPORT_METHOD(enableAdvancedGestureRecognizers:(BOOL)enable)
|
|
666
|
-
{
|
|
667
|
-
UXCam.configuration.enableAdvancedGestureRecognition = enable;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
@end
|