Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: bump Adjust SDK to the latest v5.1.0 #10

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ jobs:
github_token: ${{ secrets.PAT }}
pr_title: "chore(release): pulling ${{ steps.create-release.outputs.branch_name }} into master"
pr_body: ":crown: *An automated PR*\n\n${{ steps.finish-release.outputs.commit_summary }}"
pr_reviewer: 'pallabmaiti'
pr_reviewer: '@rudderlabs/sdk-ios'
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
outdated-pod-names: "Adjust"
directory: "Example"
title: "fix: update Adjust SDK to the latest version"
assignee: "desusai7"
labels: "outdatedPod"
color: "FBCA04"
env:
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @pallabmaiti @itsdebs
* @rudderlabs/sdk-ios
4 changes: 1 addition & 3 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use_frameworks!

platform :ios, '8.0'
platform :ios, '12.0'

target 'Rudder-Adjust_Example' do
pod 'Rudder-Adjust', :path => '../'

target 'Rudder-Adjust_Tests' do
inherit! :search_paths

pod 'FBSnapshotTestCase'
end
end
31 changes: 10 additions & 21 deletions Example/Rudder-Adjust.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
6003F5AA195388D20070C39A /* Sources */,
6003F5AB195388D20070C39A /* Frameworks */,
6003F5AC195388D20070C39A /* Resources */,
974BB9006AD69DA16F8F8CF4 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -321,40 +320,30 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
974BB9006AD69DA16F8F8CF4 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Rudder-Adjust_Tests/Pods-Rudder-Adjust_Tests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/FBSnapshotTestCase/FBSnapshotTestCase.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSnapshotTestCase.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Rudder-Adjust_Tests/Pods-Rudder-Adjust_Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
ABE207811F1BF2DFBC91AC01 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Rudder-Adjust_Example/Pods-Rudder-Adjust_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Adjust/Adjust.framework",
"${BUILT_PRODUCTS_DIR}/Adjust/AdjustSdk.framework",
"${BUILT_PRODUCTS_DIR}/MetricsReporter/MetricsReporter.framework",
"${BUILT_PRODUCTS_DIR}/RSCrashReporter/RSCrashReporter.framework",
"${BUILT_PRODUCTS_DIR}/Rudder/Rudder.framework",
"${BUILT_PRODUCTS_DIR}/Rudder-Adjust/Rudder_Adjust.framework",
"${BUILT_PRODUCTS_DIR}/RudderKit/RudderKit.framework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/AdjustSignature/AdjustSigSdk.framework/AdjustSigSdk",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Adjust.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AdjustSdk.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MetricsReporter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RSCrashReporter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Rudder.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Rudder_Adjust.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RudderKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AdjustSigSdk.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
21 changes: 14 additions & 7 deletions Example/Rudder-Adjust/RUDDERAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,29 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
{
// Override point for customization after application launch.

NSString *writeKey = @"1WC1fQ3nIuFlZcKYCN2zLirPq4D";
NSString *endPointUrl = @"https://843fa4c8.ngrok.io";
NSString *writeKey = @"<write_key>";
NSString *dataPlaneUrl = @"<dataPlane_url>";

RSConfigBuilder *configBuilder = [[RSConfigBuilder alloc] init];
[configBuilder withDataPlaneUrl:endPointUrl];
[configBuilder withLoglevel:RSLogLevelDebug];
[configBuilder withDataPlaneUrl:dataPlaneUrl];
[configBuilder withLoglevel:RSLogLevelVerbose];
[configBuilder withTrackLifecycleEvens:false];
[configBuilder withFactory:[RudderAdjustFactory instance]];
RSClient *rudderClient = [RSClient getInstance:writeKey config:[configBuilder build]];

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSLog(@"processor started");

usleep(10000000);
[rudderClient track:@"level_up"];
[rudderClient track:@"daily_rewards_claim"];
[rudderClient track:@"revenue"];
[rudderClient identify:@"RudderStack iOS user id"];
[rudderClient track:@"Track event iOS" properties:@{
@"key1": @"value1",
@"key2": @123,
@"key3": @YES,
@"key4": @4.56,
@"revenue": @"4.99",
@"currency": @"USD"
}];
});

return YES;
Expand Down
9 changes: 4 additions & 5 deletions Rudder-Adjust.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ Rudder is a platform for collecting, storing and routing customer event data to

s.homepage = 'https://github.com/rudderlabs/rudder-integration-adjust-ios'
s.license = { :type => "ELv2", :file => "LICENSE.md" }
s.author = { 'RudderStack' => 'arnab@rudderlabs.com' }
s.author = { 'RudderStack' => 'sdk@rudderstack.com' }
s.source = { :git => 'https://github.com/rudderlabs/rudder-integration-adjust-ios.git', :tag => "v#{s.version}" }
s.platform = :ios, "9.0"

s.ios.deployment_target = '8.0'
s.ios.deployment_target = '12.0'

s.source_files = 'Rudder-Adjust/Classes/**/*'

s.dependency 'Rudder'
s.dependency 'Adjust'
s.dependency 'Rudder', '~> 1.29'
s.dependency 'Adjust', '~> 5.1.0'
end
2 changes: 1 addition & 1 deletion Rudder-Adjust/Classes/RudderAdjustIntegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <Foundation/Foundation.h>
#import <Rudder/Rudder.h>
#import <Adjust/Adjust.h>
#import <AdjustSdk/AdjustSdk.h>

NS_ASSUME_NONNULL_BEGIN

Expand Down
89 changes: 48 additions & 41 deletions Rudder-Adjust/Classes/RudderAdjustIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,38 @@ - (instancetype)initWithConfig:(NSDictionary *)config
}
self.eventMap = tempDict;
}
NSNumber *delayTime = [config objectForKey:@"delay"];
double delay = 0;
if (delayTime != nil) {
delay = [delayTime doubleValue];
}
if (delay < 0) {
delay = 0;
} else if (delay > 10) {
delay = 10;
}

if (apiToken != nil && ![apiToken isEqualToString:@""]) {
NSString *environment = ADJEnvironmentProduction;
if (rudderConfig.logLevel >= 4) {
environment = ADJEnvironmentSandbox;
}

ADJConfig *adjustConfig = [ADJConfig configWithAppToken:apiToken environment:environment];
[adjustConfig setLogLevel:rudderConfig.logLevel >= 4 ? ADJLogLevelVerbose : ADJLogLevelError];
[adjustConfig setEventBufferingEnabled:YES];
ADJConfig *adjustConfig = [[ADJConfig alloc] initWithAppToken:apiToken environment:environment];
[self setLogLevel:rudderConfig.logLevel withAdjustConfig:adjustConfig];
[adjustConfig setDelegate:self];
if (delay > 0) {
[adjustConfig setDelayStart:delay];
}
[Adjust appDidLaunch:adjustConfig];
[Adjust initSdk:adjustConfig];
}
}
return self;
}

- (void)setLogLevel:(int) loglevel withAdjustConfig:(ADJConfig *)adjustConfig {
if (loglevel == RSLogLevelVerbose) {
[adjustConfig setLogLevel:ADJLogLevelVerbose];
} else if (loglevel == RSLogLevelDebug) {
[adjustConfig setLogLevel:ADJLogLevelDebug];
} else if (loglevel == RSLogLevelInfo) {
[adjustConfig setLogLevel:ADJLogLevelInfo];
} else if (loglevel == RSLogLevelWarning) {
[adjustConfig setLogLevel:ADJLogLevelWarn];
} else if (loglevel == RSLogLevelError) {
[adjustConfig setLogLevel:ADJLogLevelError];
} else {
[adjustConfig setLogLevel:ADJLogLevelSuppress];
}
}

- (void)dump:(nonnull RSMessage *)message {
if (self.eventMap == nil) {
return;
Expand All @@ -70,44 +72,49 @@ - (void)dump:(nonnull RSMessage *)message {
[self setPartnerParams:message];
} else if ([message.type isEqualToString:@"track"]) {
NSString *adjEventToken = [self.eventMap objectForKey:message.event];
if (adjEventToken != nil) {
[self setPartnerParams:message];
ADJEvent *event = [[ADJEvent alloc] initWithEventToken:adjEventToken];
NSDictionary *eventProperties = message.properties;
if (eventProperties != nil) {
for (NSString *key in [eventProperties allKeys]) {
[event addCallbackParameter:key value:[NSString stringWithFormat:@"%@", [eventProperties objectForKey:key]]];
}
NSNumber *total = [eventProperties objectForKey:@"revenue"];
NSString *currency = [eventProperties objectForKey:@"currency"];
if (total != nil && currency != nil) {
[event setRevenue:[total doubleValue] currency:currency];
}
if (adjEventToken == nil) {
[RSLogger logDebug:[NSString stringWithFormat:@"Dropping the track event: %@, since corresponding event token is not present.", message.event]];
return;
}
[self setPartnerParams:message];
ADJEvent *event = [[ADJEvent alloc] initWithEventToken:adjEventToken];
NSDictionary *eventProperties = message.properties;
if (eventProperties != nil) {
for (NSString *key in [eventProperties allKeys]) {
[event addCallbackParameter:key value:[NSString stringWithFormat:@"%@", [eventProperties objectForKey:key]]];
}
NSDictionary *userProperties = message.userProperties;
if (userProperties != nil) {
for (NSString *key in [userProperties allKeys]) {
[event addCallbackParameter:key value:[NSString stringWithFormat:@"%@", [userProperties objectForKey:key]]];
}
NSNumber *total = [eventProperties objectForKey:@"revenue"];
NSString *currency = [eventProperties objectForKey:@"currency"];
if (total != nil && currency != nil) {
[event setRevenue:[total doubleValue] currency:currency];
}
}
NSDictionary *userProperties = message.userProperties;
if (userProperties != nil) {
for (NSString *key in [userProperties allKeys]) {
[event addCallbackParameter:key value:[NSString stringWithFormat:@"%@", [userProperties objectForKey:key]]];
}
[Adjust trackEvent:event];
}
} else if ([message.type isEqualToString:@"screen"]) {
[RSLogger logWarn:@"MessageType is not supported"];
[Adjust trackEvent:event];
} else {
[RSLogger logWarn:@"MessageType is not specified"];
}
}

-(void) setPartnerParams:(RSMessage*) message {
[Adjust addSessionPartnerParameter:@"anonymousId" value:message.anonymousId];
[Adjust addGlobalPartnerParameter:@"anonymousId" forKey:message.anonymousId];
if (message.userId != nil && ![message.userId isEqualToString:@""]) {
[Adjust addSessionPartnerParameter:@"userId" value:message.userId];
[Adjust addGlobalPartnerParameter:@"userId" forKey:message.userId];
}
}

- (void)reset {
[Adjust resetSessionPartnerParameters];
[Adjust removeGlobalPartnerParameters];
}

- (void)flush {

}


@end
Loading