Save last-known server time offset.

This commit is contained in:
Greyson Parrelli
2023-07-06 12:21:31 -04:00
committed by Clark Chen
parent 8372c699f7
commit ebaa445bee
7 changed files with 57 additions and 8 deletions
@@ -0,0 +1,11 @@
/*
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.signalservice.api
data class RemoteConfigResult(
val config: Map<String, Any>,
val serverEpochTimeSeconds: Long
)
@@ -626,7 +626,7 @@ public class SignalServiceAccountManager {
}
}
public Map<String, Object> getRemoteConfig() throws IOException {
public RemoteConfigResult getRemoteConfig() throws IOException {
RemoteConfigResponse response = this.pushServiceSocket.getRemoteConfig();
Map<String, Object> out = new HashMap<>();
@@ -634,7 +634,7 @@ public class SignalServiceAccountManager {
out.put(config.getName(), config.getValue() != null ? config.getValue() : config.isEnabled());
}
return out;
return new RemoteConfigResult(out, response.getServerEpochTime());
}
public String getAccountDataReport() throws IOException {
@@ -8,10 +8,17 @@ public class RemoteConfigResponse {
@JsonProperty
private List<Config> config;
@JsonProperty
private long serverEpochTime;
public List<Config> getConfig() {
return config;
}
public long getServerEpochTime() {
return serverEpochTime;
}
public static class Config {
@JsonProperty
private String name;