File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,28 +183,46 @@ @implementation MatherAnalytics
183183 accountNumber: accountNumber];
184184
185185 NSMutableDictionary *event = [[NSMutableDictionary alloc ] init ];
186-
186+ NSMutableDictionary *options = [[NSMutableDictionary alloc ] init ];
187+
188+ // Handles Event
189+
190+ /*
187191 // no support for type
188- // NSString* type = [RCTConvert NSString:payload[@"type"]];
189- // if (type) {
190- // event[@"type"] = type;
191- // }
192+ NSString* type = [RCTConvert NSString:payload[@"type"]];
193+ if (type) {
194+ event[@"type"] = type;
195+ }
196+ */
197+
192198 NSString * category = [RCTConvert NSString: payload[@" category" ]];
193199 if (category) {
194- event[ @" category" ] = category ;
200+ [event setObject: category forKey: @" category" ];
195201 }
196202 NSString * action = [RCTConvert NSString: payload[@" action" ]];
197203 if (action) {
198- event[ @" action" ] = action ;
204+ [event setObject: action forKey: @" action" ];
199205 }
200206
207+ // Handles Options
208+ NSArray *offers = [RCTConvert NSArray: payload[@" offers" ]];
209+ if (offers) {
210+ [options setObject: offers forKey: @" offers" ];
211+ }
212+
213+ /*
201214 // no support for custom
202- // NSDictionary* custom = [RCTConvert NSDictionary:payload[@"custom"]];
203- // if (custom) {
204- // impression[@"custom"] = custom;
205- // }
215+ NSDictionary* custom = [RCTConvert NSDictionary:payload[@"custom"]];
216+ if (custom) {
217+ impression[@"custom"] = custom;
218+ }
219+ */
206220
207- [mListener trackEvent: event];
221+ if ([options count ] > 0 ) {
222+ [mListener trackEvent: event options: options];
223+ } else {
224+ [mListener trackEvent: event];
225+ }
208226}
209227
210228RCT_EXPORT_METHOD (trackImpression:(nonnull NSString *)accountName
You can’t perform that action at this time.
0 commit comments