Skip to content

Commit

Permalink
fix(android): use unescaped Android package id for the proguard rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Oct 11, 2024
1 parent 4a5b6e8 commit 21c41be
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changes/proguard-unescapted-package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Use unescaped Android package identifier for the proguard rules.
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ fn main() {
let content = fs::read_to_string(file.path())
.expect("failed to read kotlin file as string")
.replace("{{package}}", &package)
.replace("{{package-unescaped}}", &package.replace('`', ""))
.replace("{{library}}", &library)
.replace(
"{{class-extension}}",
Expand Down
12 changes: 6 additions & 6 deletions src/android/kotlin/proguard-wry.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

-keep class {{package}}.* {
-keep class {{package-unescaped}}.* {
native <methods>;
}

-keep class {{package}}.WryActivity {
-keep class {{package-unescaped}}.WryActivity {
public <init>(...);

void setWebView({{package}}.RustWebView);
void setWebView({{package-unescaped}}.RustWebView);
java.lang.Class getAppClass(...);
java.lang.String getVersion();
}

-keep class {{package}}.Ipc {
-keep class {{package-unescaped}}.Ipc {
public <init>(...);

@android.webkit.JavascriptInterface public <methods>;
}

-keep class {{package}}.RustWebView {
-keep class {{package-unescaped}}.RustWebView {
public <init>(...);

void loadUrlMainThread(...);
Expand All @@ -30,6 +30,6 @@
void evalScript(...);
}

-keep class {{package}}.RustWebChromeClient,{{package}}.RustWebViewClient {
-keep class {{package-unescaped}}.RustWebChromeClient,{{package-unescaped}}.RustWebViewClient {
public <init>(...);
}

0 comments on commit 21c41be

Please sign in to comment.