feat(about): try to open links in-app

The About screen often contains links the local accounts (e.g.
moderators, admins) instead of always opening them in the browser, try
to open them in-app first.
This commit is contained in:
FineFindus
2024-04-30 19:56:29 +02:00
parent d5cd016776
commit 86506f9ba4

View File

@@ -83,7 +83,11 @@ public class SettingsServerAboutFragment extends LoaderFragment{
public boolean shouldOverrideUrlLoading(WebView view, String url){
Uri uri=Uri.parse(url);
if(uri.getScheme().equals("http") || uri.getScheme().equals("https")){
UiUtils.launchWebBrowser(getActivity(), url);
if(uri.getHost()!=null && uri.getHost().equals(instance.uri))
//try to open linked accounts, etc in the app
UiUtils.openURL(getActivity(),accountID, url);
else
UiUtils.launchWebBrowser(getActivity(), url);
}else{
Intent intent=new Intent(Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);