Add click handling for regV5 welcome screen terms button.

This commit is contained in:
jeffrey-signal
2026-05-14 13:23:16 -04:00
committed by Michelle Tang
parent 5655fcf973
commit a796316ad6
6 changed files with 70 additions and 9 deletions
@@ -23,6 +23,8 @@ import androidx.fragment.app.FragmentManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.signal.core.util.LinkActions;
import org.signal.core.util.LinkActions.OpenUrlError;
import org.signal.core.util.Util;
import org.signal.core.util.concurrent.JvmRxExtensions;
import org.signal.core.util.concurrent.SignalExecutors;
@@ -55,6 +57,7 @@ import org.thoughtcrime.securesms.util.views.SimpleProgressDialog;
import org.whispersystems.signalservice.api.push.UsernameLinkComponents;
import io.reactivex.rxjava3.core.Single;
import kotlin.Unit;
import java.io.IOException;
import java.util.Objects;
@@ -230,15 +233,14 @@ public class CommunicationActions {
}
public static void openBrowserLink(@NonNull Context context, @NonNull String link) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
if (!(context instanceof Activity)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
LinkActions.openUrl(context, link, error -> {
if (error instanceof OpenUrlError.NoBrowserFound) {
Toast.makeText(context, R.string.CommunicationActions_no_browser_found, Toast.LENGTH_SHORT).show();
} else {
throw new AssertionError("Unhandled OpenUrlError: " + error);
}
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(context, R.string.CommunicationActions_no_browser_found, Toast.LENGTH_SHORT).show();
}
return Unit.INSTANCE;
});
}
public static void openEmail(@NonNull Context context, @NonNull String address, @Nullable String subject, @Nullable String body) {