mirror of
https://github.com/pppscn/SmsForwarder
synced 2024-11-17 21:25:31 +00:00
优化:一键克隆在请求接口时生成备份文件
This commit is contained in:
parent
049ce553b2
commit
832f2cd190
@ -117,9 +117,9 @@ public class CloneActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//备份文件
|
//备份文件
|
||||||
BackupDbTask task = new BackupDbTask(this);
|
//BackupDbTask task = new BackupDbTask(this);
|
||||||
String backup_version = task.doInBackground(BackupDbTask.COMMAND_BACKUP);
|
//String backup_version = task.doInBackground(BackupDbTask.COMMAND_BACKUP);
|
||||||
Log.d(TAG, "backup_version = " + backup_version);
|
//Log.d(TAG, "backup_version = " + backup_version);
|
||||||
|
|
||||||
SettingUtil.switchEnableHttpServer(!SettingUtil.getSwitchEnableHttpServer());
|
SettingUtil.switchEnableHttpServer(!SettingUtil.getSwitchEnableHttpServer());
|
||||||
if (!HttpServer.update()) {
|
if (!HttpServer.update()) {
|
||||||
@ -201,7 +201,9 @@ public class CloneActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
CloneInfoVo cloneInfoVo = JSON.parseObject(responseStr, CloneInfoVo.class);
|
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));
|
Toast(handError, TAG, getString(R.string.tips_versions_inconsistent));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public class CloneInfoVo implements Serializable {
|
|||||||
private int delayTime;
|
private int delayTime;
|
||||||
private boolean enableSmsTemplate;
|
private boolean enableSmsTemplate;
|
||||||
private String smsTemplate;
|
private String smsTemplate;
|
||||||
|
private String backupVersion;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@ -50,6 +51,7 @@ public class CloneInfoVo implements Serializable {
|
|||||||
", delayTime=" + delayTime +
|
", delayTime=" + delayTime +
|
||||||
", enableSmsTemplate=" + enableSmsTemplate +
|
", enableSmsTemplate=" + enableSmsTemplate +
|
||||||
", smsTemplate=" + smsTemplate +
|
", smsTemplate=" + smsTemplate +
|
||||||
|
", backupVersion=" + backupVersion +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,11 @@ public class BaseServlet extends HttpServlet {
|
|||||||
PrintWriter writer = resp.getWriter();
|
PrintWriter writer = resp.getWriter();
|
||||||
BufferedReader reader = req.getReader();
|
BufferedReader reader = req.getReader();
|
||||||
try {
|
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();
|
Map msgMap = new HashMap();
|
||||||
msgMap.put("versionCode", SettingUtil.getVersionCode());
|
msgMap.put("versionCode", SettingUtil.getVersionCode());
|
||||||
msgMap.put("versionName", SettingUtil.getVersionName());
|
msgMap.put("versionName", SettingUtil.getVersionName());
|
||||||
@ -199,6 +204,7 @@ public class BaseServlet extends HttpServlet {
|
|||||||
msgMap.put("delayTime", SettingUtil.getDelayTime());
|
msgMap.put("delayTime", SettingUtil.getDelayTime());
|
||||||
msgMap.put("enableSmsTemplate", SettingUtil.getSwitchSmsTemplate());
|
msgMap.put("enableSmsTemplate", SettingUtil.getSwitchSmsTemplate());
|
||||||
msgMap.put("smsTemplate", SettingUtil.getSmsTemplate());
|
msgMap.put("smsTemplate", SettingUtil.getSmsTemplate());
|
||||||
|
msgMap.put("backupVersion", backup_version);
|
||||||
|
|
||||||
resp.setContentType("application/json;charset=utf-8");
|
resp.setContentType("application/json;charset=utf-8");
|
||||||
String text = JSON.toJSONString(msgMap);
|
String text = JSON.toJSONString(msgMap);
|
||||||
|
@ -216,7 +216,7 @@
|
|||||||
<string name="post">POST</string>
|
<string name="post">POST</string>
|
||||||
<string name="get">GET</string>
|
<string name="get">GET</string>
|
||||||
<string name="local_ip">本机IP:</string>
|
<string name="local_ip">本机IP:</string>
|
||||||
<string name="operating_instruction">操作说明:\n1.新旧手机连接同一个WiFi网络(禁用AP隔离)\n2.旧手机直接点【发送】按钮,获取到【服务端IP】\n3.新手机填写【服务端IP】后,点【接收】按钮\n\n注意事项:\n1.发送方与接收方的APP版本号必须一致,才能克隆!\n2.新手机接收后,发送通道、转发规则将完全被覆盖,清空历史记录!\n3.主动请求、保活措施、个性设置不在克隆范围</string>
|
<string name="operating_instruction">操作说明:\n1.新旧手机连接同一个WiFi网络(禁用AP隔离)\n2.旧手机直接点【发送】按钮,获取到【服务端IP】\n3.新手机填写【服务端IP】后,点【接收】按钮\n\n注意事项:\n1.发送方与接收方的APP版本必须一致,才能克隆!\n2.新手机接收后,发送通道、转发规则将完全被覆盖,清空历史记录!\n3.主动请求、保活措施、个性设置不在克隆范围</string>
|
||||||
<string name="send">启动</string>
|
<string name="send">启动</string>
|
||||||
<string name="stop">停止</string>
|
<string name="stop">停止</string>
|
||||||
<string name="old_mobile_phone">我是旧手机</string>
|
<string name="old_mobile_phone">我是旧手机</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user