Commit 8cf426a8 by pye52

现在更新包统一改为外部地址

parent 72cb1847
...@@ -12,7 +12,6 @@ import com.blankj.utilcode.util.FileIOUtils; ...@@ -12,7 +12,6 @@ import com.blankj.utilcode.util.FileIOUtils;
import com.blankj.utilcode.util.FileUtils; import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.PathUtils; import com.blankj.utilcode.util.PathUtils;
import com.blankj.utilcode.util.Utils;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
...@@ -80,6 +79,7 @@ public class UpdateCommandHandler extends CommandHandler { ...@@ -80,6 +79,7 @@ public class UpdateCommandHandler extends CommandHandler {
.build(); .build();
this.commandUpdate = gson.fromJson(command.getData(), CommandUpdate.class); this.commandUpdate = gson.fromJson(command.getData(), CommandUpdate.class);
this.updateApk = new File(PathUtils.getExternalStoragePath(), UPDATE_APK); this.updateApk = new File(PathUtils.getExternalStoragePath(), UPDATE_APK);
FileUtils.delete(updateApk);
} }
private void init(Command command, Gson gson, CommandProgressCallback callback) { private void init(Command command, Gson gson, CommandProgressCallback callback) {
...@@ -87,7 +87,7 @@ public class UpdateCommandHandler extends CommandHandler { ...@@ -87,7 +87,7 @@ public class UpdateCommandHandler extends CommandHandler {
this.gson = gson; this.gson = gson;
this.commandProgressCallback = callback; this.commandProgressCallback = callback;
this.commandUpdate = gson.fromJson(command.getData(), CommandUpdate.class); this.commandUpdate = gson.fromJson(command.getData(), CommandUpdate.class);
this.updateApk = new File(Utils.getApp().getCacheDir(), UPDATE_APK); this.updateApk = new File(PathUtils.getExternalStoragePath(), UPDATE_APK);
} }
@Override @Override
...@@ -98,15 +98,6 @@ public class UpdateCommandHandler extends CommandHandler { ...@@ -98,15 +98,6 @@ public class UpdateCommandHandler extends CommandHandler {
} }
start = true; start = true;
FileUtils.delete(updateApk); FileUtils.delete(updateApk);
boolean createApk = false;
try {
createApk = updateApk.createNewFile();
} catch (IOException e) {
LogUtils.e(TAG, "更新包文件创建失败: " + e.getMessage(), e);
}
if (!createApk) {
return failedResult("更新包文件创建失败");
}
if (executor == null) { if (executor == null) {
executor = Executors.newScheduledThreadPool(1); executor = Executors.newScheduledThreadPool(1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment