fixed links in privacy warning in channel discovery. fixes #3577

This commit is contained in:
Daniel Gultsch 2019-11-02 17:00:23 +01:00
parent 07786d4576
commit f7b7464a65
2 changed files with 10 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Html; import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -158,6 +159,13 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
builder.setPositiveButton(R.string.confirm, (dialog, which) -> optIn()); builder.setPositiveButton(R.string.confirm, (dialog, which) -> optIn());
builder.setOnCancelListener(dialog -> finish()); builder.setOnCancelListener(dialog -> finish());
final AlertDialog dialog = builder.create(); final AlertDialog dialog = builder.create();
dialog.setOnShowListener(d -> {
final TextView textView = dialog.findViewById(android.R.id.message);
if (textView == null) {
return;
}
textView.setMovementMethod(LinkMovementMethod.getInstance());
});
dialog.setCanceledOnTouchOutside(false); dialog.setCanceledOnTouchOutside(false);
dialog.show(); dialog.show();
} }

View File

@ -70,8 +70,8 @@ public class FixedURLSpan extends URLSpan {
public void onClick(View widget) { public void onClick(View widget) {
final Uri uri = Uri.parse(getURL()); final Uri uri = Uri.parse(getURL());
final Context context = widget.getContext(); final Context context = widget.getContext();
final boolean candidateToProcessDirecty = "xmpp".equals(uri.getScheme()) || ("https".equals(uri.getScheme()) && "conversations.im".equals(uri.getHost()) && uri.getPathSegments().size() > 1 && Arrays.asList("j","i").contains(uri.getPathSegments().get(0))); final boolean candidateToProcessDirectly = "xmpp".equals(uri.getScheme()) || ("https".equals(uri.getScheme()) && "conversations.im".equals(uri.getHost()) && uri.getPathSegments().size() > 1 && Arrays.asList("j","i").contains(uri.getPathSegments().get(0)));
if (candidateToProcessDirecty && context instanceof ConversationsActivity) { if (candidateToProcessDirectly && context instanceof ConversationsActivity) {
if (((ConversationsActivity) context).onXmppUriClicked(uri)) { if (((ConversationsActivity) context).onXmppUriClicked(uri)) {
widget.playSoundEffect(0); widget.playSoundEffect(0);
return; return;