mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Remove Alert delegates
This commit is contained in:
parent
22287a25e0
commit
1215834864
10 changed files with 104 additions and 265 deletions
|
@ -17,11 +17,6 @@
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.bisq</groupId>
|
|
||||||
<artifactId>vo</artifactId>
|
|
||||||
<version>${project.parent.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.bisq</groupId>
|
<groupId>io.bisq</groupId>
|
||||||
<artifactId>network</artifactId>
|
<artifactId>network</artifactId>
|
||||||
|
|
|
@ -18,44 +18,76 @@
|
||||||
package io.bisq.core.alert;
|
package io.bisq.core.alert;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import com.google.protobuf.ByteString;
|
||||||
import io.bisq.common.app.Version;
|
import io.bisq.common.app.Version;
|
||||||
|
import io.bisq.common.crypto.CryptoUtils;
|
||||||
|
import io.bisq.generated.protobuffer.PB;
|
||||||
|
import io.bisq.network.p2p.storage.payload.StoragePayload;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Delegate;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.security.spec.X509EncodedKeySpec;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
|
@Getter
|
||||||
@ToString
|
@ToString
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public final class Alert {
|
public final class Alert implements StoragePayload {
|
||||||
|
//TODO remove after refact.
|
||||||
|
private static final long serialVersionUID = 1;
|
||||||
|
|
||||||
@Delegate
|
private final String message;
|
||||||
@Getter
|
private final String version;
|
||||||
private AlertVO alertVO;
|
private final boolean isUpdateInfo;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private String signatureAsBase64;
|
||||||
|
@Nullable
|
||||||
|
private PublicKey storagePublicKey;
|
||||||
|
@Nullable
|
||||||
|
private final byte[] storagePublicKeyBytes;
|
||||||
|
// Should be only used in emergency case if we need to add data but do not want to break backward compatibility
|
||||||
|
// at the P2P network storage checks. The hash of the object will be used to verify if the data is valid. Any new
|
||||||
|
// field in a class would break that hash and therefore break the storage mechanism.
|
||||||
|
@Nullable
|
||||||
|
private Map<String, String> extraDataMap;
|
||||||
|
|
||||||
|
// StoragePayload
|
||||||
|
private transient PublicKey ownerPubKey;
|
||||||
|
|
||||||
|
|
||||||
|
public Alert(String message,
|
||||||
|
boolean isUpdateInfo,
|
||||||
|
String version,
|
||||||
|
@Nullable byte[] storagePublicKeyBytes,
|
||||||
|
@Nullable String signatureAsBase64,
|
||||||
|
@Nullable Map<String, String> extraDataMap) {
|
||||||
|
this.message = message;
|
||||||
|
this.isUpdateInfo = isUpdateInfo;
|
||||||
|
this.version = version;
|
||||||
|
this.storagePublicKeyBytes = storagePublicKeyBytes;
|
||||||
|
this.signatureAsBase64 = signatureAsBase64;
|
||||||
|
this.extraDataMap = extraDataMap;
|
||||||
|
}
|
||||||
|
|
||||||
public Alert(String message,
|
public Alert(String message,
|
||||||
boolean isUpdateInfo,
|
boolean isUpdateInfo,
|
||||||
String version) {
|
String version) {
|
||||||
//TODO builder pattern might be better
|
this(message, isUpdateInfo, version, null, null, null);
|
||||||
// Or refactor client code so it is not using a half baked object
|
|
||||||
this.alertVO = new AlertVO(message, isUpdateInfo, version, null, null, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alert(AlertVO alertVO) {
|
|
||||||
this.alertVO = alertVO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSigAndPubKey(String signatureAsBase64, PublicKey storagePublicKey) {
|
public void setSigAndPubKey(String signatureAsBase64, PublicKey storagePublicKey) {
|
||||||
this.alertVO = new AlertVO(alertVO.getMessage(),
|
this.signatureAsBase64 = signatureAsBase64;
|
||||||
alertVO.isUpdateInfo(),
|
this.storagePublicKey = storagePublicKey;
|
||||||
alertVO.getVersion(),
|
|
||||||
new X509EncodedKeySpec(storagePublicKey.getEncoded()).getEncoded(),
|
|
||||||
signatureAsBase64,
|
|
||||||
alertVO.getExtraDataMap());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNewVersion() {
|
public boolean isNewVersion() {
|
||||||
|
@ -75,7 +107,7 @@ public final class Alert {
|
||||||
while (myVersionString.length() < 9)
|
while (myVersionString.length() < 9)
|
||||||
myVersionString += "0";
|
myVersionString += "0";
|
||||||
int myVersionNum = Integer.valueOf(myVersionString);
|
int myVersionNum = Integer.valueOf(myVersionString);
|
||||||
String alertVersionString = alertVO.getVersion().replace(".", "");
|
String alertVersionString = getVersion().replace(".", "");
|
||||||
while (alertVersionString.length() < 9)
|
while (alertVersionString.length() < 9)
|
||||||
alertVersionString += "0";
|
alertVersionString += "0";
|
||||||
int alertVersionNum = Integer.valueOf(alertVersionString);
|
int alertVersionNum = Integer.valueOf(alertVersionString);
|
||||||
|
@ -84,4 +116,38 @@ public final class Alert {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//StoragePayload
|
||||||
|
@Override
|
||||||
|
public long getTTL() {
|
||||||
|
return TimeUnit.DAYS.toMillis(30);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PublicKey getOwnerPubKey() {
|
||||||
|
try {
|
||||||
|
checkNotNull(getStoragePublicKeyBytes(), "alertVO.getStoragePublicKeyBytes() must not be null");
|
||||||
|
if (ownerPubKey == null)
|
||||||
|
ownerPubKey = CryptoUtils.getPubKeyFromBytes(getStoragePublicKeyBytes());
|
||||||
|
return ownerPubKey;
|
||||||
|
} catch (Throwable t) {
|
||||||
|
log.error(t.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Marshaller
|
||||||
|
@Override
|
||||||
|
public PB.StoragePayload toProto() {
|
||||||
|
checkNotNull(getStoragePublicKeyBytes(), "storagePublicKeyBytes must not be null");
|
||||||
|
checkNotNull(getSignatureAsBase64(), "signatureAsBase64 must not be null");
|
||||||
|
final PB.AlertProto.Builder builder = PB.AlertProto.newBuilder()
|
||||||
|
.setMessage(getMessage())
|
||||||
|
.setVersion(getVersion())
|
||||||
|
.setIsUpdateInfo(isUpdateInfo())
|
||||||
|
.setSignatureAsBase64(getSignatureAsBase64())
|
||||||
|
.setStoragePublicKeyBytes(ByteString.copyFrom(getStoragePublicKeyBytes()));
|
||||||
|
Optional.ofNullable(getExtraDataMap()).ifPresent(builder::putAllExtraDataMap);
|
||||||
|
return PB.StoragePayload.newBuilder().setAlertProto(builder).build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ public class AlertManager {
|
||||||
@Override
|
@Override
|
||||||
public void onAdded(ProtectedStorageEntry data) {
|
public void onAdded(ProtectedStorageEntry data) {
|
||||||
final StoragePayload storagePayload = data.getStoragePayload();
|
final StoragePayload storagePayload = data.getStoragePayload();
|
||||||
if (storagePayload instanceof AlertPayload) {
|
if (storagePayload instanceof Alert) {
|
||||||
Alert alert = new Alert(((AlertPayload) storagePayload).getAlertVO());
|
Alert alert = (Alert) storagePayload;
|
||||||
if (verifySignature(alert))
|
if (verifySignature(alert))
|
||||||
alertMessageProperty.set(alert);
|
alertMessageProperty.set(alert);
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,8 @@ public class AlertManager {
|
||||||
@Override
|
@Override
|
||||||
public void onRemoved(ProtectedStorageEntry data) {
|
public void onRemoved(ProtectedStorageEntry data) {
|
||||||
final StoragePayload storagePayload = data.getStoragePayload();
|
final StoragePayload storagePayload = data.getStoragePayload();
|
||||||
if (storagePayload instanceof AlertPayload) {
|
if (storagePayload instanceof Alert) {
|
||||||
Alert alert = new Alert(((AlertPayload) storagePayload).getAlertVO());
|
if (verifySignature((Alert) storagePayload))
|
||||||
if (verifySignature(alert))
|
|
||||||
alertMessageProperty.set(null);
|
alertMessageProperty.set(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +107,7 @@ public class AlertManager {
|
||||||
if (isKeyValid) {
|
if (isKeyValid) {
|
||||||
signAndAddSignatureToAlertMessage(alert);
|
signAndAddSignatureToAlertMessage(alert);
|
||||||
user.setDevelopersAlert(alert);
|
user.setDevelopersAlert(alert);
|
||||||
boolean result = p2PService.addData(new AlertPayload(alert.getAlertVO()), true);
|
boolean result = p2PService.addData(alert, true);
|
||||||
if (result) {
|
if (result) {
|
||||||
log.trace("Add alertMessage to network was successful. AlertMessage = " + alert);
|
log.trace("Add alertMessage to network was successful. AlertMessage = " + alert);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +119,7 @@ public class AlertManager {
|
||||||
public boolean removeAlertMessageIfKeyIsValid(String privKeyString) {
|
public boolean removeAlertMessageIfKeyIsValid(String privKeyString) {
|
||||||
Alert alert = user.getDevelopersAlert();
|
Alert alert = user.getDevelopersAlert();
|
||||||
if (isKeyValid(privKeyString) && alert != null) {
|
if (isKeyValid(privKeyString) && alert != null) {
|
||||||
if (p2PService.removeData(new AlertPayload(alert.getAlertVO()), true))
|
if (p2PService.removeData(alert, true))
|
||||||
log.trace("Remove alertMessage from network was successful. AlertMessage = " + alert);
|
log.trace("Remove alertMessage from network was successful. AlertMessage = " + alert);
|
||||||
|
|
||||||
user.setDevelopersAlert(null);
|
user.setDevelopersAlert(null);
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of bisq.
|
|
||||||
*
|
|
||||||
* bisq is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* bisq is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.bisq.core.alert;
|
|
||||||
|
|
||||||
import io.bisq.common.crypto.CryptoUtils;
|
|
||||||
import io.bisq.network.p2p.storage.payload.StoragePayload;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
|
||||||
import java.security.PublicKey;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Immutable
|
|
||||||
public final class AlertPayload extends AlertProto implements StoragePayload {
|
|
||||||
// lazy set
|
|
||||||
private transient PublicKey ownerPubKey;
|
|
||||||
|
|
||||||
public AlertPayload(AlertVO alertVO) {
|
|
||||||
super(alertVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getTTL() {
|
|
||||||
return TimeUnit.DAYS.toMillis(30);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PublicKey getOwnerPubKey() {
|
|
||||||
try {
|
|
||||||
checkNotNull(getStoragePublicKeyBytes(), "alertVO.getStoragePublicKeyBytes() must not be null");
|
|
||||||
if (ownerPubKey == null)
|
|
||||||
ownerPubKey = CryptoUtils.getPubKeyFromBytes(getStoragePublicKeyBytes());
|
|
||||||
return ownerPubKey;
|
|
||||||
} catch (Throwable t) {
|
|
||||||
log.error(t.toString());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of bisq.
|
|
||||||
*
|
|
||||||
* bisq is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* bisq is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.bisq.core.alert;
|
|
||||||
|
|
||||||
import io.bisq.core.PersistableNew;
|
|
||||||
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
|
||||||
|
|
||||||
@Immutable
|
|
||||||
public final class AlertPersistable extends AlertProto implements PersistableNew {
|
|
||||||
public AlertPersistable(AlertVO alertVO) {
|
|
||||||
super(alertVO);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of bisq.
|
|
||||||
*
|
|
||||||
* bisq is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* bisq is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.bisq.core.alert;
|
|
||||||
|
|
||||||
import com.google.protobuf.ByteString;
|
|
||||||
import io.bisq.common.Marshaller;
|
|
||||||
import io.bisq.generated.protobuffer.PB;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.experimental.Delegate;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Immutable
|
|
||||||
public abstract class AlertProto implements Marshaller {
|
|
||||||
@Delegate
|
|
||||||
@Getter
|
|
||||||
private final AlertVO alertVO;
|
|
||||||
|
|
||||||
public AlertProto(AlertVO alertVO) {
|
|
||||||
this.alertVO = alertVO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PB.StoragePayload toProto() {
|
|
||||||
checkNotNull(alertVO.getStoragePublicKeyBytes(), "storagePublicKeyBytes must not be null");
|
|
||||||
checkNotNull(alertVO.getSignatureAsBase64(), "signatureAsBase64 must not be null");
|
|
||||||
final PB.AlertProto.Builder builder = PB.AlertProto.newBuilder()
|
|
||||||
.setMessage(alertVO.getMessage())
|
|
||||||
.setVersion(alertVO.getVersion())
|
|
||||||
.setIsUpdateInfo(alertVO.isUpdateInfo())
|
|
||||||
.setSignatureAsBase64(alertVO.getSignatureAsBase64())
|
|
||||||
.setStoragePublicKeyBytes(ByteString.copyFrom(alertVO.getStoragePublicKeyBytes()));
|
|
||||||
Optional.ofNullable(alertVO.getExtraDataMap()).ifPresent(builder::putAllExtraDataMap);
|
|
||||||
return PB.StoragePayload.newBuilder().setAlertProto(builder).build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of bisq.
|
|
||||||
*
|
|
||||||
* bisq is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* bisq is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
|
||||||
* License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.bisq.core.alert;
|
|
||||||
|
|
||||||
import lombok.Value;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Value
|
|
||||||
@Immutable
|
|
||||||
public final class AlertVO {
|
|
||||||
//TODO remove after refact.
|
|
||||||
private static final long serialVersionUID = 1;
|
|
||||||
|
|
||||||
private final String message;
|
|
||||||
private final String version;
|
|
||||||
private final boolean isUpdateInfo;
|
|
||||||
@Nullable
|
|
||||||
private final String signatureAsBase64;
|
|
||||||
@Nullable
|
|
||||||
private final byte[] storagePublicKeyBytes;
|
|
||||||
// Should be only used in emergency case if we need to add data but do not want to break backward compatibility
|
|
||||||
// at the P2P network storage checks. The hash of the object will be used to verify if the data is valid. Any new
|
|
||||||
// field in a class would break that hash and therefore break the storage mechanism.
|
|
||||||
@Nullable
|
|
||||||
private Map<String, String> extraDataMap;
|
|
||||||
|
|
||||||
public AlertVO(String message,
|
|
||||||
boolean isUpdateInfo,
|
|
||||||
String version,
|
|
||||||
@Nullable byte[] storagePublicKeyBytes,
|
|
||||||
@Nullable String signatureAsBase64,
|
|
||||||
@Nullable Map<String, String> extraDataMap) {
|
|
||||||
this.message = message;
|
|
||||||
this.isUpdateInfo = isUpdateInfo;
|
|
||||||
this.version = version;
|
|
||||||
this.storagePublicKeyBytes = storagePublicKeyBytes;
|
|
||||||
this.signatureAsBase64 = signatureAsBase64;
|
|
||||||
this.extraDataMap = extraDataMap;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,8 +6,7 @@ import io.bisq.common.crypto.SealedAndSigned;
|
||||||
import io.bisq.common.locale.CountryUtil;
|
import io.bisq.common.locale.CountryUtil;
|
||||||
import io.bisq.common.locale.CurrencyUtil;
|
import io.bisq.common.locale.CurrencyUtil;
|
||||||
import io.bisq.common.monetary.Price;
|
import io.bisq.common.monetary.Price;
|
||||||
import io.bisq.core.alert.AlertPayload;
|
import io.bisq.core.alert.Alert;
|
||||||
import io.bisq.core.alert.AlertVO;
|
|
||||||
import io.bisq.core.alert.PrivateNotificationMessage;
|
import io.bisq.core.alert.PrivateNotificationMessage;
|
||||||
import io.bisq.core.alert.PrivateNotificationPayload;
|
import io.bisq.core.alert.PrivateNotificationPayload;
|
||||||
import io.bisq.core.arbitration.*;
|
import io.bisq.core.arbitration.*;
|
||||||
|
@ -605,12 +604,12 @@ public class CoreProtobufferResolver implements ProtobufferResolver {
|
||||||
PB.AlertProto protoAlert = protoEntry.getAlertProto();
|
PB.AlertProto protoAlert = protoEntry.getAlertProto();
|
||||||
extraDataMapMap = CollectionUtils.isEmpty(protoAlert.getExtraDataMapMap()) ?
|
extraDataMapMap = CollectionUtils.isEmpty(protoAlert.getExtraDataMapMap()) ?
|
||||||
null : protoAlert.getExtraDataMapMap();
|
null : protoAlert.getExtraDataMapMap();
|
||||||
storagePayload = new AlertPayload(new AlertVO(protoAlert.getMessage(),
|
storagePayload = new Alert(protoAlert.getMessage(),
|
||||||
protoAlert.getIsUpdateInfo(),
|
protoAlert.getIsUpdateInfo(),
|
||||||
protoAlert.getVersion(),
|
protoAlert.getVersion(),
|
||||||
protoAlert.getStoragePublicKeyBytes().toByteArray(),
|
protoAlert.getStoragePublicKeyBytes().toByteArray(),
|
||||||
protoAlert.getSignatureAsBase64(),
|
protoAlert.getSignatureAsBase64(),
|
||||||
extraDataMapMap));
|
extraDataMapMap);
|
||||||
break;
|
break;
|
||||||
case ARBITRATOR:
|
case ARBITRATOR:
|
||||||
PB.Arbitrator arbitrator = protoEntry.getArbitrator();
|
PB.Arbitrator arbitrator = protoEntry.getArbitrator();
|
||||||
|
|
|
@ -24,7 +24,6 @@ import io.bisq.common.locale.TradeCurrency;
|
||||||
import io.bisq.common.persistance.Persistable;
|
import io.bisq.common.persistance.Persistable;
|
||||||
import io.bisq.common.storage.Storage;
|
import io.bisq.common.storage.Storage;
|
||||||
import io.bisq.core.alert.Alert;
|
import io.bisq.core.alert.Alert;
|
||||||
import io.bisq.core.alert.AlertPersistable;
|
|
||||||
import io.bisq.core.arbitration.Arbitrator;
|
import io.bisq.core.arbitration.Arbitrator;
|
||||||
import io.bisq.core.arbitration.Mediator;
|
import io.bisq.core.arbitration.Mediator;
|
||||||
import io.bisq.core.filter.Filter;
|
import io.bisq.core.filter.Filter;
|
||||||
|
@ -67,9 +66,9 @@ public final class User implements Persistable {
|
||||||
private PaymentAccount currentPaymentAccount;
|
private PaymentAccount currentPaymentAccount;
|
||||||
private List<String> acceptedLanguageLocaleCodes = new ArrayList<>();
|
private List<String> acceptedLanguageLocaleCodes = new ArrayList<>();
|
||||||
@Nullable
|
@Nullable
|
||||||
private AlertPersistable developersPersistableAlert;
|
private Alert developersAlert;
|
||||||
@Nullable
|
@Nullable
|
||||||
private AlertPersistable displayedPersistableAlert;
|
private Alert displayedAlert;
|
||||||
@Nullable
|
@Nullable
|
||||||
private Filter developersFilter;
|
private Filter developersFilter;
|
||||||
|
|
||||||
|
@ -112,8 +111,8 @@ public final class User implements Persistable {
|
||||||
|
|
||||||
registeredArbitrator = persisted.getRegisteredArbitrator();
|
registeredArbitrator = persisted.getRegisteredArbitrator();
|
||||||
registeredMediator = persisted.getRegisteredMediator();
|
registeredMediator = persisted.getRegisteredMediator();
|
||||||
developersPersistableAlert = persisted.getDevelopersPersistableAlert();
|
developersAlert = persisted.getDevelopersAlert();
|
||||||
displayedPersistableAlert = persisted.getDisplayedPersistableAlert();
|
displayedAlert = persisted.getDisplayedAlert();
|
||||||
developersFilter = persisted.getDevelopersFilter();
|
developersFilter = persisted.getDevelopersFilter();
|
||||||
} else {
|
} else {
|
||||||
accountID = String.valueOf(Math.abs(keyRing.getPubKeyRing().hashCode()));
|
accountID = String.valueOf(Math.abs(keyRing.getPubKeyRing().hashCode()));
|
||||||
|
@ -385,39 +384,23 @@ public final class User implements Persistable {
|
||||||
return findFirstPaymentAccountWithCurrency(tradeCurrency) != null;
|
return findFirstPaymentAccountWithCurrency(tradeCurrency) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDevelopersAlert(@Nullable Alert alert) {
|
public void setDevelopersAlert(@Nullable Alert developersAlert) {
|
||||||
if (alert != null)
|
this.developersAlert = developersAlert;
|
||||||
this.developersPersistableAlert = new AlertPersistable(alert.getAlertVO());
|
|
||||||
else
|
|
||||||
this.developersPersistableAlert = null;
|
|
||||||
storage.queueUpForSave();
|
storage.queueUpForSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Alert getDevelopersAlert() {
|
public Alert getDevelopersAlert() {
|
||||||
return developersPersistableAlert != null ? new Alert(developersPersistableAlert.getAlertVO()) : null;
|
return developersAlert;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisplayedAlert(@Nullable Alert alert) {
|
public void setDisplayedAlert(@Nullable Alert displayedAlert) {
|
||||||
if (alert != null)
|
this.displayedAlert = displayedAlert;
|
||||||
this.displayedPersistableAlert = new AlertPersistable(alert.getAlertVO());
|
|
||||||
else
|
|
||||||
this.displayedPersistableAlert = null;
|
|
||||||
storage.queueUpForSave();
|
storage.queueUpForSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Alert getDisplayedAlert() {
|
public Alert getDisplayedAlert() {
|
||||||
return displayedPersistableAlert != null ? new Alert(displayedPersistableAlert.getAlertVO()) : null;
|
return displayedAlert;
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private AlertPersistable getDevelopersPersistableAlert() {
|
|
||||||
return developersPersistableAlert;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private AlertPersistable getDisplayedPersistableAlert() {
|
|
||||||
return displayedPersistableAlert;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -40,8 +40,6 @@
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>common</module>
|
<module>common</module>
|
||||||
<module>vo</module>
|
|
||||||
<module>protobuffer</module>
|
|
||||||
<module>network</module>
|
<module>network</module>
|
||||||
<module>core</module>
|
<module>core</module>
|
||||||
<module>jsocks</module>
|
<module>jsocks</module>
|
||||||
|
|
Loading…
Add table
Reference in a new issue