Commit 7ddd1b3a authored by Bosko Petreski's avatar Bosko Petreski Committed by Bosko Petreski

improvements

parent 5d6dba0b
......@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
PrimedIO: 20cbb8b9513ab943bf0124192a0d4264c8a6a6db
PrimedIO: 53fdb4d19fe9e54ad8ac30a25675a0520005c541
PODFILE CHECKSUM: 61ac899fd2665b85a9b286f6c81a4069548c57b1
......
......@@ -9,14 +9,14 @@
"file": "LICENSE"
},
"authors": {
"PrimedIO": "info@gmail.com"
"PrimedIO": "info@primed.io"
},
"source": {
"git": "https://gitlab.com/primedio/delivery-primedios.git",
"tag": "0.0.1"
},
"platforms": {
"ios": "8.0"
"ios": "10.0"
},
"source_files": "PrimedIO/Classes/**/*"
}
......@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
PrimedIO: 20cbb8b9513ab943bf0124192a0d4264c8a6a6db
PrimedIO: 53fdb4d19fe9e54ad8ac30a25675a0520005c541
PODFILE CHECKSUM: 61ac899fd2665b85a9b286f6c81a4069548c57b1
......
This diff is collapsed.
......@@ -12,6 +12,26 @@
#import "PrimedIO.h"
#import "PrimedTracker.h"
#import "DefaultSocketLogger.h"
#import "JFRSecurity.h"
#import "JFRWebSocket.h"
#import "NSString+VPSocketIO.h"
#import "VPSocketAck.h"
#import "VPSocketAckEmitter.h"
#import "VPSocketAckManager.h"
#import "VPSocketAnyEvent.h"
#import "VPSocketEngine+EnginePollable.h"
#import "VPSocketEngine+EngineWebsocket.h"
#import "VPSocketEngine+Private.h"
#import "VPSocketEngine.h"
#import "VPSocketEngineProtocol.h"
#import "VPSocketIO.h"
#import "VPSocketIOClient.h"
#import "VPSocketIOClientProtocol.h"
#import "VPSocketLogger.h"
#import "VPSocketOnAckCallback.h"
#import "VPSocketPacket.h"
#import "VPStringReader.h"
FOUNDATION_EXPORT double PrimedIOVersionNumber;
FOUNDATION_EXPORT const unsigned char PrimedIOVersionString[];
......
......@@ -440,7 +440,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
......@@ -473,7 +473,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
......@@ -488,6 +488,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PrimedIO/PrimedIO-Prefix.pch";
INFOPLIST_FILE = "PrimedIO/PrimedIO-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
......@@ -503,6 +504,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PrimedIO/PrimedIO-Prefix.pch";
INFOPLIST_FILE = "PrimedIO/PrimedIO-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
......
......@@ -49,11 +49,11 @@
[super viewDidLoad];
// Create PrimedIO instance
[PrimedIO.sharedInstance initWithPublicKey:@"mypubkey" secretKey:@"mysecretkey" connectionString:@"https://gw.staging.primed.io:443"];
PrimedIO.sharedInstance.debug = YES;
// [PrimedIO.sharedInstance initWithPublicKey:@"mypubkey" secretKey:@"mysecretkey" connectionString:@"https://gw.staging.primed.io:443"];
// PrimedIO.sharedInstance.debug = YES;
// Create PrimedTracker instance
[PrimedTracker.sharedInstance initWithPublicKey:@"mypubkey" secretKey:@"mysecretkey" connectionString:@"https://gw.staging.primed.io:443" trackingConnectionString:@"https://gw.staging.primed.io:553" heartbeatInterval:10 eventQueueRetryInterval:10];
[PrimedTracker.sharedInstance initWithPublicKey:@"mypubkey" secretKey:@"mysecretkey" connectionString:@"https://gw.staging.primed.io:443" trackingConnectionString:@"ws://18.191.69.104:5001/v1" heartbeatInterval:10 eventQueueRetryInterval:10];
}
-(void)didReceiveMemoryWarning{
[super didReceiveMemoryWarning];
......
......@@ -45,5 +45,20 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>18.191.69.104</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
</dict>
</plist>
......@@ -27,7 +27,7 @@ Here is longer description for PrimedIO TBA.
s.author = { 'PrimedIO' => 'info@primed.io' }
s.source = { :git => 'https://gitlab.com/primedio/delivery-primedios.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.ios.deployment_target = '10.0'
s.source_files = 'PrimedIO/Classes/**/*'
......
......@@ -8,12 +8,31 @@
#import <Foundation/Foundation.h>
#import "PrimedIO.h"
#import "VPSocketIO.h"
typedef NS_ENUM(NSUInteger, InteractionType) {
InteractionType_LEFT,
InteractionType_RIGHT,
InteractionType_MIDDLE,
InteractionType_OTHER,
InteractionType_LONGPRESS,
};
typedef NS_ENUM(NSUInteger, ScrollDirection) {
ScrollDirection_UP,
ScrollDirection_DOWN,
ScrollDirection_LEFT,
ScrollDirection_RIGHT
};
@interface PrimedTracker : PrimedIO {
NSInteger heartbeatIncrement;
}
@interface PrimedTracker : PrimedIO
@property (nonatomic,strong) NSString *trackingConnectionString;
@property (nonatomic,assign) NSInteger heartbeatInterval;
@property (nonatomic,assign) NSInteger eventQueueRetryInterval;
@property (nonatomic, strong) VPSocketIOClient *socket;
/**
* Create instance of PrimedTracker class
......
......@@ -9,8 +9,42 @@
#import "PrimedTracker.h"
#import "PrimedIO.h"
@interface ClientSocketLogger : VPSocketLogger
@end
@implementation ClientSocketLogger
-(void) log:(NSString*)message type:(NSString*)type{
NSLog(@"ClientSocket MESSAGE 1: %@", message);
}
-(void) error:(NSString*)message type:(NSString*)type{
NSLog(@"ClientSocket ERROR 1 %@", message);
}
-(void)dealloc {
}
@end
@implementation PrimedTracker
#pragma mark - CustomFunctions
-(NSDictionary *)basicEventProperties:(NSString *)type eventObject:(NSDictionary *)eventObject{
NSMutableDictionary *payload = [NSMutableDictionary dictionaryWithDictionary:@{@"apikey":@"mypubkey",
@"ts":@(NSDate.date.timeIntervalSince1970),
@"sid":@"ef46d562-c27f-412a-9e60-e1673e16fbdb",
@"did":@"7981117e-b881-4dbd-accf-4b49f4d648c9",
@"source":@"app",
@"sdkId":@(0),
@"sdkVersion":@"2.1.0-beta12",
@"type":type,
@"eventObject":eventObject
}];
return payload;
}
#pragma mark - Initialization
+(PrimedTracker *)sharedInstance{
static dispatch_once_t pred;
......@@ -48,16 +82,83 @@
self.heartbeatInterval = heartbeatInterval;
self.eventQueueRetryInterval = eventQueueRetryInterval;
self.trackingConnectionString = trackingConnectionString;
ClientSocketLogger *logger = [ClientSocketLogger new];
self.socket = [[VPSocketIOClient alloc] init:[NSURL URLWithString:self.trackingConnectionString]
withConfig:@{@"log": @YES,
//@"logger":logger
}];
heartbeatIncrement = 1;
[self.socket on:kSocketEventConnect callback:^(NSArray *array, VPSocketAckEmitter *emitter) {
[NSTimer scheduledTimerWithTimeInterval:self.heartbeatInterval repeats:YES block:^(NSTimer * _Nonnull timer) {
[self trackHeartbeat];
}];
}];
[self.socket connect];
// [self.socket removeAllHandlers];
// [self.socket disconnect];
// self.socket = nil;
}
#pragma mark - API Main Functions
-(void)trackClickX:(NSInteger)x y:(NSInteger)y interactionType:(InteractionType)interactionType{
NSDictionary *payload = [self basicEventProperties:@"click" eventObject:@{@"x":@(x),
@"y":@(y),
@"interactionType":@(interactionType)
}];
[self.socket emit:@"click" items:@[payload]];
}
-(void)trackView:(NSString *)url{
NSDictionary *payload = [self basicEventProperties:@"view" eventObject:@{@"uri":@"http://bosko.com",
@"customProperties":@{}
}];
[self.socket emit:@"view" items:@[payload]];
}
-(void)trackScroll:(ScrollDirection)scrollDirection{
NSDictionary *payload = [self basicEventProperties:@"distance" eventObject:@{@"direction":@(scrollDirection),
@"distance":@(0)
}];
[self.socket emit:@"distance" items:@[payload]];
}
-(void)trackEnterViewPort:(NSString *)campaign elements:(NSArray *)elements{
NSDictionary *payload = [self basicEventProperties:@"enterViewPort" eventObject:@{@"campaign":campaign,
@"elements":elements
}];
[self.socket emit:@"enterViewPort" items:@[payload]];
}
-(void)trackExitViewPort:(NSString *)campaign elements:(NSArray *)elements{
NSDictionary *payload = [self basicEventProperties:@"exitViewPort" eventObject:@{@"campaign":campaign,
@"elements":elements
}];
[self.socket emit:@"exitViewPort" items:@[payload]];
}
-(void)trackHeartbeat{
NSDictionary *payload = [self basicEventProperties:@"heartbeat" eventObject:@{@"i":@(heartbeatIncrement)}];
[self.socket emit:@"heartbeat" items:@[payload]];
heartbeatIncrement++;
}
-(void)trackStart:(NSString *)uri{
NSDictionary *payload = [self basicEventProperties:@"start" eventObject:@{@"ua":@"DEVICE_MODEL",
@"now":@(NSDate.date.timeIntervalSince1970),
@"uri":uri,
@"screenWidth":@(UIScreen.mainScreen.bounds.size.width),
@"screenHeight":@(UIScreen.mainScreen.bounds.size.height),
@"viewPortWidth":@(UIScreen.mainScreen.bounds.size.width),
@"viewPortHeight":@(UIScreen.mainScreen.bounds.size.height),
}];
[self.socket emit:@"start" items:@[payload]];
}
-(void)trackEnd{
}
-(void)trackPersonalise{
}
-(void)trackConvert{
}
-(void)trackCustomEvent:(NSDictionary *)data{
......
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