Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mParticle-Rokt.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Pod::Spec.new do |s|
s.swift_version = '5.3'

Copilot AI Jun 18, 2025

Copy link

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_version with the project to avoid compatibility issues.

Suggested change
s.swift_version = '5.3'
s.swift_version = '6.0'

Copilot uses AI. Check for mistakes.

s.ios.deployment_target = "12.0"
s.ios.source_files = 'mParticle-Rokt/*.{h,m}'
s.ios.source_files = 'mParticle-Rokt/*.{h,m,swift}'
s.ios.public_header_files = 'mParticle-Rokt/*.h'
s.ios.dependency 'mParticle-Apple-SDK', '~> 8.0'
s.ios.dependency 'Rokt-Widget', '~> 4.10'
end
23 changes: 22 additions & 1 deletion mParticle-Rokt.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 60;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -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 */; };
Expand All @@ -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>"; };
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
);
Expand Down Expand Up @@ -176,10 +183,12 @@
TargetAttributes = {
DBB01A5A1DC1478A00A7B188 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 1640;
ProvisioningStyle = Automatic;
};
FF0BB63A217A84E800B0556C = {
CreatedOnToolsVersion = 10.0;
LastSwiftMigration = 1640;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -230,6 +239,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B3D778522E02845700D887A4 /* MPRoktEventMapper.swift in Sources */,
DBB01A691DC1480700A7B188 /* MPKitRokt.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -238,6 +248,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B3D778532E02845700D887A4 /* MPRoktEventMapper.swift in Sources */,

Copilot AI Jun 18, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MPRoktEventMapper.swift is listed twice under PBXSourcesBuildPhase, leading to duplicate file references. Remove the extra entry.

Suggested change
B3D778532E02845700D887A4 /* MPRoktEventMapper.swift in Sources */,

Copilot uses AI. Check for mistakes.
FF0BB63E217A84E800B0556C /* mParticle_RoktTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -352,6 +363,7 @@
DBB01A641DC1478A00A7B188 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -371,12 +383,15 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-Rokt";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 6.0;
};
name = Debug;
};
DBB01A651DC1478A00A7B188 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -396,6 +411,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-Rokt";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand All @@ -404,6 +420,7 @@
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
Expand Down Expand Up @@ -433,6 +450,8 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-RoktTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -442,6 +461,7 @@
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
Expand Down Expand Up @@ -470,6 +490,7 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.mparticle.mParticle-RoktTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
21 changes: 21 additions & 0 deletions mParticle-Rokt/MPKitRokt.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "MPKitRokt.h"
#import <Rokt_Widget/Rokt_Widget-Swift.h>
#import "MPRoktEventMapper.h"

NSString * const kMPRemoteConfigKitHashesKey = @"hs";
NSString * const kMPRemoteConfigUserAttributeFilter = @"ua";
Expand Down Expand Up @@ -296,6 +297,26 @@
return [[MPKitExecStatus alloc] initWithSDKCode:[[self class] kitCode] returnCode:MPKitReturnCodeFail];
}

- (MPKitExecStatus *)eventsWithIdentifier:(NSString *)identifier onEvent:(void (^)(MPRoktEvent * _Nonnull))onEvent {

Check failure on line 300 in mParticle-Rokt/MPKitRokt.m

View workflow job for this annotation

GitHub Actions / Test

unknown type name 'MPRoktEvent'; did you mean 'RoktEvent'?
[Rokt eventsWithViewName:identifier onEvent:^(RoktEvent * _Nonnull event) {
MPRoktEvent *mpEvent = [MPRoktEventMapper mapEvent:event];

Check warning on line 302 in mParticle-Rokt/MPKitRokt.m

View workflow job for this annotation

GitHub Actions / Test

initializing 'RoktEvent *__strong' with an expression of incompatible type 'id<MPRoktEvent> _Nullable'

Check failure on line 302 in mParticle-Rokt/MPKitRokt.m

View workflow job for this annotation

GitHub Actions / Test

unknown type name 'MPRoktEvent'; did you mean 'RoktEvent'?
if (mpEvent) {
onEvent(mpEvent);
}
}];
return [[MPKitExecStatus alloc] initWithSDKCode:[[self class] kitCode] returnCode:MPKitReturnCodeSuccess];
}

- (MPKitExecStatus *)globalEventsOnEvent:(void (^)(MPRoktEvent * _Nonnull))onEvent {

Check failure on line 310 in mParticle-Rokt/MPKitRokt.m

View workflow job for this annotation

GitHub Actions / Test

unknown type name 'MPRoktEvent'; did you mean 'RoktEvent'?
[Rokt globalEventsOnEvent:^(RoktEvent * _Nonnull event) {
MPRoktEvent *mpEvent = [MPRoktEventMapper mapEvent:event];

Check warning on line 312 in mParticle-Rokt/MPKitRokt.m

View workflow job for this annotation

GitHub Actions / Test

initializing 'RoktEvent *__strong' with an expression of incompatible type 'id<MPRoktEvent> _Nullable'

Check failure on line 312 in mParticle-Rokt/MPKitRokt.m

View workflow job for this annotation

GitHub Actions / Test

unknown type name 'MPRoktEvent'; did you mean 'RoktEvent'?
if (mpEvent) {
onEvent(mpEvent);
}
}];
return [[MPKitExecStatus alloc] initWithSDKCode:[[self class] kitCode] returnCode:MPKitReturnCodeSuccess];
}

#pragma mark - User attributes and identities

- (MPKitExecStatus *)setUserIdentity:(NSString *)identityString identityType:(MPUserIdentity)identityType {
Expand Down
14 changes: 14 additions & 0 deletions mParticle-Rokt/MPRoktEventMapper.h
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
70 changes: 70 additions & 0 deletions mParticle-Rokt/MPRoktEventMapper.swift
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
}
}
}
Loading