mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-25 05:27:42 +00:00
Re-migrate delete account to WebSocket.
This commit is contained in:
committed by
Michelle Tang
parent
bb608dbfa7
commit
8a0e260061
@@ -96,10 +96,6 @@ public class SignalServiceAccountManager {
|
||||
return NetworkResultUtil.toBasicLegacy(accountApi.whoAmI());
|
||||
}
|
||||
|
||||
public void deleteAccount() throws IOException {
|
||||
this.pushServiceSocket.deleteAccount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Request a push challenge. A number will be pushed to the GCM (FCM) id. This can then be used
|
||||
* during SMS/call requests to bypass the CAPTCHA.
|
||||
|
||||
@@ -149,8 +149,6 @@ public class PushServiceSocket {
|
||||
|
||||
private static final String TAG = PushServiceSocket.class.getSimpleName();
|
||||
|
||||
private static final String DELETE_ACCOUNT_PATH = "/v1/accounts/me";
|
||||
|
||||
private static final String SET_RESTORE_METHOD_PATH = "/v1/devices/restore_account/%s";
|
||||
|
||||
private static final String ATTACHMENT_KEY_DOWNLOAD_PATH = "attachments/%s";
|
||||
@@ -429,10 +427,6 @@ public class PushServiceSocket {
|
||||
return JsonUtil.fromJson(response, BackupV3AuthCheckResponse.class);
|
||||
}
|
||||
|
||||
public void deleteAccount() throws IOException {
|
||||
makeServiceRequest(DELETE_ACCOUNT_PATH, "DELETE", null);
|
||||
}
|
||||
|
||||
public StorageManifest getStorageManifest(String authToken) throws IOException {
|
||||
try (Response response = makeStorageRequest(authToken, "/v1/storage/manifest", "GET", null, NO_HANDLER)) {
|
||||
return StorageManifest.ADAPTER.decode(readBodyBytes(response));
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.signal.libsignal.net.AuthenticatedChatConnection
|
||||
import org.signal.libsignal.net.ChatConnection
|
||||
import org.signal.libsignal.net.ChatConnectionListener
|
||||
import org.signal.libsignal.net.ChatServiceException
|
||||
import org.signal.libsignal.net.ConnectionInvalidatedException
|
||||
import org.signal.libsignal.net.DeviceDeregisteredException
|
||||
import org.signal.libsignal.net.Network
|
||||
import org.signal.libsignal.net.UnauthenticatedChatConnection
|
||||
@@ -545,8 +546,16 @@ class LibSignalChatConnection(
|
||||
Log.i(TAG, "$name disconnected")
|
||||
} else {
|
||||
Log.i(TAG, "$name connection unexpectedly closed", disconnectReason)
|
||||
|
||||
val downstreamThrowable = when (disconnectReason) {
|
||||
// This matches the behavior of OkHttpWebSocketConnection when the connection terminates
|
||||
// by the server before the response is received.
|
||||
is ConnectionInvalidatedException -> NonSuccessfulResponseCodeException(4401)
|
||||
else -> disconnectReason
|
||||
}
|
||||
|
||||
for (pendingResponse in pendingResponses) {
|
||||
pendingResponse.onError(disconnectReason)
|
||||
pendingResponse.onError(downstreamThrowable)
|
||||
}
|
||||
}
|
||||
chatConnection = null
|
||||
|
||||
@@ -354,7 +354,7 @@ public class OkHttpWebSocketConnection extends WebSocketListener implements WebS
|
||||
Iterator<Map.Entry<Long, OutgoingRequest>> iterator = outgoingRequests.entrySet().iterator();
|
||||
|
||||
IOException exception;
|
||||
if (code == 403) {
|
||||
if (code == 403 || code == 4401) {
|
||||
exception = new NonSuccessfulResponseCodeException(code);
|
||||
} else {
|
||||
exception = new SocketException("Closed unexpectedly");
|
||||
|
||||
Reference in New Issue
Block a user