Skip to content

Commit

Permalink
Pull request #17: Dev
Browse files Browse the repository at this point in the history
Merge in SST/mobile-testing-ios-sdk from dev to master

* commit '4760159b0220c66c9cf97e6d5d70b2a3e82983a8': (3 commits)
  Upgraded send exception through API
  ...
  • Loading branch information
Parvesh Chauhan committed May 26, 2023
2 parents 9b8f600 + 4760159 commit b875350
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 29 deletions.
10 changes: 5 additions & 5 deletions Demo/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ PODS:
- Socket.IO-Client-Swift (15.2.0):
- Starscream (~> 3.1)
- Starscream (3.1.1)
- VWO (2.12.0):
- VWO/All (= 2.12.0)
- VWO/All (2.12.0):
- VWO (2.13.0):
- VWO/All (= 2.13.0)
- VWO/All (2.13.0):
- Socket.IO-Client-Swift (~> 15.2.0)

DEPENDENCIES:
Expand All @@ -30,8 +30,8 @@ SPEC CHECKSUMS:
SCLAlertView: 6a77bb2edfc65e04dbe57725546cb4107a506b85
Socket.IO-Client-Swift: 1e3e3a1f09f3312a167f0d781eb2f383d477357c
Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0
VWO: 1662974fcb0e06541218a16d807ebad78ae22cb3
VWO: 133e9f3eea4c39c85e4cf85d46dfcb7cb5428b25

PODFILE CHECKSUM: 71bfa555223ee2b1ddab35d14fef462b5e6267e6

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
4 changes: 2 additions & 2 deletions Demo/VWO Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
DEVELOPMENT_TEAM = DBN26NC8KE;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "VWO Demo/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.3.7;
PRODUCT_BUNDLE_IDENTIFIER = com.wingify.abtestapp;
Expand All @@ -533,7 +533,7 @@
DEVELOPMENT_TEAM = DBN26NC8KE;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "VWO Demo/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.3.7;
PRODUCT_BUNDLE_IDENTIFIER = com.wingify.abtestapp;
Expand Down
2 changes: 1 addition & 1 deletion Demo/VWO Demo/Sorting campaign/PhoneListVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PhoneListVC: UIViewController {

// let TestKey = VWO.getCampaign("e57e8bd1-fb5f-478d-80d2-5127eb5d79f7", args: ["groupId":"8"])
// let TestKey = VWO.getCampaign("e57e8bd1-fb5f-478d-80d2-5127eb5d79f7", args: ["test_key":"ME123"])
let TestKey = VWO.getCampaign("9c3832ad-15f9-420a-93cd-a7f2cde0f7bc", args: ["test_key":"ME123","groupId":"8"])
// let TestKey = VWO.getCampaign("9c3832ad-15f9-420a-93cd-a7f2cde0f7bc", args: ["test_key":"ME123","groupId":"8"])

destination.phone = phoneList[t]
}
Expand Down
59 changes: 38 additions & 21 deletions VWO/VWO.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ + (void)setOptOut:(BOOL)optOut {
+ (void)launchForAPIKey:(NSString *)apiKey {
NSParameterAssert(apiKey);
dispatch_barrier_async(VWOController.taskQueue, ^{
[VWOController.shared launchWithAPIKey:apiKey config:nil withTimeout:nil withCallback:nil failure:nil];
@try {
[VWOController.shared launchWithAPIKey:apiKey config:nil withTimeout:nil withCallback:nil failure:nil];
}@catch (NSException *exception) {
VWOLogException(@"Caught an exception in launchForAPIKey method: %@", exception);
}
});
}

Expand All @@ -61,17 +65,17 @@ + (void)launchForAPIKey:(NSString *)apiKey
}

+ (void)launchForAPIKey:(NSString *)apiKey
config:(VWOConfig *)config
config:(VWOConfig *)config
completion:(void(^)(void))completion
failure:(nullable void (^)(NSString *error))failureBlock {
NSParameterAssert(apiKey);
dispatch_barrier_async(VWOController.taskQueue, ^{
[VWOController.shared launchWithAPIKey:apiKey
config:config
config:config
withTimeout:nil
withCallback:completion
failure:failureBlock];

});
}

Expand All @@ -80,11 +84,11 @@ + (void)launchSynchronouslyForAPIKey:(NSString *)apiKey
NSParameterAssert(apiKey);
dispatch_barrier_sync(VWOController.taskQueue, ^{
[VWOController.shared launchWithAPIKey:apiKey
config:nil
config:nil
withTimeout:@(timeout)
withCallback:nil
failure:nil];

});
}

Expand All @@ -98,29 +102,33 @@ + (void)launchSynchronouslyForAPIKey:(NSString *)apiKey
withTimeout:@(timeout)
withCallback:nil
failure:nil];

});
}

+ (void)launchSynchronouslyForAPIKey:(NSString *)apiKey
timeout:(NSTimeInterval)timeout
config:(VWOConfig *)config {
config:(VWOConfig *)config {
NSParameterAssert(apiKey);
dispatch_barrier_sync(VWOController.taskQueue, ^{
[VWOController.shared launchWithAPIKey:apiKey
config:config
config:config
withTimeout:@(timeout)
withCallback:nil
failure:nil];

});
}

+ (id)objectForKey:(NSString *)key{
NSParameterAssert(key);
__block id object;
dispatch_barrier_sync(VWOController.taskQueue, ^{
object = [VWOController.shared variationForKey:key];
@try {
object = [VWOController.shared variationForKey:key];
}@catch (NSException *exception) {
VWOLogException(@"Caught an exception in objectForKey method: %@", exception);
}
});
return object;
}
Expand All @@ -129,7 +137,11 @@ + (id)objectForKey:(NSString *)key testKey:(NSString *)testKey{
NSParameterAssert(key);
__block id object;
dispatch_barrier_sync(VWOController.taskQueue, ^{
object = [VWOController.shared variationForKey:key testKey:testKey];
@try {
object = [VWOController.shared variationForKey:key testKey:testKey];
}@catch (NSException *exception) {
VWOLogException(@"Caught an exception in objectForKey testKey method: %@", exception);
}
});

return object;
Expand All @@ -145,7 +157,7 @@ + (id)objectForKey:(NSString *)key defaultValue:(nullable id)defaultValue testKe
}

+ (id)variationForKey:(NSString *)key defaultValue:(id)defaultValue {
// Deprecated
// Deprecated
return [self objectForKey:key defaultValue:defaultValue];
}

Expand Down Expand Up @@ -195,10 +207,15 @@ + (nullable NSString *)variationNameForTestKey:(NSString *)campaignTestKey {
NSParameterAssert(campaignTestKey);
__block NSString *variationName;
dispatch_barrier_sync(VWOController.taskQueue, ^{
variationName = [VWOController.shared variationNameForCampaignTestKey:campaignTestKey];
@try {
variationName = [VWOController.shared variationNameForCampaignTestKey:campaignTestKey];
}
@catch (NSException *exception) {
VWOLogException(@"Caught an exception in variationNameForTestKey method: %@", exception);
}
});
return variationName;

}

+ (NSString *)getCampaign:(NSString *)userId args:(NSDictionary *)args {
Expand All @@ -210,25 +227,25 @@ + (NSString *)getCampaign:(NSString *)userId args:(NSDictionary *)args {
VWOCampaignArray * campaignsData = [VWOController.shared getCampaignData];

NSMutableDictionary *megGroupsData = [[NSMutableDictionary alloc] init];

if (campaignsData != nil && campaignsData.count > 0) {
for (int i = 0; i < campaignsData.count; i++) {
@try {
VWOCampaign *groupDataItem = campaignsData[i];
if ([groupDataItem type] == CAMPAIGN_GROUPS) {
[megGroupsData setObject:groupDataItem forKey:@"groups"];
break;
break;
}
}
@catch (NSException *exception) {
VWOLogDebug(@"MutuallyExclusive %@", exception);

}
}
}

NSDictionary<NSString *, Group*> *mappedData = [CampaignGroupMapper createAndGetGroups: megGroupsData];

MutuallyExclusiveGroups *meg = [[MutuallyExclusiveGroups alloc] initMutuallyExclusiveGroups:userId];
[meg addGroups:mappedData];
return [meg getCampaign:args jsonData:campaignsData];
Expand Down Expand Up @@ -267,7 +284,7 @@ + (void)pushCustomDimension:(NSString *)customDimensionKey withCustomDimensionVa
dispatch_barrier_async(VWOController.taskQueue, ^{
[VWOController.shared pushCustomDimension:customDimensionKey withCustomDimensionValue:customDimensionValue];
});

}

+ (NSString *)version {
Expand Down

0 comments on commit b875350

Please sign in to comment.