File tree Expand file tree Collapse file tree 1 file changed +10
-18
lines changed Expand file tree Collapse file tree 1 file changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -61,23 +61,16 @@ public class Context: PlatformPlugin {
61
61
" version " : __segment_version,
62
62
]
63
63
64
- // app info
65
- let info = Bundle . main. infoDictionary
66
- let localizedInfo = Bundle . main. localizedInfoDictionary
67
- var app = [ String: Any] ( )
68
- if let info = info {
69
- app. merge ( info) { ( _, new) in new }
70
- }
71
- if let localizedInfo = localizedInfo {
72
- app. merge ( localizedInfo) { ( _, new) in new }
73
- }
74
- if app. count != 0 {
75
- var name : String = " "
76
- if let displayName = app [ " CFBundleDisplayName " ] as? String {
77
- name = displayName
78
- } else if let displayName = app [ " CFBundleName " ] as? String {
79
- name = displayName
80
- }
64
+ // app information
65
+ let info = Bundle . main. infoDictionary ?? [ : ]
66
+ let localizedInfo = Bundle . main. localizedInfoDictionary ?? [ : ]
67
+ let app = info. merging ( localizedInfo) { _, localized in localized }
68
+
69
+ if !app. isEmpty {
70
+ let name = app [ " CFBundleDisplayName " ] as? String
71
+ ?? app [ " CFBundleName " ] as? String
72
+ ?? " "
73
+
81
74
staticContext [ " app " ] = [
82
75
" name " : name,
83
76
" version " : app [ " CFBundleShortVersionString " ] ?? " " ,
@@ -87,7 +80,6 @@ public class Context: PlatformPlugin {
87
80
}
88
81
89
82
insertStaticPlatformContextData ( context: & staticContext)
90
-
91
83
return staticContext
92
84
}
93
85
You can’t perform that action at this time.
0 commit comments