Remove a lot of dead code.

Resolves #14672
This commit is contained in:
Jesse Weinstein
2026-03-12 15:52:30 -04:00
committed by Cody Henthorne
parent 98d9b12438
commit ebccc6db30
38 changed files with 9 additions and 1737 deletions

View File

@@ -3,11 +3,9 @@ package org.whispersystems.signalservice.internal;
import org.whispersystems.signalservice.api.NetworkResult;
import org.whispersystems.signalservice.api.NetworkResultUtil;
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException;
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
import org.whispersystems.signalservice.api.util.Preconditions;
import org.whispersystems.signalservice.internal.websocket.WebsocketResponse;
import java.io.IOException;
import java.util.Optional;
@@ -28,14 +26,6 @@ public final class ServiceResponse<Result> {
private final Optional<Throwable> applicationError;
private final Optional<Throwable> executionError;
private ServiceResponse(Result result, WebsocketResponse response) {
this(response.getStatus(), response.getBody(), result, null, null);
}
private ServiceResponse(Throwable applicationError, WebsocketResponse response) {
this(response.getStatus(), response.getBody(), null, applicationError, null);
}
public ServiceResponse(int status,
String body,
Result result,
@@ -118,18 +108,10 @@ public final class ServiceResponse<Result> {
}
}
public static <T> ServiceResponse<T> forResult(T result, WebsocketResponse response) {
return new ServiceResponse<>(result, response);
}
public static <T> ServiceResponse<T> forResult(T result, int status, String body) {
return new ServiceResponse<>(status, body, result, null, null);
}
public static <T> ServiceResponse<T> forApplicationError(Throwable throwable, WebsocketResponse response) {
return new ServiceResponse<T>(throwable, response);
}
public static <T> ServiceResponse<T> forApplicationError(Throwable throwable, int status, String body) {
return new ServiceResponse<>(status, body, null, throwable, null);
}
@@ -149,11 +131,4 @@ public final class ServiceResponse<Result> {
return forExecutionError(throwable);
}
}
public static <T, I> ServiceResponse<T> coerceError(ServiceResponse<I> response) {
if (response.applicationError.isPresent()) {
return ServiceResponse.forApplicationError(response.applicationError.get(), response.status, response.body.orElse(null));
}
return ServiceResponse.forExecutionError(response.executionError.orElse(null));
}
}

View File

@@ -1,26 +0,0 @@
/*
* Copyright 2024 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.signalservice.internal.push
import org.whispersystems.signalservice.internal.ServiceResponse
import org.whispersystems.signalservice.internal.ServiceResponseProcessor
/**
* Processes a response from the verify stored KBS auth credentials request.
*/
class BackupAuthCheckProcessor(response: ServiceResponse<BackupV2AuthCheckResponse>) : ServiceResponseProcessor<BackupV2AuthCheckResponse>(response) {
fun getInvalid(): List<String> {
return response.result.map { it.invalid }.orElse(emptyList())
}
fun hasValidSvr2AuthCredential(): Boolean {
return response.result.map { it.match }.orElse(null) != null
}
fun requireSvr2AuthCredential(): AuthCredentials {
return response.result.get().match!!
}
}