mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-20 07:17:48 +00:00
Better handling for unregistered users on outgoing message.
This commit is contained in:
@@ -116,12 +116,14 @@ public class PushServiceSocket {
|
||||
sendMessage(new OutgoingPushMessageList(messages));
|
||||
}
|
||||
|
||||
private void sendMessage(OutgoingPushMessageList messages) throws IOException {
|
||||
private void sendMessage(OutgoingPushMessageList messages)
|
||||
throws IOException
|
||||
{
|
||||
String responseText = makeRequest(MESSAGE_PATH, "POST", new Gson().toJson(messages));
|
||||
PushMessageResponse response = new Gson().fromJson(responseText, PushMessageResponse.class);
|
||||
|
||||
if (response.getFailure().size() != 0)
|
||||
throw new IOException("Got send failure: " + response.getFailure().get(0));
|
||||
throw new UnregisteredUserException(response.getFailure());
|
||||
}
|
||||
|
||||
public void registerPreKeys(IdentityKey identityKey,
|
||||
|
@@ -0,0 +1,19 @@
|
||||
package org.whispersystems.textsecure.push;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class UnregisteredUserException extends IOException {
|
||||
|
||||
private final List<String> addresses;
|
||||
|
||||
public UnregisteredUserException(List<String> addresses) {
|
||||
super();
|
||||
this.addresses = addresses;
|
||||
}
|
||||
|
||||
public List<String> getAddresses() {
|
||||
return addresses;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user