Skip to content

Commit d921e48

Browse files
authored
Replace Objective-C implemented delegates with Dart implementations (#1218)
1 parent 5e2281e commit d921e48

File tree

70 files changed

+62039
-83234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+62039
-83234
lines changed

.github/workflows/cronet.yml

+6
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@ jobs:
2424
verify:
2525
name: Format & Analyze & Test
2626
runs-on: ubuntu-latest
27+
timeout-minutes: 20
2728
strategy:
29+
fail-fast: false
2830
matrix:
2931
cronetHttpNoPlay: ['false', 'true']
3032
defaults:
3133
run:
3234
working-directory: pkgs/cronet_http
3335
steps:
36+
- name: Delete unnecessary tools 🔧
37+
uses: jlumbroso/[email protected]
38+
with:
39+
android: false # Don't remove Android tools
3440
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
3541
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
3642
with:

.github/workflows/cupertino.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ jobs:
2828
run:
2929
working-directory: pkgs/cupertino_http
3030
strategy:
31+
fail-fast: false
3132
matrix:
3233
# Test on the minimum supported flutter version and the latest
3334
# version.
34-
flutter-version: ["3.22.0", "any"]
35+
flutter-version: ["3.24.0", "any"]
3536
steps:
3637
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
3738
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
@@ -50,9 +51,9 @@ jobs:
5051
- uses: futureware-tech/simulator-action@bfa03d93ec9de6dacb0c5553bbf8da8afc6c2ee9
5152
with:
5253
os: iOS
53-
os_version: '>=12.0'
54+
os_version: '>=13.0'
5455
- name: Run tests
5556
run: |
5657
cd example
5758
flutter pub get
58-
flutter test integration_test/main.dart
59+
flutter test integration_test/main.dart --test-randomize-ordering-seed=random

.github/workflows/dart.yml

+75-177
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.gitignore

+113-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,119 @@
1+
# Adapted from https://github.com/flutter/flutter/blob/master/.gitignore
2+
3+
# Miscellaneous
4+
*.class
5+
*.lock
6+
*.log
7+
*.pyc
8+
*.swp
9+
.DS_Store
10+
.atom/
11+
.buildlog/
12+
.history
13+
.svn/
14+
15+
# IntelliJ related
16+
*.iml
17+
*.ipr
18+
*.iws
119
.idea/
20+
21+
# Visual Studio Code related
222
.vscode/
23+
.classpath
24+
.project
25+
.settings/
26+
.vscode/*
327

4-
# Don’t commit the following directories created by pub.
5-
.dart_tool
28+
# Flutter/Dart/Pub related
29+
**/doc/api/
30+
.dart_tool/
31+
.flutter-plugins
32+
.flutter-plugins-dependencies
33+
**/generated_plugin_registrant.dart
634
.packages
35+
.pub-preload-cache/
36+
.pub-cache/
37+
.pub/
38+
build/
39+
flutter_*.png
40+
linked_*.ds
41+
unlinked.ds
42+
unlinked_spec.ds
743
pubspec.lock
844
pubspec_overrides.yaml
45+
46+
# Android related
47+
**/android/**/gradle-wrapper.jar
48+
.gradle/
49+
**/android/captures/
50+
**/android/gradlew
51+
**/android/gradlew.bat
52+
**/android/local.properties
53+
**/android/**/GeneratedPluginRegistrant.java
54+
**/android/key.properties
55+
*.jks
56+
57+
# iOS/XCode related
58+
**/ios/**/*.mode1v3
59+
**/ios/**/*.mode2v3
60+
**/ios/**/*.moved-aside
61+
**/ios/**/*.pbxuser
62+
**/ios/**/*.perspectivev3
63+
**/ios/**/*sync/
64+
**/ios/**/.sconsign.dblite
65+
**/ios/**/.tags*
66+
**/ios/**/.vagrant/
67+
**/ios/**/DerivedData/
68+
**/ios/**/Icon?
69+
**/ios/**/Pods/
70+
**/ios/**/.symlinks/
71+
**/ios/**/profile
72+
**/ios/**/xcuserdata
73+
**/ios/.generated/
74+
**/ios/Flutter/.last_build_id
75+
**/ios/Flutter/App.framework
76+
**/ios/Flutter/Flutter.framework
77+
**/ios/Flutter/Flutter.podspec
78+
**/ios/Flutter/Generated.xcconfig
79+
**/ios/Flutter/ephemeral
80+
**/ios/Flutter/app.flx
81+
**/ios/Flutter/app.zip
82+
**/ios/Flutter/flutter_assets/
83+
**/ios/Flutter/flutter_export_environment.sh
84+
**/ios/ServiceDefinitions.json
85+
**/ios/Runner/GeneratedPluginRegistrant.*
86+
87+
# macOS
88+
**/Flutter/ephemeral/
89+
**/Pods/
90+
**/macos/Flutter/GeneratedPluginRegistrant.swift
91+
**/macos/Flutter/ephemeral
92+
**/xcuserdata/
93+
94+
# Windows
95+
**/windows/flutter/ephemeral/
96+
**/windows/flutter/generated_plugin_registrant.cc
97+
**/windows/flutter/generated_plugin_registrant.h
98+
**/windows/flutter/generated_plugins.cmake
99+
100+
# Linux
101+
**/linux/flutter/ephemeral/
102+
**/linux/flutter/generated_plugin_registrant.cc
103+
**/linux/flutter/generated_plugin_registrant.h
104+
**/linux/flutter/generated_plugins.cmake
105+
106+
# Coverage
107+
coverage/
108+
109+
# Symbols
110+
app.*.symbols
111+
112+
# Exceptions to above rules.
113+
!**/ios/**/default.mode1v3
114+
!**/ios/**/default.mode2v3
115+
!**/ios/**/default.pbxuser
116+
!**/ios/**/default.perspectivev3
117+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
118+
!/dev/ci/**/Gemfile.lock
119+
!.vscode/settings.json

pkgs/cupertino_http/.gitattributes

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
# ffigen generated code
22
lib/src/native_cupertino_bindings.dart linguist-generated
3-
4-
# vendored Dart API code
5-
src/dart-sdk/** linguist-vendored
3+
darwin/cupertino_http/Sources/cupertino_http/native_cupertino_bindings.m linguist-generated

pkgs/cupertino_http/CHANGELOG.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
## 1.5.2-wip
1+
## 2.0.0-wip
2+
3+
* The behavior of `CupertinoClient` and `CupertinoWebSocket` has not changed.
4+
* **Breaking:** `MutableURLRequest.httpBodyStream` now takes a `NSInputStream`
5+
instead of a `Stream<List<int>>`.
6+
* **Breaking:** The following enums/classes previous defined by
7+
`package:cupertino_http` are now imported from `package:objective_c`:
8+
* `NSData`
9+
* `NSError`
10+
* `NSHTTPCookieAcceptPolicy`
11+
* `NSMutableData`
12+
* `NSURLRequestCachePolicy`
13+
* `NSURLRequestNetworkServiceType`
14+
* `NSURLSessionMultipathServiceType`
15+
* `NSURLSessionResponseDisposition`
16+
* `NSURLSessionTaskState`
17+
* `NSURLSessionWebSocketCloseCode`
18+
* `NSURLSessionWebSocketMessageType`
19+
* **Breaking:** `URLSession.dataTaskWithCompletionHandler` is no longer
20+
supported for background sessions.
221

322
## 1.5.1
423

pkgs/cupertino_http/darwin/Classes/CUPHTTPClientDelegate.m

-1
This file was deleted.

pkgs/cupertino_http/darwin/Classes/CUPHTTPCompletionHelper.m

-1
This file was deleted.

pkgs/cupertino_http/darwin/Classes/CUPHTTPForwardedDelegate.m

-1
This file was deleted.

pkgs/cupertino_http/darwin/Classes/CUPHTTPStreamToNSInputStreamAdapter.m

-1
This file was deleted.

pkgs/cupertino_http/darwin/Classes/dart_api_dl.c

-1
This file was deleted.

pkgs/cupertino_http/darwin/cupertino_http.podspec

+4-9
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,13 @@ Pod::Spec.new do |s|
1212
s.homepage = 'https://github.com/dart-lang/http/tree/master/pkgs/cupertino_http'
1313
s.license = { :type => 'BSD', :file => '../LICENSE' }
1414
s.author = { 'TODO' => 'use-valid-author' }
15+
s.source = { :http => 'https://github.com/dart-lang/http/tree/master/pkgs/cupertino_http' }
1516

16-
# This will ensure the source files in Classes/ are included in the native
17-
# builds of apps using this FFI plugin. Podspec does not support relative
18-
# paths, so Classes contains a forwarder C file that relatively imports
19-
# `../src/*` so that the C sources can be shared among all target platforms.
20-
s.source = { :path => '.' }
21-
s.source_files = 'Classes/**/*'
17+
s.source_files = 'cupertino_http/Sources/cupertino_http/**/*'
2218
s.ios.dependency 'Flutter'
2319
s.osx.dependency 'FlutterMacOS'
24-
s.ios.deployment_target = '12.0'
25-
s.osx.deployment_target = '10.14'
26-
s.requires_arc = []
20+
s.ios.deployment_target = '13.0' # Required for NSURLSessionWebSocketDelegate.
21+
s.osx.deployment_target = '10.15' # Required for NSURLSessionWebSocketDelegate.
2722

2823
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
2924
s.swift_version = '5.0'

0 commit comments

Comments
 (0)