Enable phone verification

Show the Close button after phone number has been verified
This commit is contained in:
Javi Rueda 2021-03-01 21:47:54 +01:00
parent e9d70dbf87
commit 36c105d3a7
4 changed files with 66 additions and 19 deletions

View file

@ -204,17 +204,18 @@ public class VerificationActivity extends FragmentActivity implements SignInList
} else if (flow == VERIFICATION_FLOW_REWARDS) { } else if (flow == VERIFICATION_FLOW_REWARDS) {
User user = Lbryio.currentUser; User user = Lbryio.currentUser;
// disable phone verification for now // disable phone verification for now
/*if (!user.isIdentityVerified()) { if (!user.isIdentityVerified()) {
// phone number verification required // phone number verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false); viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false);
flowHandled = true; flowHandled = true;
} else */ } else {
if (!user.isRewardApproved()) { if (!user.isRewardApproved()) {
// manual verification required // manual verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false); viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
flowHandled = true; flowHandled = true;
} }
} }
}
if (!flowHandled) { if (!flowHandled) {
// user has already been verified and or reward approved // user has already been verified and or reward approved
@ -225,6 +226,11 @@ public class VerificationActivity extends FragmentActivity implements SignInList
} }
} }
public void showPhoneVerification() {
ViewPager2 viewPager = findViewById(R.id.verification_pager);
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false);
}
public void showLoading() { public void showLoading() {
findViewById(R.id.verification_loading_progress).setVisibility(View.VISIBLE); findViewById(R.id.verification_loading_progress).setVisibility(View.VISIBLE);
findViewById(R.id.verification_pager).setVisibility(View.INVISIBLE); findViewById(R.id.verification_pager).setVisibility(View.INVISIBLE);
@ -238,8 +244,12 @@ public class VerificationActivity extends FragmentActivity implements SignInList
@Override @Override
public void onBackPressed() { public void onBackPressed() {
// ignore back press ViewPager2 viewPager = findViewById(R.id.verification_pager);
return;
if (viewPager.getCurrentItem() != VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL)
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL);
else
super.onBackPressed();
} }
public void onEmailAdded(String email) { public void onEmailAdded(String email) {
@ -296,14 +306,11 @@ public class VerificationActivity extends FragmentActivity implements SignInList
ViewPager2 viewPager = findViewById(R.id.verification_pager); ViewPager2 viewPager = findViewById(R.id.verification_pager);
// for rewards, (show phone verification if not done, or manual verification if required) // for rewards, (show phone verification if not done, or manual verification if required)
if (flow == VERIFICATION_FLOW_REWARDS) { if (flow == VERIFICATION_FLOW_REWARDS) {
// skipping phone verification if (!user.isIdentityVerified()) {
/*if (!user.isIdentityVerified()) {
// phone number verification required // phone number verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false); viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false);
} else } else {
*/
if (!user.isRewardApproved()) { if (!user.isRewardApproved()) {
// manual verification required // manual verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false); viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
} else { } else {
@ -311,6 +318,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
setResult(RESULT_OK); setResult(RESULT_OK);
finish(); finish();
} }
}
} else if (flow == VERIFICATION_FLOW_WALLET) { } else if (flow == VERIFICATION_FLOW_WALLET) {
// for wallet sync, if password unlock is required, show password entry page // for wallet sync, if password unlock is required, show password entry page
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_WALLET, false); viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_WALLET, false);
@ -347,6 +355,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
return; return;
} }
findViewById(R.id.verification_close_button).setVisibility(View.VISIBLE);
// show manual verification page if the user is still not reward approved // show manual verification page if the user is still not reward approved
ViewPager2 viewPager = findViewById(R.id.verification_pager); ViewPager2 viewPager = findViewById(R.id.verification_pager);
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false); viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);

View file

@ -21,6 +21,7 @@ import com.google.android.material.snackbar.Snackbar;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.R; import io.lbry.browser.R;
import io.lbry.browser.VerificationActivity;
import io.lbry.browser.listener.SignInListener; import io.lbry.browser.listener.SignInListener;
import io.lbry.browser.model.TwitterOauth; import io.lbry.browser.model.TwitterOauth;
import io.lbry.browser.model.lbryinc.RewardVerified; import io.lbry.browser.model.lbryinc.RewardVerified;
@ -98,6 +99,13 @@ public class ManualVerificationFragment extends Fragment {
} }
}); });
root.findViewById(R.id.verification_manual_phone_number_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
((VerificationActivity) getContext()).showPhoneVerification();
}
});
root.findViewById(R.id.verification_manual_continue_button).setOnClickListener(new View.OnClickListener() { root.findViewById(R.id.verification_manual_continue_button).setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -68,6 +68,33 @@
android:fontFamily="@font/inter" android:fontFamily="@font/inter"
android:text="@string/twitter_verify" /> android:text="@string/twitter_verify" />
<TextView
android:textSize="20sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:fontFamily="@font/inter"
android:text="@string/phone_number_verification"
android:textColor="@color/white"
android:textFontWeight="300" />
<TextView
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="@font/inter"
android:text="@string/phone_number_verification_desc"
android:textColor="@color/white"
android:textFontWeight="300" />
<com.google.android.material.button.MaterialButton
android:id="@+id/verification_manual_phone_number_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:fontFamily="@font/inter"
android:text="@string/phone_number_verify" />
<TextView <TextView
android:textSize="20sp" android:textSize="20sp"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -452,6 +452,9 @@
<string name="twitter_verification">Twitter Verification</string> <string name="twitter_verification">Twitter Verification</string>
<string name="twitter_verification_desc">Get instantly verified using your Twitter account. Your Twitter email address must match the email that you provided and your account should be active.</string> <string name="twitter_verification_desc">Get instantly verified using your Twitter account. Your Twitter email address must match the email that you provided and your account should be active.</string>
<string name="twitter_verify">Verify with Twitter</string> <string name="twitter_verify">Verify with Twitter</string>
<string name="phone_number_verification">Phone Number Verification</string>
<string name="phone_number_verification_desc">Get instantly verified using your phone number.</string>
<string name="phone_number_verify">Verify with phone number</string>
<string name="skip_queue_verification">Skip the Queue</string> <string name="skip_queue_verification">Skip the Queue</string>
<string name="skip_queue_verification_desc">Skip the manual verification queue by paying a fee in order to start participating in the rewards program immediately.</string> <string name="skip_queue_verification_desc">Skip the manual verification queue by paying a fee in order to start participating in the rewards program immediately.</string>
<string name="skip_queue_manual_check">If you previously completed a purchase successfully and you still see this screen, please tap the verify purchase button below.</string> <string name="skip_queue_manual_check">If you previously completed a purchase successfully and you still see this screen, please tap the verify purchase button below.</string>