Enable phone verification #1168

Merged
kekkyojin merged 1 commit from enable-phone-verification into master 2021-03-16 09:22:36 +01:00
4 changed files with 66 additions and 19 deletions

View file

@ -204,15 +204,16 @@ public class VerificationActivity extends FragmentActivity implements SignInList
} else if (flow == VERIFICATION_FLOW_REWARDS) {
User user = Lbryio.currentUser;
// disable phone verification for now
/*if (!user.isIdentityVerified()) {
if (!user.isIdentityVerified()) {
// phone number verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false);
flowHandled = true;
} else */
if (!user.isRewardApproved()) {
// manual verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
flowHandled = true;
} else {
if (!user.isRewardApproved()) {
// manual verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
flowHandled = true;
}
}
}
@ -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() {
findViewById(R.id.verification_loading_progress).setVisibility(View.VISIBLE);
findViewById(R.id.verification_pager).setVisibility(View.INVISIBLE);
@ -238,8 +244,12 @@ public class VerificationActivity extends FragmentActivity implements SignInList
@Override
public void onBackPressed() {
// ignore back press
return;
ViewPager2 viewPager = findViewById(R.id.verification_pager);
if (viewPager.getCurrentItem() != VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL)
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL);
else
super.onBackPressed();
}
public void onEmailAdded(String email) {
@ -296,20 +306,18 @@ public class VerificationActivity extends FragmentActivity implements SignInList
ViewPager2 viewPager = findViewById(R.id.verification_pager);
// for rewards, (show phone verification if not done, or manual verification if required)
if (flow == VERIFICATION_FLOW_REWARDS) {
// skipping phone verification
/*if (!user.isIdentityVerified()) {
if (!user.isIdentityVerified()) {
// phone number verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_PHONE, false);
} else
*/
if (!user.isRewardApproved()) {
// manual verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
} else {
// fully verified
setResult(RESULT_OK);
finish();
if (!user.isRewardApproved()) {
// manual verification required
viewPager.setCurrentItem(VerificationPagerAdapter.PAGE_VERIFICATION_MANUAL, false);
} else {
// fully verified
setResult(RESULT_OK);
finish();
}
}
} else if (flow == VERIFICATION_FLOW_WALLET) {
// for wallet sync, if password unlock is required, show password entry page
@ -347,6 +355,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
return;
}
findViewById(R.id.verification_close_button).setVisibility(View.VISIBLE);
// show manual verification page if the user is still not reward approved
ViewPager2 viewPager = findViewById(R.id.verification_pager);
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.R;
import io.lbry.browser.VerificationActivity;
import io.lbry.browser.listener.SignInListener;
import io.lbry.browser.model.TwitterOauth;
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() {
@Override

View file

@ -68,6 +68,33 @@
android:fontFamily="@font/inter"
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
android:textSize="20sp"
android:layout_width="match_parent"

View file

@ -452,6 +452,9 @@
<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_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_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>