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.主动请求、保活措施、个性设置不在克隆范围 启动 停止 我是旧手机