diff --git a/CleverTap-iOS-SDK.podspec b/CleverTap-iOS-SDK.podspec index 176cab56..3cf8a182 100644 --- a/CleverTap-iOS-SDK.podspec +++ b/CleverTap-iOS-SDK.podspec @@ -17,7 +17,7 @@ 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', 'CleverTapSDK/InApps/CustomTemplates/CTInAppTemplateBuilder.h', 'CleverTapSDK/InApps/CustomTemplates/CTAppFunctionBuilder.h', 'CleverTapSDK/InApps/CustomTemplates/CTTemplatePresenter.h', 'CleverTapSDK/InApps/CustomTemplates/CTTemplateProducer.h', 'CleverTapSDK/InApps/CustomTemplates/CTCustomTemplateBuilder.h', 'CleverTapSDK/InApps/CustomTemplates/CTCustomTemplate.h', 'CleverTapSDK/InApps/CustomTemplates/CTTemplateContext.h', 'CleverTapSDK/InApps/CustomTemplates/CTCustomTemplatesManager.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}', '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.source_files = 'CleverTapSDK/*.{h,m}', 'CleverTapSDK/FileDownload/*.{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/CTNotificationButton.{h,m}', 'CleverTapSDK/CTNotificationAction.{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 diff --git a/CleverTapSDK.xcodeproj/project.pbxproj b/CleverTapSDK.xcodeproj/project.pbxproj index 2b8624fd..6657d798 100644 --- a/CleverTapSDK.xcodeproj/project.pbxproj +++ b/CleverTapSDK.xcodeproj/project.pbxproj @@ -84,9 +84,7 @@ 071EB513217F6427008F0FAB /* CTInAppNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 071EB4C4217F6427008F0FAB /* CTInAppNotification.m */; }; 071EB514217F6427008F0FAB /* CTCoverImageViewController~ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 071EB4C5217F6427008F0FAB /* CTCoverImageViewController~ipad.xib */; }; 071EB515217F6427008F0FAB /* CTInterstitialViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 071EB4C6217F6427008F0FAB /* CTInterstitialViewController.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 071EB521217F6764008F0FAB /* CTNotificationButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 071EB4AA217F6427008F0FAB /* CTNotificationButton.h */; settings = {ATTRIBUTES = (Private, ); }; }; 071EB525217F6C8F008F0FAB /* CTUIUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 071EB4C2217F6427008F0FAB /* CTUIUtils.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 071EB527217F6CD1008F0FAB /* CTNotificationButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 071EB481217F6427008F0FAB /* CTNotificationButton.m */; }; 07238E3B221D638D0012DFAE /* CTInterstitialViewController~iphoneland.xib in Resources */ = {isa = PBXBuildFile; fileRef = 07238E3A221D638D0012DFAE /* CTInterstitialViewController~iphoneland.xib */; }; 07238E3D221E79F80012DFAE /* CTInboxSimpleMessageCell~land.xib in Resources */ = {isa = PBXBuildFile; fileRef = 07238E3C221E79F80012DFAE /* CTInboxSimpleMessageCell~land.xib */; }; 07238E3F221E7A100012DFAE /* CTCarouselMessageCell~land.xib in Resources */ = {isa = PBXBuildFile; fileRef = 07238E3E221E7A100012DFAE /* CTCarouselMessageCell~land.xib */; }; @@ -363,6 +361,12 @@ 6BA3B2E12B05411C004E834B /* InAppHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA3B2E02B05411C004E834B /* InAppHelper.m */; }; 6BA3B2E82B07E207004E834B /* CTTriggersMatcher+Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA3B2E72B07E207004E834B /* CTTriggersMatcher+Tests.m */; }; 6BAFFE9C2C371B4500654CAF /* CTFileDownloaderCustomTemplatesMock.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BAFFE9B2C371B4500654CAF /* CTFileDownloaderCustomTemplatesMock.m */; }; + 6BAFFEA82C45243B00654CAF /* CTFileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 48F9FD1A2C3D30B600617770 /* CTFileDownloader.h */; }; + 6BAFFEA92C45243C00654CAF /* CTFileDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 48F9FD1A2C3D30B600617770 /* CTFileDownloader.h */; }; + 6BAFFEAA2C45244100654CAF /* CTFileDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 48F9FD192C3D30B600617770 /* CTFileDownloader.m */; }; + 6BAFFEAB2C45244400654CAF /* CTFileDownloadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 48F9FD172C3D30B600617770 /* CTFileDownloadManager.h */; }; + 6BAFFEAC2C45244500654CAF /* CTFileDownloadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 48F9FD172C3D30B600617770 /* CTFileDownloadManager.h */; }; + 6BAFFEAD2C45244800654CAF /* CTFileDownloadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 48F9FD182C3D30B600617770 /* CTFileDownloadManager.m */; }; 6BB727122B8E458D009CE7D0 /* CTTemplateProducer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BB727112B8E458D009CE7D0 /* CTTemplateProducer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 6BB727152B8E463C009CE7D0 /* CTCustomTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BB727132B8E463C009CE7D0 /* CTCustomTemplate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 6BB727162B8E463C009CE7D0 /* CTCustomTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BB727142B8E463C009CE7D0 /* CTCustomTemplate.m */; }; @@ -1865,12 +1869,12 @@ 4E41FD8B294F44200001FBED /* CTVar.h in Headers */, D014B90620E2FB62001E0780 /* CTKnownProfileFields.h in Headers */, D014B8E820E2FA6D001E0780 /* CleverTapBuildInfo.h in Headers */, + 6BAFFEAC2C45244500654CAF /* CTFileDownloadManager.h in Headers */, D014B90020E2FB46001E0780 /* CTValidationResult.h in Headers */, D014B8E320E2F9FA001E0780 /* CleverTapInstanceConfigPrivate.h in Headers */, D014B91E20E2FBDA001E0780 /* CTPinnedNSURLSessionDelegate.h in Headers */, 4E41FD93294F46510001FBED /* CTVar-Internal.h in Headers */, D014B8E920E2FA88001E0780 /* CleverTapEventDetail.h in Headers */, - 071EB521217F6764008F0FAB /* CTNotificationButton.h in Headers */, D014B8FC20E2FB12001E0780 /* CTPreferences.h in Headers */, D014B8EE20E2FAA8001E0780 /* CleverTapUTMDetail.h in Headers */, 6BD334EB2AF2A41F0099E33E /* CTBatchSentDelegateHelper.h in Headers */, @@ -1892,6 +1896,7 @@ D0BD75AC241769710006EE55 /* CleverTap+FeatureFlags.h in Headers */, 4E7929FA29799E8F00B81F3C /* CTDomainFactory.h in Headers */, 4E25E3CC278887A80008C888 /* CTFlexibleIdentityRepo.h in Headers */, + 6BAFFEA92C45243C00654CAF /* CTFileDownloader.h in Headers */, D014B8EB20E2FA94001E0780 /* CleverTapSyncDelegate.h in Headers */, 4E49AE54275D24570074A774 /* CTValidationResultStack.h in Headers */, 07BF465D217F7C88002E166D /* CTInAppDisplayViewControllerPrivate.h in Headers */, @@ -1970,6 +1975,7 @@ 4E5A02DC2A4C5FD100DE242A /* LeanplumCT.h in Headers */, 6A3EBD3A2AA0713100CE97D4 /* CTTriggerValue.h in Headers */, 071EB4D3217F6427008F0FAB /* CTAVPlayerViewController.h in Headers */, + 6BAFFEAB2C45244400654CAF /* CTFileDownloadManager.h in Headers */, 07B9454A219EA34300D4C542 /* CTUserMO+CoreDataProperties.h in Headers */, 6B535FB62AD56C60002A2663 /* CTMultiDelegateManager.h in Headers */, 4EF0D5452AD84BCA0044C48F /* CTSessionManager.h in Headers */, @@ -2012,6 +2018,7 @@ 07D8C08B21DDEC54006F5A1B /* CTCarouselImageView.h in Headers */, 071EB515217F6427008F0FAB /* CTInterstitialViewController.h in Headers */, 0701E9622372C1950034AAC2 /* CTDisplayUnitController.h in Headers */, + 6BAFFEA82C45243B00654CAF /* CTFileDownloader.h in Headers */, 4E7929F929799E8F00B81F3C /* CTDomainFactory.h in Headers */, 6A775C3329BE78C7007790E0 /* CTVariables.h in Headers */, 0797132F21A2F09A0011C9A3 /* CTSwipeView.h in Headers */, @@ -2426,6 +2433,7 @@ 4EA64A2F296C1190001D9B22 /* CTRequest.m in Sources */, 49C189A6243B13110003E4D4 /* CleverTapFeatureFlags.m in Sources */, 4E41FD95294F46510001FBED /* CTVar.m in Sources */, + 6BAFFEAD2C45244800654CAF /* CTFileDownloadManager.m in Sources */, 4E6383DA296DE9A8001E83E3 /* CTRequestSender.m in Sources */, D014B8ED20E2FAA2001E0780 /* CleverTapTrackedViewController.m in Sources */, 4E5A02DF2A4C5FD800DE242A /* LeanplumCT.m in Sources */, @@ -2473,7 +2481,7 @@ 6BD334F62AF7FC660099E33E /* CTTriggerRadius.m in Sources */, D014B8FD20E2FB18001E0780 /* CTPreferences.m in Sources */, 4E49AE56275D24570074A774 /* CTValidationResultStack.m in Sources */, - 071EB527217F6CD1008F0FAB /* CTNotificationButton.m in Sources */, + 6BAFFEAA2C45244100654CAF /* CTFileDownloader.m in Sources */, 07BF4663217F838D002E166D /* CTInAppUtils.m in Sources */, 49C18999242CF6730003E4D4 /* CleverTapConfigValue.m in Sources */, ); diff --git a/CleverTapSDK/CTProfileBuilder.m b/CleverTapSDK/CTProfileBuilder.m index 49d2a706..e827a1c6 100644 --- a/CleverTapSDK/CTProfileBuilder.m +++ b/CleverTapSDK/CTProfileBuilder.m @@ -390,12 +390,8 @@ + (void)_handleIncrementDecrementValue:(NSNumber *_Nonnull)value forKey:(NSStrin } + (NSNumber *_Nullable)_getUpdatedValue:(NSNumber *_Nonnull)value forKey:(NSString *_Nonnull)key withCommand:(NSString *_Nonnull)command cachedValue:(id)cachedValue { - NSDictionary* operatorDict = @{ - key: @{command: value} - }; NSNumber *newValue; if ([cachedValue isKindOfClass: [NSNumber class]]) { - NSNumber *cachedNumber = (NSNumber*)cachedValue; CFNumberType numberType = CFNumberGetType((CFNumberRef)cachedNumber); @@ -449,7 +445,6 @@ + (NSNumber *_Nullable)_getUpdatedValue:(NSNumber *_Nonnull)value forKey:(NSStri } } return newValue; - } @end diff --git a/CleverTapSDK/CTUIUtils.m b/CleverTapSDK/CTUIUtils.m index 37d729fb..1245d3ac 100644 --- a/CleverTapSDK/CTUIUtils.m +++ b/CleverTapSDK/CTUIUtils.m @@ -53,7 +53,7 @@ + (UIWindow * _Nullable)getKeyWindow { + (CGFloat)getLeftMargin { CGFloat margin = 0; - if (@available(iOS 11.0, *)) { + if (@available(iOS 11.0, tvOS 11.0, *)) { for (UIWindow *window in [CTUIUtils getSharedApplication].windows) { if (window.isKeyWindow) { margin = window.safeAreaInsets.left; diff --git a/CleverTapSDK/CleverTap.h b/CleverTapSDK/CleverTap.h index 18a0de1c..8da1cced 100644 --- a/CleverTapSDK/CleverTap.h +++ b/CleverTapSDK/CleverTap.h @@ -1437,6 +1437,7 @@ extern NSString * _Nonnull const CleverTapProfileDidInitializeNotification; */ - (void)onceVariablesChangedAndNoDownloadsPending:(CleverTapVariablesChangedBlock _Nonnull )block; +#if !CLEVERTAP_NO_INAPP_SUPPORT #pragma mark Custom Templates and Functions /*! @@ -1457,6 +1458,8 @@ extern NSString * _Nonnull const CleverTapProfileDidInitializeNotification; */ - (void)syncCustomTemplates:(BOOL)isProduction; +#endif + @end #pragma clang diagnostic pop diff --git a/CleverTapSDK/CleverTap.m b/CleverTapSDK/CleverTap.m index 13715b10..274a772c 100644 --- a/CleverTapSDK/CleverTap.m +++ b/CleverTapSDK/CleverTap.m @@ -1982,12 +1982,12 @@ - (void)processEvent:(NSDictionary *)event withType:(CleverTapEventType)eventTyp } - (void)evaluateOnEvent:(NSDictionary *)event withType:(CleverTapEventType)eventType { +#if !CLEVERTAP_NO_INAPP_SUPPORT NSString *eventName = event[CLTAP_EVENT_NAME]; // Add the system properties for evaluation NSMutableDictionary *eventData = [[NSMutableDictionary alloc] initWithDictionary:[self generateAppFields]]; // Add the event properties last, so custom properties are not overriden [eventData addEntriesFromDictionary:event[CLTAP_EVENT_DATA]]; -#if !CLEVERTAP_NO_INAPP_SUPPORT if (eventName && [eventName isEqualToString:CLTAP_CHARGED_EVENT]) { NSArray *items = eventData[CLTAP_CHARGED_EVENT_ITEMS]; [self.inAppEvaluationManager evaluateOnChargedEvent:eventData andItems:items]; @@ -4308,6 +4308,7 @@ - (void)syncVariables:(BOOL)isProduction { } methodName:NSStringFromSelector(_cmd) isProduction:isProduction]; } +#if !CLEVERTAP_NO_INAPP_SUPPORT - (void)syncCustomTemplates { [self syncCustomTemplates:NO]; } @@ -4320,6 +4321,7 @@ - (void)syncCustomTemplates:(BOOL)isProduction { [self syncRequest:ctRequest logMessage:@"Define Custom Templates"]; } methodName:NSStringFromSelector(_cmd) isProduction:isProduction]; } +#endif - (void)syncWithBlock:(void(^)(void))syncBlock methodName:(NSString *)methodName isProduction:(BOOL)isProduction { if (isProduction) { diff --git a/CleverTapSDK/CleverTapInternal.h b/CleverTapSDK/CleverTapInternal.h index 53e7fca0..9befcbaf 100644 --- a/CleverTapSDK/CleverTapInternal.h +++ b/CleverTapSDK/CleverTapInternal.h @@ -8,6 +8,7 @@ #import "CTSessionManager.h" @class CTInAppDisplayManager; +@class CTFileDownloader; @interface CleverTap (Internal) diff --git a/CleverTapSDK/FileDownload/CTFileDownloader.m b/CleverTapSDK/FileDownload/CTFileDownloader.m index 78b4cbd1..2a95b15e 100644 --- a/CleverTapSDK/FileDownload/CTFileDownloader.m +++ b/CleverTapSDK/FileDownload/CTFileDownloader.m @@ -2,7 +2,9 @@ #import "CTConstants.h" #import "CTPreferences.h" #import "CTFileDownloadManager.h" +#if !CLEVERTAP_NO_INAPP_SUPPORT #import +#endif @interface CTFileDownloader() @@ -100,8 +102,10 @@ - (nullable UIImage *)loadImageFromDisk:(NSString *)imageURL { - (void)setup { self.fileDownloadManager = [CTFileDownloadManager sharedInstanceWithConfig:self.config]; self.fileExpiryTime = CLTAP_FILE_EXPIRY_OFFSET; - + +#if !CLEVERTAP_NO_INAPP_SUPPORT [self removeLegacyAssets:nil]; +#endif @synchronized (self) { NSDictionary *cachedUrlsExpiry = [CTPreferences getObjectForKey:[self storageKeyWithSuffix:CLTAP_FILE_URLS_EXPIRY_DICT]]; @@ -213,6 +217,7 @@ - (long)currentTimeInterval { return [[NSDate date] timeIntervalSince1970]; } +#if !CLEVERTAP_NO_INAPP_SUPPORT - (void)removeLegacyAssets:(void (^)(void))completion { NSArray *activeAssetsArray = [CTPreferences getObjectForKey:[self storageKeyWithSuffix:CLTAP_PREFS_CS_INAPP_ACTIVE_ASSETS]]; NSArray *inactiveAssetsArray = [CTPreferences getObjectForKey:[self storageKeyWithSuffix:CLTAP_PREFS_CS_INAPP_INACTIVE_ASSETS]]; @@ -255,5 +260,6 @@ - (void)removeLegacyAssets:(void (^)(void))completion { } }); } +#endif @end diff --git a/CleverTapSDK/ProductExperiences/CTVarCache.m b/CleverTapSDK/ProductExperiences/CTVarCache.m index 3b5a1a9e..d0f96d2d 100644 --- a/CleverTapSDK/ProductExperiences/CTVarCache.m +++ b/CleverTapSDK/ProductExperiences/CTVarCache.m @@ -178,7 +178,7 @@ - (void)loadDiffs { return; } NSKeyedUnarchiver *unarchiver; - if (@available(iOS 12.0, *)) { + if (@available(iOS 12.0, tvOS 11.0, *)) { NSError *error = nil; unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:diffsData error:&error]; if (error != nil) {