feat(app): response apk package
This commit is contained in:
@@ -75,12 +75,12 @@ public class AppVersionService {
|
|||||||
AppRelease target = resolveNative(release, currentCode);
|
AppRelease target = resolveNative(release, currentCode);
|
||||||
return target == null
|
return target == null
|
||||||
? AppUpdateCheckResponse.none(currentVersion)
|
? AppUpdateCheckResponse.none(currentVersion)
|
||||||
: buildResponse(target, Boolean.TRUE.equals(target.getMandatory()));
|
: buildResponse(target, Boolean.TRUE.equals(target.getMandatory()), true);
|
||||||
}
|
}
|
||||||
AppRelease target = resolveBundle(release, product, currentCode, currentVersion, req.getDeviceId());
|
AppRelease target = resolveBundle(release, product, currentCode, currentVersion, req.getDeviceId());
|
||||||
return target == null
|
return target == null
|
||||||
? AppUpdateCheckResponse.none(currentVersion)
|
? AppUpdateCheckResponse.none(currentVersion)
|
||||||
: buildResponse(target, false);
|
: buildResponse(target, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 查询更新日志
|
/// 查询更新日志
|
||||||
@@ -241,13 +241,14 @@ public class AppVersionService {
|
|||||||
///
|
///
|
||||||
/// @param release 发布记录
|
/// @param release 发布记录
|
||||||
/// @param mandatory true 为强制更新
|
/// @param mandatory true 为强制更新
|
||||||
|
/// @param shell true 为外壳安装包,客户端需要下载后覆盖安装
|
||||||
/// @return 更新响应
|
/// @return 更新响应
|
||||||
private AppUpdateCheckResponse buildResponse(AppRelease release, boolean mandatory) {
|
private AppUpdateCheckResponse buildResponse(AppRelease release, boolean mandatory, boolean shell) {
|
||||||
String url = ServletUriComponentsBuilder.fromCurrentContextPath()
|
String url = ServletUriComponentsBuilder.fromCurrentContextPath()
|
||||||
.path("/attach/download/")
|
.path("/attach/download/")
|
||||||
.path(release.getAttachmentId())
|
.path(release.getAttachmentId())
|
||||||
.toUriString();
|
.toUriString();
|
||||||
return new AppUpdateCheckResponse(release.getVersionName(), url, release.getSha256(), mandatory, release.getNote());
|
return new AppUpdateCheckResponse(release.getVersionName(), url, release.getSha256(), mandatory, shell, release.getNote());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 比较版本号
|
/// 比较版本号
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ public class AppUpdateCheckResponse {
|
|||||||
/// 是否为强制更新
|
/// 是否为强制更新
|
||||||
protected Boolean mandatory;
|
protected Boolean mandatory;
|
||||||
|
|
||||||
|
/// 是否为外壳安装包
|
||||||
|
///
|
||||||
|
/// 客户端据此判断走热更还是下载安装包。字段名不能叫 kind:
|
||||||
|
/// Capgo 插件把 kind 视为错误响应的标记,收到后会直接判为检查失败
|
||||||
|
protected Boolean shell;
|
||||||
|
|
||||||
/// 变更说明,供 App 展示更新日志
|
/// 变更说明,供 App 展示更新日志
|
||||||
///
|
///
|
||||||
/// 字段名不能叫 message:Capgo 插件把 message 当作错误信息,收到会直接判为检查失败
|
/// 字段名不能叫 message:Capgo 插件把 message 当作错误信息,收到会直接判为检查失败
|
||||||
@@ -38,6 +44,6 @@ public class AppUpdateCheckResponse {
|
|||||||
/// @param currentVersion 当前运行的 Web 包版本
|
/// @param currentVersion 当前运行的 Web 包版本
|
||||||
/// @return 无更新响应
|
/// @return 无更新响应
|
||||||
public static AppUpdateCheckResponse none(String currentVersion) {
|
public static AppUpdateCheckResponse none(String currentVersion) {
|
||||||
return new AppUpdateCheckResponse(currentVersion, "", null, false, null);
|
return new AppUpdateCheckResponse(currentVersion, "", null, false, null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user