ReviewOS

also looking at this

craft-native/craft

feat(android): the reply channel, so async actions become reachable

#152
Merged chris wants to merge feat/android-reply-channel into main
5 files +464 -0
packages/zig/src/android_dispatch.zigmodified+5-0
Changes to packages/zig/src/android_dispatch.zig
@@ -44,6 +44,7 @@ const network = @import("bridge_android_network.zig");
4444const securestore = @import("bridge_android_securestore.zig");
4545const haptics = @import("bridge_android_haptics.zig");
4646const notifcancel = @import("bridge_android_notifcancel.zig");
47const events = @import("android_events.zig");
4748
4849const Jni = jni.Jni;
4950
@@ -96,6 +97,10 @@ pub const holder_class = "com/craft/runtime/CraftNative";
9697/// linked.
9798pub export fn JNI_OnLoad(vm_handle: jni.JavaVM, _: ?*anyopaque) callconv(.c) jni.jint {
9899 java_vm = vm_handle;
100 // The reply channel needs the same handle, and needs it before any action
101 // runs: a callback that fires between load and the first native call has
102 // nowhere to deliver otherwise.
103 events.setVm(vm_handle);
99104
100105 switch (bindNatives(vm_handle)) {
101106 .registered => {},