diff --git a/ios/src/Countly.xcodeproj/project.pbxproj b/ios/src/Countly.xcodeproj/project.pbxproj index fcfd3bff..a76ecdf4 100644 --- a/ios/src/Countly.xcodeproj/project.pbxproj +++ b/ios/src/Countly.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 55; objects = { /* Begin PBXBuildFile section */ @@ -16,11 +16,18 @@ 1A423E9E2A271E46008C4757 /* CountlyRCData.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A423E9D2A271E46008C4757 /* CountlyRCData.m */; }; 1A423EA02A271FE0008C4757 /* CountlyRCData.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A423E9F2A271E52008C4757 /* CountlyRCData.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1A478D032AB314750056A5E7 /* CountlyExperimentInformation.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9027FF2AB197C00044EBCF /* CountlyExperimentInformation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1A50D7052B3C5AA3009C6938 /* CountlyBaseTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A50D7042B3C5AA3009C6938 /* CountlyBaseTestCase.swift */; }; + 1A5C4C972B35B0850032EE1F /* CountlyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A5C4C962B35B0850032EE1F /* CountlyTests.swift */; }; + 1A5C4C982B35B0850032EE1F /* Countly.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B20A9822245225A00E3D7AE /* Countly.framework */; platformFilters = (ios, macos, ); }; 1A9027FE2AB197B50044EBCF /* CountlyExperimentInformation.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A9027FD2AB197B50044EBCF /* CountlyExperimentInformation.m */; }; 1ACA5DC12A309E7F001F770B /* CountlyRemoteConfigInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACA5DBF2A309E7F001F770B /* CountlyRemoteConfigInternal.h */; }; 1ACA5DC22A309E7F001F770B /* CountlyRemoteConfigInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = 1ACA5DC02A309E7F001F770B /* CountlyRemoteConfigInternal.m */; }; + 1AFD79022B3EF82C00772FBD /* CountlyTests-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFD79012B3EF82C00772FBD /* CountlyTests-Bridging-Header.h */; }; + 3948A8572BAC2E7D002D09AA /* CountlySDKLimitsConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 3948A8552BAC2E7D002D09AA /* CountlySDKLimitsConfig.m */; }; + 3948A8582BAC2E7D002D09AA /* CountlySDKLimitsConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 3948A8562BAC2E7D002D09AA /* CountlySDKLimitsConfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; 39527E152B5FD27400EE5D7B /* CountlyAPMConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 39527E142B5FD27400EE5D7B /* CountlyAPMConfig.m */; }; 39527E182B5FD54C00EE5D7B /* CountlyAPMConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 39527E162B5FD28900EE5D7B /* CountlyAPMConfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 39911B672B457DBB00AC053C /* Resettable.h in Headers */ = {isa = PBXBuildFile; fileRef = 39911B662B457DB500AC053C /* Resettable.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3B20A9872245225A00E3D7AE /* Countly.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B20A9852245225A00E3D7AE /* Countly.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3B20A9B22245228700E3D7AE /* CountlyConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B20A98D2245228300E3D7AE /* CountlyConnectionManager.h */; }; 3B20A9B32245228700E3D7AE /* CountlyNotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B20A98E2245228300E3D7AE /* CountlyNotificationService.m */; }; @@ -59,6 +66,16 @@ D2CFEF982545FBE80026B044 /* CountlyFeedbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = D2CFEF962545FBE80026B044 /* CountlyFeedbacks.m */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 1A5C4C992B35B0850032EE1F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3B20A9792245225A00E3D7AE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3B20A9812245225A00E3D7AE; + remoteInfo = Countly; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ 1A3110622A7128CD001CB507 /* CountlyViewData.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CountlyViewData.m; sourceTree = ""; }; 1A3110642A7128DC001CB507 /* CountlyViewData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CountlyViewData.h; sourceTree = ""; }; @@ -68,12 +85,20 @@ 1A3A576429ED47B50041B7BE /* CountlyServerConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CountlyServerConfig.h; sourceTree = ""; }; 1A423E9D2A271E46008C4757 /* CountlyRCData.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CountlyRCData.m; sourceTree = ""; }; 1A423E9F2A271E52008C4757 /* CountlyRCData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CountlyRCData.h; sourceTree = ""; }; + 1A50D7042B3C5AA3009C6938 /* CountlyBaseTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountlyBaseTestCase.swift; sourceTree = ""; }; + 1A5C4C942B35B0850032EE1F /* CountlyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CountlyTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 1A5C4C962B35B0850032EE1F /* CountlyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountlyTests.swift; sourceTree = ""; }; 1A9027FD2AB197B50044EBCF /* CountlyExperimentInformation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CountlyExperimentInformation.m; sourceTree = ""; }; 1A9027FF2AB197C00044EBCF /* CountlyExperimentInformation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CountlyExperimentInformation.h; sourceTree = ""; }; 1ACA5DBF2A309E7F001F770B /* CountlyRemoteConfigInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CountlyRemoteConfigInternal.h; sourceTree = ""; }; 1ACA5DC02A309E7F001F770B /* CountlyRemoteConfigInternal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CountlyRemoteConfigInternal.m; sourceTree = ""; }; + 1AFD79012B3EF82C00772FBD /* CountlyTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CountlyTests-Bridging-Header.h"; sourceTree = ""; }; + 3948A8552BAC2E7D002D09AA /* CountlySDKLimitsConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CountlySDKLimitsConfig.m; sourceTree = ""; }; + 3948A8562BAC2E7D002D09AA /* CountlySDKLimitsConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CountlySDKLimitsConfig.h; sourceTree = ""; }; 39527E142B5FD27400EE5D7B /* CountlyAPMConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CountlyAPMConfig.m; sourceTree = ""; }; 39527E162B5FD28900EE5D7B /* CountlyAPMConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CountlyAPMConfig.h; sourceTree = ""; }; + 395683372BB2988300C7A06B /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + 39911B662B457DB500AC053C /* Resettable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Resettable.h; sourceTree = ""; }; 3B20A9822245225A00E3D7AE /* Countly.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Countly.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3B20A9852245225A00E3D7AE /* Countly.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Countly.h; sourceTree = ""; }; 3B20A9862245225A00E3D7AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -115,6 +140,14 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 1A5C4C912B35B0850032EE1F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1A5C4C982B35B0850032EE1F /* Countly.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B20A97F2245225A00E3D7AE /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -125,9 +158,23 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1A5C4C952B35B0850032EE1F /* CountlyTests */ = { + isa = PBXGroup; + children = ( + 1A5C4C962B35B0850032EE1F /* CountlyTests.swift */, + 1A50D7042B3C5AA3009C6938 /* CountlyBaseTestCase.swift */, + 1AFD79012B3EF82C00772FBD /* CountlyTests-Bridging-Header.h */, + ); + path = CountlyTests; + sourceTree = ""; + }; 3B20A9782245225A00E3D7AE = { isa = PBXGroup; children = ( + 395683372BB2988300C7A06B /* PrivacyInfo.xcprivacy */, + 3948A8562BAC2E7D002D09AA /* CountlySDKLimitsConfig.h */, + 3948A8552BAC2E7D002D09AA /* CountlySDKLimitsConfig.m */, + 39911B662B457DB500AC053C /* Resettable.h */, 39527E162B5FD28900EE5D7B /* CountlyAPMConfig.h */, 39527E142B5FD27400EE5D7B /* CountlyAPMConfig.m */, 1A9027FF2AB197C00044EBCF /* CountlyExperimentInformation.h */, @@ -179,6 +226,7 @@ 3B20A9A72245228500E3D7AE /* CountlyViewTrackingInternal.h */, 3B20A9A32245228500E3D7AE /* CountlyViewTrackingInternal.m */, 3B20A9862245225A00E3D7AE /* Info.plist */, + 1A5C4C952B35B0850032EE1F /* CountlyTests */, 3B20A9832245225A00E3D7AE /* Products */, ); sourceTree = ""; @@ -187,6 +235,7 @@ isa = PBXGroup; children = ( 3B20A9822245225A00E3D7AE /* Countly.framework */, + 1A5C4C942B35B0850032EE1F /* CountlyTests.xctest */, ); name = Products; sourceTree = ""; @@ -194,6 +243,14 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 1AFD78FC2B3EF63D00772FBD /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1AFD79022B3EF82C00772FBD /* CountlyTests-Bridging-Header.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B20A97D2245225A00E3D7AE /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -210,8 +267,10 @@ 1A3A576529ED47BD0041B7BE /* CountlyServerConfig.h in Headers */, 1ACA5DC12A309E7F001F770B /* CountlyRemoteConfigInternal.h in Headers */, 3B20A9CC2245228700E3D7AE /* CountlyViewTrackingInternal.h in Headers */, + 3948A8582BAC2E7D002D09AA /* CountlySDKLimitsConfig.h in Headers */, 3B20A9BF2245228700E3D7AE /* CountlyLocationManager.h in Headers */, D219374B248AC71C00E5798B /* CountlyPerformanceMonitoring.h in Headers */, + 39911B672B457DBB00AC053C /* Resettable.h in Headers */, 3B20A9BC2245228700E3D7AE /* CountlyCommon.h in Headers */, 39527E182B5FD54C00EE5D7B /* CountlyAPMConfig.h in Headers */, 3B20A9C52245228700E3D7AE /* CountlyCrashReporter.h in Headers */, @@ -229,6 +288,25 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 1A5C4C932B35B0850032EE1F /* CountlyTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1A5C4C9B2B35B0850032EE1F /* Build configuration list for PBXNativeTarget "CountlyTests" */; + buildPhases = ( + 1AFD78FC2B3EF63D00772FBD /* Headers */, + 1A5C4C902B35B0850032EE1F /* Sources */, + 1A5C4C912B35B0850032EE1F /* Frameworks */, + 1A5C4C922B35B0850032EE1F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1A5C4C9A2B35B0850032EE1F /* PBXTargetDependency */, + ); + name = CountlyTests; + productName = CountlyTests; + productReference = 1A5C4C942B35B0850032EE1F /* CountlyTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 3B20A9812245225A00E3D7AE /* Countly */ = { isa = PBXNativeTarget; buildConfigurationList = 3B20A98A2245225A00E3D7AE /* Build configuration list for PBXNativeTarget "Countly" */; @@ -253,11 +331,16 @@ 3B20A9792245225A00E3D7AE /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftUpdateCheck = 1410; LastUpgradeCheck = 1410; ORGANIZATIONNAME = "Alin Radut"; TargetAttributes = { + 1A5C4C932B35B0850032EE1F = { + CreatedOnToolsVersion = 14.1; + }; 3B20A9812245225A00E3D7AE = { CreatedOnToolsVersion = 10.1; + LastSwiftMigration = 1410; }; }; }; @@ -275,11 +358,19 @@ projectRoot = ""; targets = ( 3B20A9812245225A00E3D7AE /* Countly */, + 1A5C4C932B35B0850032EE1F /* CountlyTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 1A5C4C922B35B0850032EE1F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B20A9802245225A00E3D7AE /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -290,6 +381,15 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 1A5C4C902B35B0850032EE1F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1A5C4C972B35B0850032EE1F /* CountlyTests.swift in Sources */, + 1A50D7052B3C5AA3009C6938 /* CountlyBaseTestCase.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3B20A97E2245225A00E3D7AE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -303,6 +403,7 @@ 3B20A9CE2245228700E3D7AE /* CountlyCrashReporter.m in Sources */, 3B20A9D42245228700E3D7AE /* CountlyPersistency.m in Sources */, 3B20A9B32245228700E3D7AE /* CountlyNotificationService.m in Sources */, + 3948A8572BAC2E7D002D09AA /* CountlySDKLimitsConfig.m in Sources */, D2CFEF982545FBE80026B044 /* CountlyFeedbacks.m in Sources */, 1A3110632A7128CD001CB507 /* CountlyViewData.m in Sources */, 1A423E9E2A271E46008C4757 /* CountlyRCData.m in Sources */, @@ -324,7 +425,67 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 1A5C4C9A2B35B0850032EE1F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + platformFilters = ( + ios, + macos, + ); + target = 3B20A9812245225A00E3D7AE /* Countly */; + targetProxy = 1A5C4C992B35B0850032EE1F /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ + 1A5C4C9C2B35B0850032EE1F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.1; + MACOSX_DEPLOYMENT_TARGET = 13.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.countly.CountlyTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OBJC_BRIDGING_HEADER = "CountlyTests/CountlyTests-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 1A5C4C9D2B35B0850032EE1F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.1; + MACOSX_DEPLOYMENT_TARGET = 13.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.countly.CountlyTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_OBJC_BRIDGING_HEADER = "CountlyTests/CountlyTests-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; 3B20A9882245225A00E3D7AE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -456,6 +617,7 @@ 3B20A98B2245225A00E3D7AE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Manual; DEFINES_MODULE = YES; @@ -472,12 +634,14 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 24.1.0; + MARKETING_VERSION = 24.4.0; PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SUPPORTS_MACCATALYST = NO; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -485,6 +649,7 @@ 3B20A98C2245225A00E3D7AE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Manual; DEFINES_MODULE = YES; @@ -501,12 +666,13 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 24.1.0; + MARKETING_VERSION = 24.4.0; PRODUCT_BUNDLE_IDENTIFIER = ly.count.CountlyiOSSDK; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SUPPORTS_MACCATALYST = NO; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; name = Release; @@ -514,6 +680,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 1A5C4C9B2B35B0850032EE1F /* Build configuration list for PBXNativeTarget "CountlyTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1A5C4C9C2B35B0850032EE1F /* Debug */, + 1A5C4C9D2B35B0850032EE1F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 3B20A97C2245225A00E3D7AE /* Build configuration list for PBXProject "Countly" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/ios/src/CountlyTests/CountlyBaseTestCase.swift b/ios/src/CountlyTests/CountlyBaseTestCase.swift new file mode 100644 index 00000000..fde220b4 --- /dev/null +++ b/ios/src/CountlyTests/CountlyBaseTestCase.swift @@ -0,0 +1,42 @@ +// +// CountlyBaseTestCase.swift +// CountlyTests +// +// Created by Muhammad Junaid Akram on 27/12/2023. +// Copyright © 2023 Alin Radut. All rights reserved. +// + +import XCTest +@testable import Countly + +class CountlyBaseTestCase: XCTestCase { + var countly: Countly! + var deviceID: String = "" + let appKey: String = "appkey" + var host: String = "https://test.count.ly/" + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + cleanupState() + } + + func createBaseConfig() -> CountlyConfig { + let config: CountlyConfig = CountlyConfig() + config.appKey = appKey + config.host = host + config.enableDebug = true + config.features = [CLYFeature.crashReporting]; + return config + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func cleanupState() { + Countly.sharedInstance().halt(true) + } + +} + + diff --git a/ios/src/CountlyTests/CountlyTests-Bridging-Header.h b/ios/src/CountlyTests/CountlyTests-Bridging-Header.h new file mode 100644 index 00000000..d744d0d9 --- /dev/null +++ b/ios/src/CountlyTests/CountlyTests-Bridging-Header.h @@ -0,0 +1 @@ +#import "CountlyCommon.h" diff --git a/ios/src/CountlyTests/CountlyTests.swift b/ios/src/CountlyTests/CountlyTests.swift new file mode 100644 index 00000000..d1289132 --- /dev/null +++ b/ios/src/CountlyTests/CountlyTests.swift @@ -0,0 +1,67 @@ +// +// CountlyTests.swift +// CountlyTests +// +// Created by Muhammad Junaid Akram on 22/12/2023. +// Copyright © 2023 Alin Radut. All rights reserved. +// + +import XCTest +@testable import Countly + + +class CountlyTests: CountlyBaseTestCase { + + // MARK: - Configuration Tests + + func testReInitWithDeviceId() throws { + let config = createBaseConfig() + // No Device ID provided during init + Countly.sharedInstance().start(with: config); + + let sdkGeneratedDeviceID = Countly.sharedInstance().deviceID() + XCTAssertTrue(CountlyCommon.sharedInstance().hasStarted, "Countly initialization failed.") + XCTAssertTrue(Countly.sharedInstance().deviceIDType() == CLYDeviceIDType.IDFV, "Countly deviced id type should be IDFV when no device id is provided during init.") + Countly.sharedInstance().halt(false) + XCTAssertTrue(!CountlyCommon.sharedInstance().hasStarted, "Countly halt failed.") + + let deviceID = String(Int.random(in: 0..<100)) + + let newConfig = createBaseConfig() + newConfig.deviceID = deviceID + Countly.sharedInstance().start(with: newConfig); + + XCTAssertTrue(CountlyCommon.sharedInstance().hasStarted, "Countly initialization failed.") + XCTAssertTrue(Countly.sharedInstance().deviceID() == sdkGeneratedDeviceID, "Countly device id not match with provided device id.") + XCTAssertTrue(Countly.sharedInstance().deviceIDType() == CLYDeviceIDType.IDFV, "Countly deviced id type should be custom when device id is provided during init.") + } + + func testPerformanceExample() async throws { + // This is an example of a performance test case. + measure { + // Put the code you want to measure the time of here. + } + } + + + func checkPersistentValues() { + let countlyPersistency = CountlyPersistency.sharedInstance() + if(countlyPersistency != nil) { + if let queuedRequests = CountlyPersistency.sharedInstance().value(forKey: "queuedRequests") as? NSMutableArray, + let recordedEvents = CountlyPersistency.sharedInstance().value(forKey: "recordedEvents") as? NSMutableArray, + let startedEvents = CountlyPersistency.sharedInstance().value(forKey: "startedEvents") as? NSMutableDictionary, + let isQueueBeingModified = CountlyPersistency.sharedInstance().value(forKey: "isQueueBeingModified") as? Bool { + print("Successfully access private properties.") + + + } + else { + print("Failed to access private properties.") + } + } + + } +} + + + diff --git a/ios/src/Package.swift b/ios/src/Package.swift index a37185d1..70ecfc6f 100644 --- a/ios/src/Package.swift +++ b/ios/src/Package.swift @@ -33,11 +33,12 @@ let package = Package( "Info.plist", "Countly.podspec", "Countly-PL.podspec", - "LICENSE.md", + "LICENSE", "README.md", "countly_dsym_uploader.sh", "CHANGELOG.md", - "SECURITY.md" + "SECURITY.md", + "CountlyTests/" ], linkerSettings: @@ -53,5 +54,9 @@ let package = Package( .linkedFramework("WebKit", .when(platforms: [.iOS])), .linkedFramework("CoreTelephony", .when(platforms: [.iOS])), ]), + .testTarget( + name: "CountlyTests", + dependencies: ["Countly"] + ), ] ) diff --git a/ios/src/include/CountlySDKLimitsConfig.h b/ios/src/include/CountlySDKLimitsConfig.h deleted file mode 100644 index cdcf9a9a..00000000 --- a/ios/src/include/CountlySDKLimitsConfig.h +++ /dev/null @@ -1 +0,0 @@ -../CountlySDKLimitsConfig.h \ No newline at end of file diff --git a/ios/src/include/CountlySDKLimitsConfig.h b/ios/src/include/CountlySDKLimitsConfig.h new file mode 120000 index 00000000..cdcf9a9a --- /dev/null +++ b/ios/src/include/CountlySDKLimitsConfig.h @@ -0,0 +1 @@ +../CountlySDKLimitsConfig.h \ No newline at end of file diff --git a/ios/src/include/Resettable.h b/ios/src/include/Resettable.h deleted file mode 100644 index 2fcb4360..00000000 --- a/ios/src/include/Resettable.h +++ /dev/null @@ -1 +0,0 @@ -../Resettable.h \ No newline at end of file diff --git a/ios/src/include/Resettable.h b/ios/src/include/Resettable.h new file mode 120000 index 00000000..2fcb4360 --- /dev/null +++ b/ios/src/include/Resettable.h @@ -0,0 +1 @@ +../Resettable.h \ No newline at end of file