use of net.iGap.request.RequestUserProfileSetRepresentative in project iGap-Android by KianIranian-STDG.
the class UserProfileViewModel method setRequestSetReferral.
public void setRequestSetReferral(String phoneNumber) {
new RequestUserProfileSetRepresentative().userProfileSetRepresentative(phoneNumber, new OnUserProfileSetRepresentative() {
@Override
public void onSetRepresentative(String phone) {
G.handler.post(() -> {
if (!hasError) {
referralEnableLiveData.postValue(false);
referralNumberObservableField.set("");
showEditIcon();
isEditProfile = false;
}
});
}
@Override
public void onErrorSetRepresentative(int majorCode, int minorCode) {
G.handler.post(() -> {
showReferralErrorLiveData.set(true);
hasError = true;
switch(majorCode) {
case 10177:
if (minorCode == 2) {
referralError.set(R.string.referral_error_yourself);
} else {
referralError.set(R.string.phone_number_is_not_valid);
}
break;
case 10178:
if (minorCode == 2)
referralError.set(R.string.already_registered);
else
referralError.set(R.string.server_error);
break;
}
referralNumberObservableField.set("");
});
}
});
}
Aggregations