diff --git a/mParticle-Apple-SDK.xcodeproj/project.pbxproj b/mParticle-Apple-SDK.xcodeproj/project.pbxproj index 75043e4e..8944eb48 100644 --- a/mParticle-Apple-SDK.xcodeproj/project.pbxproj +++ b/mParticle-Apple-SDK.xcodeproj/project.pbxproj @@ -217,7 +217,6 @@ 53A79C1D29CDFB2100E7489F /* MPKitConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B5F29CDFB1F00E7489F /* MPKitConfiguration.h */; }; 53A79C1E29CDFB2100E7489F /* MPKitFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B6029CDFB1F00E7489F /* MPKitFilter.h */; }; 53A79C1F29CDFB2100E7489F /* MPBaseProjection.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B6129CDFB1F00E7489F /* MPBaseProjection.h */; }; - 53A79C2029CDFB2100E7489F /* MPListenerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B6329CDFB1F00E7489F /* MPListenerController.m */; }; 53A79C2129CDFB2100E7489F /* MPIConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B6429CDFB1F00E7489F /* MPIConstants.m */; }; 53A79C4529CDFB4800E7489F /* MPEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2329CDFB4800E7489F /* MPEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C4629CDFB4800E7489F /* MPBaseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2429CDFB4800E7489F /* MPBaseEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -226,12 +225,10 @@ 53A79C4929CDFB4800E7489F /* mParticle.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2729CDFB4800E7489F /* mParticle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C4A29CDFB4800E7489F /* MPExtensionProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2829CDFB4800E7489F /* MPExtensionProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C4B29CDFB4800E7489F /* FilteredMParticleUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2929CDFB4800E7489F /* FilteredMParticleUser.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 53A79C4C29CDFB4800E7489F /* MPListenerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2A29CDFB4800E7489F /* MPListenerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C4D29CDFB4800E7489F /* MPPromotion.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2B29CDFB4800E7489F /* MPPromotion.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C4F29CDFB4800E7489F /* MPKitAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2D29CDFB4800E7489F /* MPKitAPI.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C5029CDFB4800E7489F /* MPTransactionAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2E29CDFB4800E7489F /* MPTransactionAttributes.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C5129CDFB4800E7489F /* MPCommerceEventInstruction.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2F29CDFB4800E7489F /* MPCommerceEventInstruction.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 53A79C5229CDFB4800E7489F /* MPListenerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3029CDFB4800E7489F /* MPListenerController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C5329CDFB4800E7489F /* MPIdentityApi.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3129CDFB4800E7489F /* MPIdentityApi.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C5529CDFB4800E7489F /* NSDictionary+MPCaseInsensitive.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3329CDFB4800E7489F /* NSDictionary+MPCaseInsensitive.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79C5629CDFB4800E7489F /* MParticleUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3429CDFB4800E7489F /* MParticleUser.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -315,7 +312,6 @@ 53A79D0229CE23F700E7489F /* mParticle.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2729CDFB4800E7489F /* mParticle.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D0329CE23F700E7489F /* FilteredMPIdentityApiRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3C29CDFB4800E7489F /* FilteredMPIdentityApiRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D0429CE23F700E7489F /* MPBaseEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2429CDFB4800E7489F /* MPBaseEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 53A79D0529CE23F700E7489F /* MPListenerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3029CDFB4800E7489F /* MPListenerController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D0629CE23F700E7489F /* MPProduct+Dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C4229CDFB4800E7489F /* MPProduct+Dictionary.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D0729CE23F700E7489F /* MPKitRegister.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C4129CDFB4800E7489F /* MPKitRegister.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D0829CE23F700E7489F /* MPTransactionAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2E29CDFB4800E7489F /* MPTransactionAttributes.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -334,7 +330,6 @@ 53A79D1929CE23F700E7489F /* MPAliasRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3A29CDFB4800E7489F /* MPAliasRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D1A29CE23F700E7489F /* MPKitExecStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3E29CDFB4800E7489F /* MPKitExecStatus.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D1B29CE23F700E7489F /* MPEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2329CDFB4800E7489F /* MPEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 53A79D1C29CE23F700E7489F /* MPListenerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2A29CDFB4800E7489F /* MPListenerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D1E29CE23F700E7489F /* MPAliasResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3729CDFB4800E7489F /* MPAliasResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D1F29CE23F700E7489F /* MPConsentState.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C4029CDFB4800E7489F /* MPConsentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53A79D2029CE23F700E7489F /* MParticleUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3429CDFB4800E7489F /* MParticleUser.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -459,7 +454,6 @@ 53A79DB529CE23F700E7489F /* MPBackendController.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79AF429CDFB1F00E7489F /* MPBackendController.m */; }; 53A79DB629CE23F700E7489F /* MPForwardQueueItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B5D29CDFB1F00E7489F /* MPForwardQueueItem.m */; }; 53A79DB729CE23F700E7489F /* MPEventProjection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B5829CDFB1F00E7489F /* MPEventProjection.mm */; }; - 53A79DB829CE23F700E7489F /* MPListenerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B6329CDFB1F00E7489F /* MPListenerController.m */; }; 53A79DB929CE23F700E7489F /* MPKitContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B5029CDFB1F00E7489F /* MPKitContainer.mm */; }; 53A79DBA29CE23F700E7489F /* MPUploadBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B1229CDFB1F00E7489F /* MPUploadBuilder.m */; }; 53A79DBC29CE23F700E7489F /* MPBaseProjection.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B5329CDFB1F00E7489F /* MPBaseProjection.m */; }; @@ -473,6 +467,8 @@ 53FDD1BD2AE871AF003D5FA1 /* MPIHasher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53FDD1BC2AE871AF003D5FA1 /* MPIHasher.swift */; }; 53FDD1BE2AE871AF003D5FA1 /* MPIHasher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53FDD1BC2AE871AF003D5FA1 /* MPIHasher.swift */; }; D30CD0CB2CFF5FB100F5148A /* MPStateMachine.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B0629CDFB1F00E7489F /* MPStateMachine.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D346D8D82D1069A600FBA8B1 /* MPListenerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D346D8D72D1069A600FBA8B1 /* MPListenerController.swift */; }; + D346D8D92D1069A600FBA8B1 /* MPListenerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D346D8D72D1069A600FBA8B1 /* MPListenerController.swift */; }; D356E0242CFE08ED0020898D /* MPResponseConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = D356E0232CFE08ED0020898D /* MPResponseConfig.swift */; }; D356E0252CFE08ED0020898D /* MPResponseConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = D356E0232CFE08ED0020898D /* MPResponseConfig.swift */; }; D3724C192AE02AF60074CD67 /* mParticle_Apple_SDK_NoLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3724C182AE02AF60074CD67 /* mParticle_Apple_SDK_NoLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -654,7 +650,6 @@ 53A79B5F29CDFB1F00E7489F /* MPKitConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPKitConfiguration.h; sourceTree = ""; }; 53A79B6029CDFB1F00E7489F /* MPKitFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPKitFilter.h; sourceTree = ""; }; 53A79B6129CDFB1F00E7489F /* MPBaseProjection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPBaseProjection.h; sourceTree = ""; }; - 53A79B6329CDFB1F00E7489F /* MPListenerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPListenerController.m; sourceTree = ""; }; 53A79B6429CDFB1F00E7489F /* MPIConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPIConstants.m; sourceTree = ""; }; 53A79C2329CDFB4800E7489F /* MPEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPEvent.h; sourceTree = ""; }; 53A79C2429CDFB4800E7489F /* MPBaseEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPBaseEvent.h; sourceTree = ""; }; @@ -663,12 +658,10 @@ 53A79C2729CDFB4800E7489F /* mParticle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mParticle.h; sourceTree = ""; }; 53A79C2829CDFB4800E7489F /* MPExtensionProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPExtensionProtocol.h; sourceTree = ""; }; 53A79C2929CDFB4800E7489F /* FilteredMParticleUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilteredMParticleUser.h; sourceTree = ""; }; - 53A79C2A29CDFB4800E7489F /* MPListenerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPListenerProtocol.h; sourceTree = ""; }; 53A79C2B29CDFB4800E7489F /* MPPromotion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPromotion.h; sourceTree = ""; }; 53A79C2D29CDFB4800E7489F /* MPKitAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPKitAPI.h; sourceTree = ""; }; 53A79C2E29CDFB4800E7489F /* MPTransactionAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPTransactionAttributes.h; sourceTree = ""; }; 53A79C2F29CDFB4800E7489F /* MPCommerceEventInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPCommerceEventInstruction.h; sourceTree = ""; }; - 53A79C3029CDFB4800E7489F /* MPListenerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPListenerController.h; sourceTree = ""; }; 53A79C3129CDFB4800E7489F /* MPIdentityApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPIdentityApi.h; sourceTree = ""; }; 53A79C3329CDFB4800E7489F /* NSDictionary+MPCaseInsensitive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+MPCaseInsensitive.h"; sourceTree = ""; }; 53A79C3429CDFB4800E7489F /* MParticleUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MParticleUser.h; sourceTree = ""; }; @@ -767,6 +760,7 @@ 53B33E892A4606CD00CC8A19 /* MPSideloadedKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPSideloadedKit.swift; sourceTree = ""; }; 53E20DC62CBFFCD200146A97 /* NSArray+MPCaseInsensitiveTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSArray+MPCaseInsensitiveTests.swift"; sourceTree = ""; }; 53FDD1BC2AE871AF003D5FA1 /* MPIHasher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPIHasher.swift; sourceTree = ""; }; + D346D8D72D1069A600FBA8B1 /* MPListenerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPListenerController.swift; sourceTree = ""; }; D356E0232CFE08ED0020898D /* MPResponseConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPResponseConfig.swift; sourceTree = ""; }; D3724C182AE02AF60074CD67 /* mParticle_Apple_SDK_NoLocation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mParticle_Apple_SDK_NoLocation.h; sourceTree = ""; }; D3961CD52CB468DC003B3194 /* NSArray+MPCaseInsensitive.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSArray+MPCaseInsensitive.swift"; sourceTree = ""; }; @@ -1120,7 +1114,7 @@ 53A79B6229CDFB1F00E7489F /* Listener */ = { isa = PBXGroup; children = ( - 53A79B6329CDFB1F00E7489F /* MPListenerController.m */, + D346D8D72D1069A600FBA8B1 /* MPListenerController.swift */, ); path = Listener; sourceTree = ""; @@ -1137,12 +1131,10 @@ 53A79C2729CDFB4800E7489F /* mParticle.h */, 53A79C2829CDFB4800E7489F /* MPExtensionProtocol.h */, 53A79C2929CDFB4800E7489F /* FilteredMParticleUser.h */, - 53A79C2A29CDFB4800E7489F /* MPListenerProtocol.h */, 53A79C2B29CDFB4800E7489F /* MPPromotion.h */, 53A79C2D29CDFB4800E7489F /* MPKitAPI.h */, 53A79C2E29CDFB4800E7489F /* MPTransactionAttributes.h */, 53A79C2F29CDFB4800E7489F /* MPCommerceEventInstruction.h */, - 53A79C3029CDFB4800E7489F /* MPListenerController.h */, 53A79C3129CDFB4800E7489F /* MPIdentityApi.h */, 53A79C3329CDFB4800E7489F /* NSDictionary+MPCaseInsensitive.h */, 53A79C3429CDFB4800E7489F /* MParticleUser.h */, @@ -1287,7 +1279,6 @@ 53A79C4929CDFB4800E7489F /* mParticle.h in Headers */, 53A79C5E29CDFB4800E7489F /* FilteredMPIdentityApiRequest.h in Headers */, 53A79C4629CDFB4800E7489F /* MPBaseEvent.h in Headers */, - 53A79C5229CDFB4800E7489F /* MPListenerController.h in Headers */, 53A79C6429CDFB4800E7489F /* MPProduct+Dictionary.h in Headers */, 53A79C6329CDFB4800E7489F /* MPKitRegister.h in Headers */, 53A79C5029CDFB4800E7489F /* MPTransactionAttributes.h in Headers */, @@ -1306,7 +1297,6 @@ 53A79C5C29CDFB4800E7489F /* MPAliasRequest.h in Headers */, 53A79C6029CDFB4800E7489F /* MPKitExecStatus.h in Headers */, 53A79C4529CDFB4800E7489F /* MPEvent.h in Headers */, - 53A79C4C29CDFB4800E7489F /* MPListenerProtocol.h in Headers */, 53A79C5929CDFB4800E7489F /* MPAliasResponse.h in Headers */, 53A79C6229CDFB4800E7489F /* MPConsentState.h in Headers */, 53A79C5629CDFB4800E7489F /* MParticleUser.h in Headers */, @@ -1379,7 +1369,6 @@ 53A79D0229CE23F700E7489F /* mParticle.h in Headers */, 53A79D0329CE23F700E7489F /* FilteredMPIdentityApiRequest.h in Headers */, 53A79D0429CE23F700E7489F /* MPBaseEvent.h in Headers */, - 53A79D0529CE23F700E7489F /* MPListenerController.h in Headers */, 53A79D0629CE23F700E7489F /* MPProduct+Dictionary.h in Headers */, 53A79D0729CE23F700E7489F /* MPKitRegister.h in Headers */, 53A79D0829CE23F700E7489F /* MPTransactionAttributes.h in Headers */, @@ -1398,7 +1387,6 @@ 53A79D1929CE23F700E7489F /* MPAliasRequest.h in Headers */, 53A79D1A29CE23F700E7489F /* MPKitExecStatus.h in Headers */, 53A79D1B29CE23F700E7489F /* MPEvent.h in Headers */, - 53A79D1C29CE23F700E7489F /* MPListenerProtocol.h in Headers */, 53A79D1E29CE23F700E7489F /* MPAliasResponse.h in Headers */, 53A79D1F29CE23F700E7489F /* MPConsentState.h in Headers */, 53A79D2029CE23F700E7489F /* MParticleUser.h in Headers */, @@ -1700,6 +1688,7 @@ 530D24852CFF78EB000FE7E3 /* MPUserIdentityChange.swift in Sources */, 53A79B6929CDFB2000E7489F /* FilteredMPIdentityApiRequest.m in Sources */, 53A79BF929CDFB2100E7489F /* mParticle.m in Sources */, + D346D8D92D1069A600FBA8B1 /* MPListenerController.swift in Sources */, 53A79C0329CDFB2100E7489F /* MPProduct.m in Sources */, 530D24802CFF70B0000FE7E3 /* MPUserIdentityInstance.swift in Sources */, 5399DDB82CA727E5006526E1 /* MPZip.swift in Sources */, @@ -1776,7 +1765,6 @@ 53A79C1B29CDFB2100E7489F /* MPForwardQueueItem.m in Sources */, 53A79C1629CDFB2100E7489F /* MPEventProjection.mm in Sources */, D3CEDAC32C9DAC25001B32DF /* MPDateFormatter.swift in Sources */, - 53A79C2029CDFB2100E7489F /* MPListenerController.m in Sources */, 53A79C0E29CDFB2100E7489F /* MPKitContainer.mm in Sources */, 53A79BD729CDFB2000E7489F /* MPUploadBuilder.m in Sources */, 53A79C1129CDFB2100E7489F /* MPBaseProjection.m in Sources */, @@ -1870,6 +1858,7 @@ 530D24862CFF78EB000FE7E3 /* MPUserIdentityChange.swift in Sources */, 53A79D6E29CE23F700E7489F /* FilteredMPIdentityApiRequest.m in Sources */, 53A79D6F29CE23F700E7489F /* mParticle.m in Sources */, + D346D8D82D1069A600FBA8B1 /* MPListenerController.swift in Sources */, 53A79D7029CE23F700E7489F /* MPProduct.m in Sources */, 530D247F2CFF70B0000FE7E3 /* MPUserIdentityInstance.swift in Sources */, 5399DDB92CA727E5006526E1 /* MPZip.swift in Sources */, @@ -1946,7 +1935,6 @@ 53A79DB529CE23F700E7489F /* MPBackendController.m in Sources */, 53A79DB629CE23F700E7489F /* MPForwardQueueItem.m in Sources */, 53A79DB729CE23F700E7489F /* MPEventProjection.mm in Sources */, - 53A79DB829CE23F700E7489F /* MPListenerController.m in Sources */, 53A79DB929CE23F700E7489F /* MPKitContainer.mm in Sources */, 53A79DBA29CE23F700E7489F /* MPUploadBuilder.m in Sources */, 53A79DBC29CE23F700E7489F /* MPBaseProjection.m in Sources */, diff --git a/mParticle-Apple-SDK/Identity/MPIdentityApiManager.m b/mParticle-Apple-SDK/Identity/MPIdentityApiManager.m index 35ce38d5..b98628ed 100644 --- a/mParticle-Apple-SDK/Identity/MPIdentityApiManager.m +++ b/mParticle-Apple-SDK/Identity/MPIdentityApiManager.m @@ -8,7 +8,7 @@ #import "MPNetworkCommunication.h" #import "MPBackendController.h" #import "mParticle.h" -#import "MPListenerController.h" +#import "MParticleSwift.h" @interface MParticle () diff --git a/mParticle-Apple-SDK/Identity/MParticleUser.m b/mParticle-Apple-SDK/Identity/MParticleUser.m index 378a2ab6..71807272 100644 --- a/mParticle-Apple-SDK/Identity/MParticleUser.m +++ b/mParticle-Apple-SDK/Identity/MParticleUser.m @@ -10,6 +10,7 @@ #import "MPDataPlanFilter.h" #import "MPIConstants.h" #import "MPKitContainer.h" +#import "MParticleSwift.h" @interface MParticleUser () diff --git a/mParticle-Apple-SDK/Include/MPListenerController.h b/mParticle-Apple-SDK/Include/MPListenerController.h deleted file mode 100644 index 649cdbeb..00000000 --- a/mParticle-Apple-SDK/Include/MPListenerController.h +++ /dev/null @@ -1,119 +0,0 @@ -#import -#import "MPListenerProtocol.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MPListenerController : NSObject - -/** - * Returns the shared instance object. - * @returns the Singleton instance of the MPListener class. - */ -+ (instancetype)sharedInstance; - -/** - * Adds a listener to the SDK to receive any MPListenerProtocol calls from the API to that object - * @param sdkListener An instance of a class that implements the MPListenerProtocol - */ -- (void)addSdkListener:(id)sdkListener; - -/** - * Removes a listener from the SDK to no longer receive any MPListenerProtocol calls from the API to that object - * If you don't remove the Listener we will retain a zombie reference of your object and it will never be released - * @param sdkListener An instance of a class that implements the MPListenerProtocol - */ -- (void)removeSdkListener:(id)sdkListener; - -/** - * Indicates that an API method was called. This includes invocations both from external sources (your code) - * and those which originated from within the SDK - * @param apiName the name of the API method - * @param parameter1 to parameter4 are the arguments sent to this api, such as the MPEvent in logEvent - */ -- (void)onAPICalled:(SEL)apiName parameter1:(nullable NSObject *)parameter1 parameter2:(nullable NSObject *)parameter2 parameter3:(nullable NSObject *)parameter3 parameter4:(nullable NSObject *)parameter4; -- (void)onAPICalled:(SEL)apiName parameter1:(nullable NSObject *)parameter1 parameter2:(nullable NSObject *)parameter2 parameter3:(nullable NSObject *)parameter3; -- (void)onAPICalled:(SEL)apiName parameter1:(nullable NSObject *)parameter1 parameter2:(nullable NSObject *)parameter2; -- (void)onAPICalled:(SEL)apiName parameter1:(nullable NSObject *)parameter1; -- (void)onAPICalled:(SEL)apiName; - -/** - * Indicates that a new Database entry has been created - * @param tableName the name of the table - * @param primaryKey a unique identifier for the database row - * @param message the database entry in JSON form - */ -- (void)onEntityStored:(MPDatabaseTable)tableName primaryKey:(NSNumber *)primaryKey message:(NSString *)message; - -/** - * Indicates that a Network Request has been started. Network Requests for a given Endpoint are performed - * synchronously, so the next invocation of onNetworkRequestFinished of the same Endpoint will be linked - * @param type the type of network request, see Endpoint - * @param url the URL of the request - * @param body the response body in JSON form - */ -- (void)onNetworkRequestStarted:(MPEndpoint)type url:(NSString *)url body:(NSObject *)body; - -/** - * Indicates that a Network Request has completed. - * @param type the type of network request, see Endpoint - * @param url the URL of the request - * @param body the response body in JSON form - * @param responseCode the HTTP response code - */ -- (void)onNetworkRequestFinished:(MPEndpoint)type url:(NSString *)url body:(NSObject *)body responseCode:(NSInteger)responseCode; - -/** - * Indicates that a Kit's API method has been invoked and that the name of the Kit's method is different - * than the method containing this method's invocation - * @param methodName the name of the Kit's method being called - * @param kitId the Id of the kit - * @param used whether the Kit's method returned ReportingMessages, or null if return type is void - * @param objects the arguments supplied to the Kit - */ -- (void)onKitApiCalled:(NSString *)methodName kitId:(int)kitId used:(BOOL)used objects:(NSArray *)objects; - -/** - * Indicates that a Kit module, with kitId, has been included in the source files - * @param kitId the id of the kit, corresponds with a {@see com.mparticle.MParticle.ServiceProviders} - */ -- (void)onKitDetected:(int)kitId; - -/** - * Indicates that a Configuration for a kit with kitId is being applied - * @param kitId the id of the kit, corresponds with a {@see com.mparticle.MParticle.ServiceProviders} - * @param configuration the kit - */ -- (void)onKitConfigReceived:(int)kitId configuration:(NSDictionary *)configuration; - -/** - * Indicates that a kit with kitId was successfully started - * @param kitId the id of the kit, corresponds with a {@see com.mparticle.MParticle.ServiceProviders} - */ -- (void)onKitStarted:(int)kitId; - -/** - * Indicates that either an attempt to start a kit was unsuccessful, or a started kit was stopped. - * Possibilities for why this may happen include: {@see MParticleUser}'s loggedIn status or - * {@see com.mparticle.consent.ConsentState} required it to be stopped, the Kit crashed, or a - * configuration was received that excluded the kit - * @param kitId the id of the kit, corresponds with a {@see com.mparticle.MParticle.ServiceProviders} - * @param reason a message containing the reason a kit was stopped - */ -- (void)onKitExcluded:(int)kitId reason:(NSString *)reason; - -/** - * Indicates that state of a Session may have changed - * @param session the current {@see InternalSession} instance - */ -- (void)onSessionUpdated:(nullable MParticleSession *)session; - -/** - * Indicates that an alias request has completed. - * @param aliasResponse the alias response object - */ -- (void)onAliasRequestFinished:(nullable MPAliasResponse *)aliasResponse; - - -@end - -NS_ASSUME_NONNULL_END diff --git a/mParticle-Apple-SDK/Include/MPListenerProtocol.h b/mParticle-Apple-SDK/Include/MPListenerProtocol.h deleted file mode 100644 index deddd17f..00000000 --- a/mParticle-Apple-SDK/Include/MPListenerProtocol.h +++ /dev/null @@ -1,123 +0,0 @@ -NS_ASSUME_NONNULL_BEGIN - -@class MParticleSession; -@class MPAliasResponse; - -typedef NS_ENUM(NSInteger, MPEndpoint) { - MPEndpointIdentityLogin = 0, - MPEndpointIdentityLogout, - MPEndpointIdentityIdentify, - MPEndpointIdentityModify, - MPEndpointEvents, - MPEndpointConfig, - MPEndpointAlias -}; - -typedef NS_ENUM(NSInteger, MPDatabaseTable) { - MPDatabaseTableAttributes = 0, - MPDatabaseTableBreadcrumbs, - MPDatabaseTableMessages, - MPDatabaseTableReporting, - MPDatabaseTableSessions, - MPDatabaseTableUploads, - MPDatabaseTableUnknown -}; - -@protocol MPListenerProtocol -#pragma mark - Required methods - -#pragma mark - Optional methods -@optional - -@property (nonatomic, strong, nonnull) NSDictionary *configuration; -@property (nonatomic, strong, nullable) NSDictionary *launchOptions; - -/** - * Indicates that an API method was called. This includes invocations both from external sources (your code) - * and those which originated from within the SDK - * @param apiName the name of the API method - * @param stackTrace is the current stackTrace as an array of NSStrings - * @param isExternal true, if the call originated from outside of the SDK - * @param objects is the arguments sent to this api, such as the MPEvent in logEvent - */ -- (void)onAPICalled:(nonnull NSString *)apiName stackTrace:(nonnull NSArray *)stackTrace isExternal:(BOOL)isExternal objects:(nullable NSArray *)objects; - -/** - * Indicates that a new Database entry has been created - * @param tableName the name of the table - * @param primaryKey a unique identifier for the database row - * @param message the database entry in NSString form - */ -- (void)onEntityStored:(MPDatabaseTable)tableName primaryKey:(nonnull NSNumber *)primaryKey message:(nonnull NSString *)message; - -/** - * Indicates that a Network Request has been started. - * @param type the type of network request, see Endpoint - * @param url the URL of the request - * @param body the response body in JSON form - */ -- (void)onNetworkRequestStarted:(MPEndpoint)type url:(nonnull NSString *)url body:(nonnull NSObject *)body; - -/** - * Indicates that a Network Request has completed. - * @param type the type of network request, see Endpoint - * @param url the URL of the request - * @param body the response body in JSON form - * @param responseCode the HTTP response code - */ -- (void)onNetworkRequestFinished:(MPEndpoint)type url:(nonnull NSString *)url body:(nonnull NSObject *)body responseCode:(NSInteger)responseCode; - -/** - * Indicates that a Kit's API method has been invoked and that the name of the Kit's method is different - * than the method containing this method's invocation - * @param methodName the name of the Kit's method being called - * @param kitId the Id of the kit - * @param used whether the Kit's method returned ReportingMessages, or null if return type is void - * @param objects the arguments supplied to the Kit - */ -- (void)onKitApiCalled:(nonnull NSString *)methodName kitId:(int)kitId used:(BOOL)used objects:(nonnull NSArray *)objects; - -/** - * Indicates that a Kit module, with kitId, has been included in the source files - * @param kitId the id of the kit, corresponds with a {@see MPKitInstance} - */ -- (void)onKitDetected:(int)kitId; - -/** - * Indicates that a Configuration for a kit with kitId is being applied - * @param kitId the id of the kit, corresponds with a {@see MPKitInstance} - * @param configuration the kit - */ -- (void)onKitConfigReceived:(int)kitId configuration:(nonnull NSDictionary *)configuration; - -/** - * Indicates that a kit with kitId was successfully started - * @param kitId the id of the kit, corresponds with a {@see MPKitInstance} - */ -- (void)onKitStarted:(int)kitId; - -/** - * Indicates that either an attempt to start a kit was unsuccessful, or a started kit was stopped. - * Possibilities for why this may happen include: {@see MParticleUser}'s loggedIn status or - * {@see MPConsentState} required it to be stopped, the Kit crashed, or a - * configuration was received that excluded the kit - * @param kitId the id of the kit, corresponds with a {@see MPKitInstance} - * @param reason a message containing the reason a kit was stopped - */ -- (void)onKitExcluded:(int)kitId reason:(nonnull NSString *)reason; - -/** - * Indicates that state of a Session may have changed - * @param session the current {@see MParticleSession} instance - */ -- (void)onSessionUpdated:(nullable MParticleSession *)session; - -/** - * Indicates that an alias request has completed - * @param aliasResponse the alias response object - */ -- (void)onAliasRequestFinished:(nullable MPAliasResponse *)aliasResponse; - -@end - -NS_ASSUME_NONNULL_END diff --git a/mParticle-Apple-SDK/Include/mParticle.h b/mParticle-Apple-SDK/Include/mParticle.h index 5fda36b8..dc59cb19 100644 --- a/mParticle-Apple-SDK/Include/mParticle.h +++ b/mParticle-Apple-SDK/Include/mParticle.h @@ -16,7 +16,6 @@ #import "MPIdentityApi.h" #import "MPKitAPI.h" #import "MPConsentState.h" -#import "MPListenerController.h" #import "MPForwardRecord.h" #import #import "MPStateMachine.h" diff --git a/mParticle-Apple-SDK/Listener/MPListenerController.m b/mParticle-Apple-SDK/Listener/MPListenerController.m deleted file mode 100644 index 63c5cc6b..00000000 --- a/mParticle-Apple-SDK/Listener/MPListenerController.m +++ /dev/null @@ -1,258 +0,0 @@ -#import "MPListenerController.h" -#import "MPIConstants.h" - -static MPListenerController *_sharedInstance = nil; -static dispatch_once_t predicate; - -@interface MPListenerController () - -@property (nonatomic, strong) NSMutableArray> *sdkListeners; - -@end - -@implementation MPListenerController - -#pragma mark Initialization -- (instancetype)init -{ - self = [super init]; - if (self) { - _sdkListeners = [NSMutableArray array]; - } - return self; -} - -+ (MPListenerController *)sharedInstance { - dispatch_once(&predicate, ^{ - _sharedInstance = [[MPListenerController alloc] init]; - }); - - return _sharedInstance; -} - -#pragma mark Private methods -- (void)addSdkListener:(id)sdkListener { - [self.sdkListeners addObject:sdkListener]; -} - -- (void)removeSdkListener:(id)sdkListener { - if (self.sdkListeners) { - [self.sdkListeners removeObject:sdkListener]; - } -} - -- (void)onAPICalled:(SEL)apiName { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onAPICalled:stackTrace:isExternal:objects:)]) { - NSArray *stackTrace = [NSThread callStackSymbols]; - NSMutableArray *parameters = [NSMutableArray array]; - - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onAPICalled:NSStringFromSelector(apiName) stackTrace:stackTrace isExternal:true objects:parameters]; - }); - } - } -} - -- (void)onAPICalled:(SEL)apiName parameter1:(nullable NSObject *)parameter1 { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onAPICalled:stackTrace:isExternal:objects:)]) { - NSArray *stackTrace = [NSThread callStackSymbols]; - NSMutableArray *parameters = [NSMutableArray array]; - if (parameter1) { - [parameters addObject:parameter1]; - } else { - [parameters addObject:[NSNull null]]; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onAPICalled:NSStringFromSelector(apiName) stackTrace:stackTrace isExternal:true objects:parameters]; - }); - } - } -} - -- (void)onAPICalled:(SEL)apiName parameter1:(nullable NSObject *)parameter1 parameter2:(nullable NSObject *)parameter2 { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onAPICalled:stackTrace:isExternal:objects:)]) { - NSArray *stackTrace = [NSThread callStackSymbols]; - NSMutableArray *parameters = [NSMutableArray array]; - if (parameter1) { - [parameters addObject:parameter1]; - } else { - [parameters addObject:[NSNull null]]; - } - if (parameter2) { - [parameters addObject:parameter2]; - } else { - [parameters addObject:[NSNull null]]; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onAPICalled:NSStringFromSelector(apiName) stackTrace:stackTrace isExternal:true objects:parameters]; - }); - } - } -} - -- (void)onAPICalled:(SEL)apiName parameter1:(nullable NSObject *)parameter1 parameter2:(nullable NSObject *)parameter2 parameter3:(nullable NSObject *)parameter3 { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onAPICalled:stackTrace:isExternal:objects:)]) { - NSArray *stackTrace = [NSThread callStackSymbols]; - NSMutableArray *parameters = [NSMutableArray array]; - if (parameter1) { - [parameters addObject:parameter1]; - } else { - [parameters addObject:[NSNull null]]; - } - if (parameter2) { - [parameters addObject:parameter2]; - } else { - [parameters addObject:[NSNull null]]; - } - if (parameter3) { - [parameters addObject:parameter3]; - } else { - [parameters addObject:[NSNull null]]; - } - - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onAPICalled:NSStringFromSelector(apiName) stackTrace:stackTrace isExternal:true objects:parameters]; - }); - } - } -} - -- (void)onAPICalled:(SEL)apiName parameter1:(nullable NSObject *)parameter1 parameter2:(nullable NSObject *)parameter2 parameter3:(nullable NSObject *)parameter3 parameter4:(nullable NSObject *)parameter4 { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onAPICalled:stackTrace:isExternal:objects:)]) { - NSArray *stackTrace = [NSThread callStackSymbols]; - NSMutableArray *parameters = [NSMutableArray array]; - if (parameter1) { - [parameters addObject:parameter1]; - } else { - [parameters addObject:[NSNull null]]; - } - if (parameter2) { - [parameters addObject:parameter2]; - } else { - [parameters addObject:[NSNull null]]; - } - if (parameter3) { - [parameters addObject:parameter3]; - } else { - [parameters addObject:[NSNull null]]; - } - if (parameter4) { - [parameters addObject:parameter4]; - } else { - [parameters addObject:[NSNull null]]; - } - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onAPICalled:NSStringFromSelector(apiName) stackTrace:stackTrace isExternal:true objects:parameters]; - }); - } - } -} - -- (void)onEntityStored:(MPDatabaseTable)tableName primaryKey:(nonnull NSNumber *)primaryKey message:(nonnull NSString *)message { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onEntityStored:primaryKey:message:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onEntityStored:tableName primaryKey:primaryKey message:message]; - }); - } - } -} - -- (void)onNetworkRequestStarted:(MPEndpoint)type url:(nonnull NSString *)url body:(nonnull NSObject *)body { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onNetworkRequestStarted:url:body:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onNetworkRequestStarted:type url:url body:body]; - }); - } - } -} - -- (void)onNetworkRequestFinished:(MPEndpoint)type url:(nonnull NSString *)url body:(nonnull NSObject *)body responseCode:(NSInteger)responseCode { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onNetworkRequestFinished:url:body:responseCode:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onNetworkRequestFinished:type url:url body:body responseCode:responseCode]; - }); - } - } -} - -- (void)onKitApiCalled:(nonnull NSString *)methodName kitId:(int)kitId used:(BOOL)used objects:(nonnull NSArray *)objects { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onKitApiCalled:kitId:used:objects:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onKitApiCalled:methodName kitId:kitId used:used objects:objects]; - }); - } - } -} - -- (void)onKitDetected:(int)kitId { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onKitDetected:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onKitDetected:kitId]; - }); - } - } -} - -- (void)onKitConfigReceived:(int)kitId configuration:(nonnull NSDictionary *)configuration { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onKitConfigReceived:configuration:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onKitConfigReceived:kitId configuration:configuration]; - }); - } - } -} - -- (void)onKitStarted:(int)kitId { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onKitStarted:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onKitStarted:kitId]; - }); - } - } -} - -- (void)onKitExcluded:(int)kitId reason:(nonnull NSString *)reason { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onKitExcluded:reason:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onKitExcluded:kitId reason:reason]; - }); - } - } -} - -- (void)onSessionUpdated:(nullable MParticleSession *)session { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onSessionUpdated:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onSessionUpdated:session]; - }); - } - } -} - -- (void)onAliasRequestFinished:(nullable MPAliasResponse *)aliasResponse { - for (iddelegate in self.sdkListeners) { - if ([delegate respondsToSelector:@selector(onAliasRequestFinished:)]) { - dispatch_async(dispatch_get_main_queue(), ^{ - [delegate onAliasRequestFinished:aliasResponse]; - }); - } - } -} - -@end diff --git a/mParticle-Apple-SDK/Listener/MPListenerController.swift b/mParticle-Apple-SDK/Listener/MPListenerController.swift new file mode 100644 index 00000000..a29a2218 --- /dev/null +++ b/mParticle-Apple-SDK/Listener/MPListenerController.swift @@ -0,0 +1,353 @@ +// +// MPListenerController.swift +// mParticle-Apple-SDK +// +// Created by Brandon Stalnaker on 12/16/24. +// + +import Foundation + +@objc public enum MPEndpoint: Int { + case identityLogin = 0, identityLogout, identityIdentify, identityModify, events, config, alias +} +@objc public enum MPDatabaseTable: Int { + case attributes = 0, breadcrumbs, messages, reporting, sessions, uploads, unknown +} + +@objc public protocol MPListenerProtocol { + + /** + * Indicates that an API method was called. This includes invocations both from external sources (your code) + * and those which originated from within the SDK + * @param apiName the name of the API method + * @param stackTrace is the current stackTrace as an array of NSStrings + * @param isExternal true, if the call originated from outside of the SDK + * @param objects is the arguments sent to this api, such as the MPEvent in logEvent + */ + @objc optional func onAPICalled(_ apiName: Any!, stackTrace: Any!, isExternal: Any!, objects: Any!) + + /** + * Indicates that a new Database entry has been created + * @param tableName the name of the table + * @param primaryKey a unique identifier for the database row + * @param message the database entry in NSString form + */ + @objc optional func onEntityStored(_ tableName: Any!, primaryKey: Any!, message: Any!) + + /** + * Indicates that a Network Request has been started. + * @param type the type of network request, see Endpoint + * @param url the URL of the request + * @param body the response body in JSON form + */ + @objc optional func onNetworkRequestStarted(_ type: Any!, url: Any!, body: Any!) + + /** + * Indicates that a Network Request has completed. + * @param type the type of network request, see Endpoint + * @param url the URL of the request + * @param body the response body in JSON form + * @param responseCode the HTTP response code + */ + @objc optional func onNetworkRequestFinished(_ type: Any!, url: Any!, body: Any!, responseCode: Any!) + + /** + * Indicates that a Kit's API method has been invoked and that the name of the Kit's method is different + * than the method containing this method's invocation + * @param methodName the name of the Kit's method being called + * @param kitId the Id of the kit + * @param used whether the Kit's method returned ReportingMessages, or null if return type is void + * @param objects the arguments supplied to the Kit + */ + @objc optional func onKitApiCalled(_ methodName: Any!, kitId: Int32, used: Any!, objects: Any!) + + /** + * Indicates that a Kit module, with kitId, has been included in the source files + * @param kitId the id of the kit, corresponds with a {@see MPKitInstance} + */ + @objc optional func onKitDetected(_ kitId: Int32) + + /** + * Indicates that a Configuration for a kit with kitId is being applied + * @param kitId the id of the kit, corresponds with a {@see MPKitInstance} + * @param configuration the kit + */ + @objc optional func onKitConfigReceived(_ kitId: Int32, configuration: Any!) + + /** + * Indicates that a kit with kitId was successfully started + * @param kitId the id of the kit, corresponds with a {@see MPKitInstance} + */ + @objc optional func onKitStarted(_ kitId: Int32) + + /** + * Indicates that either an attempt to start a kit was unsuccessful, or a started kit was stopped. + * Possibilities for why this may happen include: {@see MParticleUser}'s loggedIn status or + * {@see MPConsentState} required it to be stopped, the Kit crashed, or a + * configuration was received that excluded the kit + * @param kitId the id of the kit, corresponds with a {@see MPKitInstance} + * @param reason a message containing the reason a kit was stopped + */ + @objc optional func onKitExcluded(_ kitId: Int32, reason: Any!) + + /** + * Indicates that state of a Session may have changed + * @param session the current {@see MParticleSession} instance + */ + @objc optional func onSessionUpdated(_ session: Any!) + + /** + * Indicates that an alias request has completed + * @param aliasResponse the alias response object + */ + @objc optional func onAliasRequestFinished(_ aliasResponse: MPAliasResponse?) +} + + +@objc public class MPListenerController : NSObject { + private static let shared = MPListenerController() + private var sdkListeners: [MPListenerProtocol] = [] + + /** + * Returns the shared instance object. + * @returns the Singleton instance of the MPListener class. + */ + @objc public class func sharedInstance() -> MPListenerController { + return shared + } + + /** + * Adds a listener to the SDK to receive any MPListenerProtocol calls from the API to that object + * @param sdkListener An instance of a class that implements the MPListenerProtocol + */ + @objc public func addSdkListener(_ sdkListener: any MPListenerProtocol) { + self.sdkListeners.append(sdkListener) + } + + /** + * Removes a listener from the SDK to no longer receive any MPListenerProtocol calls from the API to that object + * If you don't remove the Listener we will retain a zombie reference of your object and it will never be released + * @param sdkListener An instance of a class that implements the MPListenerProtocol + */ + @objc public func removeSdkListener(_ sdkListener: any MPListenerProtocol) { + self.sdkListeners = self.sdkListeners.filter { sdkListener !== $0 } + } + + /** + * Indicates that an API method was called. This includes invocations both from external sources (your code) + * and those which originated from within the SDK + * @param apiName the name of the API method + * @param parameter1 to parameter4 are the arguments sent to this api, such as the MPEvent in logEvent + */ + @objc public func onAPICalled(_ apiName: Selector, parameter1: NSObject?, parameter2: NSObject?, parameter3: NSObject?, parameter4: NSObject?) { + + } + + @objc public func onAPICalled(_ apiName: Selector, parameter1: NSObject?, parameter2: NSObject?, parameter3: NSObject?) { + for delegate in self.sdkListeners { + let stackTrace = [Thread.callStackSymbols] + var parameters: [NSObject] = [] + if parameter1 != nil { + parameters.append(parameter1!) + } else { + parameters.append(NSNull()) + } + if parameter2 != nil { + parameters.append(parameter2!) + } else { + parameters.append(NSNull()) + } + if parameter3 != nil { + parameters.append(parameter3!) + } else { + parameters.append(NSNull()) + } + DispatchQueue.main.async { + delegate.onAPICalled?(NSStringFromSelector(apiName), stackTrace: stackTrace, isExternal: true, objects: parameters) + } + } + } + + @objc public func onAPICalled(_ apiName: Selector, parameter1: NSObject?, parameter2: NSObject?) { + for delegate in self.sdkListeners { + let stackTrace = [Thread.callStackSymbols] + var parameters: [NSObject] = [] + if parameter1 != nil { + parameters.append(parameter1!) + } else { + parameters.append(NSNull()) + } + if parameter2 != nil { + parameters.append(parameter2!) + } else { + parameters.append(NSNull()) + } + DispatchQueue.main.async { + delegate.onAPICalled?(NSStringFromSelector(apiName), stackTrace: stackTrace, isExternal: true, objects: parameters) + } + } + } + + @objc public func onAPICalled(_ apiName: Selector, parameter1: NSObject?) { + for delegate in self.sdkListeners { + let stackTrace = [Thread.callStackSymbols] + var parameters: [NSObject] = [] + if parameter1 != nil { + parameters.append(parameter1!) + } else { + parameters.append(NSNull()) + } + DispatchQueue.main.async { + delegate.onAPICalled?(NSStringFromSelector(apiName), stackTrace: stackTrace, isExternal: true, objects: parameters) + } + } + } + + @objc public func onAPICalled(_ apiName: Selector) { + for delegate in self.sdkListeners { + let stackTrace = [Thread.callStackSymbols] + let parameters: [NSObject] = [] + DispatchQueue.main.async { + delegate.onAPICalled?(NSStringFromSelector(apiName), stackTrace: stackTrace, isExternal: true, objects: parameters) + } + } + } + + /** + * Indicates that a new Database entry has been created + * @param tableName the name of the table + * @param primaryKey a unique identifier for the database row + * @param message the database entry in JSON form + */ + @objc public func onEntityStored(_ tableName: MPDatabaseTable, primaryKey: NSNumber, message: String) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onEntityStored?(tableName, primaryKey: primaryKey, message: message) + } + } + } + + /** + * Indicates that a Network Request has been started. Network Requests for a given Endpoint are performed + * synchronously, so the next invocation of onNetworkRequestFinished of the same Endpoint will be linked + * @param type the type of network request, see Endpoint + * @param url the URL of the request + * @param body the response body in JSON form + */ + @objc public func onNetworkRequestStarted(_ type: MPEndpoint, url: String, body: NSObject) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onNetworkRequestStarted?(type, url: url, body: body) + } + } + } + + /** + * Indicates that a Network Request has completed. + * @param type the type of network request, see Endpoint + * @param url the URL of the request + * @param body the response body in JSON form + * @param responseCode the HTTP response code + */ + @objc public func onNetworkRequestFinished(_ type: MPEndpoint, url: String, body: NSObject, responseCode: Int) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onNetworkRequestFinished?(type, url: url, body: body, responseCode: responseCode) + } + } + } + + /** + * Indicates that a Kit's API method has been invoked and that the name of the Kit's method is different + * than the method containing this method's invocation + * @param methodName the name of the Kit's method being called + * @param kitId the Id of the kit + * @param used whether the Kit's method returned ReportingMessages, or null if return type is void + * @param objects the arguments supplied to the Kit + */ + @objc public func onKitApiCalled(_ methodName: String, kitId: Int32, used: Bool, objects: [Any]) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onKitApiCalled?(methodName, kitId: kitId, used: used, objects: objects) + } + } + } + + /** + * Indicates that a Kit module, with kitId, has been included in the source files + * @param kitId the id of the kit, corresponds with a {@see com.mparticle.MParticle.ServiceProviders} + */ + @objc public func onKitDetected(_ kitId: Int32) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onKitDetected?(kitId) + } + } + } + + /** + * Indicates that a Configuration for a kit with kitId is being applied + * @param kitId the id of the kit, corresponds with a {@see com.mparticle.MParticle.ServiceProviders} + * @param configuration the kit + */ + @objc public func onKitConfigReceived(_ kitId: Int32, configuration: [AnyHashable : Any]) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onKitConfigReceived?(kitId, configuration: configuration) + } + } + } + + /** + * Indicates that a kit with kitId was successfully started + * @param kitId the id of the kit, corresponds with a {@see com.mparticle.MParticle.ServiceProviders} + */ + @objc public func onKitStarted(_ kitId: Int32) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onKitStarted?(kitId) + } + } + } + + /** + * Indicates that either an attempt to start a kit was unsuccessful, or a started kit was stopped. + * Possibilities for why this may happen include: {@see MParticleUser}'s loggedIn status or + * {@see com.mparticle.consent.ConsentState} required it to be stopped, the Kit crashed, or a + * configuration was received that excluded the kit + * @param kitId the id of the kit, corresponds with a {@see com.mparticle.MParticle.ServiceProviders} + * @param reason a message containing the reason a kit was stopped + */ + @objc public func onKitExcluded(_ kitId: Int32, reason: String) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onKitExcluded?(kitId, reason: reason) + } + } + } + + /** + * Indicates that state of a Session may have changed + * @param session the current {@see InternalSession} instance + */ + @objc public func onSessionUpdated(_ session: MParticleSession?) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onSessionUpdated?(session) + } + } + } + + /** + * Indicates that an alias request has completed. + * @param aliasResponse the alias response object + */ + @objc public func onAliasRequestFinished(_ aliasResponse: MPAliasResponse?) { + for delegate in self.sdkListeners { + DispatchQueue.main.async { + delegate.onAliasRequestFinished?(aliasResponse) + } + } + } +} + diff --git a/mParticle-Apple-SDK/MPBackendController.m b/mParticle-Apple-SDK/MPBackendController.m index f3910b44..e1973d8f 100644 --- a/mParticle-Apple-SDK/MPBackendController.m +++ b/mParticle-Apple-SDK/MPBackendController.m @@ -22,12 +22,13 @@ #import "MPCommerceEvent+Dictionary.h" #import "MPKitContainer.h" #import "MPURLRequestBuilder.h" -#import "MPListenerController.h" #import "MPDevice.h" #import "MPIdentityCaching.h" #import "MParticleSwift.h" #import "MPLaunchInfo.h" #import "MPNetworkCommunication.h" +#import "MParticleSwift.h" +#import "mParticle.h" #if TARGET_OS_IOS == 1 #import "MPNotificationController.h" #endif diff --git a/mParticle-Apple-SDK/Persistence/MPIdentityCaching.h b/mParticle-Apple-SDK/Persistence/MPIdentityCaching.h index 61946129..96687627 100644 --- a/mParticle-Apple-SDK/Persistence/MPIdentityCaching.h +++ b/mParticle-Apple-SDK/Persistence/MPIdentityCaching.h @@ -6,8 +6,8 @@ // #import -#import "MPListenerProtocol.h" #import "MPIdentityDTO.h" +#import "MParticleSwift.h" @interface MPIdentityCachedResponse : NSObject @property (nonnull, nonatomic, readonly) NSData *bodyData; diff --git a/mParticle-Apple-SDK/Persistence/MPPersistenceController.mm b/mParticle-Apple-SDK/Persistence/MPPersistenceController.mm index d0ad55a5..8a0e6b73 100644 --- a/mParticle-Apple-SDK/Persistence/MPPersistenceController.mm +++ b/mParticle-Apple-SDK/Persistence/MPPersistenceController.mm @@ -16,7 +16,7 @@ #import "MPIConstants.h" #import "MPConsentSerialization.h" #import -#import "MPListenerProtocol.h" +#import "MParticleSwift.h" #import "MPKitFilter.h" #import "MPDevice.h" #import "MPApplication.h"