1
0
mirror of https://github.com/areteruhiro/LIME-beta-hiro.git synced 2025-02-10 23:41:38 +09:00

Update RedirectWebView.java

web viewを規定のブラウザにリダイレクトをオンにしていると設定のアカウントセンターまでブラウザで開いてしまうのを改善
This commit is contained in:
areteruhiro 2024-11-03 15:42:07 +09:00 committed by GitHub
parent 1304e281a3
commit 947a468d16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,8 @@ import de.robv.android.xposed.callbacks.XC_LoadPackage;
import io.github.chipppppppppp.lime.LimeOptions;
public class RedirectWebView implements IHook {
@Override
public void hook(LimeOptions limeOptions, XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
if (!limeOptions.redirectWebView.checked) return;
@ -30,10 +32,20 @@ public class RedirectWebView implements IHook {
WebView webView = findWebView(rootView);
if (webView != null) {
String currentUrl = webView.getUrl();
if (currentUrl != null &&
(currentUrl.startsWith("https://account-center.lylink.yahoo.co.jp") ||
currentUrl.startsWith("https://access.line.me") ||
currentUrl.startsWith("https://id.lylink.yahoo.co.jp/federation/ly/normal/callback/first"))) {
return;
}
webView.setVisibility(View.GONE);
webView.stopLoading();
Uri uri = Uri.parse(webView.getUrl());
Uri uri = Uri.parse(currentUrl);
if (limeOptions.openInBrowser.checked) {
Intent intent = new Intent(Intent.ACTION_VIEW);
@ -48,13 +60,13 @@ public class RedirectWebView implements IHook {
}
activity.finish();
}
}
}
);
}
private WebView findWebView(View view) {
if (view instanceof WebView) {
return (WebView) view;