Skip to content

Commit

Permalink
Merge pull request #680 from adjust/v4351
Browse files Browse the repository at this point in the history
Version 4.35.1
  • Loading branch information
uerceg authored Oct 2, 2023
2 parents f90ae6c + 877bc75 commit 9abd400
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 105 deletions.
4 changes: 2 additions & 2 deletions Adjust.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "Adjust"
s.version = "4.35.0"
s.version = "4.35.1"
s.summary = "This is the iOS SDK of adjust. You can read more about it at http://adjust.com."
s.homepage = "https://github.com/adjust/ios_sdk"
s.license = { :type => 'MIT', :file => 'MIT-LICENSE' }
s.author = { "Adjust" => "[email protected]" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.35.0" }
s.source = { :git => "https://github.com/adjust/ios_sdk.git", :tag => "v4.35.1" }
s.ios.deployment_target = '9.0'
s.tvos.deployment_target = '9.0'
s.framework = 'SystemConfiguration'
Expand Down
94 changes: 0 additions & 94 deletions Adjust/ADJPackageBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ - (ADJActivityPackage *)buildSessionPackage:(BOOL)isInDelay {
sessionPackage.activityKind = ADJActivityKindSession;
sessionPackage.suffix = @"";
sessionPackage.parameters = parameters;

[self signWithSigV2Plugin:sessionPackage];
sessionPackage.parameters = [ADJUtil deepCopyOfDictionary:sessionPackage.parameters];

return sessionPackage;
Expand All @@ -84,13 +82,10 @@ - (ADJActivityPackage *)buildEventPackage:(ADJEvent *)event
eventPackage.activityKind = ADJActivityKindEvent;
eventPackage.suffix = [self eventSuffix:event];
eventPackage.parameters = parameters;

if (isInDelay) {
eventPackage.callbackParameters = [ADJUtil deepCopyOfDictionary:event.callbackParameters];
eventPackage.partnerParameters = [ADJUtil deepCopyOfDictionary:event.partnerParameters];
}

[self signWithSigV2Plugin:eventPackage];
eventPackage.parameters = [ADJUtil deepCopyOfDictionary:eventPackage.parameters];

return eventPackage;
Expand All @@ -103,8 +98,6 @@ - (ADJActivityPackage *)buildInfoPackage:(NSString *)infoSource {
infoPackage.activityKind = ADJActivityKindInfo;
infoPackage.suffix = @"";
infoPackage.parameters = parameters;

[self signWithSigV2Plugin:infoPackage];
infoPackage.parameters = [ADJUtil deepCopyOfDictionary:infoPackage.parameters];

return infoPackage;
Expand All @@ -117,8 +110,6 @@ - (ADJActivityPackage *)buildAdRevenuePackage:(NSString *)source payload:(NSData
adRevenuePackage.activityKind = ADJActivityKindAdRevenue;
adRevenuePackage.suffix = @"";
adRevenuePackage.parameters = parameters;

[self signWithSigV2Plugin:adRevenuePackage];
adRevenuePackage.parameters = [ADJUtil deepCopyOfDictionary:adRevenuePackage.parameters];

return adRevenuePackage;
Expand All @@ -131,13 +122,10 @@ - (ADJActivityPackage *)buildAdRevenuePackage:(ADJAdRevenue *)adRevenue isInDela
adRevenuePackage.activityKind = ADJActivityKindAdRevenue;
adRevenuePackage.suffix = @"";
adRevenuePackage.parameters = parameters;

if (isInDelay) {
adRevenuePackage.callbackParameters = [ADJUtil deepCopyOfDictionary:adRevenue.callbackParameters];
adRevenuePackage.partnerParameters = [ADJUtil deepCopyOfDictionary:adRevenue.partnerParameters];
}

[self signWithSigV2Plugin:adRevenuePackage];
adRevenuePackage.parameters = [ADJUtil deepCopyOfDictionary:adRevenuePackage.parameters];

return adRevenuePackage;
Expand All @@ -154,8 +142,6 @@ - (ADJActivityPackage *)buildClickPackage:(NSString *)clickSource extraParameter
clickPackage.activityKind = ADJActivityKindClick;
clickPackage.suffix = @"";
clickPackage.parameters = parameters;

[self signWithSigV2Plugin:clickPackage];
clickPackage.parameters = [ADJUtil deepCopyOfDictionary:clickPackage.parameters];

return clickPackage;
Expand All @@ -168,8 +154,6 @@ - (ADJActivityPackage *)buildAttributionPackage:(NSString *)initiatedBy {
attributionPackage.activityKind = ADJActivityKindAttribution;
attributionPackage.suffix = @"";
attributionPackage.parameters = parameters;

[self signWithSigV2Plugin:attributionPackage];
attributionPackage.parameters = [ADJUtil deepCopyOfDictionary:attributionPackage.parameters];

return attributionPackage;
Expand All @@ -182,8 +166,6 @@ - (ADJActivityPackage *)buildGdprPackage {
gdprPackage.activityKind = ADJActivityKindGdpr;
gdprPackage.suffix = @"";
gdprPackage.parameters = parameters;

[self signWithSigV2Plugin:gdprPackage];
gdprPackage.parameters = [ADJUtil deepCopyOfDictionary:gdprPackage.parameters];

return gdprPackage;
Expand All @@ -196,8 +178,6 @@ - (ADJActivityPackage *)buildDisableThirdPartySharingPackage {
dtpsPackage.activityKind = ADJActivityKindDisableThirdPartySharing;
dtpsPackage.suffix = @"";
dtpsPackage.parameters = parameters;

[self signWithSigV2Plugin:dtpsPackage];
dtpsPackage.parameters = [ADJUtil deepCopyOfDictionary:dtpsPackage.parameters];

return dtpsPackage;
Expand All @@ -211,8 +191,6 @@ - (ADJActivityPackage *)buildThirdPartySharingPackage:(nonnull ADJThirdPartyShar
tpsPackage.activityKind = ADJActivityKindThirdPartySharing;
tpsPackage.suffix = @"";
tpsPackage.parameters = parameters;

[self signWithSigV2Plugin:tpsPackage];
tpsPackage.parameters = [ADJUtil deepCopyOfDictionary:tpsPackage.parameters];

return tpsPackage;
Expand All @@ -225,8 +203,6 @@ - (ADJActivityPackage *)buildMeasurementConsentPackage:(BOOL)enabled {
mcPackage.activityKind = ADJActivityKindMeasurementConsent;
mcPackage.suffix = @"";
mcPackage.parameters = parameters;

[self signWithSigV2Plugin:mcPackage];
mcPackage.parameters = [ADJUtil deepCopyOfDictionary:mcPackage.parameters];

return mcPackage;
Expand All @@ -240,13 +216,10 @@ - (ADJActivityPackage *)buildSubscriptionPackage:(ADJSubscription *)subscription
subscriptionPackage.activityKind = ADJActivityKindSubscription;
subscriptionPackage.suffix = @"";
subscriptionPackage.parameters = parameters;

if (isInDelay) {
subscriptionPackage.callbackParameters = [ADJUtil deepCopyOfDictionary:subscription.callbackParameters];
subscriptionPackage.partnerParameters = [ADJUtil deepCopyOfDictionary:subscription.partnerParameters];
}

[self signWithSigV2Plugin:subscriptionPackage];
subscriptionPackage.parameters = [ADJUtil deepCopyOfDictionary:subscriptionPackage.parameters];

return subscriptionPackage;
Expand All @@ -263,8 +236,6 @@ - (ADJActivityPackage *)buildPurchaseVerificationPackageWithExtraParams:(NSDicti
purchaseVerificationPackage.activityKind = ADJActivityKindPurchaseVerification;
purchaseVerificationPackage.suffix = @"";
purchaseVerificationPackage.parameters = parameters;

[self signWithSigV2Plugin:purchaseVerificationPackage];
purchaseVerificationPackage.parameters = [ADJUtil deepCopyOfDictionary:purchaseVerificationPackage.parameters];

return purchaseVerificationPackage;
Expand Down Expand Up @@ -350,71 +321,6 @@ + (void)parameters:(NSMutableDictionary *)parameters setString:(NSString *)value

#pragma mark - Private & helper methods

- (void)signWithSigV2Plugin:(ADJActivityPackage *)activityPackage {
Class signerClass = NSClassFromString(@"ADJSigner");
if (signerClass == nil) {
return;
}
SEL signSEL = NSSelectorFromString(@"sign:withActivityKind:withSdkVersion:");
if (![signerClass respondsToSelector:signSEL]) {
return;
}

NSMutableDictionary *parameters = activityPackage.parameters;
const char *activityKindChar = [[ADJActivityKindUtil activityKindToString:activityPackage.activityKind] UTF8String];
const char *sdkVersionChar = [activityPackage.clientSdk UTF8String];

// Stack allocated strings to ensure their lifetime stays until the next iteration
static char activityKind[64], sdkVersion[64];
strncpy(activityKind, activityKindChar, strlen(activityKindChar) + 1);
strncpy(sdkVersion, sdkVersionChar, strlen(sdkVersionChar) + 1);

// NSInvocation setArgument requires lvalue references with exact matching types to the executed function signature.
// With this usage we ensure that the lifetime of the object remains until the next iteration, as it points to the
// stack allocated string where we copied the buffer.
const char *lvalActivityKind = activityKind;
const char *lvalSdkVersion = sdkVersion;

/*
[ADJSigner sign:parameters
withActivityKind:activityKindChar
withSdkVersion:sdkVersionChar];
*/

NSMethodSignature *signMethodSignature = [signerClass methodSignatureForSelector:signSEL];
NSInvocation *signInvocation = [NSInvocation invocationWithMethodSignature:signMethodSignature];
[signInvocation setSelector:signSEL];
[signInvocation setTarget:signerClass];

[signInvocation setArgument:&parameters atIndex:2];
[signInvocation setArgument:&lvalActivityKind atIndex:3];
[signInvocation setArgument:&lvalSdkVersion atIndex:4];

[signInvocation invoke];

SEL getVersionSEL = NSSelectorFromString(@"getVersion");
if (![signerClass respondsToSelector:getVersionSEL]) {
return;
}
/*
NSString *signerVersion = [ADJSigner getVersion];
*/
IMP getVersionIMP = [signerClass methodForSelector:getVersionSEL];
if (!getVersionIMP) {
return;
}
id (*getVersionFunc)(id, SEL) = (void *)getVersionIMP;
id signerVersion = getVersionFunc(signerClass, getVersionSEL);
if (![signerVersion isKindOfClass:[NSString class]]) {
return;
}

NSString *signerVersionString = (NSString *)signerVersion;
[ADJPackageBuilder parameters:parameters
setString:signerVersionString
forKey:@"native_version"];
}

- (NSMutableDictionary *)getSessionParameters:(BOOL)isInDelay {
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];

Expand Down
67 changes: 67 additions & 0 deletions Adjust/ADJRequestHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ - (id)initWithResponseCallback:(id<ADJResponseCallback>)responseCallback
- (void)sendPackageByPOST:(ADJActivityPackage *)activityPackage
sendingParameters:(NSDictionary *)sendingParameters
{
[self signWithSigV2Plugin:activityPackage];
NSDictionary *parameters = [[NSDictionary alloc]
initWithDictionary:activityPackage.parameters
copyItems:YES];
Expand Down Expand Up @@ -103,6 +104,7 @@ - (void)sendPackageByPOST:(ADJActivityPackage *)activityPackage
- (void)sendPackageByGET:(ADJActivityPackage *)activityPackage
sendingParameters:(NSDictionary *)sendingParameters
{
[self signWithSigV2Plugin:activityPackage];
NSDictionary *parameters = [[NSDictionary alloc]
initWithDictionary:activityPackage.parameters
copyItems:YES];
Expand Down Expand Up @@ -647,4 +649,69 @@ - (NSDictionary *)buildJsonDict:(NSData *)jsonData
return jsonDict;
}

- (void)signWithSigV2Plugin:(ADJActivityPackage *)activityPackage {
Class signerClass = NSClassFromString(@"ADJSigner");
if (signerClass == nil) {
return;
}
SEL signSEL = NSSelectorFromString(@"sign:withActivityKind:withSdkVersion:");
if (![signerClass respondsToSelector:signSEL]) {
return;
}

NSMutableDictionary *parameters = activityPackage.parameters;
const char *activityKindChar = [[ADJActivityKindUtil activityKindToString:activityPackage.activityKind] UTF8String];
const char *sdkVersionChar = [activityPackage.clientSdk UTF8String];

// Stack allocated strings to ensure their lifetime stays until the next iteration
static char activityKind[64], sdkVersion[64];
strncpy(activityKind, activityKindChar, strlen(activityKindChar) + 1);
strncpy(sdkVersion, sdkVersionChar, strlen(sdkVersionChar) + 1);

// NSInvocation setArgument requires lvalue references with exact matching types to the executed function signature.
// With this usage we ensure that the lifetime of the object remains until the next iteration, as it points to the
// stack allocated string where we copied the buffer.
const char *lvalActivityKind = activityKind;
const char *lvalSdkVersion = sdkVersion;

/*
[ADJSigner sign:parameters
withActivityKind:activityKindChar
withSdkVersion:sdkVersionChar];
*/

NSMethodSignature *signMethodSignature = [signerClass methodSignatureForSelector:signSEL];
NSInvocation *signInvocation = [NSInvocation invocationWithMethodSignature:signMethodSignature];
[signInvocation setSelector:signSEL];
[signInvocation setTarget:signerClass];

[signInvocation setArgument:&parameters atIndex:2];
[signInvocation setArgument:&lvalActivityKind atIndex:3];
[signInvocation setArgument:&lvalSdkVersion atIndex:4];

[signInvocation invoke];

SEL getVersionSEL = NSSelectorFromString(@"getVersion");
if (![signerClass respondsToSelector:getVersionSEL]) {
return;
}
/*
NSString *signerVersion = [ADJSigner getVersion];
*/
IMP getVersionIMP = [signerClass methodForSelector:getVersionSEL];
if (!getVersionIMP) {
return;
}
id (*getVersionFunc)(id, SEL) = (void *)getVersionIMP;
id signerVersion = getVersionFunc(signerClass, getVersionSEL);
if (![signerVersion isKindOfClass:[NSString class]]) {
return;
}

NSString *signerVersionString = (NSString *)signerVersion;
[ADJPackageBuilder parameters:parameters
setString:signerVersionString
forKey:@"native_version"];
}

@end
2 changes: 1 addition & 1 deletion Adjust/ADJUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
static NSRegularExpression *shortUniversalLinkRegex = nil;
static NSRegularExpression *excludedDeeplinkRegex = nil;

static NSString * const kClientSdk = @"ios4.35.0";
static NSString * const kClientSdk = @"ios4.35.1";
static NSString * const kDeeplinkParam = @"deep_link=";
static NSString * const kSchemeDelimiter = @"://";
static NSString * const kDefaultScheme = @"AdjustUniversalScheme";
Expand Down
2 changes: 1 addition & 1 deletion Adjust/Adjust.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Adjust.h
// Adjust SDK
//
// V4.35.0
// V4.35.1
// Created by Christian Wellenbrock (@wellle) on 23rd July 2013.
// Copyright (c) 2012-2021 Adjust GmbH. All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion AdjustBridge/AdjustBridgeRegister.m
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ + (NSString *)adjust_js {
if (this.sdkPrefix) {
return this.sdkPrefix;
} else {
return 'web-bridge4.35.0';
return 'web-bridge4.35.1';
}
},
setTestOptions: function(testOptions) {
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
### Version 4.35.1 (2nd October 2023)
#### Fixed
- Fixed issue with signing requests post ATT delay timer exipry.

---

### Version 4.35.0 (12th September 2023)
#### Added
- Added support for SigV3 library. Update authorization header building logic to use `adj_signing_id`.

---

### Version 4.34.2 (6th September 2023)

#### Added
- Added more logging around ATT delay timer feature to indicate that it's activated.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.35.0
4.35.1
8 changes: 4 additions & 4 deletions examples/AdjustExample-Swift/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- Adjust (4.35.0):
- Adjust/Core (= 4.35.0)
- Adjust/Core (4.35.0)
- Adjust (4.35.1):
- Adjust/Core (= 4.35.1)
- Adjust/Core (4.35.1)

DEPENDENCIES:
- Adjust (from `../../`)
Expand All @@ -11,7 +11,7 @@ EXTERNAL SOURCES:
:path: "../../"

SPEC CHECKSUMS:
Adjust: e633c0cb917deeb2b00ac45bf9a4f34e6ece9477
Adjust: 63c56c81b420738f927fbc19e5cf4f34fd39d572

PODFILE CHECKSUM: 4c79da456db9adb90cdd42adc7f721c7bb6490cd

Expand Down

0 comments on commit 9abd400

Please sign in to comment.