@@ -43,11 +43,15 @@ + (NSString *)moduleName {
4343}
4444
4545+ (void )load {
46+ RCTLogWarn (@" [mParticle-Rokt] RNMPRokt module load" );
4647 RCTRegisterModule (self);
4748}
4849
4950- (dispatch_queue_t )methodQueue
5051{
52+ BOOL bridgeNil = (self.bridge == nil );
53+ BOOL uiManagerNil = (self.bridge .uiManager == nil );
54+ RCTLogWarn (@" [mParticle-Rokt] methodQueue called, bridge %@ , uiManager %@ " , bridgeNil ? @" nil" : @" non-nil" , uiManagerNil ? @" nil" : @" non-nil" );
5155 return self.bridge .uiManager .methodQueue ;
5256}
5357
@@ -65,8 +69,10 @@ - (void)setMethodQueue:(dispatch_queue_t)methodQueue
6569static NSDictionary * __attribute__ ((optnone)) safeExtractRoktConfigDict(
6670 JS::NativeMPRokt::RoktConfigType &roktConfig) {
6771 if (&roktConfig == nullptr ) {
72+ RCTLogWarn (@" [mParticle-Rokt] safeExtractRoktConfigDict: roktConfig ref is nullptr, returning nil" );
6873 return nil ;
6974 }
75+ RCTLogWarn (@" [mParticle-Rokt] safeExtractRoktConfigDict: extracting config" );
7076 NSMutableDictionary *roktConfigDict = [[NSMutableDictionary alloc ] init ];
7177 if (roktConfig.cacheConfig ().has_value ()) {
7278 NSMutableDictionary *cacheConfigDict = [[NSMutableDictionary alloc ] init ];
@@ -78,7 +84,11 @@ - (void)setMethodQueue:(dispatch_queue_t)methodQueue
7884 cacheConfigDict[@" cacheAttributes" ] = cacheConfig.cacheAttributes ();
7985 }
8086 roktConfigDict[@" cacheConfig" ] = cacheConfigDict;
87+ RCTLogWarn (@" [mParticle-Rokt] safeExtractRoktConfigDict: cacheConfig present, keys: %lu " , (unsigned long )roktConfigDict.count );
88+ } else {
89+ RCTLogWarn (@" [mParticle-Rokt] safeExtractRoktConfigDict: cacheConfig has no value" );
8190 }
91+ RCTLogWarn (@" [mParticle-Rokt] safeExtractRoktConfigDict: returning dict with %lu keys" , (unsigned long )roktConfigDict.count );
8292 return roktConfigDict;
8393}
8494
@@ -89,6 +99,7 @@ - (void)selectPlacements:(NSString *)identifer
8999 roktConfig : (JS::NativeMPRokt::RoktConfigType &)roktConfig
90100 fontFilesMap : (NSDictionary *)fontFilesMap
91101{
102+ RCTLogWarn (@" [mParticle-Rokt] New Architecture Implementation" );
92103 NSMutableDictionary *finalAttributes = [self convertToMutableDictionaryOfStrings: attributes];
93104
94105 NSDictionary *roktConfigDict = safeExtractRoktConfigDict (roktConfig);
@@ -97,51 +108,66 @@ - (void)selectPlacements:(NSString *)identifer
97108// Old Architecture Implementation
98109RCT_EXPORT_METHOD (selectPlacements:(NSString *) identifer attributes:(NSDictionary *)attributes placeholders:(NSDictionary * _Nullable)placeholders roktConfig:(NSDictionary * _Nullable)roktConfig fontFilesMap:(NSDictionary * _Nullable)fontFilesMap)
99110{
111+ RCTLogWarn (@" [mParticle-Rokt] Old Architecture Implementation" );
100112 NSMutableDictionary *finalAttributes = [self convertToMutableDictionaryOfStrings: attributes];
101113 MPRoktConfig *config = [self buildRoktConfigFromDict: roktConfig];
102114#endif
103115
116+ RCTLogWarn (@" [mParticle-Rokt] selectPlacements called with identifier: %@ , attributes count: %lu " , identifer, (unsigned long )finalAttributes.count );
117+
104118 [MParticle _setWrapperSdk_internal: MPWrapperSdkReactNative version: @" " ];
105119 // Create callback implementation
106120 MPRoktEventCallback *callbacks = [[MPRoktEventCallback alloc ] init ];
107121
108- __weak __typeof__ (self) weakSelf = self;
109-
110122 callbacks.onLoad = ^{
123+ RCTLogWarn (@" [mParticle-Rokt] onLoad" );
111124 [self .eventManager onRoktCallbackReceived: @" onLoad" ];
112125 };
113126
114127 callbacks.onUnLoad = ^{
128+ RCTLogWarn (@" [mParticle-Rokt] onUnLoad" );
115129 [self .eventManager onRoktCallbackReceived: @" onUnLoad" ];
116- RCTLogInfo (@" unloaded" );
117130 };
118131
119132 callbacks.onShouldShowLoadingIndicator = ^{
133+ RCTLogWarn (@" [mParticle-Rokt] onShouldShowLoadingIndicator" );
120134 [self .eventManager onRoktCallbackReceived: @" onShouldShowLoadingIndicator" ];
121135 };
122136
123137 callbacks.onShouldHideLoadingIndicator = ^{
138+ RCTLogWarn (@" [mParticle-Rokt] onShouldHideLoadingIndicator" );
124139 [self .eventManager onRoktCallbackReceived: @" onShouldHideLoadingIndicator" ];
125140 };
126141
127142 callbacks.onEmbeddedSizeChange = ^(NSString *placementId, CGFloat height) {
143+ RCTLogWarn (@" [mParticle-Rokt] onEmbeddedSizeChange" );
128144 [self .eventManager onWidgetHeightChanges: height placement: placementId];
129145 };
130146
131- if (self.bridge == nil || self.bridge .uiManager == nil ) {
132- NSLog (@" [mParticle-Rokt] addUIBlock skipped: self.bridge%@ is nil. selectPlacements will not be called. This can occur in New Architecture bridgeless production builds." , self.bridge == nil ? @" " : @" .uiManager" );
147+ BOOL bridgeNil = (self.bridge == nil );
148+ BOOL uiManagerNil = (self.bridge .uiManager == nil );
149+ RCTLogWarn (@" [mParticle-Rokt] bridge %@ , uiManager %@ " , bridgeNil ? @" nil" : @" non-nil" , uiManagerNil ? @" nil" : @" non-nil" );
150+
151+ if (bridgeNil || uiManagerNil) {
152+ RCTLogWarn (@" [mParticle-Rokt] addUIBlock skipped: self.bridge%@ is nil. selectPlacements will not be called. This can occur in New Architecture bridgeless production builds." , bridgeNil ? @" " : @" .uiManager" );
153+ } else {
154+ RCTLogWarn (@" [mParticle-Rokt] queuing addUIBlock for identifier: %@ " , identifer);
133155 }
134156 [self .bridge.uiManager addUIBlock: ^(RCTUIManager *uiManager, NSDictionary <NSNumber *,UIView *> *viewRegistry) {
157+ RCTLogWarn (@" [mParticle-Rokt] addUIBlock executing for identifier: %@ , viewRegistry count: %lu " , identifer, (unsigned long )viewRegistry.count );
158+
135159 NSMutableDictionary *nativePlaceholders = [self getNativePlaceholders: placeholders viewRegistry: viewRegistry];
136160
137161 [self subscribeViewEvents: identifer];
138162
163+ RCTLogWarn (@" [mParticle-Rokt] calling mParticle Core selectPlacements for: %@ " , identifer);
139164 [[[MParticle sharedInstance ] rokt ] selectPlacements: identifer
140165 attributes: finalAttributes
141166 embeddedViews: nativePlaceholders
142167 config: config
143168 callbacks: callbacks];
144169 }];
170+ RCTLogWarn (@" [mParticle-Rokt] addUIBlock enqueued for identifier: %@ " , identifer);
145171}
146172
147173RCT_EXPORT_METHOD (purchaseFinalized : (NSString *)placementId catalogItemId : (
@@ -180,6 +206,7 @@ - (MPColorMode)stringToColorMode:(NSString*)colorString
180206}
181207
182208- (MPRoktConfig *)buildRoktConfigFromDict:(NSDictionary <NSString *, id > *)configMap {
209+ RCTLogWarn (@" [mParticle-Rokt] buildRoktConfigFromDict: configMap %@ " , configMap == nil ? @" nil" : [NSString stringWithFormat: @" non-nil (%lu keys)" , (unsigned long )configMap.count]);
183210 MPRoktConfig *config = [[MPRoktConfig alloc ] init ];
184211 BOOL isConfigEmpty = YES ;
185212
@@ -212,11 +239,13 @@ - (MPRoktConfig *)buildRoktConfigFromDict:(NSDictionary<NSString *, id> *)config
212239 config.cacheDuration = cacheDuration;
213240 }
214241
242+ RCTLogWarn (@" [mParticle-Rokt] buildRoktConfigFromDict: returning %@ " , isConfigEmpty ? @" nil" : @" config" );
215243 return isConfigEmpty ? nil : config;
216244}
217245
218246- (void )subscribeViewEvents:(NSString * _Nonnull) viewName
219247{
248+ RCTLogWarn (@" [mParticle-Rokt] subscribeViewEvents for viewName: %@ " , viewName);
220249 if (self.eventManager == nil ) {
221250 self.eventManager = [RoktEventManager allocWithZone: nil ];
222251 }
@@ -227,6 +256,7 @@ - (void)subscribeViewEvents:(NSString* _Nonnull) viewName
227256
228257- (NSMutableDictionary *)getNativePlaceholders:(NSDictionary *)placeholders viewRegistry:(NSDictionary <NSNumber *, UIView *> *)viewRegistry
229258{
259+ RCTLogWarn (@" [mParticle-Rokt] getNativePlaceholders: placeholders %lu , viewRegistry %lu " , (unsigned long )placeholders.count , (unsigned long )viewRegistry.count );
230260 NSMutableDictionary *nativePlaceholders = [[NSMutableDictionary alloc ]initWithCapacity:placeholders.count];
231261
232262 for (id key in placeholders){
@@ -248,12 +278,14 @@ - (NSMutableDictionary *)getNativePlaceholders:(NSDictionary *)placeholders view
248278#endif // RCT_NEW_ARCH_ENABLED
249279 }
250280
281+ RCTLogWarn (@" [mParticle-Rokt] getNativePlaceholders: resolved %lu native placeholder(s)" , (unsigned long )nativePlaceholders.count );
251282 return nativePlaceholders;
252283}
253284
254285#ifdef RCT_NEW_ARCH_ENABLED
255286- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
256287 self.bridge = params.instance .bridge ;
288+ RCTLogWarn (@" [mParticle-Rokt] getTurboModule: bridge set to %@ " , self.bridge == nil ? @" nil" : @" non-nil" );
257289 return std::make_shared<facebook::react::NativeMPRoktSpecJSI>(params);
258290}
259291#endif // RCT_NEW_ARCH_ENABLED
0 commit comments