From 832f2cd1909406c176f62f116e3e611f7b012542 Mon Sep 17 00:00:00 2001
From: pppscn <35696959@qq.com>
Date: Sun, 30 Jan 2022 15:34:03 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E4=B8=80=E9=94=AE?=
=?UTF-8?q?=E5=85=8B=E9=9A=86=E5=9C=A8=E8=AF=B7=E6=B1=82=E6=8E=A5=E5=8F=A3?=
=?UTF-8?q?=E6=97=B6=E7=94=9F=E6=88=90=E5=A4=87=E4=BB=BD=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/idormy/sms/forwarder/CloneActivity.java | 10 ++++++----
.../com/idormy/sms/forwarder/model/vo/CloneInfoVo.java | 2 ++
.../com/idormy/sms/forwarder/receiver/BaseServlet.java | 6 ++++++
app/src/main/res/values/strings.xml | 2 +-
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/app/src/main/java/com/idormy/sms/forwarder/CloneActivity.java b/app/src/main/java/com/idormy/sms/forwarder/CloneActivity.java
index de88b086..a3f472ea 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/CloneActivity.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/CloneActivity.java
@@ -117,9 +117,9 @@ public class CloneActivity extends AppCompatActivity {
}
//备份文件
- BackupDbTask task = new BackupDbTask(this);
- String backup_version = task.doInBackground(BackupDbTask.COMMAND_BACKUP);
- Log.d(TAG, "backup_version = " + backup_version);
+ //BackupDbTask task = new BackupDbTask(this);
+ //String backup_version = task.doInBackground(BackupDbTask.COMMAND_BACKUP);
+ //Log.d(TAG, "backup_version = " + backup_version);
SettingUtil.switchEnableHttpServer(!SettingUtil.getSwitchEnableHttpServer());
if (!HttpServer.update()) {
@@ -201,7 +201,9 @@ public class CloneActivity extends AppCompatActivity {
try {
CloneInfoVo cloneInfoVo = JSON.parseObject(responseStr, CloneInfoVo.class);
- if (SettingUtil.getVersionCode() != cloneInfoVo.getVersionCode()) {
+ Log.d(TAG, cloneInfoVo.toString());
+
+ if (!SettingUtil.getVersionName().equals(cloneInfoVo.getVersionName())) {
Toast(handError, TAG, getString(R.string.tips_versions_inconsistent));
return;
}
diff --git a/app/src/main/java/com/idormy/sms/forwarder/model/vo/CloneInfoVo.java b/app/src/main/java/com/idormy/sms/forwarder/model/vo/CloneInfoVo.java
index 7634a8ca..bef8e662 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/model/vo/CloneInfoVo.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/model/vo/CloneInfoVo.java
@@ -28,6 +28,7 @@ public class CloneInfoVo implements Serializable {
private int delayTime;
private boolean enableSmsTemplate;
private String smsTemplate;
+ private String backupVersion;
@NonNull
@Override
@@ -50,6 +51,7 @@ public class CloneInfoVo implements Serializable {
", delayTime=" + delayTime +
", enableSmsTemplate=" + enableSmsTemplate +
", smsTemplate=" + smsTemplate +
+ ", backupVersion=" + backupVersion +
'}';
}
}
diff --git a/app/src/main/java/com/idormy/sms/forwarder/receiver/BaseServlet.java b/app/src/main/java/com/idormy/sms/forwarder/receiver/BaseServlet.java
index c863ec3d..5e46acdf 100644
--- a/app/src/main/java/com/idormy/sms/forwarder/receiver/BaseServlet.java
+++ b/app/src/main/java/com/idormy/sms/forwarder/receiver/BaseServlet.java
@@ -181,6 +181,11 @@ public class BaseServlet extends HttpServlet {
PrintWriter writer = resp.getWriter();
BufferedReader reader = req.getReader();
try {
+ //备份文件
+ BackupDbTask task = new BackupDbTask(context);
+ String backup_version = task.doInBackground(BackupDbTask.COMMAND_BACKUP);
+ Log.d(TAG, "backup_version = " + backup_version);
+
Map msgMap = new HashMap();
msgMap.put("versionCode", SettingUtil.getVersionCode());
msgMap.put("versionName", SettingUtil.getVersionName());
@@ -199,6 +204,7 @@ public class BaseServlet extends HttpServlet {
msgMap.put("delayTime", SettingUtil.getDelayTime());
msgMap.put("enableSmsTemplate", SettingUtil.getSwitchSmsTemplate());
msgMap.put("smsTemplate", SettingUtil.getSmsTemplate());
+ msgMap.put("backupVersion", backup_version);
resp.setContentType("application/json;charset=utf-8");
String text = JSON.toJSONString(msgMap);
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c62ab6e5..74e4e5c3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -216,7 +216,7 @@
POST
GET
本机IP:
- 操作说明:\n1.新旧手机连接同一个WiFi网络(禁用AP隔离)\n2.旧手机直接点【发送】按钮,获取到【服务端IP】\n3.新手机填写【服务端IP】后,点【接收】按钮\n\n注意事项:\n1.发送方与接收方的APP版本号必须一致,才能克隆!\n2.新手机接收后,发送通道、转发规则将完全被覆盖,清空历史记录!\n3.主动请求、保活措施、个性设置不在克隆范围
+ 操作说明:\n1.新旧手机连接同一个WiFi网络(禁用AP隔离)\n2.旧手机直接点【发送】按钮,获取到【服务端IP】\n3.新手机填写【服务端IP】后,点【接收】按钮\n\n注意事项:\n1.发送方与接收方的APP版本必须一致,才能克隆!\n2.新手机接收后,发送通道、转发规则将完全被覆盖,清空历史记录!\n3.主动请求、保活措施、个性设置不在克隆范围
启动
停止
我是旧手机