File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed
Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ NSURL* /* _Nonnull */ BNCURLForBranchDirectory(void);
8585
8686- (void )addInstrumentationDictionaryKey : (NSString *)key value : (NSString *)value ;
8787- (NSMutableDictionary *)instrumentationDictionary ;
88+ - (NSDictionary *)instrumentationParameters ; // a safe copy to use in a POST body
8889- (void )clearInstrumentationDictionary ;
8990
9091- (void )saveBranchAnalyticsData : (NSDictionary *)analyticsData ;
Original file line number Diff line number Diff line change @@ -492,6 +492,15 @@ - (void)setRequestMetadataKey:(NSString *)key value:(NSObject *)value {
492492 }
493493}
494494
495+ - (NSDictionary *)instrumentationParameters {
496+ @synchronized (self) {
497+ if (_instrumentationDictionary.count == 0 ) {
498+ return nil ; // this avoids the .count check in prepareParamDict
499+ }
500+ return [[NSDictionary alloc ] initWithDictionary: _instrumentationDictionary];
501+ }
502+ }
503+
495504- (NSMutableDictionary *)instrumentationDictionary {
496505 @synchronized (self) {
497506 if (!_instrumentationDictionary) {
Original file line number Diff line number Diff line change @@ -443,10 +443,12 @@ - (NSMutableDictionary *)prepareParamDict:(NSDictionary *)params
443443 fullParamDict[BRANCH_REQUEST_KEY_STATE] = metadata;
444444 }
445445 // we only send instrumentation info in the POST body request
446- if (self.preferenceHelper .instrumentationDictionary .count && [reqType isEqualToString: @" POST" ]) {
447- fullParamDict[BRANCH_REQUEST_KEY_INSTRUMENTATION] = self.preferenceHelper .instrumentationDictionary ;
446+ if ([reqType isEqualToString: @" POST" ]) {
447+ NSDictionary *instrumentationDictionary = self.preferenceHelper .instrumentationParameters ;
448+ if (instrumentationDictionary) {
449+ fullParamDict[BRANCH_REQUEST_KEY_INSTRUMENTATION] = instrumentationDictionary;
450+ }
448451 }
449-
450452 return fullParamDict;
451453}
452454
You can’t perform that action at this time.
0 commit comments