Commit ac6b4ecf authored by Bosko Petreski's avatar Bosko Petreski Committed by Bosko Petreski

improvements

parent 7ddd1b3a
...@@ -18,5 +18,10 @@ ...@@ -18,5 +18,10 @@
"platforms": { "platforms": {
"ios": "10.0" "ios": "10.0"
}, },
"source_files": "PrimedIO/Classes/**/*" "source_files": "PrimedIO/Classes/**/*",
"dependencies": {
"Socket.IO-Client-Swift": [
"~> 13.3.0"
]
}
} }
This diff is collapsed.
...@@ -144,9 +144,13 @@ strip_invalid_archs() { ...@@ -144,9 +144,13 @@ strip_invalid_archs() {
if [[ "$CONFIGURATION" == "Debug" ]]; then if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/PrimedIO/PrimedIO.framework" install_framework "${BUILT_PRODUCTS_DIR}/PrimedIO/PrimedIO.framework"
install_framework "${BUILT_PRODUCTS_DIR}/Socket.IO-Client-Swift/SocketIO.framework"
install_framework "${BUILT_PRODUCTS_DIR}/Starscream/Starscream.framework"
fi fi
if [[ "$CONFIGURATION" == "Release" ]]; then if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/PrimedIO/PrimedIO.framework" install_framework "${BUILT_PRODUCTS_DIR}/PrimedIO/PrimedIO.framework"
install_framework "${BUILT_PRODUCTS_DIR}/Socket.IO-Client-Swift/SocketIO.framework"
install_framework "${BUILT_PRODUCTS_DIR}/Starscream/Starscream.framework"
fi fi
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
wait wait
......
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO" EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO" "${PODS_CONFIGURATION_BUILD_DIR}/Socket.IO-Client-Swift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers" OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Socket.IO-Client-Swift/SocketIO.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Starscream/Starscream.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "PrimedIO" OTHER_LDFLAGS = $(inherited) -framework "PrimedIO" -framework "SocketIO" -framework "Starscream"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
......
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO" EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO" "${PODS_CONFIGURATION_BUILD_DIR}/Socket.IO-Client-Swift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers" OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Socket.IO-Client-Swift/SocketIO.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Starscream/Starscream.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "PrimedIO" OTHER_LDFLAGS = $(inherited) -framework "PrimedIO" -framework "SocketIO" -framework "Starscream"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
......
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO" FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO" "${PODS_CONFIGURATION_BUILD_DIR}/Socket.IO-Client-Swift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers" OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Socket.IO-Client-Swift/SocketIO.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Starscream/Starscream.framework/Headers"
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
......
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO" FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO" "${PODS_CONFIGURATION_BUILD_DIR}/Socket.IO-Client-Swift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers" OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Socket.IO-Client-Swift/SocketIO.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Starscream/Starscream.framework/Headers"
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/. PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
......
...@@ -12,26 +12,6 @@ ...@@ -12,26 +12,6 @@
#import "PrimedIO.h" #import "PrimedIO.h"
#import "PrimedTracker.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 double PrimedIOVersionNumber;
FOUNDATION_EXPORT const unsigned char PrimedIOVersionString[]; FOUNDATION_EXPORT const unsigned char PrimedIOVersionString[];
......
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Socket.IO-Client-Swift" "${PODS_CONFIGURATION_BUILD_DIR}/Starscream"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
PODS_BUILD_DIR = ${BUILD_DIR} PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
......
...@@ -302,10 +302,14 @@ ...@@ -302,10 +302,14 @@
inputPaths = ( inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-PrimedIO_Example/Pods-PrimedIO_Example-frameworks.sh", "${SRCROOT}/Pods/Target Support Files/Pods-PrimedIO_Example/Pods-PrimedIO_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/PrimedIO/PrimedIO.framework", "${BUILT_PRODUCTS_DIR}/PrimedIO/PrimedIO.framework",
"${BUILT_PRODUCTS_DIR}/Socket.IO-Client-Swift/SocketIO.framework",
"${BUILT_PRODUCTS_DIR}/Starscream/Starscream.framework",
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
outputPaths = ( outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PrimedIO.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PrimedIO.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketIO.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Starscream.framework",
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
// PrimedIO.sharedInstance.debug = YES; // PrimedIO.sharedInstance.debug = YES;
// Create PrimedTracker instance // Create PrimedTracker instance
[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]; [PrimedTracker.sharedInstance initWithPublicKey:@"mypubkey" secretKey:@"mysecretkey" connectionString:@"https://gw.staging.primed.io:443" trackingConnectionString:@"http://18.191.69.104:5001/v1" heartbeatInterval:10 eventQueueRetryInterval:10];
} }
-(void)didReceiveMemoryWarning{ -(void)didReceiveMemoryWarning{
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
......
...@@ -7,35 +7,19 @@ ...@@ -7,35 +7,19 @@
# #
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'PrimedIO' s.name = 'PrimedIO'
s.version = '0.0.1' s.version = '0.0.1'
s.summary = 'Here is short description for PrimedIO' s.summary = 'Here is short description for PrimedIO'
s.description = <<-DESC
# This description is used to generate tags and improve search results. Here is longer description for PrimedIO TBA.
# * Think: What does it do? Why did you write it? What is the focus? DESC
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below. s.homepage = 'https://gitlab.com/primedio/delivery-primedios'
# * Finally, don't worry about the indent, CocoaPods strips it! s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'PrimedIO' => 'info@primed.io' }
s.description = <<-DESC s.source = { :git => 'https://gitlab.com/primedio/delivery-primedios.git', :tag => s.version.to_s }
Here is longer description for PrimedIO TBA. s.ios.deployment_target = '10.0'
DESC s.source_files = 'PrimedIO/Classes/**/*'
s.homepage = 'https://gitlab.com/primedio/delivery-primedios' s.dependency "Socket.IO-Client-Swift", "~> 13.3.0"
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
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 = '10.0'
s.source_files = 'PrimedIO/Classes/**/*'
# s.resource_bundles = {
# 'PrimedIO' => ['PrimedIO/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end end
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "PrimedIO.h" #import "PrimedIO.h"
#import "VPSocketIO.h"
@import SocketIO;
typedef NS_ENUM(NSUInteger, InteractionType) { typedef NS_ENUM(NSUInteger, InteractionType) {
InteractionType_LEFT, InteractionType_LEFT,
...@@ -32,8 +33,8 @@ typedef NS_ENUM(NSUInteger, ScrollDirection) { ...@@ -32,8 +33,8 @@ typedef NS_ENUM(NSUInteger, ScrollDirection) {
@property (nonatomic,strong) NSString *trackingConnectionString; @property (nonatomic,strong) NSString *trackingConnectionString;
@property (nonatomic,assign) NSInteger heartbeatInterval; @property (nonatomic,assign) NSInteger heartbeatInterval;
@property (nonatomic,assign) NSInteger eventQueueRetryInterval; @property (nonatomic,assign) NSInteger eventQueueRetryInterval;
@property (nonatomic, strong) VPSocketIOClient *socket; @property (nonatomic,strong) SocketIOClient *socket;
@property (nonatomic,strong) SocketManager *manager;
/** /**
* Create instance of PrimedTracker class * Create instance of PrimedTracker class
* @return PrimedTracker shared instance * @return PrimedTracker shared instance
......
...@@ -9,24 +9,6 @@ ...@@ -9,24 +9,6 @@
#import "PrimedTracker.h" #import "PrimedTracker.h"
#import "PrimedIO.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 @implementation PrimedTracker
#pragma mark - CustomFunctions #pragma mark - CustomFunctions
...@@ -36,7 +18,7 @@ ...@@ -36,7 +18,7 @@
@"sid":@"ef46d562-c27f-412a-9e60-e1673e16fbdb", @"sid":@"ef46d562-c27f-412a-9e60-e1673e16fbdb",
@"did":@"7981117e-b881-4dbd-accf-4b49f4d648c9", @"did":@"7981117e-b881-4dbd-accf-4b49f4d648c9",
@"source":@"app", @"source":@"app",
@"sdkId":@(0), @"sdkId":@(1),
@"sdkVersion":@"2.1.0-beta12", @"sdkVersion":@"2.1.0-beta12",
@"type":type, @"type":type,
@"eventObject":eventObject @"eventObject":eventObject
...@@ -84,24 +66,26 @@ ...@@ -84,24 +66,26 @@
self.eventQueueRetryInterval = eventQueueRetryInterval; self.eventQueueRetryInterval = eventQueueRetryInterval;
self.trackingConnectionString = trackingConnectionString; self.trackingConnectionString = trackingConnectionString;
ClientSocketLogger *logger = [ClientSocketLogger new]; NSURL *url = [NSURL URLWithString:self.trackingConnectionString];
self.socket = [[VPSocketIOClient alloc] init:[NSURL URLWithString:self.trackingConnectionString] self.manager = [[SocketManager alloc] initWithSocketURL:url config:@{@"log": @(self.debug)}];
withConfig:@{@"log": @YES, // [self.manager setForceNew:YES];
//@"logger":logger // [self.manager setReconnects:YES];
}]; self.socket = [[SocketIOClient alloc] initWithManager:self.manager nsp:@"/v1"];
[self.manager setNsps:@{@"/v1":self.socket}];
heartbeatIncrement = 1; [self.socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
[self.socket on:kSocketEventConnect callback:^(NSArray *array, VPSocketAckEmitter *emitter) { NSLog(@"socket connected");
self->heartbeatIncrement = 1;
[NSTimer scheduledTimerWithTimeInterval:self.heartbeatInterval repeats:YES block:^(NSTimer * _Nonnull timer) { [NSTimer scheduledTimerWithTimeInterval:self.heartbeatInterval repeats:YES block:^(NSTimer * _Nonnull timer) {
[self trackHeartbeat]; [self trackHeartbeat];
}]; }];
}]; }];
[self.socket connect];
// [self.socket removeAllHandlers]; [self.socket onAny:^(SocketAnyEvent *data) {
// [self.socket disconnect]; NSLog(@"onAny: [%@] %@",data.event,data.items);
// self.socket = nil; }];
[self.socket connect];
} }
#pragma mark - API Main Functions #pragma mark - API Main Functions
...@@ -110,35 +94,44 @@ ...@@ -110,35 +94,44 @@
@"y":@(y), @"y":@(y),
@"interactionType":@(interactionType) @"interactionType":@(interactionType)
}]; }];
[self.socket emit:@"click" items:@[payload]]; [[self.socket emitWithAck:@"event" with:@[payload]] timingOutAfter:0 callback:^(NSArray* data) {
NSLog(@"data return: %@",data);
}];
} }
-(void)trackView:(NSString *)url{ -(void)trackView:(NSString *)url{
NSDictionary *payload = [self basicEventProperties:@"view" eventObject:@{@"uri":@"http://bosko.com", NSDictionary *payload = [self basicEventProperties:@"view" eventObject:@{@"uri":@"http://bosko.com",
@"customProperties":@{} @"customProperties":@{}
}]; }];
[self.socket emit:@"view" items:@[payload]]; [[self.socket emitWithAck:@"event" with:@[payload]] timingOutAfter:0 callback:^(NSArray* data) {
NSLog(@"data return: %@",data);
}];
} }
-(void)trackScroll:(ScrollDirection)scrollDirection{ -(void)trackScroll:(ScrollDirection)scrollDirection{
NSDictionary *payload = [self basicEventProperties:@"distance" eventObject:@{@"direction":@(scrollDirection), NSDictionary *payload = [self basicEventProperties:@"distance" eventObject:@{@"direction":@(scrollDirection),
@"distance":@(0) @"distance":@(0)
}]; }];
[self.socket emit:@"distance" items:@[payload]]; [[self.socket emitWithAck:@"event" with:@[payload]] timingOutAfter:0 callback:^(NSArray* data) {
} NSLog(@"data return: %@",data);
}];}
-(void)trackEnterViewPort:(NSString *)campaign elements:(NSArray *)elements{ -(void)trackEnterViewPort:(NSString *)campaign elements:(NSArray *)elements{
NSDictionary *payload = [self basicEventProperties:@"enterViewPort" eventObject:@{@"campaign":campaign, NSDictionary *payload = [self basicEventProperties:@"enterViewPort" eventObject:@{@"campaign":campaign,
@"elements":elements @"elements":elements
}]; }];
[self.socket emit:@"enterViewPort" items:@[payload]]; [[self.socket emitWithAck:@"event" with:@[payload]] timingOutAfter:0 callback:^(NSArray* data) {
} NSLog(@"data return: %@",data);
}];}
-(void)trackExitViewPort:(NSString *)campaign elements:(NSArray *)elements{ -(void)trackExitViewPort:(NSString *)campaign elements:(NSArray *)elements{
NSDictionary *payload = [self basicEventProperties:@"exitViewPort" eventObject:@{@"campaign":campaign, NSDictionary *payload = [self basicEventProperties:@"exitViewPort" eventObject:@{@"campaign":campaign,
@"elements":elements @"elements":elements
}]; }];
[self.socket emit:@"exitViewPort" items:@[payload]]; [[self.socket emitWithAck:@"event" with:@[payload]] timingOutAfter:0 callback:^(NSArray* data) {
} NSLog(@"data return: %@",data);
}];}
-(void)trackHeartbeat{ -(void)trackHeartbeat{
NSDictionary *payload = [self basicEventProperties:@"heartbeat" eventObject:@{@"i":@(heartbeatIncrement)}]; NSDictionary *payload = [self basicEventProperties:@"heartbeat" eventObject:@{@"i":@(heartbeatIncrement)}];
[self.socket emit:@"heartbeat" items:@[payload]]; [[self.socket emitWithAck:@"event" with:@[payload]] timingOutAfter:0 callback:^(NSArray* data) {
NSLog(@"data return: %@",data);
}];
heartbeatIncrement++; heartbeatIncrement++;
} }
-(void)trackStart:(NSString *)uri{ -(void)trackStart:(NSString *)uri{
...@@ -150,8 +143,9 @@ ...@@ -150,8 +143,9 @@
@"viewPortWidth":@(UIScreen.mainScreen.bounds.size.width), @"viewPortWidth":@(UIScreen.mainScreen.bounds.size.width),
@"viewPortHeight":@(UIScreen.mainScreen.bounds.size.height), @"viewPortHeight":@(UIScreen.mainScreen.bounds.size.height),
}]; }];
[self.socket emit:@"start" items:@[payload]]; [[self.socket emitWithAck:@"event" with:@[payload]] timingOutAfter:0 callback:^(NSArray* data) {
} NSLog(@"data return: %@",data);
}];}
-(void)trackEnd{ -(void)trackEnd{
} }
......
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