Skip to content

Commit

Permalink
merge with MEG feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Parvesh Chauhan committed May 26, 2023
2 parents b875350 + 2b04d27 commit e603f92
Show file tree
Hide file tree
Showing 36 changed files with 1,363 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Demo/VWO Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// setCurrentViewController(vc: houseNav)
setCurrentViewController(vc: phoneNav)
// VWOManager.launch("033cf474a02bb4aafea16dc0685c896a-11000006")
VWOManager.launch("1e3e3391505171af754858fc088f50ce-5021085")

return true
}
Expand Down
7 changes: 7 additions & 0 deletions Demo/VWO Demo/Sorting campaign/PhoneListVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ class PhoneListVC: UIViewController {
break
}
tableView.reloadData()

let TestKey = VWO.getCampaign("e57e8bd1-fb5f-478d-80d2-5127eb5d79f7", args: ["groupId":"36"])
// let TestKey = VWO.getCampaign("e57e8bd1-fb5f-478d-80d2-5127eb5d79f7", args: ["test_key":"camp5Harsh", "groupId":"36"])
// let TestKey = VWO.getCampaign("e57e8bd1-fb5f-478d-80d2-5127eb5d79f7", args: ["test_key":"camp5Harsh"])
print("Harsh TestKey @%",TestKey)
// let TestKey = VWO.getCampaign("e57e8bd1-fb5f-478d-80d2-5127eb5d79f7", args: ["test_key":"ME123"])
// VWO.getCampaign("HarshUserID", args: ["test_key":"ME123","groupId":"8"])
}
}

Expand Down
4 changes: 3 additions & 1 deletion Demo/VWO Demo/VWOManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class VWOManager {
// VWO.pushCustomDimension(customDimensionKey: "userId", customDimensionValue: "userName")
hud.hide(animated: false)
SCLAlertView().showSuccess("Success", subTitle: "VWO launched successfully \(apiKey)")

var str: String? = nil;
VWO.variationNameFor(testKey: str ?? "")
VWO.trackConversion("", value: 10.0)

}
}, failure: { (errorString) in
Expand Down
4 changes: 2 additions & 2 deletions 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.13.0"
s.version = "2.14.0"
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 All @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.author = { 'VWO' => 'info@wingify.com' }
s.source = { :git => "https://github.com/wingify/vwo-ios-sdk.git",
:tag => s.version.to_s }
s.platform = :ios, '9.0'
s.platform = :ios, '11.0'
s.swift_version = '5.0'
s.default_subspec = 'All'

Expand Down
68 changes: 66 additions & 2 deletions VWO.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@
7B165B1629383B1D0060EEE2 /* MurmurHash.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B165B1429383B1D0060EEE2 /* MurmurHash.m */; };
7B6B7E09294094AA00961493 /* VWOGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B6B7E07294094AA00961493 /* VWOGroup.h */; };
7B6B7E0A294094AA00961493 /* VWOGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B6B7E08294094AA00961493 /* VWOGroup.m */; };
BA6899102A1C9BFE0003E538 /* WinnerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BA6899042A1C9BFE0003E538 /* WinnerManager.h */; };
BA6899112A1C9BFE0003E538 /* Pair.m in Sources */ = {isa = PBXBuildFile; fileRef = BA6899052A1C9BFE0003E538 /* Pair.m */; };
BA6899122A1C9BFE0003E538 /* PriorityQualificationWinnerResult.h in Headers */ = {isa = PBXBuildFile; fileRef = BA6899062A1C9BFE0003E538 /* PriorityQualificationWinnerResult.h */; };
BA6899132A1C9BFE0003E538 /* PriorityQualificationWinnerResult.m in Sources */ = {isa = PBXBuildFile; fileRef = BA6899072A1C9BFE0003E538 /* PriorityQualificationWinnerResult.m */; };
BA6899142A1C9BFE0003E538 /* Winner.m in Sources */ = {isa = PBXBuildFile; fileRef = BA6899082A1C9BFE0003E538 /* Winner.m */; };
BA6899152A1C9BFE0003E538 /* Winner.h in Headers */ = {isa = PBXBuildFile; fileRef = BA6899092A1C9BFE0003E538 /* Winner.h */; };
BA6899162A1C9BFE0003E538 /* WinnerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BA68990A2A1C9BFE0003E538 /* WinnerManager.m */; };
BA6899172A1C9BFE0003E538 /* Response.h in Headers */ = {isa = PBXBuildFile; fileRef = BA68990B2A1C9BFE0003E538 /* Response.h */; };
BA6899182A1C9BFE0003E538 /* Pair.h in Headers */ = {isa = PBXBuildFile; fileRef = BA68990C2A1C9BFE0003E538 /* Pair.h */; };
BA6899192A1C9BFE0003E538 /* Weight.h in Headers */ = {isa = PBXBuildFile; fileRef = BA68990D2A1C9BFE0003E538 /* Weight.h */; };
BA68991A2A1C9BFE0003E538 /* Weight.m in Sources */ = {isa = PBXBuildFile; fileRef = BA68990E2A1C9BFE0003E538 /* Weight.m */; };
BA68991B2A1C9BFE0003E538 /* Response.m in Sources */ = {isa = PBXBuildFile; fileRef = BA68990F2A1C9BFE0003E538 /* Response.m */; };
BAA32AC02A20C82900737458 /* Mapping.h in Headers */ = {isa = PBXBuildFile; fileRef = BAA32ABC2A20C82900737458 /* Mapping.h */; };
BAA32AC12A20C82900737458 /* Mapping.m in Sources */ = {isa = PBXBuildFile; fileRef = BAA32ABD2A20C82900737458 /* Mapping.m */; };
BAA32AC22A20C82900737458 /* MEGManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BAA32ABE2A20C82900737458 /* MEGManager.h */; };
BAA32AC32A20C82900737458 /* MEGManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BAA32ABF2A20C82900737458 /* MEGManager.m */; };
E31714C71F838C2F0036CF07 /* VWOTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E31714C61F838C2F0036CF07 /* VWOTests.swift */; };
E32079C120075516005CB5CD /* CampaignIDMissing.json in Resources */ = {isa = PBXBuildFile; fileRef = E32079C020075516005CB5CD /* CampaignIDMissing.json */; };
E32079C320075541005CB5CD /* CampaignStatusMissing.json in Resources */ = {isa = PBXBuildFile; fileRef = E32079C220075541005CB5CD /* CampaignStatusMissing.json */; };
Expand Down Expand Up @@ -160,6 +176,22 @@
7B165B1429383B1D0060EEE2 /* MurmurHash.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MurmurHash.m; sourceTree = "<group>"; };
7B6B7E07294094AA00961493 /* VWOGroup.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VWOGroup.h; sourceTree = "<group>"; };
7B6B7E08294094AA00961493 /* VWOGroup.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VWOGroup.m; sourceTree = "<group>"; };
BA6899042A1C9BFE0003E538 /* WinnerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WinnerManager.h; sourceTree = "<group>"; };
BA6899052A1C9BFE0003E538 /* Pair.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Pair.m; sourceTree = "<group>"; };
BA6899062A1C9BFE0003E538 /* PriorityQualificationWinnerResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PriorityQualificationWinnerResult.h; sourceTree = "<group>"; };
BA6899072A1C9BFE0003E538 /* PriorityQualificationWinnerResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PriorityQualificationWinnerResult.m; sourceTree = "<group>"; };
BA6899082A1C9BFE0003E538 /* Winner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Winner.m; sourceTree = "<group>"; };
BA6899092A1C9BFE0003E538 /* Winner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Winner.h; sourceTree = "<group>"; };
BA68990A2A1C9BFE0003E538 /* WinnerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WinnerManager.m; sourceTree = "<group>"; };
BA68990B2A1C9BFE0003E538 /* Response.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Response.h; sourceTree = "<group>"; };
BA68990C2A1C9BFE0003E538 /* Pair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pair.h; sourceTree = "<group>"; };
BA68990D2A1C9BFE0003E538 /* Weight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Weight.h; sourceTree = "<group>"; };
BA68990E2A1C9BFE0003E538 /* Weight.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Weight.m; sourceTree = "<group>"; };
BA68990F2A1C9BFE0003E538 /* Response.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Response.m; sourceTree = "<group>"; };
BAA32ABC2A20C82900737458 /* Mapping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mapping.h; sourceTree = "<group>"; };
BAA32ABD2A20C82900737458 /* Mapping.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Mapping.m; sourceTree = "<group>"; };
BAA32ABE2A20C82900737458 /* MEGManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MEGManager.h; sourceTree = "<group>"; };
BAA32ABF2A20C82900737458 /* MEGManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MEGManager.m; sourceTree = "<group>"; };
E31714C51F838C2F0036CF07 /* VWOTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "VWOTests-Bridging-Header.h"; sourceTree = "<group>"; };
E31714C61F838C2F0036CF07 /* VWOTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VWOTests.swift; sourceTree = "<group>"; };
E319151E1F67F1B900FC1695 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -294,6 +326,22 @@
7B165AF82936AEA70060EEE2 /* MEG */ = {
isa = PBXGroup;
children = (
BAA32ABC2A20C82900737458 /* Mapping.h */,
BAA32ABD2A20C82900737458 /* Mapping.m */,
BAA32ABE2A20C82900737458 /* MEGManager.h */,
BAA32ABF2A20C82900737458 /* MEGManager.m */,
BA68990C2A1C9BFE0003E538 /* Pair.h */,
BA6899052A1C9BFE0003E538 /* Pair.m */,
BA6899062A1C9BFE0003E538 /* PriorityQualificationWinnerResult.h */,
BA6899072A1C9BFE0003E538 /* PriorityQualificationWinnerResult.m */,
BA68990B2A1C9BFE0003E538 /* Response.h */,
BA68990F2A1C9BFE0003E538 /* Response.m */,
BA68990D2A1C9BFE0003E538 /* Weight.h */,
BA68990E2A1C9BFE0003E538 /* Weight.m */,
BA6899092A1C9BFE0003E538 /* Winner.h */,
BA6899082A1C9BFE0003E538 /* Winner.m */,
BA6899042A1C9BFE0003E538 /* WinnerManager.h */,
BA68990A2A1C9BFE0003E538 /* WinnerManager.m */,
7B165B03293756EE0060EEE2 /* MutuallyExclusiveGroups.h */,
7B165B04293756EE0060EEE2 /* MutuallyExclusiveGroups.m */,
7B165B0729376B6E0060EEE2 /* Group.h */,
Expand Down Expand Up @@ -537,29 +585,37 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
BA6899192A1C9BFE0003E538 /* Weight.h in Headers */,
BA6899182A1C9BFE0003E538 /* Pair.h in Headers */,
7B6B7E09294094AA00961493 /* VWOGroup.h in Headers */,
E39815851F6291970035D519 /* VWOLogger.h in Headers */,
E39815591F6291680035D519 /* VWOGoal.h in Headers */,
E3871A1D212FE27C0033D86B /* NSString+MD5.h in Headers */,
E3D29FCA1FBEDE2A00A11C61 /* NSString+VWO.h in Headers */,
E3D29FC61FBEDAB300A11C61 /* NSDate+VWO.h in Headers */,
E39815811F6291970035D519 /* VWODevice.h in Headers */,
BAA32AC02A20C82900737458 /* Mapping.h in Headers */,
7B165B1529383B1D0060EEE2 /* MurmurHash.h in Headers */,
E398155B1F6291680035D519 /* VWOQueue.h in Headers */,
E3F7CBAC2004A9B100CC8C03 /* VWOStack.h in Headers */,
E388B6CE1F8F7D350023E11E /* VWOURLQueue.h in Headers */,
E344B2F01F87906900A4EEE6 /* VWOUserDefaults.h in Headers */,
E39815571F6291680035D519 /* VWOCampaign.h in Headers */,
BAA32AC22A20C82900737458 /* MEGManager.h in Headers */,
E39815831F6291970035D519 /* VWOFile.h in Headers */,
7B165B0929376B6E0060EEE2 /* Group.h in Headers */,
7B165B05293756EE0060EEE2 /* MutuallyExclusiveGroups.h in Headers */,
E35484F51F713C2E00E14D2E /* NSURLSession+Synchronous.h in Headers */,
E3529574206B720A00C90716 /* VWOSocketConnector.h in Headers */,
E3E95E8D206D0B13006DCE6C /* VWOConfig.h in Headers */,
BA6899102A1C9BFE0003E538 /* WinnerManager.h in Headers */,
7B165B1129376BA30060EEE2 /* CampaignGroupMapper.h in Headers */,
BA6899152A1C9BFE0003E538 /* Winner.h in Headers */,
BA6899172A1C9BFE0003E538 /* Response.h in Headers */,
E398155F1F6291680035D519 /* VWOVariation.h in Headers */,
E39567A3206E5DA80030B30B /* VWOCampaignFetcher.h in Headers */,
E3BBA3602068FA630046B2F2 /* VWOSocket.h in Headers */,
BA6899122A1C9BFE0003E538 /* PriorityQualificationWinnerResult.h in Headers */,
E398157F1F6291970035D519 /* VWOController.h in Headers */,
E39815931F6291C10035D519 /* VWOSegmentEvaluator.h in Headers */,
E3D5F7FD1F6BD86C0011C43C /* VWOURL.h in Headers */,
Expand Down Expand Up @@ -708,9 +764,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BA68991B2A1C9BFE0003E538 /* Response.m in Sources */,
E344B2F11F87906900A4EEE6 /* VWOUserDefaults.m in Sources */,
7B165B1629383B1D0060EEE2 /* MurmurHash.m in Sources */,
7B165B06293756EE0060EEE2 /* MutuallyExclusiveGroups.m in Sources */,
BA6899132A1C9BFE0003E538 /* PriorityQualificationWinnerResult.m in Sources */,
E3D29FC71FBEDAB300A11C61 /* NSDate+VWO.m in Sources */,
E3871A1E212FE27C0033D86B /* NSString+MD5.m in Sources */,
E36AC7191F75614E0041ACDF /* VWO.m in Sources */,
Expand All @@ -721,6 +779,8 @@
7B6B7E0A294094AA00961493 /* VWOGroup.m in Sources */,
7B165B0A29376B6E0060EEE2 /* Group.m in Sources */,
E3E95E8E206D0B13006DCE6C /* VWOConfig.m in Sources */,
BA6899142A1C9BFE0003E538 /* Winner.m in Sources */,
BA6899112A1C9BFE0003E538 /* Pair.m in Sources */,
E35484F61F713C2E00E14D2E /* NSURLSession+Synchronous.m in Sources */,
E398159D1F6293BC0035D519 /* NSDictionary+VWO.m in Sources */,
E39815861F6291970035D519 /* VWOLogger.m in Sources */,
Expand All @@ -730,7 +790,10 @@
E3529575206B720A00C90716 /* VWOSocketConnector.m in Sources */,
E3D5F7FE1F6BD86C0011C43C /* VWOURL.m in Sources */,
E39815801F6291970035D519 /* VWOController.m in Sources */,
BAA32AC32A20C82900737458 /* MEGManager.m in Sources */,
BA6899162A1C9BFE0003E538 /* WinnerManager.m in Sources */,
7B165B1229376BA30060EEE2 /* CampaignGroupMapper.m in Sources */,
BAA32AC12A20C82900737458 /* Mapping.m in Sources */,
E398155C1F6291680035D519 /* VWOQueue.m in Sources */,
E3F7CBA92004A07800CC8C03 /* VWOInfixEvaluator.m in Sources */,
E39815601F6291680035D519 /* VWOVariation.m in Sources */,
Expand All @@ -739,6 +802,7 @@
E39815581F6291680035D519 /* VWOCampaign.m in Sources */,
E3F7CBB52004C91400CC8C03 /* VWOSegment.m in Sources */,
E39815841F6291970035D519 /* VWOFile.m in Sources */,
BA68991A2A1C9BFE0003E538 /* Weight.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -927,7 +991,7 @@
);
INFOPLIST_FILE = VWO/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -959,7 +1023,7 @@
);
INFOPLIST_FILE = VWO/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
7 changes: 7 additions & 0 deletions VWO/MEG/CampaignGroupMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@
//

#import <Foundation/Foundation.h>
#import "Group.h"

NS_ASSUME_NONNULL_BEGIN

@interface CampaignGroupMapper : NSObject

+ (NSDictionary *)getCampaignGroups: (NSDictionary *)jsonObject;
+ (NSDictionary *)createAndGetGroups: (NSDictionary *)jsonObject;
+ (void)preparePriority: (NSDictionary *)source destination:(Group *)destination;
+ (void)prepareEt:(NSDictionary *)source destination:(Group *)destination;
+ (void)prepareCampaigns:(NSDictionary *)source destination:(Group *)destination;
+ (void)prepareWeight:(NSDictionary *)source destination:(Group *)destination;
+ (NSDictionary *)getGroups: (NSDictionary *)jsonObject;

@end

NS_ASSUME_NONNULL_END
58 changes: 54 additions & 4 deletions VWO/MEG/CampaignGroupMapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ @implementation CampaignGroupMapper
static NSString * const KEY_GROUPS = @"groups";
static NSString * const KEY_NAME = @"name";
static NSString * const KEY_CAMPAIGNS = @"campaigns";
static NSString * const KEY_PRIORITY = @"p";
static NSString * const KEY_ET = @"et";
static NSString * const KEY_WEIGHT = @"wt";

float m = 1.0;

Expand Down Expand Up @@ -49,17 +52,18 @@ + (NSDictionary *)createAndGetGroups: (NSDictionary *)jsonObject{
NSString *key = itrJsonGroups[index];

NSDictionary *objGroup = jsonGroups[key];
NSArray *arrCampaigns = objGroup[KEY_CAMPAIGNS];

NSString *groupName = objGroup[KEY_NAME];

Group *group = [[Group alloc]init];
group.name = groupName;
group.Id = key.intValue;

for (int i = 0; i < arrCampaigns.count; i++) {
[group addCampaign:arrCampaigns[i]];
}
[self prepareWeight:objGroup destination:group];
[self prepareCampaigns:objGroup destination:group];
[self prepareEt:objGroup destination:group];
[self preparePriority:objGroup destination:group];

VWOLogDebug(@"MutuallyExclusive Added Group Id %d", group.Id);
VWOLogDebug(@"MutuallyExclusive Added Group Campaign %@", group.getCampaigns);

Expand All @@ -74,6 +78,52 @@ + (NSDictionary *)createAndGetGroups: (NSDictionary *)jsonObject{
return groups;
}

+ (void)preparePriority: (NSDictionary *)source destination:(Group *)destination {
if (![source objectForKey:KEY_PRIORITY]) return;

NSArray *priority = [source objectForKey:KEY_PRIORITY];
NSLog(@"priority should be given to these campaigns -> %@", priority);
for (int pIndex = 0; pIndex < priority.count; ++pIndex) {
[destination addPriority:[priority objectAtIndex:pIndex]];
}
}

+ (void)prepareEt:(NSDictionary *)source destination:(Group *)destination {
if (![source objectForKey:KEY_ET]) return;

int et = [[source objectForKey:KEY_ET] intValue];
[destination addEt:et];
}

+ (void)prepareCampaigns:(NSDictionary *)source destination:(Group *)destination {
if (![source objectForKey:KEY_CAMPAIGNS]) return;

NSArray *arrCampaigns = [source objectForKey:KEY_CAMPAIGNS];
for (int index = 0; index < arrCampaigns.count; index++) {
[destination addCampaign:[arrCampaigns objectAtIndex:index]];
}
}

+ (void)prepareWeight:(NSDictionary *)source destination:(Group *)destination {
if (![source objectForKey:KEY_WEIGHT]) return;

NSLog(@"------------------------------------------------------------");
NSLog(@"preparing for -> %@", destination.name);
NSLog(@"found weight sent from server, preparing the weight value for later usage.");
NSLog(@"NOTE: these weight will only be applied if no priority campaign exist.");

NSDictionary *weights = [source objectForKey:KEY_WEIGHT];
NSEnumerator *enumerator = [weights keyEnumerator];
NSString *campaign;
while ((campaign = [enumerator nextObject])) {
NSNumber *weightNumber = [weights objectForKey:campaign];
int weight = [weightNumber intValue];
[destination addWeight:campaign weight:weight];
}

NSLog(@"------------------------------------------------------------");
}

+ (NSDictionary *)getGroups: (NSDictionary *)jsonObject{
NSDictionary *jsonGroups = nil;

Expand Down
Loading

0 comments on commit e603f92

Please sign in to comment.