Skip to content

Commit 27184eb

Browse files
authored
Remove bespoke code that handled blocking callbacks (#1450)
1 parent 7271367 commit 27184eb

File tree

8 files changed

+13
-5184
lines changed

8 files changed

+13
-5184
lines changed

pkgs/cupertino_http/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.3-wip
2+
3+
* Remove some unnecessary native code.
4+
15
## 2.0.2
26

37
* Upgrade to `package:objective_c` 4.1.

pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/native_cupertino_bindings.m

Lines changed: 0 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/utils.h

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

pkgs/cupertino_http/darwin/cupertino_http/Sources/cupertino_http/utils.m

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

pkgs/cupertino_http/ffigen.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ headers:
2121
- '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSOperation.h'
2222
- '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSError.h'
2323
- '/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSDictionary.h'
24-
- 'darwin/cupertino_http/Sources/cupertino_http/utils.h'
2524
preamble: |
2625
// ignore_for_file: always_specify_types
2726
// ignore_for_file: camel_case_types

pkgs/cupertino_http/lib/src/cupertino_api.dart

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -919,29 +919,15 @@ class URLSession extends _ObjectHolder<ncb.NSURLSession> {
919919
}
920920

921921
if (onFinishedDownloading != null) {
922-
final asyncFinishDownloading =
923-
// ignore: lines_longer_than_80_chars
924-
ncb.ObjCBlock_ffiVoid_NSCondition_NSURLSession_NSURLSessionDownloadTask_NSURL
925-
.listener((nsCondition, nsSession, nsTask, nsUrl) {
926-
try {
927-
onFinishedDownloading(
928-
URLSession._(nsSession,
929-
isBackground: isBackground, hasDelegate: true),
930-
URLSessionDownloadTask._(nsTask),
931-
nsurlToUri(nsUrl));
932-
} finally {
933-
nsCondition.unlock();
934-
}
922+
ncb.NSURLSessionDownloadDelegate
923+
.URLSession_downloadTask_didFinishDownloadingToURL_
924+
.implementAsBlocking(protoBuilder, (nsSession, nsTask, nsUrl) {
925+
onFinishedDownloading(
926+
URLSession._(nsSession,
927+
isBackground: isBackground, hasDelegate: true),
928+
URLSessionDownloadTask._(nsTask),
929+
nsurlToUri(nsUrl));
935930
});
936-
937-
final downloadDelegate = objc.getProtocol('NSURLSessionDownloadDelegate');
938-
final didFinishDownloadingToURL = objc
939-
.registerName('URLSession:downloadTask:didFinishDownloadingToURL:');
940-
final signature = objc.getProtocolMethodSignature(
941-
downloadDelegate, didFinishDownloadingToURL,
942-
isRequired: true, isInstanceMethod: true)!;
943-
protoBuilder.implementMethod(didFinishDownloadingToURL, signature,
944-
linkedLibs.adaptFinishWithLock(asyncFinishDownloading));
945931
}
946932

947933
if (onWebSocketTaskOpened != null) {

0 commit comments

Comments
 (0)