diff options
author | roldenburg <roldenburg@google.com> | 2017-12-13 17:14:12 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2017-12-13 17:16:17 -0800 |
commit | efe91971cbb687f72e4914530bd7abe96e8f6f8b (patch) | |
tree | f078adb557ec863fca3f699a6b73d0d3ec1d6e9e /java | |
parent | 19c6c256bbb6f6a2d1c5772b6cd85f2a07d50a1c (diff) |
Take user to install Duo if they tap "Set up" without the app installed
Bug: 70034799
Test: DuoImplTest, GoogleCallLogAdapterTest
PiperOrigin-RevId: 178981398
Change-Id: Id524dfe61bf3a2358d863dd8d5f7c6c083b8063c
Diffstat (limited to 'java')
4 files changed, 33 insertions, 1 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index a5a0cff21..a6489cdd3 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -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)) { - setUpVideoButtonView.setTag(IntentProvider.getSetUpDuoIntentProvider()); + if (!duo.isInstalled(mContext)) { + setUpVideoButtonView.setTag(IntentProvider.getInstallDuoIntentProvider()); + } else { + setUpVideoButtonView.setTag(IntentProvider.getSetUpDuoIntentProvider()); + } setUpVideoButtonView.setVisibility(View.VISIBLE); } break; diff --git a/java/com/android/dialer/app/calllog/IntentProvider.java b/java/com/android/dialer/app/calllog/IntentProvider.java index 996bca0f6..c86a2603d 100644 --- a/java/com/android/dialer/app/calllog/IntentProvider.java +++ b/java/com/android/dialer/app/calllog/IntentProvider.java @@ -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 diff --git a/java/com/android/dialer/duo/Duo.java b/java/com/android/dialer/duo/Duo.java index 5f49e3e7e..d9147844f 100644 --- a/java/com/android/dialer/duo/Duo.java +++ b/java/com/android/dialer/duo/Duo.java @@ -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. diff --git a/java/com/android/dialer/duo/stub/DuoStub.java b/java/com/android/dialer/duo/stub/DuoStub.java index 398e99035..cfa400a7f 100644 --- a/java/com/android/dialer/duo/stub/DuoStub.java +++ b/java/com/android/dialer/duo/stub/DuoStub.java @@ -41,6 +41,11 @@ public class DuoStub implements Duo { } @Override + public boolean isInstalled(@NonNull Context context) { + return false; + } + + @Override public boolean isActivated(@NonNull Context context) { return false; } |