Skip to content

Commit

Permalink
Fix[bridge]: incorrect arg type in accessClipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Jul 7, 2024
1 parent 619f3cd commit 4d60d60
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Natives/ios_uikit_bridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_uikit_UIKit_showError(JNIEnv* en
});
}

jstring UIKit_accessClipboard(JNIEnv* env, jint action, jstring copySrc) {
jstring UIKit_accessClipboard(JNIEnv* env, jint action, jbyteArray copySrc) {
if (action == CLIPBOARD_PASTE) {
// paste request
if (UIPasteboard.generalPasteboard.hasStrings) {
Expand All @@ -94,9 +94,11 @@ jstring UIKit_accessClipboard(JNIEnv* env, jint action, jstring copySrc) {
}
} else if (action == CLIPBOARD_COPY) {
// copy request
const char* copySrcC = (*env)->GetStringUTFChars(env, copySrc, 0);
UIPasteboard.generalPasteboard.string = @(copySrcC);
(*env)->ReleaseStringUTFChars(env, copySrc, copySrcC);
const char* copySrcC = (*env)->GetByteArrayElements(env, copySrc, 0);
if (copySrcC) {
UIPasteboard.generalPasteboard.string = @(copySrcC);
(*env)->ReleaseByteArrayElements(env, copySrc, copySrcC, 0);
}
return NULL;
} else {
// unknown request
Expand Down

0 comments on commit 4d60d60

Please sign in to comment.