diff --git a/app/src/main/java/io/lbry/browser/MainActivity.java b/app/src/main/java/io/lbry/browser/MainActivity.java
index aa5b65c5..25ed0f7e 100644
--- a/app/src/main/java/io/lbry/browser/MainActivity.java
+++ b/app/src/main/java/io/lbry/browser/MainActivity.java
@@ -225,6 +225,7 @@ import lombok.SneakyThrows;
import okhttp3.OkHttpClient;
import static android.os.Build.VERSION_CODES.M;
+import static android.os.Build.VERSION_CODES.P;
public class MainActivity extends AppCompatActivity implements SdkStatusListener,
SharedPreferences.OnSharedPreferenceChangeListener,
@@ -1271,7 +1272,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
return sp.getBoolean(PREFERENCE_KEY_INTERNAL_FIRST_RUN_COMPLETED, false);
}
- private void checkPurchases() {
+ public void checkPurchases() {
if (billingClient != null) {
Purchase.PurchasesResult result = billingClient.queryPurchases(BillingClient.SkuType.INAPP);
if (result.getPurchasesList() != null) {
@@ -1282,6 +1283,24 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
}
}
+ public void checkPurchases(GenericTaskHandler handler) {
+ boolean purchaseFound = false;
+ if (billingClient != null) {
+ Purchase.PurchasesResult result = billingClient.queryPurchases(BillingClient.SkuType.INAPP);
+ if (result.getPurchasesList() != null) {
+ for (Purchase purchase : result.getPurchasesList()) {
+ handlePurchase(purchase, handler);
+ purchaseFound = true;
+ return;
+ }
+ }
+ }
+
+ if (!purchaseFound) {
+ handler.onError(new Exception(getString(R.string.skip_queue_purchase_not_found)));
+ }
+ }
+
private void handlePurchase(Purchase purchase) {
handleBillingPurchase(purchase, billingClient, MainActivity.this, null, new RewardVerifiedHandler() {
@Override
@@ -1298,6 +1317,28 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
});
}
+ private void handlePurchase(Purchase purchase, GenericTaskHandler handler) {
+ handleBillingPurchase(purchase, billingClient, MainActivity.this, null, new RewardVerifiedHandler() {
+ @Override
+ public void onSuccess(RewardVerified rewardVerified) {
+ if (Lbryio.currentUser != null) {
+ Lbryio.currentUser.setRewardApproved(rewardVerified.isRewardApproved());
+ }
+
+ if (handler != null) {
+ handler.onSuccess();
+ }
+ }
+
+ @Override
+ public void onError(Exception error) {
+ if (handler != null) {
+ handler.onError(error);
+ }
+ }
+ });
+ }
+
private void checkPendingOpens() {
if (pendingFollowingReload) {
loadFollowingContent();
diff --git a/app/src/main/java/io/lbry/browser/ui/verification/ManualVerificationFragment.java b/app/src/main/java/io/lbry/browser/ui/verification/ManualVerificationFragment.java
index 7bc09379..3dd421ff 100644
--- a/app/src/main/java/io/lbry/browser/ui/verification/ManualVerificationFragment.java
+++ b/app/src/main/java/io/lbry/browser/ui/verification/ManualVerificationFragment.java
@@ -19,10 +19,12 @@ import androidx.fragment.app.Fragment;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.snackbar.Snackbar;
+import io.lbry.browser.MainActivity;
import io.lbry.browser.R;
import io.lbry.browser.listener.SignInListener;
import io.lbry.browser.model.TwitterOauth;
import io.lbry.browser.model.lbryinc.RewardVerified;
+import io.lbry.browser.tasks.GenericTaskHandler;
import io.lbry.browser.tasks.RewardVerifiedHandler;
import io.lbry.browser.tasks.TwitterOauthHandler;
import io.lbry.browser.tasks.lbryinc.TwitterVerifyTask;
@@ -69,6 +71,33 @@ public class ManualVerificationFragment extends Fragment {
}
});
+ root.findViewById(R.id.verification_manual_skip_queue_verify).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ showLoading();
+ if (MainActivity.instance != null) {
+ MainActivity.instance.checkPurchases(new GenericTaskHandler() {
+ @Override
+ public void beforeStart() {
+
+ }
+
+ @Override
+ public void onSuccess() {
+ hideLoading();
+ listener.onManualVerifyContinue();
+ }
+
+ @Override
+ public void onError(Exception error) {
+ hideLoading();
+ showError(error.getMessage());
+ }
+ });
+ }
+ }
+ });
+
root.findViewById(R.id.verification_manual_continue_button).setOnClickListener(new View.OnClickListener() {
@Override
@@ -267,6 +296,16 @@ public class ManualVerificationFragment extends Fragment {
showFlowError(extra);
}
+ private void showError(String message) {
+ Context context = getContext();
+ View root = getView();
+ if (context != null && root != null) {
+ Snackbar.make(root, message, Snackbar.LENGTH_LONG).
+ setTextColor(Color.WHITE).
+ setBackgroundTint(Color.RED).show();
+ }
+ }
+
private void showFlowError(String extra) {
Context context = getContext();
View root = getView();
diff --git a/app/src/main/res/layout/fragment_verification_manual.xml b/app/src/main/res/layout/fragment_verification_manual.xml
index b9e11c25..211a8c38 100644
--- a/app/src/main/res/layout/fragment_verification_manual.xml
+++ b/app/src/main/res/layout/fragment_verification_manual.xml
@@ -93,7 +93,22 @@
android:layout_marginTop="4dp"
android:fontFamily="@font/inter"
android:text="@string/skip_queue_button_text" />
-
+
+
Verify with Twitter
Skip the Queue
Skip the manual verification queue by paying a fee in order to start participating in the rewards program immediately.
+ If you previously completed a purchase successfully and you still see this screen, please tap the verify purchase button below.
+ No purchase was found for this account.
+ Verify Purchase
Please request to be verified on the <a href="https://discordapp.com/invite/Z3bERWA">LBRY Discord server</a>. A manual review can take anywhere from several minutes to several days.
Please enjoy free content in the meantime!
Verify Phone Number