Skip to content

Commit

Permalink
Merge branch 'release/0.7.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
yulingtianxia committed Oct 16, 2022
2 parents 852ddd4 + 137838d commit 1c4205e
Show file tree
Hide file tree
Showing 24 changed files with 115 additions and 73 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@ jobs:
matrix:
os: [macos-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: "12.x"
- uses: subosito/flutter-action@v1
java-version: "11.x"
distribution: microsoft
- uses: subosito/flutter-action@v2
with:
# same with pubspec.yaml
flutter-version: "2.8.1"
flutter-version: "2.2.0"
- run: flutter pub get
working-directory: dart_native/example
- run: flutter test --no-pub test/
working-directory: dart_native/example
- run: flutter build apk
working-directory: dart_native/example
- run: flutter build ios --release --no-codesign
- run: flutter build ios --release --no-codesign --verbose
working-directory: dart_native/example
- run: flutter config --enable-macos-desktop
- run: flutter build macos --release
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
name: release
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: "12.x"
- uses: subosito/flutter-action@v1
- uses: subosito/flutter-action@v2
with:
# same with pubspec.yaml
flutter-version: "2.8.1"
flutter-version: "2.2.0"
- run: flutter pub get
working-directory: dart_native/example
- run: flutter analyze --no-pub --no-current-package lib/ test/
Expand All @@ -31,7 +31,7 @@ jobs:
- run: flutter config --enable-macos-desktop
- run: flutter build macos --release
working-directory: dart_native/example
- uses: softprops/action-gh-release@v1
- uses: softprops/action-gh-release@v1.1.0
with:
files: |
build/app/outputs/apk/release/app-release.apk
Expand Down
4 changes: 4 additions & 0 deletions dart_native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.7.6

* [Fix] https://github.com/dart-native/dart_native/issues/107

## 0.7.5

* [Fix] Crash on iOS.
Expand Down
2 changes: 2 additions & 0 deletions dart_native/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ android {
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders += [appAuthRedirectScheme: "com.dartnative.dart_native_example",
applicationName: "com.dartnative.dart_native_example.Application"]
}

buildTypes {
Expand Down
2 changes: 1 addition & 1 deletion dart_native/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SPEC CHECKSUMS:
ClassWrittenInSwift: de0543e7c1a836e190af74fddff84ad9b2f3d18c
CocoaLumberjack: 543c79c114dadc3b1aba95641d8738b06b05b646
dart_native: 3ed31c9e40530ad0ae006c0b7cf75a22b24e933f
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a

PODFILE CHECKSUM: 6e9979e89c4dd9698b3ed55a88e6a5100fa0dc38

Expand Down
6 changes: 3 additions & 3 deletions dart_native/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.dartNativeExample;
PRODUCT_BUNDLE_IDENTIFIER = com.yulingtianxia.dartNativeExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -555,7 +555,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.dartNativeExample;
PRODUCT_BUNDLE_IDENTIFIER = com.yulingtianxia.dartNativeExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down Expand Up @@ -586,7 +586,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.dartNativeExample;
PRODUCT_BUNDLE_IDENTIFIER = com.yulingtianxia.dartNativeExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
4 changes: 2 additions & 2 deletions dart_native/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand Down Expand Up @@ -43,7 +45,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
39 changes: 23 additions & 16 deletions dart_native/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "22.0.0"
version: "31.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.1"
version: "2.8.0"
args:
dependency: transitive
description:
Expand All @@ -28,7 +28,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
version: "2.8.2"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -98,14 +98,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
checked_yaml:
dependency: transitive
description:
Expand Down Expand Up @@ -140,7 +140,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -168,14 +168,14 @@ packages:
path: ".."
relative: true
source: path
version: "0.7.5"
version: "0.7.6"
dart_native_gen:
dependency: transitive
description:
name: dart_native_gen
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
version: "0.3.3"
dart_style:
dependency: transitive
description:
Expand All @@ -189,7 +189,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -297,14 +297,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
mime:
dependency: transitive
description:
Expand All @@ -325,7 +332,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
pedantic:
dependency: transitive
description:
Expand Down Expand Up @@ -386,7 +393,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -428,7 +435,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.4.9"
timing:
dependency: transitive
description:
Expand All @@ -449,7 +456,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.2"
watcher:
dependency: transitive
description:
Expand All @@ -472,5 +479,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.13.0 <3.0.0"
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.2.0"
2 changes: 1 addition & 1 deletion dart_native/ios/Classes/native_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ DN_EXTERN DNPassObjectResult BindObjcLifecycleToDart(Dart_Handle h, void *pointe

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

DN_EXTERN bool NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);
DN_EXTERN void NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);

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

Expand Down
35 changes: 24 additions & 11 deletions dart_native/ios/Classes/native_runtime.mm
Original file line number Diff line number Diff line change
Expand Up @@ -818,20 +818,33 @@ void NotifyMethodPerformToDart(DNInvocation *invocation,

#pragma mark - Native Dealloc Callback

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

void RegisterDeallocCallback(void (*callback)(intptr_t)) {
native_dealloc_callback = callback;
void RegisterDeallocCallback(void (*callback)(intptr_t), Dart_Port dartPort) {
dispatch_barrier_async(deallocCallbackPortsQueue, ^{
deallocCallbackPtrForDartPort[@(dartPort)] = @((intptr_t)callback);
});
}

bool NotifyDeallocToDart(intptr_t address, Dart_Port dartPort) {
auto callback = native_dealloc_callback;
const Work work = [address, callback]() {
callback(address);
};

const Work *work_ptr = new Work(work);
return NotifyDart(dartPort, work_ptr);
void NotifyDeallocToDart(intptr_t address, Dart_Port dartPort) {
dispatch_async(deallocCallbackPortsQueue, ^{
void (*callback)(intptr_t) = reinterpret_cast<void (*)(intptr_t)>(deallocCallbackPtrForDartPort[@(dartPort)].longValue);
if (callback) {
dispatch_async(dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
const Work work = [address, callback]() {
callback(address);
};
const Work *work_ptr = new Work(work);
bool success = NotifyDart(dartPort, work_ptr);
if (!success) {
dispatch_barrier_async(deallocCallbackPortsQueue, ^{
deallocCallbackPtrForDartPort[@(dartPort)] = nil;
});
}
});
}
});
}

#pragma mark - Dart Finalizer
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ DN_EXTERN DNPassObjectResult BindObjcLifecycleToDart(Dart_Handle h, void *pointe

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

DN_EXTERN bool NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);
DN_EXTERN void NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);

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

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
</data>
<key>Headers/native_runtime.h</key>
<data>
6c44v+1AyKy32YFhT2voVEWZ7JI=
11nRIWQMl7+5BFqADBiLFAmeBq8=
</data>
<key>Info.plist</key>
<data>
Xtc5s5mwE6jJOQ039IhNd9vAsKM=
D4w7YQbSFm2D4rYM5H05NRtfAAc=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand Down Expand Up @@ -98,11 +98,11 @@
<dict>
<key>hash</key>
<data>
6c44v+1AyKy32YFhT2voVEWZ7JI=
11nRIWQMl7+5BFqADBiLFAmeBq8=
</data>
<key>hash2</key>
<data>
s4HJjjCIyAUxCoSXBgc7R849gbSi1IufGAF1DbGwhQo=
vJX7/wTOXaOgfDR3IB07SWgm1OqfP9yPHClStItPWKk=
</data>
</dict>
<key>Modules/module.modulemap</key>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ DN_EXTERN DNPassObjectResult BindObjcLifecycleToDart(Dart_Handle h, void *pointe

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

DN_EXTERN bool NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);
DN_EXTERN void NotifyDeallocToDart(intptr_t address, Dart_Port dartPort);

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

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
</data>
<key>Headers/native_runtime.h</key>
<data>
6c44v+1AyKy32YFhT2voVEWZ7JI=
11nRIWQMl7+5BFqADBiLFAmeBq8=
</data>
<key>Info.plist</key>
<data>
Yj6HW2dqtkKMgRRFXJalQLjdvtA=
0Kq+tqf/uvamzXqFXIHFNWazqQE=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand Down Expand Up @@ -98,11 +98,11 @@
<dict>
<key>hash</key>
<data>
6c44v+1AyKy32YFhT2voVEWZ7JI=
11nRIWQMl7+5BFqADBiLFAmeBq8=
</data>
<key>hash2</key>
<data>
s4HJjjCIyAUxCoSXBgc7R849gbSi1IufGAF1DbGwhQo=
vJX7/wTOXaOgfDR3IB07SWgm1OqfP9yPHClStItPWKk=
</data>
</dict>
<key>Modules/module.modulemap</key>
Expand Down
Loading

0 comments on commit 1c4205e

Please sign in to comment.