Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/3868 wkwebview inspectable #3869

Merged
merged 2 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CodenameOne/src/com/codename1/ui/BrowserComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -2140,8 +2140,10 @@ public void run() {
public void setDebugMode(boolean mode) {
if(mode) {
putClientProperty("BrowserComponent.firebug", Boolean.TRUE);
putClientProperty("BrowserComponent.ios.debug", Boolean.TRUE);
} else {
putClientProperty("BrowserComponent.firebug", null);
putClientProperty("BrowserComponent.ios.debug", null);
}
}

Expand Down
19 changes: 19 additions & 0 deletions Ports/iOSPort/nativeSources/IOSNative.m
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,21 @@ void releaseCN1(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o){
com_codename1_impl_ios_IOSImplementation_release___java_lang_Object(CN1_THREAD_STATE_PASS_ARG o);
}

JAVA_OBJECT getClientProperty(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o, NSString* key){
return com_codename1_ui_Component_getClientProperty___java_lang_String_R_java_lang_Object(
CN1_THREAD_STATE_PASS_ARG o,
fromNSString(CN1_THREAD_STATE_PASS_ARG key)
);
}

BOOL getBooleanClientProperty(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o, NSString* key){
JAVA_OBJECT val = getClientProperty(CN1_THREAD_STATE_PASS_ARG o, key);
if(val == JAVA_NULL){
return NO;
}
return val == get_static_java_lang_Boolean_TRUE(threadStateData);
}

#ifndef NEW_CODENAME_ONE_VM
NSString* toNSString(JAVA_OBJECT str) {
if(str == JAVA_NULL) {
Expand Down Expand Up @@ -2489,6 +2504,10 @@ JAVA_LONG com_codename1_impl_ios_IOSNative_createWKBrowserComponent___java_lang_
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.backgroundColor = [UIColor clearColor];
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.opaque = NO;
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.autoresizesSubviews = YES;

if (getBooleanClientProperty(CN1_THREAD_GET_STATE_PASS_ARG obj, @"BrowserComponent.ios.debug")) {
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.inspectable = YES;
}

com_codename1_impl_ios_IOSNative_createWKBrowserComponent.navigationDelegate = del;
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
Expand Down
Loading