删除 EmoneyRequestConfig 和 ProxyConfig 设置,改为数据库(SQLite)配置。默认配置的设置和删除逻辑由
SQLite 触发器配置。
This commit is contained in:
@@ -49,6 +49,11 @@ public class DeviceInfoConfig implements IConfig<DeviceInfoConfig> {
|
||||
@Slf4j
|
||||
public static class DeviceInfo {
|
||||
|
||||
// 持久化在本地的 DeviceInfo 只有三个字段:
|
||||
// model、deviceType 和 fingerprint
|
||||
// 其中除 model 和 deviceType 外,其他字段全部从 fingerprint 派生
|
||||
// 也就是说只要提供 model、deviceType 和 fingerprint 就能创建一个 DeviceInfo 实例
|
||||
|
||||
@JsonView(IConfig.Views.Persistence.class)
|
||||
private String model;
|
||||
private String brand;
|
||||
@@ -62,11 +67,12 @@ public class DeviceInfoConfig implements IConfig<DeviceInfoConfig> {
|
||||
private String buildType;
|
||||
private String buildTags;
|
||||
|
||||
/**
|
||||
* 用以匹配 fingerprint 的正则表达式
|
||||
*/
|
||||
public static final Pattern PATTERN = Pattern.compile("^(?<brand>.*?)/(?<product>.*?)/(?<device>.*?):(?<versionRelease>.*?)/(?<buildId>.*?)/(?<buildNumber>.*?):(?<buildType>.*?)/(?<buildTags>.*?)$");
|
||||
|
||||
|
||||
private DeviceInfo() {
|
||||
}
|
||||
private DeviceInfo() {}
|
||||
|
||||
public DeviceInfo setFingerprint(String fingerprint) {
|
||||
Matcher m = PATTERN.matcher(fingerprint);
|
||||
@@ -126,8 +132,8 @@ public class DeviceInfoConfig implements IConfig<DeviceInfoConfig> {
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
return String.format("Model: %s, Fingerprint: %s",
|
||||
getModel(), getFingerprint()
|
||||
return String.format("Model: %s, DeviceType: %s, Fingerprint: %s",
|
||||
getModel(), getDeviceType(), getFingerprint()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -139,7 +145,7 @@ public class DeviceInfoConfig implements IConfig<DeviceInfoConfig> {
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return Objects.hash(getModel(), getFingerprint());
|
||||
return Objects.hash(getModel(), getDeviceType(), getFingerprint());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user