diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18ff7d6b5..380c9e7ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: build: runs-on: macos-12 env: - DERIVED_DATA: $HOME/.DerivedData + DERIVED_DATA: ${{ github.workspace }}/.DerivedData steps: - name: Checkout Repo @@ -62,14 +62,16 @@ jobs: run: | xcresultparser -o cobertura ${{ env.DERIVED_DATA }}/Logs/Test/*.xcresult/ \ > ${{ env.DERIVED_DATA }}/cobertura-coverage.xml - pwd - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - files: /Users/runner/.DerivedData/cobertura-coverage.xml + fail_ci_if_error: true + files: ./.DerivedData/cobertura-coverage.xml + directory: ${{ github.workspace }} + verbose: true - name: Parse xcresult to Sonarqube xml run: | diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 5c580cc64..d66c67293 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -49,7 +49,6 @@ 0465314824DD4272002D254C /* GIOPageEventViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 046530F724DD4271002D254C /* GIOPageEventViewController.m */; }; 0465314924DD4272002D254C /* GIOFirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 046530F924DD4271002D254C /* GIOFirstViewController.m */; }; 0465314A24DD4272002D254C /* GIOSecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 046530FA24DD4271002D254C /* GIOSecondViewController.m */; }; - 0465314B24DD4272002D254C /* GrowingIO-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 046530FD24DD4271002D254C /* GrowingIO-Info.plist */; }; 0465314C24DD4272002D254C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 046530FE24DD4271002D254C /* main.m */; }; 0465314D24DD4272002D254C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 046530FF24DD4271002D254C /* AppDelegate.m */; }; 0465314E24DD4272002D254C /* GIOLabelAttributeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0465310124DD4271002D254C /* GIOLabelAttributeViewController.m */; }; @@ -2241,7 +2240,6 @@ 0465315F24DD4272002D254C /* GIOListTableViewCell.xib in Resources */, 0465315D24DD4272002D254C /* GIOFoodTableViewCell.xib in Resources */, 34B932352767661600025C94 /* MeasurementProtocol.storyboard in Resources */, - 0465314B24DD4272002D254C /* GrowingIO-Info.plist in Resources */, 0465315924DD4272002D254C /* GIOPageStructure.storyboard in Resources */, 34BDC35A277088D40030B3CE /* UICatalogTests.storyboard in Resources */, 0465313B24DD4272002D254C /* LaunchScreen.storyboard in Resources */, @@ -3563,7 +3561,7 @@ INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; @@ -3620,7 +3618,7 @@ INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = NO; diff --git a/Example/ShareExtension/ShareViewController.m b/Example/ShareExtension/ShareViewController.m index 19f73d692..e911c12ef 100644 --- a/Example/ShareExtension/ShareViewController.m +++ b/Example/ShareExtension/ShareViewController.m @@ -32,7 +32,7 @@ - (void)viewDidLoad { GrowingAutotrackConfiguration *configuration = [GrowingAutotrackConfiguration configurationWithAccountId:@"0a1b4118dd954ec3bcc69da5138bdb96"]; configuration.dataSourceId = @"ab555003531e0fd1"; configuration.debugEnabled = YES; - [GrowingAutotracker startWithConfiguration:configuration launchOptions:nil]; + [GrowingAutotracker startWithConfiguration:configuration launchOptions:@{}]; } - (BOOL)isContentValid { diff --git a/GrowingAutotrackerCore/Autotrack/UICollectionView+GrowingAutotracker.m b/GrowingAutotrackerCore/Autotrack/UICollectionView+GrowingAutotracker.m index e6fcbb157..177d5b589 100644 --- a/GrowingAutotrackerCore/Autotrack/UICollectionView+GrowingAutotracker.m +++ b/GrowingAutotrackerCore/Autotrack/UICollectionView+GrowingAutotracker.m @@ -34,7 +34,6 @@ - (void)growing_setDelegate:(id)delegate { GUSWReturnType(void), GUSWArguments(UICollectionView * collectionView, NSIndexPath * indexPath), GUSWReplacement({ - GUSWCallOriginal(collectionView, indexPath); if (collectionView && indexPath) { UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath]; @@ -42,6 +41,7 @@ - (void)growing_setDelegate:(id)delegate { [GrowingViewClickProvider viewOnClick:cell]; } } + GUSWCallOriginal(collectionView, indexPath); }), GrowingULSwizzleModeOncePerClassAndSuperclasses, key); diff --git a/GrowingAutotrackerCore/Autotrack/UITableView+GrowingAutotracker.m b/GrowingAutotrackerCore/Autotrack/UITableView+GrowingAutotracker.m index ccf2b3fa1..ff927798f 100644 --- a/GrowingAutotrackerCore/Autotrack/UITableView+GrowingAutotracker.m +++ b/GrowingAutotrackerCore/Autotrack/UITableView+GrowingAutotracker.m @@ -34,13 +34,13 @@ - (void)growing_setDelegate:(id)delegate { GUSWReturnType(void), GUSWArguments(UITableView * tableView, NSIndexPath * indexPath), GUSWReplacement({ - GUSWCallOriginal(tableView, indexPath); if (tableView && indexPath) { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; if (cell) { [GrowingViewClickProvider viewOnClick:cell]; } } + GUSWCallOriginal(tableView, indexPath); }), GrowingULSwizzleModeOncePerClassAndSuperclasses, key); diff --git a/GrowingTrackerCore/DeepLink/GrowingSceneDelegateAutotracker.m b/GrowingTrackerCore/DeepLink/GrowingSceneDelegateAutotracker.m index c89447f2b..92e3c1c79 100644 --- a/GrowingTrackerCore/DeepLink/GrowingSceneDelegateAutotracker.m +++ b/GrowingTrackerCore/DeepLink/GrowingSceneDelegateAutotracker.m @@ -31,7 +31,7 @@ @implementation GrowingSceneDelegateAutotracker + (void)track:(Class)delegateClass { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - if (@available(iOS 13.0, *)) { + if (@available(iOS 13.0, tvOS 13.0, *)) { // URL Scheme SEL sel = @selector(scene:openURLContexts:); Method method = class_getInstanceMethod(delegateClass, sel); diff --git a/GrowingTrackerCore/Helpers/UIKit/UIApplication+GrowingHelper.m b/GrowingTrackerCore/Helpers/UIKit/UIApplication+GrowingHelper.m index f5449fcea..03ae343e3 100644 --- a/GrowingTrackerCore/Helpers/UIKit/UIApplication+GrowingHelper.m +++ b/GrowingTrackerCore/Helpers/UIKit/UIApplication+GrowingHelper.m @@ -22,6 +22,7 @@ #if Growing_OS_IOS #import "GrowingTrackerCore/GrowingWindow.h" #import "GrowingTrackerCore/Helpers/UIKit/UIApplication+GrowingHelper.h" +#import "GrowingULApplication.h" @implementation UIApplication (GrowingHelper) @@ -30,7 +31,7 @@ @implementation UIApplication (GrowingHelper) /// 我们需要将其加入数组中 - (NSArray *)growingHelper_allWindows { NSArray *array = [self windows]; - UIWindow *keyWindow = [self keyWindow]; + UIWindow *keyWindow = [self growingul_keyWindow]; if (!keyWindow) { return array; diff --git a/GrowingTrackerCore/Network/GrowingNetworkInterfaceManager.m b/GrowingTrackerCore/Network/GrowingNetworkInterfaceManager.m index 27931f1f5..8a507c0b3 100644 --- a/GrowingTrackerCore/Network/GrowingNetworkInterfaceManager.m +++ b/GrowingTrackerCore/Network/GrowingNetworkInterfaceManager.m @@ -85,7 +85,10 @@ - (NSString *)networkType { } } } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" accessString = self.teleInfo.currentRadioAccessTechnology; +#pragma clang diagnostic pop } if ([typeStrings4G containsObject:accessString]) { diff --git a/GrowingTrackerCore/Thirdparty/Logger/GrowingLog.h b/GrowingTrackerCore/Thirdparty/Logger/GrowingLog.h index 7f9b0d5e8..d19ac1066 100755 --- a/GrowingTrackerCore/Thirdparty/Logger/GrowingLog.h +++ b/GrowingTrackerCore/Thirdparty/Logger/GrowingLog.h @@ -14,24 +14,12 @@ // prior written permission of Deusty, LLC. #import - -// The Swift Package integration has no support for the legacy macros. -#if __has_include() - // Enable 1.9.x legacy macros if imported directly and it's not a swift package build. - #ifndef Growing_LEGACY_MACROS - #define Growing_LEGACY_MACROS 1 - #endif - // Growing_LEGACY_MACROS is checked in the file itself - #import "GrowingLegacyMacros.h" -#endif - -// Names of loggers. #import "GrowingTrackerCore/Thirdparty/Logger/GrowingLoggerNames.h" #if OS_OBJECT_USE_OBJC - #define DISPATCH_QUEUE_REFERENCE_TYPE strong + #define GIO_DISPATCH_QUEUE_REFERENCE_TYPE strong #else - #define DISPATCH_QUEUE_REFERENCE_TYPE assign + #define GIO_DISPATCH_QUEUE_REFERENCE_TYPE assign #endif @class GrowingLogMessage; @@ -224,7 +212,7 @@ FOUNDATION_EXTERN NSString * __nullable GrowingExtractFileNameWithoutExtension(c * Provides access to the underlying logging queue. * This may be helpful to Logger classes for things like thread synchronization. **/ -@property (class, nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggingQueue; +@property (class, nonatomic, GIO_DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggingQueue; /** * Logging Primitive. @@ -304,7 +292,7 @@ FOUNDATION_EXTERN NSString * __nullable GrowingExtractFileNameWithoutExtension(c line:(NSUInteger)line tag:(nullable id)tag format:(NSString *)format - args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:)); + args:(va_list)argList; /** * Logging Primitive. @@ -332,7 +320,7 @@ FOUNDATION_EXTERN NSString * __nullable GrowingExtractFileNameWithoutExtension(c line:(NSUInteger)line tag:(nullable id)tag format:(NSString *)format - args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:)); + args:(va_list)argList; /** * Logging Primitive. @@ -343,7 +331,7 @@ FOUNDATION_EXTERN NSString * __nullable GrowingExtractFileNameWithoutExtension(c * @param logMessage the log message stored in a `GrowingLogMessage` model object */ + (void)log:(BOOL)asynchronous - message:(GrowingLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:)); + message:(GrowingLogMessage *)logMessage; /** * Logging Primitive. @@ -354,7 +342,7 @@ FOUNDATION_EXTERN NSString * __nullable GrowingExtractFileNameWithoutExtension(c * @param logMessage the log message stored in a `GrowingLogMessage` model object */ - (void)log:(BOOL)asynchronous - message:(GrowingLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:)); + message:(GrowingLogMessage *)logMessage; /** * Since logging can be asynchronous, there may be times when you want to flush the logs. @@ -573,7 +561,7 @@ FOUNDATION_EXTERN NSString * __nullable GrowingExtractFileNameWithoutExtension(c * * @param logMessage the message (model) */ -- (void)logMessage:(GrowingLogMessage *)logMessage NS_SWIFT_NAME(log(message:)); +- (void)logMessage:(GrowingLogMessage *)logMessage; /** * Formatters may optionally be added to any logger. @@ -633,7 +621,7 @@ FOUNDATION_EXTERN NSString * __nullable GrowingExtractFileNameWithoutExtension(c * Thus, a dedicated dispatch queue is used for each logger. * Logger implementations may optionally choose to provide their own dispatch queue. **/ -@property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggerQueue; +@property (nonatomic, GIO_DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggerQueue; /** * If the logger implementation does not choose to provide its own queue, @@ -666,7 +654,7 @@ FOUNDATION_EXTERN NSString * __nullable GrowingExtractFileNameWithoutExtension(c * The formatter may also optionally filter the log message by returning nil, * in which case the logger will not log the message. **/ -- (nullable NSString *)formatLogMessage:(GrowingLogMessage *)logMessage NS_SWIFT_NAME(format(message:)); +- (nullable NSString *)formatLogMessage:(GrowingLogMessage *)logMessage; @optional @@ -884,7 +872,7 @@ typedef NS_OPTIONS(NSInteger, GrowingLogMessageOptions){ } @property (nonatomic, strong, nullable) id logFormatter; -@property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE) dispatch_queue_t loggerQueue; +@property (nonatomic, GIO_DISPATCH_QUEUE_REFERENCE_TYPE) dispatch_queue_t loggerQueue; // For thread-safety assertions diff --git a/GrowingTrackerCore/Utils/GrowingArgumentChecker.h b/GrowingTrackerCore/Utils/GrowingArgumentChecker.h index a298a6396..bdea86a69 100644 --- a/GrowingTrackerCore/Utils/GrowingArgumentChecker.h +++ b/GrowingTrackerCore/Utils/GrowingArgumentChecker.h @@ -19,6 +19,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface GrowingArgumentChecker : NSObject + (BOOL)isIllegalEventName:(NSString *)eventName; @@ -27,3 +29,5 @@ + (NSDictionary *_Nullable)serializableAttributes:(NSDictionary *)properties; @end + +NS_ASSUME_NONNULL_END diff --git a/GrowingTrackerCore/Utils/GrowingKeyChainWrapper.m b/GrowingTrackerCore/Utils/GrowingKeyChainWrapper.m index 5560ccc8f..c8d2913f8 100644 --- a/GrowingTrackerCore/Utils/GrowingKeyChainWrapper.m +++ b/GrowingTrackerCore/Utils/GrowingKeyChainWrapper.m @@ -18,6 +18,7 @@ // limitations under the License. #import "GrowingTrackerCore/Utils/GrowingKeyChainWrapper.h" +#import "GrowingTargetConditionals.h" #import "GrowingTrackerCore/Thirdparty/Logger/GrowingLogger.h" @implementation GrowingKeyChainWrapper @@ -30,7 +31,23 @@ + (void)setKeychainObject:(id)value forKey:(NSString *)service { SecItemDelete((CFDictionaryRef)keychainQuery); // Add new object to search dictionary(Attention:the data format) - [keychainQuery setObject:[NSKeyedArchiver archivedDataWithRootObject:value] forKey:(id)kSecValueData]; +#if Growing_OS_VISION + if (1) { // if (@available(visionOS 1.0, *)) { +#else + if (@available(iOS 11.0, macCatalyst 13.1, macOS 10.13, tvOS 11.0, watchOS 4.0, *)) { +#endif + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:value requiringSecureCoding:YES error:nil]; + [keychainQuery setObject:data forKey:(id)kSecValueData]; + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:value]; + [keychainQuery setObject:data forKey:(id)kSecValueData]; +#pragma clang diagnostic pop + } + + // Configure accessible attribute + [keychainQuery setObject:(id)kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly forKey:(id)kSecAttrAccessible]; // Add item to keychain with the search dictionary SecItemAdd((CFDictionaryRef)keychainQuery, NULL); @@ -48,7 +65,20 @@ + (id)keyChainObjectForKey:(NSString *)key { CFDataRef keyData = NULL; if (SecItemCopyMatching((CFDictionaryRef)keychainQuery, (CFTypeRef *)&keyData) == noErr) { @try { - ret = [NSKeyedUnarchiver unarchiveObjectWithData:(__bridge NSData *)keyData]; +#if Growing_OS_VISION + if (1) { // if (@available(visionOS 1.0, *)) { +#else + if (@available(iOS 11.0, macCatalyst 13.1, macOS 10.13, tvOS 11.0, watchOS 4.0, *)) { +#endif + ret = [NSKeyedUnarchiver unarchivedObjectOfClass:[NSString class] + fromData:(__bridge NSData *)keyData + error:nil]; + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + ret = [NSKeyedUnarchiver unarchiveObjectWithData:(__bridge NSData *)keyData]; +#pragma clang diagnostic pop + } } @catch (NSException *e) { GIOLogError(@"GrowingIO Unarchive of %@ failed: %@", key, e); } @finally { @@ -58,7 +88,6 @@ + (id)keyChainObjectForKey:(NSString *)key { return ret; } -// keychain + (NSMutableDictionary *)getKeychainQuery:(NSString *)key { return [NSMutableDictionary dictionaryWithObjectsAndKeys:(id)kSecClassGenericPassword, (id)kSecClass, @@ -66,8 +95,6 @@ + (NSMutableDictionary *)getKeychainQuery:(NSString *)key { (id)kSecAttrService, key, (id)kSecAttrAccount, - (id)kSecAttrAccessibleAlwaysThisDeviceOnly, - (id)kSecAttrAccessible, nil]; }