@@ -41,26 +41,20 @@ public class SwiftFlutterSystemProxyPlugin: NSObject, FlutterPlugin {
41
41
if ( SwiftFlutterSystemProxyPlugin . proxyCache [ url] != nil ) {
42
42
return SwiftFlutterSystemProxyPlugin . proxyCache [ url]
43
43
}
44
- let proxConfigDict = CFNetworkCopySystemProxySettings ( ) ? . takeUnretainedValue ( ) as NSDictionary ?
45
- if ( proxConfigDict != nil ) {
46
- if ( proxConfigDict! [ " ProxyAutoConfigEnable " ] as? Int == 1 ) {
47
- let pacUrl = proxConfigDict! [ " ProxyAutoConfigURLString " ] as? String
48
- let pacContent = proxConfigDict! [ " ProxyAutoConfigJavaScript " ] as? String
44
+ let proxConfigDict = CFNetworkCopySystemProxySettings ( ) ? . takeUnretainedValue ( ) as NSDictionary ?
45
+ if proxConfigDict != nil {
46
+ if ( proxConfigDict ? [ kCFNetworkProxiesProxyAutoConfigEnable ] as? Int == 1 ) {
47
+ let pacUrl = proxConfigDict ? [ kCFNetworkProxiesProxyAutoConfigURLString ] as! String ?
48
+ let pacContent = proxConfigDict ? [ kCFNetworkProxiesProxyAutoConfigJavaScript ] as! String ?
49
49
if ( pacContent != nil ) {
50
- self . handlePacContent ( pacContent: pacContent! as String , url: url)
50
+ self . handlePacContent ( pacContent: pacContent!, url: url)
51
51
} else if ( pacUrl != nil ) {
52
52
self . handlePacUrl ( pacUrl: pacUrl!, url: url)
53
53
}
54
- } else if ( proxConfigDict![ " HTTPEnable " ] as? Int == 1 ) {
54
+ } else if ( proxConfigDict![ kCFNetworkProxiesHTTPEnable ] as! Int == 1 ) {
55
55
var dict : [ String : Any ] = [ : ]
56
- dict [ " host " ] = proxConfigDict![ " HTTPProxy " ] as? String
57
- dict [ " port " ] = proxConfigDict![ " HTTPPort " ] as? Int
58
- SwiftFlutterSystemProxyPlugin . proxyCache [ url] = dict
59
-
60
- } else if ( proxConfigDict![ " HTTPSEnable " ] as? Int == 1 ) {
61
- var dict : [ String : Any ] = [ : ]
62
- dict [ " host " ] = proxConfigDict![ " HTTPSProxy " ] as? String
63
- dict [ " port " ] = proxConfigDict![ " HTTPSPort " ] as? Int
56
+ dict [ " host " ] = proxConfigDict![ kCFNetworkProxiesHTTPProxy] as? String
57
+ dict [ " port " ] = proxConfigDict![ kCFNetworkProxiesHTTPPort] as? Int
64
58
SwiftFlutterSystemProxyPlugin . proxyCache [ url] = dict
65
59
}
66
60
}
0 commit comments