Skip to content

Commit 1c4205e

Browse files
committed
Merge branch 'release/0.7.6'
2 parents 852ddd4 + 137838d commit 1c4205e

File tree

24 files changed

+115
-73
lines changed

24 files changed

+115
-73
lines changed

.github/workflows/dart.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,22 @@ jobs:
1010
matrix:
1111
os: [macos-latest]
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-java@v1
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-java@v3
1515
with:
16-
java-version: "12.x"
17-
- uses: subosito/flutter-action@v1
16+
java-version: "11.x"
17+
distribution: microsoft
18+
- uses: subosito/flutter-action@v2
1819
with:
1920
# same with pubspec.yaml
20-
flutter-version: "2.8.1"
21+
flutter-version: "2.2.0"
2122
- run: flutter pub get
2223
working-directory: dart_native/example
2324
- run: flutter test --no-pub test/
2425
working-directory: dart_native/example
2526
- run: flutter build apk
2627
working-directory: dart_native/example
27-
- run: flutter build ios --release --no-codesign
28+
- run: flutter build ios --release --no-codesign --verbose
2829
working-directory: dart_native/example
2930
- run: flutter config --enable-macos-desktop
3031
- run: flutter build macos --release

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ jobs:
1010
name: release
1111
runs-on: macos-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-java@v1
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-java@v3
1515
with:
1616
java-version: "12.x"
17-
- uses: subosito/flutter-action@v1
17+
- uses: subosito/flutter-action@v2
1818
with:
1919
# same with pubspec.yaml
20-
flutter-version: "2.8.1"
20+
flutter-version: "2.2.0"
2121
- run: flutter pub get
2222
working-directory: dart_native/example
2323
- run: flutter analyze --no-pub --no-current-package lib/ test/
@@ -31,7 +31,7 @@ jobs:
3131
- run: flutter config --enable-macos-desktop
3232
- run: flutter build macos --release
3333
working-directory: dart_native/example
34-
- uses: softprops/action-gh-release@v1
34+
- uses: softprops/action-gh-release@v1.1.0
3535
with:
3636
files: |
3737
build/app/outputs/apk/release/app-release.apk

dart_native/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.6
2+
3+
* [Fix] https://github.com/dart-native/dart_native/issues/107
4+
15
## 0.7.5
26

37
* [Fix] Crash on iOS.

dart_native/example/android/app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ android {
4141
versionCode flutterVersionCode.toInteger()
4242
versionName flutterVersionName
4343
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
44+
manifestPlaceholders += [appAuthRedirectScheme: "com.dartnative.dart_native_example",
45+
applicationName: "com.dartnative.dart_native_example.Application"]
4446
}
4547

4648
buildTypes {

dart_native/example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ SPEC CHECKSUMS:
2828
ClassWrittenInSwift: de0543e7c1a836e190af74fddff84ad9b2f3d18c
2929
CocoaLumberjack: 543c79c114dadc3b1aba95641d8738b06b05b646
3030
dart_native: 3ed31c9e40530ad0ae006c0b7cf75a22b24e933f
31-
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
31+
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
3232

3333
PODFILE CHECKSUM: 6e9979e89c4dd9698b3ed55a88e6a5100fa0dc38
3434

dart_native/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@
417417
"$(inherited)",
418418
"$(PROJECT_DIR)/Flutter",
419419
);
420-
PRODUCT_BUNDLE_IDENTIFIER = com.example.dartNativeExample;
420+
PRODUCT_BUNDLE_IDENTIFIER = com.yulingtianxia.dartNativeExample;
421421
PRODUCT_NAME = "$(TARGET_NAME)";
422422
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
423423
SWIFT_VERSION = 5.0;
@@ -555,7 +555,7 @@
555555
"$(inherited)",
556556
"$(PROJECT_DIR)/Flutter",
557557
);
558-
PRODUCT_BUNDLE_IDENTIFIER = com.example.dartNativeExample;
558+
PRODUCT_BUNDLE_IDENTIFIER = com.yulingtianxia.dartNativeExample;
559559
PRODUCT_NAME = "$(TARGET_NAME)";
560560
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
561561
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -586,7 +586,7 @@
586586
"$(inherited)",
587587
"$(PROJECT_DIR)/Flutter",
588588
);
589-
PRODUCT_BUNDLE_IDENTIFIER = com.example.dartNativeExample;
589+
PRODUCT_BUNDLE_IDENTIFIER = com.yulingtianxia.dartNativeExample;
590590
PRODUCT_NAME = "$(TARGET_NAME)";
591591
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
592592
SWIFT_VERSION = 5.0;

dart_native/example/ios/Runner/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>CADisableMinimumFrameDurationOnPhone</key>
6+
<true/>
57
<key>CFBundleDevelopmentRegion</key>
68
<string>$(DEVELOPMENT_LANGUAGE)</string>
79
<key>CFBundleDisplayName</key>
@@ -43,7 +45,5 @@
4345
</array>
4446
<key>UIViewControllerBasedStatusBarAppearance</key>
4547
<true/>
46-
<key>CADisableMinimumFrameDurationOnPhone</key>
47-
<true/>
4848
</dict>
4949
</plist>

dart_native/example/pubspec.lock

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ packages:
77
name: _fe_analyzer_shared
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "22.0.0"
10+
version: "31.0.0"
1111
analyzer:
1212
dependency: transitive
1313
description:
1414
name: analyzer
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.7.1"
17+
version: "2.8.0"
1818
args:
1919
dependency: transitive
2020
description:
@@ -28,7 +28,7 @@ packages:
2828
name: async
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "2.6.1"
31+
version: "2.8.2"
3232
boolean_selector:
3333
dependency: transitive
3434
description:
@@ -98,14 +98,14 @@ packages:
9898
name: characters
9999
url: "https://pub.dartlang.org"
100100
source: hosted
101-
version: "1.1.0"
101+
version: "1.2.0"
102102
charcode:
103103
dependency: transitive
104104
description:
105105
name: charcode
106106
url: "https://pub.dartlang.org"
107107
source: hosted
108-
version: "1.2.0"
108+
version: "1.3.1"
109109
checked_yaml:
110110
dependency: transitive
111111
description:
@@ -140,7 +140,7 @@ packages:
140140
name: collection
141141
url: "https://pub.dartlang.org"
142142
source: hosted
143-
version: "1.15.0"
143+
version: "1.16.0"
144144
convert:
145145
dependency: transitive
146146
description:
@@ -168,14 +168,14 @@ packages:
168168
path: ".."
169169
relative: true
170170
source: path
171-
version: "0.7.5"
171+
version: "0.7.6"
172172
dart_native_gen:
173173
dependency: transitive
174174
description:
175175
name: dart_native_gen
176176
url: "https://pub.dartlang.org"
177177
source: hosted
178-
version: "0.3.2"
178+
version: "0.3.3"
179179
dart_style:
180180
dependency: transitive
181181
description:
@@ -189,7 +189,7 @@ packages:
189189
name: fake_async
190190
url: "https://pub.dartlang.org"
191191
source: hosted
192-
version: "1.2.0"
192+
version: "1.3.0"
193193
ffi:
194194
dependency: transitive
195195
description:
@@ -297,14 +297,21 @@ packages:
297297
name: matcher
298298
url: "https://pub.dartlang.org"
299299
source: hosted
300-
version: "0.12.10"
300+
version: "0.12.11"
301+
material_color_utilities:
302+
dependency: transitive
303+
description:
304+
name: material_color_utilities
305+
url: "https://pub.dartlang.org"
306+
source: hosted
307+
version: "0.1.4"
301308
meta:
302309
dependency: transitive
303310
description:
304311
name: meta
305312
url: "https://pub.dartlang.org"
306313
source: hosted
307-
version: "1.3.0"
314+
version: "1.7.0"
308315
mime:
309316
dependency: transitive
310317
description:
@@ -325,7 +332,7 @@ packages:
325332
name: path
326333
url: "https://pub.dartlang.org"
327334
source: hosted
328-
version: "1.8.0"
335+
version: "1.8.1"
329336
pedantic:
330337
dependency: transitive
331338
description:
@@ -386,7 +393,7 @@ packages:
386393
name: source_span
387394
url: "https://pub.dartlang.org"
388395
source: hosted
389-
version: "1.8.1"
396+
version: "1.8.2"
390397
stack_trace:
391398
dependency: transitive
392399
description:
@@ -428,7 +435,7 @@ packages:
428435
name: test_api
429436
url: "https://pub.dartlang.org"
430437
source: hosted
431-
version: "0.3.0"
438+
version: "0.4.9"
432439
timing:
433440
dependency: transitive
434441
description:
@@ -449,7 +456,7 @@ packages:
449456
name: vector_math
450457
url: "https://pub.dartlang.org"
451458
source: hosted
452-
version: "2.1.0"
459+
version: "2.1.2"
453460
watcher:
454461
dependency: transitive
455462
description:
@@ -472,5 +479,5 @@ packages:
472479
source: hosted
473480
version: "3.1.0"
474481
sdks:
475-
dart: ">=2.13.0 <3.0.0"
482+
dart: ">=2.17.0-0 <3.0.0"
476483
flutter: ">=2.2.0"

dart_native/ios/Classes/native_runtime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ DN_EXTERN DNPassObjectResult BindObjcLifecycleToDart(Dart_Handle h, void *pointe
165165

166166
DN_EXTERN void RegisterDartFinalizer(Dart_Handle h, void *callback, void *key, Dart_Port dartPort);
167167

168-
DN_EXTERN bool NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);
168+
DN_EXTERN void NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);
169169

170170
DN_EXTERN void RegisterDeallocCallback(void (*callback)(intptr_t));
171171

dart_native/ios/Classes/native_runtime.mm

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -818,20 +818,33 @@ void NotifyMethodPerformToDart(DNInvocation *invocation,
818818

819819
#pragma mark - Native Dealloc Callback
820820

821-
void (*native_dealloc_callback)(intptr_t);
821+
static NSMutableDictionary<NSNumber *, NSNumber *> *deallocCallbackPtrForDartPort = [NSMutableDictionary dictionary];
822+
static dispatch_queue_t deallocCallbackPortsQueue = dispatch_queue_create("com.dartnative.deallocCallback", DISPATCH_QUEUE_CONCURRENT);;
822823

823-
void RegisterDeallocCallback(void (*callback)(intptr_t)) {
824-
native_dealloc_callback = callback;
824+
void RegisterDeallocCallback(void (*callback)(intptr_t), Dart_Port dartPort) {
825+
dispatch_barrier_async(deallocCallbackPortsQueue, ^{
826+
deallocCallbackPtrForDartPort[@(dartPort)] = @((intptr_t)callback);
827+
});
825828
}
826829

827-
bool NotifyDeallocToDart(intptr_t address, Dart_Port dartPort) {
828-
auto callback = native_dealloc_callback;
829-
const Work work = [address, callback]() {
830-
callback(address);
831-
};
832-
833-
const Work *work_ptr = new Work(work);
834-
return NotifyDart(dartPort, work_ptr);
830+
void NotifyDeallocToDart(intptr_t address, Dart_Port dartPort) {
831+
dispatch_async(deallocCallbackPortsQueue, ^{
832+
void (*callback)(intptr_t) = reinterpret_cast<void (*)(intptr_t)>(deallocCallbackPtrForDartPort[@(dartPort)].longValue);
833+
if (callback) {
834+
dispatch_async(dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
835+
const Work work = [address, callback]() {
836+
callback(address);
837+
};
838+
const Work *work_ptr = new Work(work);
839+
bool success = NotifyDart(dartPort, work_ptr);
840+
if (!success) {
841+
dispatch_barrier_async(deallocCallbackPortsQueue, ^{
842+
deallocCallbackPtrForDartPort[@(dartPort)] = nil;
843+
});
844+
}
845+
});
846+
}
847+
});
835848
}
836849

837850
#pragma mark - Dart Finalizer

dart_native/ios/DartNative.xcframework/ios-arm64_armv7/DartNative.framework/Headers/native_runtime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ DN_EXTERN DNPassObjectResult BindObjcLifecycleToDart(Dart_Handle h, void *pointe
165165

166166
DN_EXTERN void RegisterDartFinalizer(Dart_Handle h, void *callback, void *key, Dart_Port dartPort);
167167

168-
DN_EXTERN bool NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);
168+
DN_EXTERN void NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);
169169

170170
DN_EXTERN void RegisterDeallocCallback(void (*callback)(intptr_t));
171171

dart_native/ios/DartNative.xcframework/ios-arm64_armv7/DartNative.framework/_CodeSignature/CodeResources

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
</data>
2727
<key>Headers/native_runtime.h</key>
2828
<data>
29-
6c44v+1AyKy32YFhT2voVEWZ7JI=
29+
11nRIWQMl7+5BFqADBiLFAmeBq8=
3030
</data>
3131
<key>Info.plist</key>
3232
<data>
33-
Xtc5s5mwE6jJOQ039IhNd9vAsKM=
33+
D4w7YQbSFm2D4rYM5H05NRtfAAc=
3434
</data>
3535
<key>Modules/module.modulemap</key>
3636
<data>
@@ -98,11 +98,11 @@
9898
<dict>
9999
<key>hash</key>
100100
<data>
101-
6c44v+1AyKy32YFhT2voVEWZ7JI=
101+
11nRIWQMl7+5BFqADBiLFAmeBq8=
102102
</data>
103103
<key>hash2</key>
104104
<data>
105-
s4HJjjCIyAUxCoSXBgc7R849gbSi1IufGAF1DbGwhQo=
105+
vJX7/wTOXaOgfDR3IB07SWgm1OqfP9yPHClStItPWKk=
106106
</data>
107107
</dict>
108108
<key>Modules/module.modulemap</key>

dart_native/ios/DartNative.xcframework/ios-i386_x86_64-simulator/DartNative.framework/Headers/native_runtime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ DN_EXTERN DNPassObjectResult BindObjcLifecycleToDart(Dart_Handle h, void *pointe
165165

166166
DN_EXTERN void RegisterDartFinalizer(Dart_Handle h, void *callback, void *key, Dart_Port dartPort);
167167

168-
DN_EXTERN bool NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);
168+
DN_EXTERN void NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);
169169

170170
DN_EXTERN void RegisterDeallocCallback(void (*callback)(intptr_t));
171171

dart_native/ios/DartNative.xcframework/ios-i386_x86_64-simulator/DartNative.framework/_CodeSignature/CodeResources

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
</data>
2727
<key>Headers/native_runtime.h</key>
2828
<data>
29-
6c44v+1AyKy32YFhT2voVEWZ7JI=
29+
11nRIWQMl7+5BFqADBiLFAmeBq8=
3030
</data>
3131
<key>Info.plist</key>
3232
<data>
33-
Yj6HW2dqtkKMgRRFXJalQLjdvtA=
33+
0Kq+tqf/uvamzXqFXIHFNWazqQE=
3434
</data>
3535
<key>Modules/module.modulemap</key>
3636
<data>
@@ -98,11 +98,11 @@
9898
<dict>
9999
<key>hash</key>
100100
<data>
101-
6c44v+1AyKy32YFhT2voVEWZ7JI=
101+
11nRIWQMl7+5BFqADBiLFAmeBq8=
102102
</data>
103103
<key>hash2</key>
104104
<data>
105-
s4HJjjCIyAUxCoSXBgc7R849gbSi1IufGAF1DbGwhQo=
105+
vJX7/wTOXaOgfDR3IB07SWgm1OqfP9yPHClStItPWKk=
106106
</data>
107107
</dict>
108108
<key>Modules/module.modulemap</key>

0 commit comments

Comments
 (0)