Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into SDK-3338-XCPrivacyFile_iOS17
  • Loading branch information
AishwaryaNanna committed Feb 18, 2024
2 parents e4af41c + df87c8a commit 1cc996d
Show file tree
Hide file tree
Showing 126 changed files with 11,161 additions and 1,741 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Change Log
All notable changes to this project will be documented in this file.

### [Version 6.0.0](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/6.0.0) (January 15, 2024)

#### Added
- Adds support for client-side in-apps.

#### Fixed
- Fixes a bug where some in-apps were not being dismissed.

### [Version 5.2.2](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/5.2.2) (November 21, 2023)

#### Fixed
Expand Down
7 changes: 3 additions & 4 deletions CleverTap-iOS-SDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ s.requires_arc = true
s.module_name = 'CleverTapSDK'
s.resources = 'CleverTapSDK/*.{cer,xcprivacy}'
s.ios.dependency 'SDWebImage', '~> 5.11'
s.ios.resource_bundle = {'CleverTapSDK' => ['CleverTapSDK/**/*.{png,xib}', 'CleverTapSDK/**/*.xcdatamodeld']}
s.ios.resource_bundle = {'CleverTapSDK' => ['CleverTapSDK/**/*.{png,xib,html}', 'CleverTapSDK/**/*.xcdatamodeld']}
s.ios.deployment_target = '9.0'
s.ios.source_files = 'CleverTapSDK/**/*.{h,m}'
s.ios.exclude_files = 'CleverTapSDK/include/**/*.h'
s.ios.public_header_files = 'CleverTapSDK/CleverTap.h', 'CleverTapSDK/CleverTap+SSLPinning.h','CleverTapSDK/CleverTap+Inbox.h', 'CleverTapSDK/CleverTapInstanceConfig.h', 'CleverTapSDK/CleverTapBuildInfo.h', 'CleverTapSDK/CleverTapEventDetail.h', 'CleverTapSDK/CleverTapInAppNotificationDelegate.h', 'CleverTapSDK/CleverTapSyncDelegate.h', 'CleverTapSDK/CleverTapTrackedViewController.h', 'CleverTapSDK/CleverTapUTMDetail.h', 'CleverTapSDK/CleverTapJSInterface.h', 'CleverTapSDK/CleverTap+DisplayUnit.h', 'CleverTapSDK/CleverTap+FeatureFlags.h', 'CleverTapSDK/CleverTap+ProductConfig.h', 'CleverTapSDK/CleverTapPushNotificationDelegate.h', 'CleverTapSDK/CleverTapURLDelegate.h', 'CleverTapSDK/CleverTap+InAppNotifications.h', 'CleverTapSDK/CleverTap+SCDomain.h', 'CleverTapSDK/CleverTap+PushPermission.h', 'CleverTapSDK/InApps/CTLocalInApp.h', 'CleverTapSDK/CleverTap+CTVar.h', 'CleverTapSDK/ProductExperiences/CTVar.h', 'CleverTapSDK/LeanplumCT.h'
s.tvos.deployment_target = '9.0'
s.tvos.source_files = 'CleverTapSDK/*.{h,m}', 'CleverTapSDK/ProductConfig/**/*.{h,m}', 'CleverTapSDK/FeatureFlags/**/*.{h,m}', 'CleverTapSDK/ProductExperiences/*.{h,m}'
s.tvos.exclude_files = 'CleverTapSDK/include/**/*.h'
s.tvos.exclude_files = 'CleverTapSDK/CleverTapJSInterface.{h,m}'
s.tvos.source_files = 'CleverTapSDK/*.{h,m}', 'CleverTapSDK/ProductConfig/**/*.{h,m}', 'CleverTapSDK/FeatureFlags/**/*.{h,m}', 'CleverTapSDK/ProductExperiences/*.{h,m}', 'CleverTapSDK/Swizzling/*.{h,m}', 'CleverTapSDK/Session/*.{h,m}'
s.tvos.exclude_files = 'CleverTapSDK/include/**/*.h', 'CleverTapSDK/CleverTapJSInterface.{h,m}', 'CleverTapSDK/CTInAppNotification.{h,m}', 'CleverTapSDK/CTPushPrimerManager.{h,m}', 'CleverTapSDK/InApps/*.{h,m}', 'CleverTapSDK/InApps/**/*.{h,m}', 'CleverTapSDK/CTInAppFCManager.{h,m}', 'CleverTapSDK/CTInAppDisplayViewController.{h,m}'
s.tvos.public_header_files = 'CleverTapSDK/CleverTap.h', 'CleverTapSDK/CleverTap+SSLPinning.h', 'CleverTapSDK/CleverTapInstanceConfig.h', 'CleverTapSDK/CleverTapBuildInfo.h', 'CleverTapSDK/CleverTapEventDetail.h', 'CleverTapSDK/CleverTapSyncDelegate.h', 'CleverTapSDK/CleverTapTrackedViewController.h', 'CleverTapSDK/CleverTapUTMDetail.h', 'CleverTapSDK/CleverTap+FeatureFlags.h', 'CleverTapSDK/CleverTap+ProductConfig.h', 'CleverTapSDK/CleverTap+CTVar.h', 'CleverTapSDK/ProductExperiences/CTVar.h'
end
481 changes: 426 additions & 55 deletions CleverTapSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion CleverTapSDK/CTAES.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#import <Foundation/Foundation.h>
#import "CleverTap.h"

@interface CTAES : NSObject<NSSecureCoding>
@interface CTAES : NSObject <NSSecureCoding>

/**
* Returns AES128 encrypted string using the crypto framework.
Expand All @@ -15,4 +15,10 @@

- (instancetype)initWithAccountID:(NSString *)accountID encryptionLevel:(CleverTapEncryptionLevel)encryptionLevel isDefaultInstance:(BOOL)isDefaultInstance;

- (NSString *)getEncryptedBase64String:(id)objectToEncrypt;

- (id)getDecryptedObject:(NSString *)encryptedString;

- (instancetype)initWithAccountID:(NSString *)accountID;

@end
46 changes: 41 additions & 5 deletions CleverTapSDK/CTAES.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import <CommonCrypto/CommonCryptor.h>
#import "CTAES.h"
#import <CommonCrypto/CommonCryptor.h>
#import "CTConstants.h"
#import "CTPreferences.h"
#import "CTUtils.h"
Expand Down Expand Up @@ -28,10 +28,11 @@ - (instancetype)initWithAccountID:(NSString *)accountID
return self;
}

- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject: _accountID forKey:@"accountID"];
[coder encodeBool: _isDefaultInstance forKey:@"isDefaultInstance"];
[coder encodeInt: _encryptionLevel forKey:@"encryptionLevel"];
- (instancetype)initWithAccountID:(NSString *)accountID {
if (self = [super init]) {
_accountID = accountID;
}
return self;
}

- (nullable instancetype)initWithCoder:(nonnull NSCoder *)coder {
Expand All @@ -43,6 +44,12 @@ - (nullable instancetype)initWithCoder:(nonnull NSCoder *)coder {
return self;
}

- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject: _accountID forKey:@"accountID"];
[coder encodeBool: _isDefaultInstance forKey:@"isDefaultInstance"];
[coder encodeInt: _encryptionLevel forKey:@"encryptionLevel"];
}

+ (BOOL)supportsSecureCoding {
return YES;
}
Expand Down Expand Up @@ -194,4 +201,33 @@ - (NSString *)generateKeyPassword {
return keyPassword;
}

- (NSString *)getEncryptedBase64String:(id)objectToEncrypt {
@try {
NSData *dataValue = [NSKeyedArchiver archivedDataWithRootObject:objectToEncrypt];
NSData *encryptedData = [self convertData:dataValue withOperation:kCCEncrypt];
if (encryptedData) {
return [encryptedData base64EncodedStringWithOptions:kNilOptions];
}
} @catch (NSException *e) {
CleverTapLogStaticInternal(@"Error: %@ while encrypting object: %@", e.debugDescription, objectToEncrypt);
return nil;
}
return nil;
}

- (id)getDecryptedObject:(NSString *)encryptedString {
if (!encryptedString) return nil;
@try {
NSData *dataValue = [[NSData alloc] initWithBase64EncodedString:encryptedString options:kNilOptions];
NSData *decryptedData = [self convertData:dataValue withOperation:kCCDecrypt];
if (decryptedData && decryptedData.length > 0) {
return [NSKeyedUnarchiver unarchiveObjectWithData:decryptedData];
}
} @catch (NSException *e) {
CleverTapLogStaticInternal(@"Error: %@ while decrypting string: %@", e.debugDescription, encryptedString);
return nil;
}
return nil;
}

@end
22 changes: 22 additions & 0 deletions CleverTapSDK/CTAttachToBatchHeaderDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// CTAttachToBatchHeaderDelegate.h
// CleverTapSDK
//
// Created by Nikola Zagorchev on 29.09.23.
// Copyright © 2023 CleverTap. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CTQueueType.h"

NS_ASSUME_NONNULL_BEGIN

typedef NSDictionary<NSString *, id> * _Nonnull BatchHeaderKeyPathValues;

@protocol CTAttachToBatchHeaderDelegate <NSObject>

- (BatchHeaderKeyPathValues)onBatchHeaderCreationForQueue:(CTQueueType)queueType;

@end

NS_ASSUME_NONNULL_END
19 changes: 19 additions & 0 deletions CleverTapSDK/CTBatchSentDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// CTBatchSentDelegate.h
// CleverTapSDK
//
// Created by Nikola Zagorchev on 12.09.23.
// Copyright © 2023 CleverTap. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol CTBatchSentDelegate <NSObject>

@optional
- (void)onBatchSent:(NSArray *)batchWithHeader withSuccess:(BOOL)success;

@optional
- (void)onAppLaunchedWithSuccess:(BOOL)success;

@end
19 changes: 19 additions & 0 deletions CleverTapSDK/CTBatchSentDelegateHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// CTBatchSentDelegateHelper.h
// CleverTapSDK
//
// Created by Nikola Zagorchev on 1.11.23.
// Copyright © 2023 CleverTap. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface CTBatchSentDelegateHelper : NSObject

+ (BOOL)isBatchWithAppLaunched:(NSArray *)batchWithHeader;

@end

NS_ASSUME_NONNULL_END
24 changes: 24 additions & 0 deletions CleverTapSDK/CTBatchSentDelegateHelper.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// CTBatchSentDelegateHelper.m
// CleverTapSDK
//
// Created by Nikola Zagorchev on 1.11.23.
// Copyright © 2023 CleverTap. All rights reserved.
//

#import "CTBatchSentDelegateHelper.h"
#import "CTConstants.h"

@implementation CTBatchSentDelegateHelper

+ (BOOL)isBatchWithAppLaunched:(NSArray *)batchWithHeader {
// Find the event with evtName == "App Launched"
for (NSDictionary *event in batchWithHeader) {
if ([event[CLTAP_EVENT_NAME] isEqualToString:CLTAP_APP_LAUNCHED_EVENT]) {
return YES;
}
}
return NO;
}

@end
17 changes: 17 additions & 0 deletions CleverTapSDK/CTClock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// CTClock.h
// CleverTapSDK
//
// Created by Nikola Zagorchev on 27.10.23.
// Copyright © 2023 CleverTap. All rights reserved.
//

#ifndef CTClock_h
#define CTClock_h

@protocol CTClock <NSObject>
- (NSNumber *)timeIntervalSince1970;
- (NSDate *)currentDate;
@end

#endif /* CTClock_h */
Loading

0 comments on commit 1cc996d

Please sign in to comment.