mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-27 14:40:22 +00:00
Convert donations apis to WebSocket.
This commit is contained in:
committed by
Michelle Tang
parent
2f9692a1a0
commit
ecb040ce98
@@ -105,9 +105,13 @@ class DeleteAccountRepository {
|
||||
try {
|
||||
AppDependencies.getSignalServiceAccountManager().deleteAccount();
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "deleteAccount: failed to delete account from signal service", e);
|
||||
onDeleteAccountEvent.accept(DeleteAccountEvent.ServerDeletionFailed.INSTANCE);
|
||||
return;
|
||||
if (e instanceof NonSuccessfulResponseCodeException && ((NonSuccessfulResponseCodeException) e).code == 4401) {
|
||||
Log.i(TAG, "deleteAccount: WebSocket closed with expected status after delete account, moving forward as delete was successful");
|
||||
} else {
|
||||
Log.w(TAG, "deleteAccount: failed to delete account from signal service, bail", e);
|
||||
onDeleteAccountEvent.accept(DeleteAccountEvent.ServerDeletionFailed.INSTANCE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log.i(TAG, "deleteAccount: successfully removed account from server");
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.whispersystems.signalservice.api.attachment.AttachmentApi
|
||||
import org.whispersystems.signalservice.api.calling.CallingApi
|
||||
import org.whispersystems.signalservice.api.cds.CdsApi
|
||||
import org.whispersystems.signalservice.api.certificate.CertificateApi
|
||||
import org.whispersystems.signalservice.api.donations.DonationsApi
|
||||
import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations
|
||||
import org.whispersystems.signalservice.api.keys.KeysApi
|
||||
import org.whispersystems.signalservice.api.link.LinkDeviceApi
|
||||
@@ -350,6 +351,9 @@ object AppDependencies {
|
||||
val remoteConfigApi: RemoteConfigApi
|
||||
get() = networkModule.remoteConfigApi
|
||||
|
||||
val donationsApi: DonationsApi
|
||||
get() = networkModule.donationsApi
|
||||
|
||||
@JvmStatic
|
||||
val okHttpClient: OkHttpClient
|
||||
get() = networkModule.okHttpClient
|
||||
@@ -405,7 +409,7 @@ object AppDependencies {
|
||||
fun provideGiphyMp4Cache(): GiphyMp4Cache
|
||||
fun provideExoPlayerPool(): SimpleExoPlayerPool
|
||||
fun provideAndroidCallAudioManager(): AudioManagerCompat
|
||||
fun provideDonationsService(pushServiceSocket: PushServiceSocket): DonationsService
|
||||
fun provideDonationsService(donationsApi: DonationsApi): DonationsService
|
||||
fun provideProfileService(profileOperations: ClientZkProfileOperations, authWebSocket: SignalWebSocket.AuthenticatedWebSocket, unauthWebSocket: SignalWebSocket.UnauthenticatedWebSocket): ProfileService
|
||||
fun provideDeadlockDetector(): DeadlockDetector
|
||||
fun provideClientZkReceiptOperations(signalServiceConfiguration: SignalServiceConfiguration): ClientZkReceiptOperations
|
||||
@@ -431,5 +435,6 @@ object AppDependencies {
|
||||
fun provideCertificateApi(authWebSocket: SignalWebSocket.AuthenticatedWebSocket): CertificateApi
|
||||
fun provideProfileApi(authWebSocket: SignalWebSocket.AuthenticatedWebSocket, pushServiceSocket: PushServiceSocket): ProfileApi
|
||||
fun provideRemoteConfigApi(authWebSocket: SignalWebSocket.AuthenticatedWebSocket): RemoteConfigApi
|
||||
fun provideDonationsApi(authWebSocket: SignalWebSocket.AuthenticatedWebSocket, unauthWebSocket: SignalWebSocket.UnauthenticatedWebSocket): DonationsApi
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ import org.whispersystems.signalservice.api.attachment.AttachmentApi;
|
||||
import org.whispersystems.signalservice.api.calling.CallingApi;
|
||||
import org.whispersystems.signalservice.api.cds.CdsApi;
|
||||
import org.whispersystems.signalservice.api.certificate.CertificateApi;
|
||||
import org.whispersystems.signalservice.api.donations.DonationsApi;
|
||||
import org.whispersystems.signalservice.api.groupsv2.ClientZkOperations;
|
||||
import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations;
|
||||
import org.whispersystems.signalservice.api.keys.KeysApi;
|
||||
@@ -140,7 +141,6 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
return new PushServiceSocket(signalServiceConfiguration,
|
||||
new DynamicCredentialsProvider(),
|
||||
BuildConfig.SIGNAL_AGENT,
|
||||
groupsV2Operations.getProfileOperations(),
|
||||
RemoteConfig.okHttpAutomaticRetry());
|
||||
}
|
||||
|
||||
@@ -444,8 +444,8 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull DonationsService provideDonationsService(@NonNull PushServiceSocket pushServiceSocket) {
|
||||
return new DonationsService(pushServiceSocket);
|
||||
public @NonNull DonationsService provideDonationsService(@NonNull DonationsApi donationsApi) {
|
||||
return new DonationsService(donationsApi);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -558,6 +558,11 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
return new RemoteConfigApi(authWebSocket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull DonationsApi provideDonationsApi(@NonNull SignalWebSocket.AuthenticatedWebSocket authWebSocket, @NonNull SignalWebSocket.UnauthenticatedWebSocket unauthWebSocket) {
|
||||
return new DonationsApi(authWebSocket, unauthWebSocket);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
static class DynamicCredentialsProvider implements CredentialsProvider {
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.whispersystems.signalservice.api.attachment.AttachmentApi
|
||||
import org.whispersystems.signalservice.api.calling.CallingApi
|
||||
import org.whispersystems.signalservice.api.cds.CdsApi
|
||||
import org.whispersystems.signalservice.api.certificate.CertificateApi
|
||||
import org.whispersystems.signalservice.api.donations.DonationsApi
|
||||
import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations
|
||||
import org.whispersystems.signalservice.api.keys.KeysApi
|
||||
import org.whispersystems.signalservice.api.link.LinkDeviceApi
|
||||
@@ -142,7 +143,7 @@ class NetworkDependenciesModule(
|
||||
}
|
||||
|
||||
val donationsService: DonationsService by lazy {
|
||||
provider.provideDonationsService(pushServiceSocket)
|
||||
provider.provideDonationsService(donationsApi)
|
||||
}
|
||||
|
||||
val archiveApi: ArchiveApi by lazy {
|
||||
@@ -213,6 +214,10 @@ class NetworkDependenciesModule(
|
||||
provider.provideRemoteConfigApi(authWebSocket)
|
||||
}
|
||||
|
||||
val donationsApi: DonationsApi by lazy {
|
||||
provider.provideDonationsApi(authWebSocket, unauthWebSocket)
|
||||
}
|
||||
|
||||
val okHttpClient: OkHttpClient by lazy {
|
||||
OkHttpClient.Builder()
|
||||
.addInterceptor(StandardUserAgentInterceptor())
|
||||
|
||||
Reference in New Issue
Block a user