use of net.iGap.observers.interfaces.OnUserRegistration in project iGap-Android by KianIranian-STDG.
the class RegisterRepository method requestRegister.
private void requestRegister(String phoneNumber, RepositoryCallbackWithError<ErrorWithWaitTime> callback) {
if (phoneNumber == null)
return;
this.phoneNumber = phoneNumber.replace("-", "");
ProtoUserRegister.UserRegister.Builder builder = ProtoUserRegister.UserRegister.newBuilder();
builder.setCountryCode(isoCode);
builder.setPhoneNumber(Long.parseLong(this.phoneNumber));
builder.setPreferenceMethodValue(ProtoUserRegister.UserRegisterResponse.Method.VERIFY_CODE_SMS.getNumber());
builder.setRequest(ProtoRequest.Request.newBuilder().setId(HelperString.generateKey()));
builder.setAppId(BuildConfig.APP_ID);
RequestWrapper requestWrapper = new RequestWrapper(100, builder, new OnUserRegistration() {
@Override
public void onRegister(String userNameR, long userIdR, ProtoUserRegister.UserRegisterResponse.Method methodValue, List<Long> smsNumbersR, String regex, int verifyCodeDigitCount, String authorHashR, boolean callMethodSupported, long resendCodeDelay) {
/*isCallMethodSupported = callMethodSupported;*/
// because is new ui verification code number is 5 and number not not use it more
/*digitCount = verifyCodeDigitCount;*/
regexFetchCodeVerification = regex;
userName = userNameR;
userId = userIdR;
authorHash = authorHashR;
G.smsNumbers = smsNumbersR;
method = methodValue;
resendDelayTime = resendCodeDelay;
callback.onSuccess();
}
@Override
public void onRegisterError(int majorCode, int minorCode, int getWait) {
G.handler.post(() -> callback.onError(new ErrorWithWaitTime(majorCode, minorCode, getWait)));
}
});
try {
RequestQueue.sendRequest(requestWrapper);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
Aggregations