Skip to content

Commit

Permalink
refactor: Port MPLaunchInfo to Swift
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonStalnaker committed Dec 19, 2024
1 parent 6cc3db7 commit 8f68ec5
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 207 deletions.
1 change: 0 additions & 1 deletion UnitTests/MPBackendControllerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#import "MPBaseTestCase.h"
#import "MPIUserDefaults.h"
#import "MPDevice.h"
#import "MPLaunchInfo.h"

#if TARGET_OS_IOS == 1
#import <CoreLocation/CoreLocation.h>
Expand Down
8 changes: 1 addition & 7 deletions UnitTests/MPLaunchInfoTests.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import <XCTest/XCTest.h>
#import "MPLaunchInfo.h"
#import "MParticleSwift.h"
#import "MParticleSwift.h"
#import "MPBaseTestCase.h"

Expand Down Expand Up @@ -91,12 +91,6 @@ - (void)testInvalidValues {

MPLaunchInfo *launchInfo = [[MPLaunchInfo alloc] initWithURL:url sourceApplication:sourceApp annotation:annotation];
XCTAssertNil(launchInfo, @"Should have been nil.");

url = (NSURL *)[NSNull null];
sourceApp = nil;

launchInfo = [[MPLaunchInfo alloc] initWithURL:url sourceApplication:sourceApp annotation:annotation];
XCTAssertNil(launchInfo, @"Should have been nil.");
}

- (void)testCreation {
Expand Down
2 changes: 1 addition & 1 deletion UnitTests/MPStateMachineTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "MPBaseTestCase.h"
#import "MPStateMachine.h"
#import "MPKitContainer.h"
#import "MPLaunchInfo.h"
#import "MParticleSwift.h"

#pragma mark - MPStateMachine category
@interface MPStateMachine_PRIVATE(Tests)
Expand Down
18 changes: 6 additions & 12 deletions mParticle-Apple-SDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,12 @@
53A79BD229CDFB2000E7489F /* MPApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B0D29CDFB1F00E7489F /* MPApplication.m */; };
53A79BD729CDFB2000E7489F /* MPUploadBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B1229CDFB1F00E7489F /* MPUploadBuilder.m */; };
53A79BDA29CDFB2000E7489F /* MPDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B1529CDFB1F00E7489F /* MPDevice.m */; };
53A79BDC29CDFB2000E7489F /* MPLaunchInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B1729CDFB1F00E7489F /* MPLaunchInfo.h */; };
53A79BDF29CDFB2000E7489F /* MPMessageBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B1A29CDFB1F00E7489F /* MPMessageBuilder.h */; };
53A79BE229CDFB2000E7489F /* MPIUserDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B1D29CDFB1F00E7489F /* MPIUserDefaults.m */; };
53A79BE329CDFB2000E7489F /* MPBracket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B1E29CDFB1F00E7489F /* MPBracket.cpp */; };
53A79BE829CDFB2000E7489F /* MPUploadBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B2329CDFB1F00E7489F /* MPUploadBuilder.h */; };
53A79BE929CDFB2000E7489F /* MPApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B2429CDFB1F00E7489F /* MPApplication.h */; settings = {ATTRIBUTES = (Public, ); }; };
53A79BEB29CDFB2000E7489F /* NSNumber+MPFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B2629CDFB1F00E7489F /* NSNumber+MPFormatter.swift */; };
53A79BEE29CDFB2000E7489F /* MPLaunchInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B2929CDFB1F00E7489F /* MPLaunchInfo.m */; };
53A79BF029CDFB2000E7489F /* MPDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B2B29CDFB1F00E7489F /* MPDevice.h */; };
53A79BF129CDFB2000E7489F /* MPBracket.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B2C29CDFB1F00E7489F /* MPBracket.h */; };
53A79BF329CDFB2000E7489F /* MPCustomModulePreference.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B2F29CDFB1F00E7489F /* MPCustomModulePreference.h */; };
Expand Down Expand Up @@ -341,7 +339,6 @@
53A79D2129CE23F700E7489F /* NSDictionary+MPCaseInsensitive.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C3329CDFB4800E7489F /* NSDictionary+MPCaseInsensitive.h */; settings = {ATTRIBUTES = (Public, ); }; };
53A79D2229CE23F700E7489F /* MPCommerceEventInstruction.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C2F29CDFB4800E7489F /* MPCommerceEventInstruction.h */; settings = {ATTRIBUTES = (Public, ); }; };
53A79D2329CE23F700E7489F /* MPTransactionAttributes+Dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79C4429CDFB4800E7489F /* MPTransactionAttributes+Dictionary.h */; settings = {ATTRIBUTES = (Public, ); }; };
53A79D2529CE23F700E7489F /* MPLaunchInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B1729CDFB1F00E7489F /* MPLaunchInfo.h */; };
53A79D2729CE23F700E7489F /* MPApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B2429CDFB1F00E7489F /* MPApplication.h */; settings = {ATTRIBUTES = (Public, ); }; };
53A79D2829CE23F700E7489F /* MPCustomModulePreference.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79B2F29CDFB1F00E7489F /* MPCustomModulePreference.h */; };
53A79D2929CE23F700E7489F /* MPDataModelProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A79AC229CDFB1E00E7489F /* MPDataModelProtocol.h */; };
Expand Down Expand Up @@ -412,7 +409,6 @@
53A79D7929CE23F700E7489F /* MPBracket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B1E29CDFB1F00E7489F /* MPBracket.cpp */; };
53A79D7A29CE23F700E7489F /* MParticleUserNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79AC729CDFB1E00E7489F /* MParticleUserNotification.m */; };
53A79D7B29CE23F700E7489F /* MPIConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B6429CDFB1F00E7489F /* MPIConstants.m */; };
53A79D7C29CE23F700E7489F /* MPLaunchInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B2929CDFB1F00E7489F /* MPLaunchInfo.m */; };
53A79D7D29CE23F700E7489F /* MPPromotion.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B4129CDFB1F00E7489F /* MPPromotion.m */; };
53A79D8129CE23F700E7489F /* MPIdentityApiRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A79A9829CDFB1E00E7489F /* MPIdentityApiRequest.m */; };
53A79D8229CE23F700E7489F /* MPCommerceEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53A79B4029CDFB1F00E7489F /* MPCommerceEvent.mm */; };
Expand Down Expand Up @@ -473,6 +469,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, ); }; };
D346D8DB2D14682000FBA8B1 /* MPLaunchInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D346D8DA2D14682000FBA8B1 /* MPLaunchInfo.swift */; };
D346D8DC2D14682000FBA8B1 /* MPLaunchInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D346D8DA2D14682000FBA8B1 /* MPLaunchInfo.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, ); }; };
Expand Down Expand Up @@ -599,14 +597,12 @@
53A79B0D29CDFB1F00E7489F /* MPApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPApplication.m; sourceTree = "<group>"; };
53A79B1229CDFB1F00E7489F /* MPUploadBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPUploadBuilder.m; sourceTree = "<group>"; };
53A79B1529CDFB1F00E7489F /* MPDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDevice.m; sourceTree = "<group>"; };
53A79B1729CDFB1F00E7489F /* MPLaunchInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPLaunchInfo.h; sourceTree = "<group>"; };
53A79B1A29CDFB1F00E7489F /* MPMessageBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPMessageBuilder.h; sourceTree = "<group>"; };
53A79B1D29CDFB1F00E7489F /* MPIUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPIUserDefaults.m; sourceTree = "<group>"; };
53A79B1E29CDFB1F00E7489F /* MPBracket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MPBracket.cpp; sourceTree = "<group>"; };
53A79B2329CDFB1F00E7489F /* MPUploadBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPUploadBuilder.h; sourceTree = "<group>"; };
53A79B2429CDFB1F00E7489F /* MPApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPApplication.h; sourceTree = "<group>"; };
53A79B2629CDFB1F00E7489F /* NSNumber+MPFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSNumber+MPFormatter.swift"; sourceTree = "<group>"; };
53A79B2929CDFB1F00E7489F /* MPLaunchInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPLaunchInfo.m; sourceTree = "<group>"; };
53A79B2B29CDFB1F00E7489F /* MPDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDevice.h; sourceTree = "<group>"; };
53A79B2C29CDFB1F00E7489F /* MPBracket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPBracket.h; sourceTree = "<group>"; };
53A79B2F29CDFB1F00E7489F /* MPCustomModulePreference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPCustomModulePreference.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -767,6 +763,7 @@
53B33E892A4606CD00CC8A19 /* MPSideloadedKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPSideloadedKit.swift; sourceTree = "<group>"; };
53E20DC62CBFFCD200146A97 /* NSArray+MPCaseInsensitiveTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSArray+MPCaseInsensitiveTests.swift"; sourceTree = "<group>"; };
53FDD1BC2AE871AF003D5FA1 /* MPIHasher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPIHasher.swift; sourceTree = "<group>"; };
D346D8DA2D14682000FBA8B1 /* MPLaunchInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPLaunchInfo.swift; sourceTree = "<group>"; };
D356E0232CFE08ED0020898D /* MPResponseConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPResponseConfig.swift; sourceTree = "<group>"; };
D3724C182AE02AF60074CD67 /* mParticle_Apple_SDK_NoLocation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mParticle_Apple_SDK_NoLocation.h; sourceTree = "<group>"; };
D3961CD52CB468DC003B3194 /* NSArray+MPCaseInsensitive.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSArray+MPCaseInsensitive.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1009,13 +1006,12 @@
D3961CDD2CC0B7E4003B3194 /* NSString+MPPercentEscape.swift */,
53A79B1229CDFB1F00E7489F /* MPUploadBuilder.m */,
53A79B1529CDFB1F00E7489F /* MPDevice.m */,
53A79B1729CDFB1F00E7489F /* MPLaunchInfo.h */,
D346D8DA2D14682000FBA8B1 /* MPLaunchInfo.swift */,
53A79B1A29CDFB1F00E7489F /* MPMessageBuilder.h */,
53A79B1D29CDFB1F00E7489F /* MPIUserDefaults.m */,
53A79B1E29CDFB1F00E7489F /* MPBracket.cpp */,
53A79B2329CDFB1F00E7489F /* MPUploadBuilder.h */,
53A79B2629CDFB1F00E7489F /* NSNumber+MPFormatter.swift */,
53A79B2929CDFB1F00E7489F /* MPLaunchInfo.m */,
53A79B2B29CDFB1F00E7489F /* MPDevice.h */,
53A79B2C29CDFB1F00E7489F /* MPBracket.h */,
53FDD1BC2AE871AF003D5FA1 /* MPIHasher.swift */,
Expand Down Expand Up @@ -1313,7 +1309,6 @@
53A79C5529CDFB4800E7489F /* NSDictionary+MPCaseInsensitive.h in Headers */,
53A79C5129CDFB4800E7489F /* MPCommerceEventInstruction.h in Headers */,
53A79C6629CDFB4800E7489F /* MPTransactionAttributes+Dictionary.h in Headers */,
53A79BDC29CDFB2000E7489F /* MPLaunchInfo.h in Headers */,
53A79BE929CDFB2000E7489F /* MPApplication.h in Headers */,
D30CD0CB2CFF5FB100F5148A /* MPStateMachine.h in Headers */,
53A79BF329CDFB2000E7489F /* MPCustomModulePreference.h in Headers */,
Expand Down Expand Up @@ -1405,7 +1400,6 @@
53A79D2129CE23F700E7489F /* NSDictionary+MPCaseInsensitive.h in Headers */,
53A79D2229CE23F700E7489F /* MPCommerceEventInstruction.h in Headers */,
53A79D2329CE23F700E7489F /* MPTransactionAttributes+Dictionary.h in Headers */,
53A79D2529CE23F700E7489F /* MPLaunchInfo.h in Headers */,
53A79D2729CE23F700E7489F /* MPApplication.h in Headers */,
53A79D2829CE23F700E7489F /* MPCustomModulePreference.h in Headers */,
53A79D2929CE23F700E7489F /* MPDataModelProtocol.h in Headers */,
Expand Down Expand Up @@ -1718,7 +1712,6 @@
53A79B9129CDFB2000E7489F /* MParticleUserNotification.m in Sources */,
53A79C2129CDFB2100E7489F /* MPIConstants.m in Sources */,
530D24832CFF72D9000FE7E3 /* MPConstants.swift in Sources */,
53A79BEE29CDFB2000E7489F /* MPLaunchInfo.m in Sources */,
53A79C0229CDFB2100E7489F /* MPPromotion.m in Sources */,
D356E0242CFE08ED0020898D /* MPResponseConfig.swift in Sources */,
53A79B6629CDFB2000E7489F /* MPIdentityApiRequest.m in Sources */,
Expand Down Expand Up @@ -1747,6 +1740,7 @@
53B33E8A2A4606CD00CC8A19 /* MPSideloadedKit.swift in Sources */,
53A79B9629CDFB2000E7489F /* MPSession.m in Sources */,
53A79B9729CDFB2000E7489F /* MPIntegrationAttributes.m in Sources */,
D346D8DB2D14682000FBA8B1 /* MPLaunchInfo.swift in Sources */,
D3CEDAC82CA2F214001B32DF /* MPLogger.swift in Sources */,
53A79B6A29CDFB2000E7489F /* MPAliasRequest.m in Sources */,
53A79B6829CDFB2000E7489F /* MParticleUser.m in Sources */,
Expand Down Expand Up @@ -1886,7 +1880,6 @@
53A79D7A29CE23F700E7489F /* MParticleUserNotification.m in Sources */,
531BCF372B28A23400F5C573 /* MPIdentityCaching.m in Sources */,
53A79D7B29CE23F700E7489F /* MPIConstants.m in Sources */,
53A79D7C29CE23F700E7489F /* MPLaunchInfo.m in Sources */,
530D24822CFF72D9000FE7E3 /* MPConstants.swift in Sources */,
53A79D7D29CE23F700E7489F /* MPPromotion.m in Sources */,
534CD25C29CE2877008452B3 /* NSNumber+MPFormatter.swift in Sources */,
Expand Down Expand Up @@ -1917,6 +1910,7 @@
53A79D9929CE23F700E7489F /* MPDataPlanFilter.m in Sources */,
53B33E8B2A4606CD00CC8A19 /* MPSideloadedKit.swift in Sources */,
53A79D9A29CE23F700E7489F /* MPSession.m in Sources */,
D346D8DC2D14682000FBA8B1 /* MPLaunchInfo.swift in Sources */,
53A79D9B29CE23F700E7489F /* MPIntegrationAttributes.m in Sources */,
D3CEDAC92CA2F214001B32DF /* MPLogger.swift in Sources */,
53A79D9C29CE23F700E7489F /* MPAliasRequest.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import "MPAppNotificationHandler.h"
#import "MPLaunchInfo.h"
#import "MPForwardRecord.h"
#import "MPPersistenceController.h"
#import "MPILogger.h"
Expand All @@ -9,6 +8,7 @@
#import "MPForwardQueueParameters.h"
#import "MPKitAPI.h"
#import "MPApplication.h"
#import "MParticleSwift.h"
#import "mParticle.h"

#if TARGET_OS_IOS == 1
Expand Down
1 change: 0 additions & 1 deletion mParticle-Apple-SDK/MPBackendController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#import "MPDevice.h"
#import "MPIdentityCaching.h"
#import "MParticleSwift.h"
#import "MPLaunchInfo.h"
#import "MPNetworkCommunication.h"
#if TARGET_OS_IOS == 1
#import "MPNotificationController.h"
Expand Down
1 change: 0 additions & 1 deletion mParticle-Apple-SDK/MPStateMachine.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#import "MPForwardQueueParameters.h"
#import "MPDataPlanFilter.h"
#import "MParticleSwift.h"
#import "MPLaunchInfo.h"
#import "MParticleReachability.h"
#import "MPIConstants.h"

Expand Down
13 changes: 0 additions & 13 deletions mParticle-Apple-SDK/Utils/MPLaunchInfo.h

This file was deleted.

Loading

0 comments on commit 8f68ec5

Please sign in to comment.