Skip to content

Commit 12cd7ee

Browse files
committed
native source files and binaries update
1 parent d6e0b28 commit 12cd7ee

25 files changed

+770
-964
lines changed

android/libs/adjust-android.jar

2.86 KB
Binary file not shown.

ios/Adjust/ADJActivityHandler.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,9 +1725,11 @@ - (BOOL)shouldFetchAdServicesI:(ADJActivityHandler *)selfI {
17251725
- (void)checkForAdServicesAttributionI:(ADJActivityHandler *)selfI {
17261726
if (@available(iOS 14.3, tvOS 14.3, *)) {
17271727
if ([selfI shouldFetchAdServicesI:selfI]) {
1728-
NSError *error = nil;
1729-
NSString *token = [[UIDevice currentDevice] adjFetchAdServicesAttribution:&error];
1730-
[selfI setAdServicesAttributionToken:token error:error];
1728+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
1729+
NSError *error = nil;
1730+
NSString *token = [[UIDevice currentDevice] adjFetchAdServicesAttribution:&error];
1731+
[selfI setAdServicesAttributionToken:token error:error];
1732+
});
17311733
}
17321734
}
17331735
}

ios/Adjust/ADJActivityState.m

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// Copyright (c) 2013 adjust GmbH. All rights reserved.
77
//
88

9-
#import "ADJKeychain.h"
109
#import "ADJAdjustFactory.h"
1110
#import "ADJActivityState.h"
1211
#import "UIDevice+ADJAdditions.h"
@@ -84,26 +83,7 @@ - (BOOL)findTransactionId:(NSString *)transactionId {
8483
#pragma mark - Private & helper methods
8584

8685
- (void)assignUuid:(NSString *)uuid {
87-
NSString *persistedUuid = [ADJKeychain valueForKeychainKey:@"adjust_uuid" service:@"deviceInfo"];
88-
89-
// Check if value exists in Keychain.
90-
if (persistedUuid != nil) {
91-
// Check if value has UUID format.
92-
if ((bool)[[NSUUID alloc] initWithUUIDString:persistedUuid]) {
93-
[[ADJAdjustFactory logger] verbose:@"Value read from the keychain"];
94-
95-
// Value written in keychain seems to have UUID format.
96-
self.uuid = persistedUuid;
97-
self.isPersisted = YES;
98-
return;
99-
}
100-
}
101-
102-
// At this point, UUID was not persisted in Keychain or if persisted, didn't have proper UUID format.
103-
// Since we don't have anything in the keychain, we'll use the passed UUID value.
104-
// Try to save that value to the keychain.
10586
self.uuid = uuid;
106-
self.isPersisted = [ADJKeychain setValue:self.uuid forKeychainKey:@"adjust_uuid" inService:@"deviceInfo"];
10787
}
10888

10989
- (NSString *)description {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// NSNumber+ADJAdditions.h
3+
// Adjust
4+
//
5+
// Created by Uglješa Erceg (@uerceg) on 26th March 2021.
6+
// Copyright (c) 2021 Adjust GmbH. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface NSNumber(ADJAdditions)
12+
13+
+ (BOOL)adjIsEqual:(NSNumber *)first toNumber:(NSNumber *)second;
14+
15+
@end
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// NSNumber+ADJAdditions.m
3+
// Adjust
4+
//
5+
// Created by Uglješa Erceg (@uerceg) on 26th March 2021.
6+
// Copyright (c) 2021 Adjust GmbH. All rights reserved.
7+
//
8+
9+
#import "NSNumber+ADJAdditions.h"
10+
11+
@implementation NSNumber(ADJAdditions)
12+
13+
+ (BOOL)adjIsEqual:(NSNumber *)first toNumber:(NSNumber *)second {
14+
if (first == nil && second == nil) {
15+
return YES;
16+
}
17+
18+
return [first isEqualToNumber:second];
19+
}
20+
21+
@end

ios/Adjust/ADJAdditions/UIDevice+ADJAdditions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
- (NSString *)adjDeviceName;
2222
- (NSString *)adjCreateUuid;
2323
- (NSString *)adjVendorId;
24-
- (NSString *)adjDeviceId:(ADJDeviceInfo *)deviceInfo;
2524
- (void)adjCheckForiAd:(ADJActivityHandler *)activityHandler queue:(dispatch_queue_t)queue;
2625
- (NSString *)adjFetchAdServicesAttribution:(NSError **)errorPtr;
2726

ios/Adjust/ADJAdditions/UIDevice+ADJAdditions.m

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -214,111 +214,6 @@ - (NSString *)adjVendorId {
214214
return @"";
215215
}
216216

217-
- (NSString *)adjDeviceId:(ADJDeviceInfo *)deviceInfo {
218-
int languageMaxLength = 16;
219-
NSString *language = deviceInfo.languageCode;
220-
NSString *binaryLanguage = [ADJUtil stringToBinaryString:language];
221-
NSString *binaryLanguageFormatted = [ADJUtil enforceParameterLength:binaryLanguage withMaxlength:languageMaxLength];
222-
223-
int hardwareNameMaxLength = 48;
224-
NSString *hardwareName = deviceInfo.machineModel;
225-
NSString *binaryHardwareName = [ADJUtil stringToBinaryString:hardwareName];
226-
NSString *binaryHardwareNameFormatted = [ADJUtil enforceParameterLength:binaryHardwareName withMaxlength:hardwareNameMaxLength];
227-
228-
NSArray *versionParts = [deviceInfo.systemVersion componentsSeparatedByString:@"."];
229-
int osVersionMajor = [[versionParts objectAtIndex:0] intValue];
230-
int osVersionMinor = [[versionParts objectAtIndex:1] intValue];
231-
int osVersionPatch = [versionParts count] == 3 ? [[versionParts objectAtIndex:2] intValue] : 0;
232-
233-
int osVersionMajorMaxLength = 8;
234-
NSString *binaryOsVersionMajor = [ADJUtil decimalToBinaryString:osVersionMajor];
235-
NSString *binaryOsVersionMajorFormatted = [ADJUtil enforceParameterLength:binaryOsVersionMajor withMaxlength:osVersionMajorMaxLength];
236-
237-
int osVersionMinorMaxLength = 8;
238-
NSString *binaryOsVersionMinor = [ADJUtil decimalToBinaryString:osVersionMinor];
239-
NSString *binaryOsVersionMinorFormatted = [ADJUtil enforceParameterLength:binaryOsVersionMinor withMaxlength:osVersionMinorMaxLength];
240-
241-
int osVersionPatchMaxLength = 8;
242-
NSString *binaryOsVersionPatch = [ADJUtil decimalToBinaryString:osVersionPatch];
243-
NSString *binaryOsVersionPatchFormatted = [ADJUtil enforceParameterLength:binaryOsVersionPatch withMaxlength:osVersionPatchMaxLength];
244-
245-
int mccMaxLength = 24;
246-
NSString *mcc = [ADJUtil readMCC];
247-
NSString *binaryMcc = [ADJUtil stringToBinaryString:mcc];
248-
NSString *binaryMccFormatted = [ADJUtil enforceParameterLength:binaryMcc withMaxlength:mccMaxLength];
249-
250-
int mncMaxLength = 24;
251-
NSString *mnc = [ADJUtil readMNC];
252-
NSString *binaryMnc = [ADJUtil stringToBinaryString:mnc];
253-
NSString *binaryMncFormatted = [ADJUtil enforceParameterLength:binaryMnc withMaxlength:mncMaxLength];
254-
255-
int chargingStatusMaxLength = 8;
256-
NSUInteger chargingStatus = [ADJSystemProfile chargingStatus];
257-
NSString *binaryChargingStatus = [ADJUtil decimalToBinaryString:chargingStatus];
258-
NSString *binaryChargingStatusFormatted = [ADJUtil enforceParameterLength:binaryChargingStatus withMaxlength:chargingStatusMaxLength];
259-
260-
int batteryLevelMaxSize = 8;
261-
NSUInteger batteryLevel = [ADJSystemProfile batteryLevel];
262-
NSString *binaryBatteryLevel = [ADJUtil decimalToBinaryString:batteryLevel];
263-
NSString *binaryBatteryLevelFormatted = [ADJUtil enforceParameterLength:binaryBatteryLevel withMaxlength:batteryLevelMaxSize];
264-
265-
int totalSpaceMaxSize = 24;
266-
NSUInteger totalSpace = [ADJSystemProfile totalDiskSpace];
267-
NSString *binaryTotalSpace = [ADJUtil decimalToBinaryString:totalSpace];
268-
NSString *binaryTotalSpaceFormatted = [ADJUtil enforceParameterLength:binaryTotalSpace withMaxlength:totalSpaceMaxSize];
269-
270-
int freeSpaceMaxSize = 24;
271-
NSUInteger freeSpace = [ADJSystemProfile freeDiskSpace];
272-
NSString *binaryFreeSpace = [ADJUtil decimalToBinaryString:freeSpace];
273-
NSString *binaryFreeSpaceFormatted = [ADJUtil enforceParameterLength:binaryFreeSpace withMaxlength:freeSpaceMaxSize];
274-
275-
int systemUptimeMaxSize = 24;
276-
NSUInteger systemUptime = [ADJSystemProfile systemUptime];
277-
NSString *binarySystemUptime = [ADJUtil decimalToBinaryString:systemUptime];
278-
NSString *binarySystemUptimeFormatted = [ADJUtil enforceParameterLength:binarySystemUptime withMaxlength:systemUptimeMaxSize];
279-
280-
int lastBootTimeMaxSize = 32;
281-
NSUInteger lastBootTime = [ADJSystemProfile lastBootTime];
282-
NSString *binaryLastBootTime = [ADJUtil decimalToBinaryString:lastBootTime];
283-
NSString *binaryLastBootTimeFormatted = [ADJUtil enforceParameterLength:binaryLastBootTime withMaxlength:lastBootTimeMaxSize];
284-
285-
NSString *concatenated = [NSString stringWithFormat:@"%@%@%@%@%@%@%@%@%@%@%@%@%@",
286-
binaryLanguageFormatted,
287-
binaryHardwareNameFormatted,
288-
binaryOsVersionMajorFormatted,
289-
binaryOsVersionMinorFormatted,
290-
binaryOsVersionPatchFormatted,
291-
binaryMccFormatted,
292-
binaryMncFormatted,
293-
binaryChargingStatusFormatted,
294-
binaryBatteryLevelFormatted,
295-
binaryTotalSpaceFormatted,
296-
binaryFreeSpaceFormatted,
297-
binarySystemUptimeFormatted,
298-
binaryLastBootTimeFormatted];
299-
300-
// make sure concatenated string length is multiple of 4
301-
if (concatenated.length % 4 != 0) {
302-
int numberOfBits = concatenated.length % 4;
303-
while (numberOfBits != 4) {
304-
concatenated = [@"0" stringByAppendingString:concatenated];
305-
numberOfBits += 1;
306-
}
307-
}
308-
309-
NSString *mParameter = @"";
310-
for (NSUInteger i = 0; i < concatenated.length; i += 4) {
311-
// get fourplet substring
312-
NSString *fourplet = [concatenated substringWithRange:NSMakeRange(i, 4)];
313-
// convert fourplet to decimal number
314-
long decimalFourplet = strtol([fourplet UTF8String], NULL, 2);
315-
// append hex value of fourplet to final parameter
316-
mParameter = [mParameter stringByAppendingString:[NSString stringWithFormat:@"%lX", decimalFourplet]];
317-
}
318-
319-
return mParameter;
320-
}
321-
322217
- (void)adjCheckForiAd:(ADJActivityHandler *)activityHandler queue:(dispatch_queue_t)queue {
323218
// if no tries for iad v3 left, stop trying
324219
id<ADJLogger> logger = [ADJAdjustFactory logger];

ios/Adjust/ADJAttribution.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
// Copyright (c) 2014 adjust GmbH. All rights reserved.
77
//
88

9+
#import "ADJUtil.h"
910
#import "ADJAttribution.h"
1011
#import "NSString+ADJAdditions.h"
11-
#import "ADJUtil.h"
12+
#import "NSNumber+ADJAdditions.h"
1213

1314
@implementation ADJAttribution
1415

@@ -73,8 +74,7 @@ - (BOOL)isEqualToAttribution:(ADJAttribution *)attribution {
7374
if (![NSString adjIsEqual:self.costType toString:attribution.costType]) {
7475
return NO;
7576
}
76-
// costAmount is of type NSNumber
77-
if (![self.costAmount isEqualToNumber:attribution.costAmount]) {
77+
if (![NSNumber adjIsEqual:self.costAmount toNumber:attribution.costAmount]) {
7878
return NO;
7979
}
8080
if (![NSString adjIsEqual:self.costCurrency toString:attribution.costCurrency]) {

0 commit comments

Comments
 (0)