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

improvements

parent 7ddd1b3a
......@@ -18,5 +18,10 @@
"platforms": {
"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() {
if [[ "$CONFIGURATION" == "Debug" ]]; then
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
if [[ "$CONFIGURATION" == "Release" ]]; then
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
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
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
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "PrimedIO"
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" -framework "SocketIO" -framework "Starscream"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
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
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PrimedIO/PrimedIO.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "PrimedIO"
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" -framework "SocketIO" -framework "Starscream"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
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
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_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
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
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_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
......
......@@ -12,26 +12,6 @@
#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[];
......
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
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
......
......@@ -302,10 +302,14 @@
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-PrimedIO_Example/Pods-PrimedIO_Example-frameworks.sh",
"${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";
outputPaths = (
"${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;
shellPath = /bin/sh;
......
......@@ -53,7 +53,7 @@
// PrimedIO.sharedInstance.debug = YES;
// 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{
[super didReceiveMemoryWarning];
......
......@@ -7,35 +7,19 @@
#
Pod::Spec.new do |s|
s.name = 'PrimedIO'
s.version = '0.0.1'
s.summary = 'Here is short description for PrimedIO'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
Here is longer description for PrimedIO TBA.
DESC
s.homepage = 'https://gitlab.com/primedio/delivery-primedios'
# 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'
s.name = 'PrimedIO'
s.version = '0.0.1'
s.summary = 'Here is short description for PrimedIO'
s.description = <<-DESC
Here is longer description for PrimedIO TBA.
DESC
s.homepage = 'https://gitlab.com/primedio/delivery-primedios'
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.dependency "Socket.IO-Client-Swift", "~> 13.3.0"
end
......@@ -8,7 +8,8 @@
#import <Foundation/Foundation.h>
#import "PrimedIO.h"
#import "VPSocketIO.h"
@import SocketIO;
typedef NS_ENUM(NSUInteger, InteractionType) {
InteractionType_LEFT,
......@@ -32,8 +33,8 @@ typedef NS_ENUM(NSUInteger, ScrollDirection) {
@property (nonatomic,strong) NSString *trackingConnectionString;
@property (nonatomic,assign) NSInteger heartbeatInterval;
@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
* @return PrimedTracker shared instance
......
......@@ -9,24 +9,6 @@
#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
......@@ -36,7 +18,7 @@
@"sid":@"ef46d562-c27f-412a-9e60-e1673e16fbdb",
@"did":@"7981117e-b881-4dbd-accf-4b49f4d648c9",
@"source":@"app",
@"sdkId":@(0),
@"sdkId":@(1),
@"sdkVersion":@"2.1.0-beta12",
@"type":type,
@"eventObject":eventObject
......@@ -84,24 +66,26 @@
self.eventQueueRetryInterval = eventQueueRetryInterval;
self.trackingConnectionString = trackingConnectionString;
ClientSocketLogger *logger = [ClientSocketLogger new];
self.socket = [[VPSocketIOClient alloc] init:[NSURL URLWithString:self.trackingConnectionString]
withConfig:@{@"log": @YES,
//@"logger":logger
}];
NSURL *url = [NSURL URLWithString:self.trackingConnectionString];
self.manager = [[SocketManager alloc] initWithSocketURL:url config:@{@"log": @(self.debug)}];
// [self.manager setForceNew:YES];
// [self.manager setReconnects:YES];
self.socket = [[SocketIOClient alloc] initWithManager:self.manager nsp:@"/v1"];
[self.manager setNsps:@{@"/v1":self.socket}];
heartbeatIncrement = 1;
[self.socket on:kSocketEventConnect callback:^(NSArray *array, VPSocketAckEmitter *emitter) {
[self.socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
NSLog(@"socket connected");
self->heartbeatIncrement = 1;
[NSTimer scheduledTimerWithTimeInterval:self.heartbeatInterval repeats:YES block:^(NSTimer * _Nonnull timer) {
[self trackHeartbeat];
}];
}];
[self.socket connect];
// [self.socket removeAllHandlers];
// [self.socket disconnect];
// self.socket = nil;
[self.socket onAny:^(SocketAnyEvent *data) {
NSLog(@"onAny: [%@] %@",data.event,data.items);
}];
[self.socket connect];
}
#pragma mark - API Main Functions
......@@ -110,35 +94,44 @@
@"y":@(y),
@"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{
NSDictionary *payload = [self basicEventProperties:@"view" eventObject:@{@"uri":@"http://bosko.com",
@"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{
NSDictionary *payload = [self basicEventProperties:@"distance" eventObject:@{@"direction":@(scrollDirection),
@"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{
NSDictionary *payload = [self basicEventProperties:@"enterViewPort" eventObject:@{@"campaign":campaign,
@"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{
NSDictionary *payload = [self basicEventProperties:@"exitViewPort" eventObject:@{@"campaign":campaign,
@"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{
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++;
}
-(void)trackStart:(NSString *)uri{
......@@ -150,8 +143,9 @@
@"viewPortWidth":@(UIScreen.mainScreen.bounds.size.width),
@"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{
}
......
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