Skip to content

Commit b454240

Browse files
committed
feat[ios]: add setOverAirVersion
1 parent ea749d4 commit b454240

File tree

6 files changed

+31
-2
lines changed

6 files changed

+31
-2
lines changed

ios/RNInstabug/ArgsRegistry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ typedef NSDictionary<NSString*, NSNumber*> ArgsDictionary;
2323
+ (ArgsDictionary *) locales;
2424
+ (ArgsDictionary *)nonFatalExceptionLevel;
2525
+ (ArgsDictionary *) launchType;
26+
+ (ArgsDictionary *) overAirServices;
2627

2728
+ (NSDictionary<NSString *, NSString *> *) placeholders;
2829

ios/RNInstabug/ArgsRegistry.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ + (NSMutableDictionary *) getAll {
2121
[all addEntriesFromDictionary:ArgsRegistry.nonFatalExceptionLevel];
2222
[all addEntriesFromDictionary:ArgsRegistry.placeholders];
2323
[all addEntriesFromDictionary:ArgsRegistry.launchType];
24+
[all addEntriesFromDictionary:ArgsRegistry.overAirServices];
2425

2526
return all;
2627
}
@@ -248,5 +249,11 @@ + (ArgsDictionary *) launchType {
248249
@"unknown":@(LaunchTypeUnknown)
249250
};
250251
}
252+
+ (ArgsDictionary *) overAirServices {
253+
return @{
254+
@"expo":@(IBGOverAirTypeExpo) ,
255+
@"codePush":@(IBGOverAirTypeCodePush),
256+
};
257+
}
251258

252259
@end

ios/RNInstabug/InstabugReactBridge.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626

2727
- (void)setEnabled:(BOOL)isEnabled;
2828

29-
- (void)init:(NSString *)token invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel useNativeNetworkInterception:(BOOL)useNativeNetworkInterception codePushVersion:(NSString *)codePushVersion;
29+
- (void)init:(NSString *)token invocationEvents:(NSArray *)invocationEventsArray debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel useNativeNetworkInterception:(BOOL)useNativeNetworkInterception codePushVersion:(NSString *)codePushVersion overAirVersion:(NSDictionary *)overAirVersion;
3030

3131
- (void)setCodePushVersion:(NSString *)version;
3232

33+
- (void)setOverAirVersion:(NSDictionary *)overAirVersion;
34+
3335
- (void)setUserData:(NSString *)userData;
3436

3537
- (void)setTrackUserSteps:(BOOL)isEnabled;

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ - (dispatch_queue_t)methodQueue {
4141
invocationEvents:(NSArray *)invocationEventsArray
4242
debugLogsLevel:(IBGSDKDebugLogsLevel)sdkDebugLogsLevel
4343
useNativeNetworkInterception:(BOOL)useNativeNetworkInterception
44-
codePushVersion:(NSString *)codePushVersion) {
44+
codePushVersion:(NSString *)codePushVersion
45+
overAirVersion :(NSDictionary *)overAirVersion
46+
) {
4547
IBGInvocationEvent invocationEvents = 0;
4648

4749
for (NSNumber *boxedValue in invocationEventsArray) {
@@ -50,6 +52,9 @@ - (dispatch_queue_t)methodQueue {
5052

5153
[Instabug setCodePushVersion:codePushVersion];
5254

55+
IBGOverAirType service = [ArgsRegistry.overAirServices[overAirVersion[@"service"]] intValue];
56+
[Instabug setOverAirVersion:overAirVersion[@"version"] withType:service];
57+
5358
[RNInstabug initWithToken:token
5459
invocationEvents:invocationEvents
5560
debugLogsLevel:sdkDebugLogsLevel
@@ -60,6 +65,11 @@ - (dispatch_queue_t)methodQueue {
6065
[Instabug setCodePushVersion:version];
6166
}
6267

68+
RCT_EXPORT_METHOD(setOverAirVersion:(NSDictionary *)overAirVersion) {
69+
IBGOverAirType service = [ArgsRegistry.overAirServices[overAirVersion[@"service"]] intValue];
70+
[Instabug setOverAirVersion:overAirVersion[@"version"] withType:service];
71+
}
72+
6373
RCT_EXPORT_METHOD(setReproStepsConfig:(IBGUserStepsMode)bugMode :(IBGUserStepsMode)crashMode:(IBGUserStepsMode)sessionReplayMode) {
6474
[Instabug setReproStepsFor:IBGIssueTypeBug withMode:bugMode];
6575
[Instabug setReproStepsFor:IBGIssueTypeCrash withMode:crashMode];

ios/RNInstabug/RNInstabug.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define RNInstabug_h
33

44
#import <InstabugSDK/InstabugSDK.h>
5+
#import "ArgsRegistry.h"
56

67
@interface RNInstabug : NSObject
78

@@ -27,6 +28,8 @@ useNativeNetworkInterception:(BOOL)useNativeNetworkInterception;
2728
*/
2829
+ (void)setCodePushVersion:(NSString *)codePushVersion;
2930

31+
+ (void)setOverAirVersion:(NSDictionary *)overAirVersion;
32+
3033
@end
3134

3235
#endif /* RNInstabug_h */

ios/RNInstabug/RNInstabug.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ + (void)setCodePushVersion:(NSString *)codePushVersion {
6161
[Instabug setCodePushVersion:codePushVersion];
6262
}
6363

64+
+ (void)setOverAirVersion:(NSDictionary *)overAirVersion {
65+
IBGOverAirType service = [ArgsRegistry.overAirServices[overAirVersion[@"service"]] intValue];
66+
[Instabug setOverAirVersion:overAirVersion[@"version"] withType:service];
67+
}
68+
69+
6470
// Note: This function is used to bridge IBGNSLog with RCTLogFunction.
6571
// This log function should not be used externally and is only an implementation detail.
6672
void RNIBGLog(IBGLogLevel logLevel, NSString *format, ...) {

0 commit comments

Comments
 (0)