Skip to content

Commit a2ebbf5

Browse files
authored
Merge pull request #21 from BrowserStackCE/18-xcode-16-support
add: Xcode 16 support and fix warnings
2 parents 022ef2c + 17399b7 commit a2ebbf5

File tree

16 files changed

+141
-105
lines changed

16 files changed

+141
-105
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "interactive"
3+
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Wed Sep 25 17:08:44 IST 2024
12
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
24
distributionPath=wrapper/dists
3-
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
6+
zipStoreBase=GRADLE_USER_HOME
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
1+
#Wed Sep 25 17:08:39 IST 2024
22
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
34
distributionPath=wrapper/dists
4-
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
6+
zipStoreBase=GRADLE_USER_HOME

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>11.0</string>
24+
<string>12.0</string>
2525
</dict>
2626
</plist>

example/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
platform :ios, '11.0'
2+
platform :ios, '12.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ EXTERNAL SOURCES:
1414
:path: ".symlinks/plugins/flutter_system_proxy/ios"
1515

1616
SPEC CHECKSUMS:
17-
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
17+
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
1818
flutter_system_proxy: 96eb97e3857a1d1bc533a6f7387a1f0dcb63d782
1919

20-
PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d
20+
PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048
2121

22-
COCOAPODS: 1.11.3
22+
COCOAPODS: 1.15.2

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
97C146E61CF9000F007C117D /* Project object */ = {
156156
isa = PBXProject;
157157
attributes = {
158-
LastUpgradeCheck = 1430;
158+
LastUpgradeCheck = 1510;
159159
ORGANIZATIONNAME = "";
160160
TargetAttributes = {
161161
97C146ED1CF9000F007C117D = {
@@ -342,7 +342,7 @@
342342
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
343343
GCC_WARN_UNUSED_FUNCTION = YES;
344344
GCC_WARN_UNUSED_VARIABLE = YES;
345-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
345+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
346346
MTL_ENABLE_DEBUG_INFO = NO;
347347
SDKROOT = iphoneos;
348348
SUPPORTED_PLATFORMS = iphoneos;
@@ -420,7 +420,7 @@
420420
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
421421
GCC_WARN_UNUSED_FUNCTION = YES;
422422
GCC_WARN_UNUSED_VARIABLE = YES;
423-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
423+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
424424
MTL_ENABLE_DEBUG_INFO = YES;
425425
ONLY_ACTIVE_ARCH = YES;
426426
SDKROOT = iphoneos;
@@ -469,7 +469,7 @@
469469
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
470470
GCC_WARN_UNUSED_FUNCTION = YES;
471471
GCC_WARN_UNUSED_VARIABLE = YES;
472-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
472+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
473473
MTL_ENABLE_DEBUG_INFO = NO;
474474
SDKROOT = iphoneos;
475475
SUPPORTED_PLATFORMS = iphoneos;

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1430"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22
import Flutter
33

4-
@UIApplicationMain
4+
@main
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,

example/lib/main.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:io';
2-
import 'dart:async';
32
import 'package:dio/adapter.dart';
43
import 'package:flutter/material.dart';
54
import 'package:dio/dio.dart';
@@ -35,13 +34,10 @@ class _MyHomePageState extends State<MyHomePage> {
3534
int _counter = 0;
3635
String _res = "Response";
3736
void _incrementCounter() {
38-
setState(() {
39-
_counter++;
40-
});
4137
fetchLocalHost().then((value) {
42-
print(value);
4338
setState(() {
44-
_res = value.toString();
39+
_counter++;
40+
_res = value;
4541
});
4642
});
4743
}
@@ -61,11 +57,11 @@ class _MyHomePageState extends State<MyHomePage> {
6157
),
6258
Text(
6359
'$_counter',
64-
style: Theme.of(context).textTheme.headline4,
60+
style: Theme.of(context).textTheme.headlineMedium,
6561
),
6662
Text(
6763
'$_counter:$_res',
68-
style: Theme.of(context).textTheme.bodyText1,
64+
style: Theme.of(context).textTheme.bodyLarge,
6965
)
7066
],
7167
),
@@ -80,17 +76,21 @@ class _MyHomePageState extends State<MyHomePage> {
8076
}
8177

8278
Future<String> fetchLocalHost() async {
79+
try {
8380
var dio = new Dio();
8481
var url = 'http://ip-api.com/json';
8582
var proxy = await FlutterSystemProxy.findProxyFromEnvironment(url);
86-
print(proxy);
8783
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
8884
(HttpClient client) {
8985
client.findProxy = (uri) {
9086
return proxy;
9187
};
88+
return null;
9289
};
9390
var response = await dio.get(url);
94-
print(response.toString());
9591
return response.toString();
92+
} catch (e) {
93+
print(e);
94+
return "Error";
95+
}
9696
}

example/pubspec.lock

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ packages:
7676
path: ".."
7777
relative: true
7878
source: path
79-
version: "0.1.0"
79+
version: "0.1.4"
8080
flutter_test:
8181
dependency: "direct dev"
8282
description: flutter
@@ -90,38 +90,62 @@ packages:
9090
url: "https://pub.dev"
9191
source: hosted
9292
version: "4.0.2"
93+
leak_tracker:
94+
dependency: transitive
95+
description:
96+
name: leak_tracker
97+
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
98+
url: "https://pub.dev"
99+
source: hosted
100+
version: "10.0.5"
101+
leak_tracker_flutter_testing:
102+
dependency: transitive
103+
description:
104+
name: leak_tracker_flutter_testing
105+
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
106+
url: "https://pub.dev"
107+
source: hosted
108+
version: "3.0.5"
109+
leak_tracker_testing:
110+
dependency: transitive
111+
description:
112+
name: leak_tracker_testing
113+
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
114+
url: "https://pub.dev"
115+
source: hosted
116+
version: "3.0.1"
93117
matcher:
94118
dependency: transitive
95119
description:
96120
name: matcher
97-
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
121+
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
98122
url: "https://pub.dev"
99123
source: hosted
100-
version: "0.12.16"
124+
version: "0.12.16+1"
101125
material_color_utilities:
102126
dependency: transitive
103127
description:
104128
name: material_color_utilities
105-
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
129+
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
106130
url: "https://pub.dev"
107131
source: hosted
108-
version: "0.5.0"
132+
version: "0.11.1"
109133
meta:
110134
dependency: transitive
111135
description:
112136
name: meta
113-
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
137+
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
114138
url: "https://pub.dev"
115139
source: hosted
116-
version: "1.10.0"
140+
version: "1.15.0"
117141
path:
118142
dependency: transitive
119143
description:
120144
name: path
121-
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
145+
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
122146
url: "https://pub.dev"
123147
source: hosted
124-
version: "1.8.3"
148+
version: "1.9.0"
125149
sky_engine:
126150
dependency: transitive
127151
description: flutter
@@ -171,10 +195,10 @@ packages:
171195
dependency: transitive
172196
description:
173197
name: test_api
174-
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
198+
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
175199
url: "https://pub.dev"
176200
source: hosted
177-
version: "0.6.1"
201+
version: "0.7.2"
178202
typed_data:
179203
dependency: transitive
180204
description:
@@ -191,14 +215,14 @@ packages:
191215
url: "https://pub.dev"
192216
source: hosted
193217
version: "2.1.4"
194-
web:
218+
vm_service:
195219
dependency: transitive
196220
description:
197-
name: web
198-
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
221+
name: vm_service
222+
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
199223
url: "https://pub.dev"
200224
source: hosted
201-
version: "0.3.0"
225+
version: "14.2.5"
202226
sdks:
203-
dart: ">=3.2.0-194.0.dev <4.0.0"
204-
flutter: ">=1.20.0"
227+
dart: ">=3.3.0 <4.0.0"
228+
flutter: ">=3.18.0-18.0.pre.54"

ios/Classes/SwiftFlutterSystemProxyPlugin.swift

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,23 @@ public class SwiftFlutterSystemProxyPlugin: NSObject, FlutterPlugin {
1414
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
1515
switch call.method {
1616
case "getDeviceProxy":
17-
do {
1817
let args = call.arguments as! NSDictionary
1918
let url = args.value(forKey:"url") as! String
20-
var dict:[String:Any] = [:]
19+
var dict:[String:Any]? = [:]
2120
if(SwiftFlutterSystemProxyPlugin.proxyCache[url] != nil){
2221
let res = SwiftFlutterSystemProxyPlugin.proxyCache[url]
2322
if(res != nil){
24-
dict = res as! [String:Any]
23+
dict = res
2524
}
2625
}
2726
else
2827
{
29-
let res = try SwiftFlutterSystemProxyPlugin.resolve(url: url)
28+
let res = SwiftFlutterSystemProxyPlugin.resolve(url: url)
3029
if(res != nil){
31-
dict = res as! [String:Any]
30+
dict = res
3231
}
3332
}
3433
result(dict)
35-
} catch let error {
36-
print("Unexpected Proxy Error: \(error).")
37-
result(error)
38-
}
3934
break
4035
default:
4136
result(FlutterMethodNotImplemented)
@@ -88,34 +83,32 @@ public class SwiftFlutterSystemProxyPlugin: NSObject, FlutterPlugin {
8883
}
8984

9085
static func handlePacUrl(pacUrl: String, url: String){
91-
var _pacUrl = CFURLCreateWithString(kCFAllocatorDefault, pacUrl as CFString?,nil)
92-
var targetUrl = CFURLCreateWithString(kCFAllocatorDefault, url as CFString?, nil)
86+
let _pacUrl = CFURLCreateWithString(kCFAllocatorDefault, pacUrl as CFString?,nil)
87+
let targetUrl = CFURLCreateWithString(kCFAllocatorDefault, url as CFString?, nil)
9388
var info = url;
94-
if(pacUrl != nil && targetUrl != nil){
95-
var context:CFStreamClientContext = CFStreamClientContext.init(version: 0, info: &info, retain: nil, release: nil, copyDescription: nil)
96-
let runLoopSource = CFNetworkExecuteProxyAutoConfigurationURL(_pacUrl!,targetUrl!, { client, proxies, error in
97-
let _proxies = proxies as? [[CFString: Any]] ?? [];
98-
if(_proxies != nil){
99-
if(_proxies.count > 0){
100-
let proxy = _proxies.first{$0[kCFProxyTypeKey] as! CFString == kCFProxyTypeHTTP || $0[kCFProxyTypeKey] as! CFString == kCFProxyTypeHTTPS}
101-
if(proxy != nil){
102-
let host = proxy?[kCFProxyHostNameKey] ?? nil
103-
let port = proxy?[kCFProxyPortNumberKey] ?? nil
104-
var dict:[String: Any] = [:]
105-
dict["host"] = host
106-
dict["port"] = port
107-
let url = client.assumingMemoryBound(to: String.self).pointee
108-
SwiftFlutterSystemProxyPlugin.proxyCache[url] = dict
109-
}
110-
}
111-
}
112-
CFRunLoopStop(CFRunLoopGetCurrent());
113-
}, &context).takeUnretainedValue()
114-
let runLoop = CFRunLoopGetCurrent();
115-
CFRunLoopAddSource(runLoop, runLoopSource, CFRunLoopMode.defaultMode);
116-
CFRunLoopRun();
117-
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), runLoopSource, CFRunLoopMode.defaultMode);
118-
}
89+
withUnsafeMutablePointer(to: &info, { infoPointer in
90+
var context:CFStreamClientContext = CFStreamClientContext.init(version: 0, info: infoPointer, retain: nil, release: nil, copyDescription: nil)
91+
let runLoopSource = CFNetworkExecuteProxyAutoConfigurationURL(_pacUrl!,targetUrl!, { client, proxies, error in
92+
let _proxies = proxies as? [[CFString: Any]] ?? [];
93+
if(_proxies.count > 0){
94+
let proxy = _proxies.first{$0[kCFProxyTypeKey] as! CFString == kCFProxyTypeHTTP || $0[kCFProxyTypeKey] as! CFString == kCFProxyTypeHTTPS}
95+
if(proxy != nil){
96+
let host = proxy?[kCFProxyHostNameKey] ?? nil
97+
let port = proxy?[kCFProxyPortNumberKey] ?? nil
98+
var dict:[String: Any] = [:]
99+
dict["host"] = host
100+
dict["port"] = port
101+
let url = client.assumingMemoryBound(to: String.self).pointee
102+
SwiftFlutterSystemProxyPlugin.proxyCache[url] = dict
103+
}
104+
}
105+
CFRunLoopStop(CFRunLoopGetCurrent());
106+
}, &context);
107+
let runLoop = CFRunLoopGetCurrent();
108+
CFRunLoopAddSource(runLoop, runLoopSource, CFRunLoopMode.defaultMode);
109+
CFRunLoopRun();
110+
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), runLoopSource, CFRunLoopMode.defaultMode);
111+
})
119112
}
120113

121114
}

pac/test.pac

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)