Skip to content

Commit 898f4d6

Browse files
shannahSteve Hannah
andauthored
Feature/3868 wkwebview inspectable (#3869)
* feat: [3868] Added support for debugging webviews in iOS * fixed typo compile error on ios --------- Co-authored-by: Steve Hannah <[email protected]>
1 parent c300c4e commit 898f4d6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

CodenameOne/src/com/codename1/ui/BrowserComponent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,8 +2140,10 @@ public void run() {
21402140
public void setDebugMode(boolean mode) {
21412141
if(mode) {
21422142
putClientProperty("BrowserComponent.firebug", Boolean.TRUE);
2143+
putClientProperty("BrowserComponent.ios.debug", Boolean.TRUE);
21432144
} else {
21442145
putClientProperty("BrowserComponent.firebug", null);
2146+
putClientProperty("BrowserComponent.ios.debug", null);
21452147
}
21462148
}
21472149

Ports/iOSPort/nativeSources/IOSNative.m

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,21 @@ void releaseCN1(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o){
427427
com_codename1_impl_ios_IOSImplementation_release___java_lang_Object(CN1_THREAD_STATE_PASS_ARG o);
428428
}
429429

430+
JAVA_OBJECT getClientProperty(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o, NSString* key){
431+
return com_codename1_ui_Component_getClientProperty___java_lang_String_R_java_lang_Object(
432+
CN1_THREAD_STATE_PASS_ARG o,
433+
fromNSString(CN1_THREAD_STATE_PASS_ARG key)
434+
);
435+
}
436+
437+
BOOL getBooleanClientProperty(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o, NSString* key){
438+
JAVA_OBJECT val = getClientProperty(CN1_THREAD_STATE_PASS_ARG o, key);
439+
if(val == JAVA_NULL){
440+
return NO;
441+
}
442+
return val == get_static_java_lang_Boolean_TRUE(threadStateData);
443+
}
444+
430445
#ifndef NEW_CODENAME_ONE_VM
431446
NSString* toNSString(JAVA_OBJECT str) {
432447
if(str == JAVA_NULL) {
@@ -2489,6 +2504,10 @@ JAVA_LONG com_codename1_impl_ios_IOSNative_createWKBrowserComponent___java_lang_
24892504
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.backgroundColor = [UIColor clearColor];
24902505
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.opaque = NO;
24912506
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.autoresizesSubviews = YES;
2507+
2508+
if (getBooleanClientProperty(CN1_THREAD_GET_STATE_PASS_ARG obj, @"BrowserComponent.ios.debug")) {
2509+
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.inspectable = YES;
2510+
}
24922511

24932512
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.navigationDelegate = del;
24942513
com_codename1_impl_ios_IOSNative_createWKBrowserComponent.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);

0 commit comments

Comments
 (0)