use of org.matrix.androidsdk.rest.model.RequestOwnershipParams in project matrix-android-sdk by matrix-org.
the class ThirdPidRestClient method submitValidationToken.
/**
* Request the ownership validation of an email address or a phone number previously set
* by {@link ThirdPidRestClient#requestEmailValidationToken(ThreePid, String, ApiCallback)}
*
* @param medium the medium of the 3pid
* @param token the token generated by the requestEmailValidationToken call
* @param clientSecret the client secret which was supplied in the requestEmailValidationToken call
* @param sid the sid for the session
* @param callback asynchronous callback response
*/
public void submitValidationToken(final String medium, final String token, final String clientSecret, final String sid, final ApiCallback<Boolean> callback) {
RequestOwnershipParams params = RequestOwnershipParams.Companion.with(clientSecret, sid, token);
mApi.requestOwnershipValidationV2(medium, params).enqueue(new RestAdapterCallback<>("submitValidationToken", null, new SimpleApiCallback<SuccessResult>(callback) {
@Override
public void onSuccess(SuccessResult info) {
callback.onSuccess(info.success);
}
@Override
public void onMatrixError(MatrixError e) {
if (e.mStatus == HttpURLConnection.HTTP_NOT_FOUND) /*404*/
{
// Use legacy request
submitValidationTokenLegacy(medium, token, clientSecret, sid, callback);
} else {
super.onMatrixError(e);
}
}
}, null));
}
use of org.matrix.androidsdk.rest.model.RequestOwnershipParams in project matrix-android-sdk by matrix-org.
the class ProfileRestClient method submitToken.
public void submitToken(final String submitUrl, ThreePid pid, String token, final ApiCallback<SuccessResult> callback) {
final String description = "submitPNToken";
RequestOwnershipParams params = RequestOwnershipParams.Companion.with(pid.getClientSecret(), pid.getSid(), token);
mApi.submitPhoneNumberToken(submitUrl, params).enqueue(new RestAdapterCallback<SuccessResult>(description, mUnsentEventsManager, callback, new RestAdapterCallback.RequestRetryCallBack() {
@Override
public void onRetry() {
submitToken(submitUrl, pid, token, callback);
}
}));
}
Aggregations