Commit c07bdd46 authored by Matthijs van der Kroon's avatar Matthijs van der Kroon

Merge branch 'feature/oct12' into 'dev'

Feature/oct12

See merge request !11
parents 77fd0ac6 94e94112
......@@ -19,6 +19,7 @@
"ios": "10.0"
},
"source_files": "PrimedIO/Classes/**/*",
"swift_version": "4.0",
"dependencies": {
"Socket.IO-Client-Swift": [
"~> 13.3.0"
......
......@@ -779,7 +779,7 @@
};
name = Debug;
};
34A067DFDD7F982EEEC217CBB22CF2D5 /* Debug */ = {
1A4AF95FAE8B32FC2F49D1C2995F7066 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8C7A17849ADD01F30C6BE6CF1A65888B /* PrimedIO.xcconfig */;
buildSettings = {
......@@ -804,6 +804,7 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
......@@ -1136,7 +1137,7 @@
};
name = Debug;
};
F9A6810CDF7945005B8B9328E1C95CA6 /* Release */ = {
F54ACE5214CE4504AD573E3FFC897981 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8C7A17849ADD01F30C6BE6CF1A65888B /* PrimedIO.xcconfig */;
buildSettings = {
......@@ -1161,6 +1162,7 @@
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
......@@ -1241,8 +1243,8 @@
D588D9C726F433250C12FF07551CC556 /* Build configuration list for PBXNativeTarget "PrimedIO" */ = {
isa = XCConfigurationList;
buildConfigurations = (
34A067DFDD7F982EEEC217CBB22CF2D5 /* Debug */,
F9A6810CDF7945005B8B9328E1C95CA6 /* Release */,
1A4AF95FAE8B32FC2F49D1C2995F7066 /* Debug */,
F54ACE5214CE4504AD573E3FFC897981 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
......
......@@ -31,6 +31,16 @@
@"userid": @"someuserid"
};
// [Primed.sharedInstance personalise:@"frontpage.recommendations" limit:3 abvariantLabel:@"A" success:^(NSDictionary<NSString *,id> *response) {
// //Handle response
// NSLog(@"personalise: %@",response);
// txtConsole.text = [NSString stringWithFormat:@"personalise: %@",response];
// } failed:^(NSString *message) {
// //Handle message
// NSLog(@"personalise error: %@",message);
// txtConsole.text = [NSString stringWithFormat:@"personalise error: %@",message];
// }];
[Primed.sharedInstance personalise:@"frontpage.recommendations" signals:dictSignals limit:3 abvariantLabel:@"A" success:^(NSDictionary *response) {
//Handle response
NSLog(@"personalise: %@",response);
......
......@@ -36,11 +36,20 @@ typedef void(^APIFailed)(NSString *message);
*/
-(void)initWithPublicKey:(NSString *)publicKey secretKey:(NSString *)secretKey connectionString:(NSString *)connectionString;
/**
* Deal with the results as they are returned
* @param campaign Campaign to personalise
* @param limit Limit the response
* @param abvariantLabel Abvariant Label
*/
-(void)personalise:(NSString *)campaign limit:(NSUInteger)limit abvariantLabel:(NSString *)abvariantLabel success:(APISuccess)success failed:(APIFailed)failed;
/**
* Deal with the results as they are returned
* @param campaign Campaign to personalise
* @param signals Dictionary signals
* @param limit Limit the response
* @param abvariantLabel Abvariant Label
*/
-(void)personalise:(NSString *)campaign signals:(NSDictionary<NSString*,id> *)signals limit:(NSUInteger)limit abvariantLabel:(NSString *)abvariantLabel success:(APISuccess)success failed:(APIFailed)failed;
......
......@@ -150,10 +150,20 @@
}
#pragma mark - API Main Functions
-(void)personalise:(NSString *)campaign limit:(NSUInteger)limit abvariantLabel:(NSString *)abvariantLabel success:(APISuccess)success failed:(APIFailed)failed{
[self personalise:campaign signals:@{} limit:limit abvariantLabel:abvariantLabel success:success failed:failed];
}
-(void)personalise:(NSString *)campaign signals:(NSDictionary<NSString*,id> *)signals limit:(NSUInteger)limit abvariantLabel:(NSString *)abvariantLabel success:(APISuccess)success failed:(APIFailed)failed{
NSMutableDictionary *trackSignals = [NSMutableDictionary dictionaryWithDictionary:signals];
if(![trackSignals.allKeys containsObject:@"did"]){
if(Primed.sharedInstance.primedTrackerAvailable){
[trackSignals setObject:PrimedTracker.sharedInstance.getDID forKey:@"did"];
}
}
NSError *errorJSON;
NSData *signalsJSON = [NSJSONSerialization dataWithJSONObject:signals options:NSJSONWritingPrettyPrinted error:&errorJSON];
NSData *signalsJSON = [NSJSONSerialization dataWithJSONObject:trackSignals options:NSJSONWritingPrettyPrinted error:&errorJSON];
if(errorJSON){
failed(@"Signals not valid format");
return;
......@@ -170,7 +180,7 @@
[self get:generateURL success:^(NSDictionary *response) {
if(Primed.sharedInstance.primedTrackerAvailable){
[PrimedTracker.sharedInstance trackPersonalise:response];
[PrimedTracker.sharedInstance trackPersonalise:@{@"guuid":response[@"guuid"]}];
}
success(response);
......
......@@ -60,7 +60,7 @@
@"sid":sid,
@"did":did,
@"source":@"APP",
@"sdkId":@(1),
@"sdkId":@(2),
@"sdkVersion":@"2.1.0-beta12",
@"type":type.uppercaseString,
@"ipaddress":(externalIPAddress ?: @""),
......@@ -131,7 +131,8 @@
self.trackingConnectionString = trackingConnectionString;
NSURL *url = [NSURL URLWithString:self.trackingConnectionString];
self.manager = [[SocketManager alloc] initWithSocketURL:url config:@{@"log": @(PrimedTracker.sharedInstance.debug)}];
self.manager = [[SocketManager alloc] initWithSocketURL:url config:@{@"forceWebsockets":@YES,
@"log": @(PrimedTracker.sharedInstance.debug)}];
self.socket = [[SocketIOClient alloc] initWithManager:self.manager nsp:@"/v1"];
[self.manager setNsps:@{@"/v1":self.socket}];
......@@ -220,18 +221,8 @@
@"screenHeight":@(UIScreen.mainScreen.bounds.size.height),
@"viewPortWidth":@(UIScreen.mainScreen.bounds.size.width),
@"viewPortHeight":@(UIScreen.mainScreen.bounds.size.height),
@"location":NSNull.null,
@"customProperties":(customProperties ?: @{})
}];
if(currLocation){
NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:payload];
mutDict[@"location"] = @{@"latitude":@(currLocation.coordinate.latitude),
@"longitude":@(currLocation.coordinate.longitude),
@"accuracy":@(currLocation.horizontalAccuracy)
};
payload = mutDict;
}
[self emitPayload:payload];
}
-(void)trackStart:(NSString *)uri{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment