Open gemini link from external application

This commit is contained in:
Balazs Toldi 2021-02-17 15:51:24 +01:00
parent 18e4250a66
commit 582b36bc80
No known key found for this signature in database
GPG Key ID: 933820884952BE27
2 changed files with 3 additions and 8 deletions

View File

@ -665,9 +665,7 @@ public class Status implements Parcelable {
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); context.startActivity(intent);
} else { } else {
if (!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://")) Helper.openBrowser(context, url);
finalUrl = "http://" + url;
Helper.openBrowser(context, finalUrl);
} }
} }
@ -891,10 +889,7 @@ public class Status implements Parcelable {
contentSpanTranslated.setSpan(new ClickableSpan() { contentSpanTranslated.setSpan(new ClickableSpan() {
@Override @Override
public void onClick(@NonNull View textView) { public void onClick(@NonNull View textView) {
String finalUrl = url; Helper.openBrowser(context, url);
if (!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://"))
finalUrl = "http://" + url;
Helper.openBrowser(context, finalUrl);
} }
@Override @Override

View File

@ -3166,7 +3166,7 @@ public class BaseHelper {
public static void openBrowser(Context context, String url) { public static void openBrowser(Context context, String url) {
SharedPreferences sharedpreferences = context.getSharedPreferences(APP_PREFS, android.content.Context.MODE_PRIVATE); SharedPreferences sharedpreferences = context.getSharedPreferences(APP_PREFS, android.content.Context.MODE_PRIVATE);
boolean embedded_browser = sharedpreferences.getBoolean(SET_EMBEDDED_BROWSER, true); boolean embedded_browser = sharedpreferences.getBoolean(SET_EMBEDDED_BROWSER, true);
if (embedded_browser) { if (embedded_browser && !url.toLowerCase().startsWith("gemini://")) {
Intent intent = new Intent(context, WebviewActivity.class); Intent intent = new Intent(context, WebviewActivity.class);
Bundle b = new Bundle(); Bundle b = new Bundle();
String finalUrl = url; String finalUrl = url;