Skip to content
Open
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
16 changes: 13 additions & 3 deletions OpacityCore/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
-keep class com.opacitylabs.opacitycore.OpacityResponse { *; }
-keep class com.opacitylabs.opacitycore.OpacityError { *; }

# Keep the InAppBrowserActivity as it's referenced by string name
-keep class com.opacitylabs.opacitycore.InAppBrowserActivity { *; }
# Keep browser activity classes
-keep class com.opacitylabs.opacitycore.BaseBrowserActivity { *; }
-keep class com.opacitylabs.opacitycore.WebViewBrowserActivity { *; }
-keep class com.opacitylabs.opacitycore.GeckoViewBrowserActivity { *; }

# Keep utility classes
-keep class com.opacitylabs.opacitycore.JsonUtils { *; }
Expand Down Expand Up @@ -64,7 +66,15 @@
-keep class * extends android.content.BroadcastReceiver
-keep class * extends android.os.Parcelable

# Keep GeckoView related classes (since you use Mozilla GeckoView)
# Keep WebView JavascriptInterface methods
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}

# Keep the OpacityJsBridge inner class
-keep class com.opacitylabs.opacitycore.WebViewBrowserActivity$OpacityJsBridge { *; }

# Keep GeckoView classes
-keep class org.mozilla.geckoview.** { *; }
-dontwarn org.mozilla.geckoview.**

Expand Down
10 changes: 4 additions & 6 deletions OpacityCore/src/main/cpp/OpacityCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,15 @@ extern "C" void android_set_request_header(const char *key, const char *value) {
env->CallVoidMethod(java_object, method, jkey, jvalue);
}

extern "C" void android_present_webview(bool shouldIntercept) {
extern "C" void android_present_webview(bool shouldIntercept, bool androidUseSystemWebView) {
JNIEnv *env = GetJniEnv();
// Get the Kotlin class
jclass jOpacityCore = env->GetObjectClass(java_object);

// Get the method ID for the method you want to call
jmethodID method = env->GetMethodID(jOpacityCore, "presentBrowser", "(Z)V");
jmethodID method = env->GetMethodID(jOpacityCore, "presentBrowser", "(ZZ)V");

// Call the method with the necessary parameters
jboolean jshouldIntercept = shouldIntercept ? JNI_TRUE : JNI_FALSE;
env->CallVoidMethod(java_object, method, jshouldIntercept);
jboolean jandroidUseSystemWebView = androidUseSystemWebView ? JNI_TRUE : JNI_FALSE;
env->CallVoidMethod(java_object, method, jshouldIntercept, jandroidUseSystemWebView);
}

extern "C" void android_webview_change_url(const char *url) {
Expand Down
2 changes: 1 addition & 1 deletion OpacityCore/src/main/jni/include/sdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ extern void android_prepare_request(const char *url);

extern void android_set_request_header(const char *key, const char *value);

extern void android_present_webview(bool should_intercept);
extern void android_present_webview(bool should_intercept, bool android_use_system_webview);

extern void android_close_webview(void);

Expand Down
Loading