Skip to content

Commit

Permalink
fix(API): variationNameForTestKey API changes for segmentation relate…
Browse files Browse the repository at this point in the history
…d bug
  • Loading branch information
Varun Malhotra committed Jul 13, 2021
1 parent 885a5d6 commit 4f03719
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Demo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ platform :ios, '9.0'

target 'VWO Demo' do
use_frameworks!
#pod 'VWO', '~> 2.7'
pod 'VWO', :path => '../'
#pod 'VWO', '~> 2.7.1'
pod 'VWO', :path => '../'
# pod 'FLEX', '~> 2.0', :configurations => ['Debug']
pod 'SCLAlertView'
pod 'MBProgressHUD', '~> 1.1.0'
Expand Down
12 changes: 6 additions & 6 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 (13.4.0):
- Starscream (~> 3.0.2)
- Starscream (3.0.6)
- VWO (2.6.0):
- VWO/All (= 2.6.0)
- VWO/All (2.6.0):
- VWO (2.7.0):
- VWO/All (= 2.7.0)
- VWO/All (2.7.0):
- Socket.IO-Client-Swift (~> 13.1)

DEPENDENCIES:
Expand All @@ -30,8 +30,8 @@ SPEC CHECKSUMS:
SCLAlertView: 6a77bb2edfc65e04dbe57725546cb4107a506b85
Socket.IO-Client-Swift: 2b2720f14c92ff1237ced09bc2f2da2022624fee
Starscream: ef3ece99d765eeccb67de105bfa143f929026cf5
VWO: 67b825b53b72ede9fe11796a2e137c7e893c36b6
VWO: f86cb4e2df45c2c04188800ebcede0da0ae10e4c

PODFILE CHECKSUM: d4c98c91472994b426b3f22ad61ac4197ae00a0c
PODFILE CHECKSUM: d09e5733ca3cd69659f82c8ebab0ed0ff0b9e3a7

COCOAPODS: 1.8.4
COCOAPODS: 1.10.1
2 changes: 2 additions & 0 deletions Demo/VWO Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
880EA21C25AC2FAB00A129D3 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
880EA21F25AC2FB000A129D3 /* Starscream.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Starscream.framework; sourceTree = BUILT_PRODUCTS_DIR; };
880EA22225AC2FB400A129D3 /* VWO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = VWO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
88A772532678BEF400DAC487 /* UserExperiorSDK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = UserExperiorSDK.xcframework; path = Pods/UserExperior/UserExperiorSDK.xcframework; sourceTree = "<group>"; };
8FAF68EB5053737B941C0877 /* Pods_VWO_Demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_VWO_Demo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BB5B8FB3D715DA6E51505A25 /* Pods-VWO Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VWO Demo.release.xcconfig"; path = "Pods/Target Support Files/Pods-VWO Demo/Pods-VWO Demo.release.xcconfig"; sourceTree = "<group>"; };
E29775C6CEE32F6DD028E06B /* Pods-VWO Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VWO Demo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-VWO Demo/Pods-VWO Demo.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -154,6 +155,7 @@
E34D6BE11F7E512F0094A905 /* Frameworks */ = {
isa = PBXGroup;
children = (
88A772532678BEF400DAC487 /* UserExperiorSDK.xcframework */,
880EA22225AC2FB400A129D3 /* VWO.framework */,
880EA21F25AC2FB000A129D3 /* Starscream.framework */,
880EA21C25AC2FAB00A129D3 /* SocketIO.framework */,
Expand Down
2 changes: 1 addition & 1 deletion VWO.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "VWO"
s.version = "2.7.0"
s.version = "2.7.1"
s.summary = "VWO SDK for A/B Testing iOS apps."
s.description = "VWO iOS SDK enables you to A/B test mobile apps."
s.documentation_url = "http://developers.vwo.com/reference#ios-sdk-reference"
Expand Down
2 changes: 1 addition & 1 deletion VWO/VWOController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

NS_ASSUME_NONNULL_BEGIN

static NSString *kVWOSDKversion = @"2.7.0";
static NSString *kVWOSDKversion = @"2.7.1";

@class VWOConfig;

Expand Down
31 changes: 28 additions & 3 deletions VWO/VWOController.m
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,38 @@ - (id)variationForKey:(NSString *)key {
}

- (nullable NSString *)variationNameForCampaignTestKey:(NSString *)campaignTestKey {
if (!_initialised) {
VWOLogWarning(@"variationNameForCampaignTestKey(%@) called before launching VWO", campaignTestKey);
return nil;
}

id finalVariation = nil;
for (VWOCampaign *campaign in _campaignList) {
if ([campaign.testKey isEqualToString:campaignTestKey]) {
[self trackUserForCampaign:campaign];
return campaign.variation.name;
id variation = campaign.variation.name;
BOOL isCampaignTracked = [VWOUserDefaults isTrackingUserForCampaign:campaign];

//If variation Key is present in Campaign
if (isCampaignTracked) {
finalVariation = variation;
} else {
VWOSegmentEvaluator *evaluator = [VWOSegmentEvaluator makeEvaluator:_customVariables];
BOOL canBePart = [evaluator canUserBePartOfCampaignForSegment:campaign.segmentObject];
if (canBePart) {
finalVariation = variation;
[self trackUserForCampaign:campaign];
}
}
}
}
return nil;

if (finalVariation == [NSNull null]) {
// finalVariation can be NSNull if Control is assigned to campaign
return nil;
}

VWOLogDebug(@"Got variation %@ for campaign %@", finalVariation, campaignTestKey);
return finalVariation;
}

- (void)sendNotificationUserStartedTracking:(VWOCampaign *)campaign {
Expand Down
2 changes: 1 addition & 1 deletion VWO/VWOURL.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ + (instancetype)vwoComponentForPath:(NSString *)path {
}
@end

static NSString *kSDKversionNumber = @"16";
static NSString *kSDKversionNumber = @"17";

@interface VWOURL()

Expand Down

0 comments on commit 4f03719

Please sign in to comment.