|
|
|
@ -1,7 +1,5 @@
|
|
|
|
|
package org.thoughtcrime.redphone.signaling;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.squareup.okhttp.MediaType;
|
|
|
|
|
import com.squareup.okhttp.OkHttpClient;
|
|
|
|
|
import com.squareup.okhttp.Request;
|
|
|
|
@ -9,6 +7,7 @@ import com.squareup.okhttp.RequestBody;
|
|
|
|
|
import com.squareup.okhttp.Response;
|
|
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.util.Base64;
|
|
|
|
|
import org.thoughtcrime.securesms.util.JsonUtils;
|
|
|
|
|
import org.whispersystems.libaxolotl.util.guava.Optional;
|
|
|
|
|
import org.whispersystems.textsecure.api.push.TrustStore;
|
|
|
|
|
|
|
|
|
@ -52,7 +51,7 @@ public class RedPhoneAccountManager {
|
|
|
|
|
builder.header("Authorization", "Basic " + Base64.encodeBytes((login + ":" + password).getBytes()));
|
|
|
|
|
|
|
|
|
|
if (gcmId.isPresent()) {
|
|
|
|
|
String body = new ObjectMapper().writeValueAsString(new RedPhoneGcmId(gcmId.get()));
|
|
|
|
|
String body = JsonUtils.toJson(new RedPhoneGcmId(gcmId.get()));
|
|
|
|
|
builder.put(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), body));
|
|
|
|
|
} else {
|
|
|
|
|
builder.delete();
|
|
|
|
@ -70,7 +69,7 @@ public class RedPhoneAccountManager {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void createAccount(String verificationToken, RedPhoneAccountAttributes attributes) throws IOException {
|
|
|
|
|
String body = new ObjectMapper().writeValueAsString(attributes);
|
|
|
|
|
String body = JsonUtils.toJson(attributes);
|
|
|
|
|
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
.url(baseUrl + "/api/v1/accounts/token/" + verificationToken)
|
|
|
|
|