Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 229cbb34 authored by roldenburg's avatar roldenburg Committed by android-build-merger
Browse files

Merge "Take user to install Duo if they tap "Set up" without the app installed" am: 38ed3cc6

am: 040ab389

Change-Id: Ib682448a0e3deafc3dda97d8bbe218bfa7619e8b
parents 335329f6 040ab389
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -683,7 +683,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
          inviteVideoButtonView.setTag(IntentProvider.getDuoInviteIntentProvider(number));
          inviteVideoButtonView.setVisibility(View.VISIBLE);
        } else if (duo.isEnabled(mContext)) {
          if (!duo.isInstalled(mContext)) {
            setUpVideoButtonView.setTag(IntentProvider.getInstallDuoIntentProvider());
          } else {
            setUpVideoButtonView.setTag(IntentProvider.getSetUpDuoIntentProvider());
          }
          setUpVideoButtonView.setVisibility(View.VISIBLE);
        }
        break;
+20 −0
Original line number Diff line number Diff line
@@ -104,6 +104,26 @@ public abstract class IntentProvider {
    };
  }

  public static IntentProvider getInstallDuoIntentProvider() {
    return new IntentProvider() {
      @Override
      public Intent getIntent(Context context) {
        return new Intent(
            Intent.ACTION_VIEW,
            new Uri.Builder()
                .scheme("https")
                .authority("play.google.com")
                .appendEncodedPath("store/apps/details")
                .appendQueryParameter("id", "com.google.android.apps.tachyon")
                .appendQueryParameter(
                    "referrer",
                    "utm_source=dialer&utm_medium=text&utm_campaign=product") // This string is from
                // the Duo team
                .build());
      }
    };
  }

  public static IntentProvider getSetUpDuoIntentProvider() {
    return new IntentProvider() {
      @Override
+3 −0
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@ public interface Duo {
  /** @return true if the Duo integration is enabled on this device. */
  boolean isEnabled(@NonNull Context context);

  /** @return true if Duo is installed on this device. */
  boolean isInstalled(@NonNull Context context);

  /**
   * @return true if Duo is installed and the user has gone through the set-up flow confirming their
   *     phone number.
+5 −0
Original line number Diff line number Diff line
@@ -40,6 +40,11 @@ public class DuoStub implements Duo {
    return false;
  }

  @Override
  public boolean isInstalled(@NonNull Context context) {
    return false;
  }

  @Override
  public boolean isActivated(@NonNull Context context) {
    return false;