-
Notifications
You must be signed in to change notification settings - Fork 1
feat: SQDSDKS-7423 - Add event mapping functionality and new MPRoktEventMapper class #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
BrandonStalnaker
merged 5 commits into
development
from
feat/SQDSDKS-7423-events-api-subscription
Jun 20, 2025
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2a6e164
feat: SQDSDKS-7423 - Add event mapping functionality and new MPRoktEv…
thomson-t 2a38817
Add unit tests
thomson-t 55c17ed
Remove onFulfillmentAttributesUpdate
jamesnrokt a6514a1
Remove refs to global events
jamesnrokt 04c2453
fix tests
BrandonStalnaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |||
| archiveVersion = 1; | ||||
| classes = { | ||||
| }; | ||||
| objectVersion = 54; | ||||
| objectVersion = 60; | ||||
| objects = { | ||||
|
|
||||
| /* Begin PBXBuildFile section */ | ||||
|
|
@@ -12,6 +12,8 @@ | |||
| 7E15B2092D9AE82000C1FF3E /* mParticle-Apple-SDK in Frameworks */ = {isa = PBXBuildFile; productRef = 7E15B2082D9AE82000C1FF3E /* mParticle-Apple-SDK */; }; | ||||
| 7E15B20B2D9AE82600C1FF3E /* Rokt-Widget in Frameworks */ = {isa = PBXBuildFile; productRef = 7E15B20A2D9AE82600C1FF3E /* Rokt-Widget */; }; | ||||
| 7EE7F13E2DA95BEE006C5440 /* OCMock in Frameworks */ = {isa = PBXBuildFile; productRef = 7EE7F13D2DA95BEE006C5440 /* OCMock */; }; | ||||
| B3D778532E02845700D887A4 /* MPRoktEventMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */; }; | ||||
| B3D778582E028ACD00D887A4 /* MPRoktEventMapper.h in Headers */ = {isa = PBXBuildFile; fileRef = B3D778572E028ACD00D887A4 /* MPRoktEventMapper.h */; }; | ||||
| DBB01A601DC1478A00A7B188 /* mParticle_Rokt.h in Headers */ = {isa = PBXBuildFile; fileRef = DBB01A5E1DC1478A00A7B188 /* mParticle_Rokt.h */; settings = {ATTRIBUTES = (Public, ); }; }; | ||||
| DBB01A681DC1480700A7B188 /* MPKitRokt.h in Headers */ = {isa = PBXBuildFile; fileRef = DBB01A661DC1480700A7B188 /* MPKitRokt.h */; }; | ||||
| DBB01A691DC1480700A7B188 /* MPKitRokt.m in Sources */ = {isa = PBXBuildFile; fileRef = DBB01A671DC1480700A7B188 /* MPKitRokt.m */; }; | ||||
|
|
@@ -30,6 +32,8 @@ | |||
| /* End PBXContainerItemProxy section */ | ||||
|
|
||||
| /* Begin PBXFileReference section */ | ||||
| B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPRoktEventMapper.swift; sourceTree = "<group>"; }; | ||||
| B3D778572E028ACD00D887A4 /* MPRoktEventMapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPRoktEventMapper.h; sourceTree = "<group>"; }; | ||||
| DBB01A5B1DC1478A00A7B188 /* mParticle_Rokt.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = mParticle_Rokt.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | ||||
| DBB01A5E1DC1478A00A7B188 /* mParticle_Rokt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mParticle_Rokt.h; sourceTree = "<group>"; }; | ||||
| DBB01A5F1DC1478A00A7B188 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | ||||
|
|
@@ -86,6 +90,8 @@ | |||
| DBB01A5D1DC1478A00A7B188 /* mParticle-Rokt */ = { | ||||
| isa = PBXGroup; | ||||
| children = ( | ||||
| B3D778572E028ACD00D887A4 /* MPRoktEventMapper.h */, | ||||
| B3D778512E02845700D887A4 /* MPRoktEventMapper.swift */, | ||||
| DBB01A661DC1480700A7B188 /* MPKitRokt.h */, | ||||
| DBB01A671DC1480700A7B188 /* MPKitRokt.m */, | ||||
| DBB01A5E1DC1478A00A7B188 /* mParticle_Rokt.h */, | ||||
|
|
@@ -117,6 +123,7 @@ | |||
| isa = PBXHeadersBuildPhase; | ||||
| buildActionMask = 2147483647; | ||||
| files = ( | ||||
| B3D778582E028ACD00D887A4 /* MPRoktEventMapper.h in Headers */, | ||||
| DBB01A601DC1478A00A7B188 /* mParticle_Rokt.h in Headers */, | ||||
| DBB01A681DC1480700A7B188 /* MPKitRokt.h in Headers */, | ||||
| ); | ||||
|
|
@@ -176,10 +183,12 @@ | |||
| TargetAttributes = { | ||||
| DBB01A5A1DC1478A00A7B188 = { | ||||
| CreatedOnToolsVersion = 8.0; | ||||
| LastSwiftMigration = 1640; | ||||
| ProvisioningStyle = Automatic; | ||||
| }; | ||||
| FF0BB63A217A84E800B0556C = { | ||||
| CreatedOnToolsVersion = 10.0; | ||||
| LastSwiftMigration = 1640; | ||||
| ProvisioningStyle = Automatic; | ||||
| }; | ||||
| }; | ||||
|
|
@@ -230,6 +239,7 @@ | |||
| isa = PBXSourcesBuildPhase; | ||||
| buildActionMask = 2147483647; | ||||
| files = ( | ||||
| B3D778522E02845700D887A4 /* MPRoktEventMapper.swift in Sources */, | ||||
| DBB01A691DC1480700A7B188 /* MPKitRokt.m in Sources */, | ||||
| ); | ||||
| runOnlyForDeploymentPostprocessing = 0; | ||||
|
|
@@ -238,6 +248,7 @@ | |||
| isa = PBXSourcesBuildPhase; | ||||
| buildActionMask = 2147483647; | ||||
| files = ( | ||||
| B3D778532E02845700D887A4 /* MPRoktEventMapper.swift in Sources */, | ||||
|
||||
| B3D778532E02845700D887A4 /* MPRoktEventMapper.swift in Sources */, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #import <Foundation/Foundation.h> | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @protocol MPRoktEvent; | ||
| @class RoktEvent; | ||
|
|
||
| @interface MPRoktEventMapper : NSObject | ||
|
|
||
| + (nullable id<MPRoktEvent>)mapEvent:(RoktEvent *)event; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import Foundation | ||
| import mParticle_Apple_SDK | ||
| import Rokt_Widget | ||
|
|
||
| /// Utility class for mapping Rokt events to mParticle events | ||
| @objc(MPRoktEventMapper) public class MPRoktEventMapper: NSObject { | ||
| /// Maps a RoktEvent to the corresponding MPRoktEvent | ||
| /// - Parameter event: The RoktEvent to map | ||
| /// - Returns: The mapped MPRoktEvent, or nil if mapping fails | ||
| @objc public static func mapEvent(_ event: RoktEvent) -> MPRoktEvent? { | ||
| switch event { | ||
| case let initComplete as RoktEvent.InitComplete: | ||
| return MPRoktEvent.MPRoktInitComplete(success: initComplete.success) | ||
|
|
||
| case is RoktEvent.ShowLoadingIndicator: | ||
| return MPRoktEvent.MPRoktShowLoadingIndicator() | ||
|
|
||
| case is RoktEvent.HideLoadingIndicator: | ||
| return MPRoktEvent.MPRoktHideLoadingIndicator() | ||
|
|
||
| case let placementInteractive as RoktEvent.PlacementInteractive: | ||
| return MPRoktEvent.MPRoktPlacementInteractive(placementId: placementInteractive.placementId) | ||
|
|
||
| case let placementReady as RoktEvent.PlacementReady: | ||
| return MPRoktEvent.MPRoktPlacementReady(placementId: placementReady.placementId) | ||
|
|
||
| case let offerEngagement as RoktEvent.OfferEngagement: | ||
| return MPRoktEvent.MPRoktOfferEngagement(placementId: offerEngagement.placementId) | ||
|
|
||
| case let openUrl as RoktEvent.OpenUrl: | ||
| return MPRoktEvent.MPRoktOpenUrl(placementId: openUrl.placementId, url: openUrl.url) | ||
|
|
||
| case let positiveEngagement as RoktEvent.PositiveEngagement: | ||
| return MPRoktEvent.MPRoktPositiveEngagement(placementId: positiveEngagement.placementId) | ||
|
|
||
| case let placementClosed as RoktEvent.PlacementClosed: | ||
| return MPRoktEvent.MPRoktPlacementClosed(placementId: placementClosed.placementId) | ||
|
|
||
| case let placementCompleted as RoktEvent.PlacementCompleted: | ||
| return MPRoktEvent.MPRoktPlacementCompleted(placementId: placementCompleted.placementId) | ||
|
|
||
| case let placementFailure as RoktEvent.PlacementFailure: | ||
| return MPRoktEvent.MPRoktPlacementFailure(placementId: placementFailure.placementId) | ||
|
|
||
| case let firstPositiveEngagement as RoktEvent.FirstPositiveEngagement: | ||
| return MPRoktEvent.MPRoktFirstPositiveEngagement( | ||
| placementId: firstPositiveEngagement.placementId, | ||
| onFulfillmentAttributesUpdate: firstPositiveEngagement.setFulfillmentAttributes | ||
| ) | ||
|
|
||
| case let cartItemInstantPurchase as RoktEvent.CartItemInstantPurchase: | ||
| return MPRoktEvent.MPRoktCartItemInstantPurchase( | ||
| placementId: cartItemInstantPurchase.placementId, | ||
| name: cartItemInstantPurchase.name ?? "", | ||
| cartItemId: cartItemInstantPurchase.cartItemId, | ||
| catalogItemId: cartItemInstantPurchase.catalogItemId, | ||
| currency: cartItemInstantPurchase.currency, | ||
| description: cartItemInstantPurchase.description, | ||
| linkedProductId: cartItemInstantPurchase.linkedProductId, | ||
| providerData: cartItemInstantPurchase.providerData, | ||
| quantity: cartItemInstantPurchase.quantity, | ||
| totalPrice: cartItemInstantPurchase.totalPrice, | ||
| unitPrice: cartItemInstantPurchase.unitPrice | ||
| ) | ||
|
|
||
| default: | ||
| return nil | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The podspec declares Swift version '5.3' but the Xcode project is set to Swift 6.0. Align the podspec
swift_versionwith the project to avoid compatibility issues.