use of com.odysee.app.model.lbryinc.RewardVerified in project odysee-android by OdyseeTeam.
the class RewardVerificationTwitterFragment method twitterVerify.
private void twitterVerify(TwitterOauth twitterOauth) {
Context context = getContext();
if (context != null) {
showLoading();
twitterOauthInProgress = true;
if (listener != null) {
listener.onManualProgress(twitterOauthInProgress);
}
TwitterVerifyTask task = new TwitterVerifyTask(twitterOauth, null, context, new RewardVerifiedHandler() {
@Override
public void onSuccess(RewardVerified rewardVerified) {
twitterOauthInProgress = false;
if (listener != null) {
listener.onManualProgress(twitterOauthInProgress);
}
if (Lbryio.currentUser != null) {
Lbryio.currentUser.setRewardApproved(rewardVerified.isRewardApproved());
}
if (rewardVerified.isRewardApproved()) {
if (listener != null) {
listener.onTwitterVerified();
}
} else {
View root = getView();
if (root != null) {
// reward approved wasn't set to true
Snackbar.make(root, getString(R.string.twitter_verification_not_approved), Snackbar.LENGTH_LONG).setTextColor(Color.WHITE).setBackgroundTint(Color.RED).show();
}
hideLoading();
}
}
@Override
public void onError(Exception error) {
handleFlowError(error != null ? error.getMessage() : null);
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
twitterOauthInProgress = false;
if (listener != null) {
listener.onManualProgress(twitterOauthInProgress);
}
hideLoading();
}
}
Aggregations