Search in sources :

Example 1 with OnUserVerification

use of net.iGap.observers.interfaces.OnUserVerification in project iGap-Android by KianIranian-STDG.

the class RegisterRepository method userVerify.

public void userVerify(@NotNull String verificationCode, RepositoryCallbackWithError<ErrorWithWaitTime> callback) {
    try {
        ProtoUserVerify.UserVerify.Builder userVerify = ProtoUserVerify.UserVerify.newBuilder();
        userVerify.setCode(Integer.parseInt(verificationCode.replaceAll("[^0-9]", "").replaceAll("[\u0000-\u001f]", "")));
        if (userName != null)
            userVerify.setUsername(userName);
        RequestWrapper requestWrapper = new RequestWrapper(101, userVerify, new OnUserVerification() {

            @Override
            public void onUserVerify(String tokenR, boolean newUserR) {
                newUser = newUserR;
                token = tokenR;
                userLogin(token);
            }

            @Override
            public void onUserVerifyError(int majorCode, int minorCode, int time) {
                callback.onError(new ErrorWithWaitTime(majorCode, minorCode, time));
            }
        });
        RequestQueue.sendRequest(requestWrapper);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}
Also used : ProtoUserVerify(net.iGap.proto.ProtoUserVerify) RequestWrapper(net.iGap.request.RequestWrapper) OnUserVerification(net.iGap.observers.interfaces.OnUserVerification) HelperString(net.iGap.helper.HelperString)

Aggregations

HelperString (net.iGap.helper.HelperString)1 OnUserVerification (net.iGap.observers.interfaces.OnUserVerification)1 ProtoUserVerify (net.iGap.proto.ProtoUserVerify)1 RequestWrapper (net.iGap.request.RequestWrapper)1