Skip to content

Commit 0468f00

Browse files
committed
SDK-1625 protect BNCDeviceInfo
1 parent fa2f532 commit 0468f00

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

Branch-SDK/BranchPluginSupport.m

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,29 @@ + (BranchPluginSupport *)instance {
2828

2929

3030
- (NSDictionary<NSString *, NSString *> *)deviceDescription {
31-
BNCDeviceInfo *deviceInfo = [BNCDeviceInfo getInstance];
32-
[deviceInfo checkAdvertisingIdentifier];
33-
3431
NSMutableDictionary<NSString *, NSString *> *dictionary = [NSMutableDictionary new];
35-
36-
[dictionary bnc_safeSetObject:deviceInfo.osName forKey:@"os"];
37-
[dictionary bnc_safeSetObject:deviceInfo.osVersion forKey:@"os_version"];
38-
[dictionary bnc_safeSetObject:deviceInfo.environment forKey:@"environment"];
39-
[dictionary bnc_safeSetObject:deviceInfo.vendorId forKey:@"idfv"];
40-
[dictionary bnc_safeSetObject:deviceInfo.advertiserId forKey:@"idfa"];
41-
[dictionary bnc_safeSetObject:deviceInfo.optedInStatus forKey:@"opted_in_status"];
42-
[dictionary bnc_safeSetObject:[BNCPreferenceHelper sharedInstance].userIdentity forKey:@"developer_identity"];
43-
[dictionary bnc_safeSetObject:deviceInfo.country forKey:@"country"];
44-
[dictionary bnc_safeSetObject:deviceInfo.language forKey:@"language"];
45-
[dictionary bnc_safeSetObject:deviceInfo.localIPAddress forKey:@"local_ip"];
46-
[dictionary bnc_safeSetObject:deviceInfo.brandName forKey:@"brand"];
47-
[dictionary bnc_safeSetObject:deviceInfo.applicationVersion forKey:@"app_version"];
48-
[dictionary bnc_safeSetObject:deviceInfo.modelName forKey:@"model"];
49-
[dictionary bnc_safeSetObject:deviceInfo.screenScale.stringValue forKey:@"screen_dpi"];
50-
[dictionary bnc_safeSetObject:deviceInfo.screenHeight.stringValue forKey:@"screen_height"];
51-
[dictionary bnc_safeSetObject:deviceInfo.screenWidth.stringValue forKey:@"screen_width"];
32+
BNCDeviceInfo *deviceInfo = [BNCDeviceInfo getInstance];
5233

34+
@synchronized (deviceInfo) {
35+
[deviceInfo checkAdvertisingIdentifier];
36+
37+
[dictionary bnc_safeSetObject:deviceInfo.osName forKey:@"os"];
38+
[dictionary bnc_safeSetObject:deviceInfo.osVersion forKey:@"os_version"];
39+
[dictionary bnc_safeSetObject:deviceInfo.environment forKey:@"environment"];
40+
[dictionary bnc_safeSetObject:deviceInfo.vendorId forKey:@"idfv"];
41+
[dictionary bnc_safeSetObject:deviceInfo.advertiserId forKey:@"idfa"];
42+
[dictionary bnc_safeSetObject:deviceInfo.optedInStatus forKey:@"opted_in_status"];
43+
[dictionary bnc_safeSetObject:[BNCPreferenceHelper sharedInstance].userIdentity forKey:@"developer_identity"];
44+
[dictionary bnc_safeSetObject:deviceInfo.country forKey:@"country"];
45+
[dictionary bnc_safeSetObject:deviceInfo.language forKey:@"language"];
46+
[dictionary bnc_safeSetObject:deviceInfo.localIPAddress forKey:@"local_ip"];
47+
[dictionary bnc_safeSetObject:deviceInfo.brandName forKey:@"brand"];
48+
[dictionary bnc_safeSetObject:deviceInfo.applicationVersion forKey:@"app_version"];
49+
[dictionary bnc_safeSetObject:deviceInfo.modelName forKey:@"model"];
50+
[dictionary bnc_safeSetObject:deviceInfo.screenScale.stringValue forKey:@"screen_dpi"];
51+
[dictionary bnc_safeSetObject:deviceInfo.screenHeight.stringValue forKey:@"screen_height"];
52+
[dictionary bnc_safeSetObject:deviceInfo.screenWidth.stringValue forKey:@"screen_width"];
53+
}
5354
return dictionary;
5455
}
5556

0 commit comments

Comments
 (0)