Skip to content

Commit

Permalink
feat: support for Amazon Fire WebView (#6603)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Anderson <[email protected]>
Co-authored-by: Mark Anderson <[email protected]>
Co-authored-by: Chace Daniels <[email protected]>
  • Loading branch information
4 people authored Nov 28, 2023
1 parent 6bc4b37 commit 3cb4eb8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions android/capacitor/src/main/java/com/getcapacitor/Bridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,27 @@ public boolean isMinimumWebViewInstalled() {
Logger.warn("Unable to get package info for 'com.android.webview'" + ex.toString());
}

final int amazonFireMajorWebViewVersion = extractWebViewMajorVersion(pm, "com.amazon.webview.chromium");
if (amazonFireMajorWebViewVersion >= config.getMinWebViewVersion()) {
return true;
}

// Could not detect any webview, return false
return false;
}

private int extractWebViewMajorVersion(final PackageManager pm, final String webViewPackageName) {
try {
final PackageInfo info = InternalUtils.getPackageInfo(pm, webViewPackageName);
final String majorVersionStr = info.versionName.split("\\.")[0];
final int majorVersion = Integer.parseInt(majorVersionStr);
return majorVersion;
} catch (Exception ex) {
Logger.warn(String.format("Unable to get package info for '%s' with err '%s'", webViewPackageName, ex));
}
return 0;
}

public boolean launchIntent(Uri url) {
/*
* Give plugins the chance to handle the url
Expand Down

0 comments on commit 3cb4eb8

Please sign in to comment.