Harden read-only thread handling and refresh Android releases

This commit is contained in:
kris
2026-04-06 13:26:48 +08:00
parent 9d7d2f4d17
commit 3564aeaf2e
18 changed files with 346 additions and 27 deletions

View File

@@ -144,17 +144,27 @@ public class GroupCreateActivityUiTest {
JSONArray conversations = new JSONArray()
.put(new JSONObject()
.put("projectId", "thread-2")
.put("projectTitle", "硬件审计协作")
.put("projectTitle", "查询树莓派二代")
.put("folderLabel", "Mac Studio")
.put("lastMessagePreview", "检查摄像头供电链路")
.put("lastMessagePreview", "检查树莓派二代供电链路")
.put("latestReplyLabel", "09:28")
.put("conversationType", "single_device")
.put("isGroup", false))
.put(new JSONObject()
.put("projectId", "thread-3")
.put("projectTitle", "Boss 移动控制台")
.put("projectTitle", "Boss 线程修复")
.put("folderLabel", "Boss")
.put("lastMessagePreview", "统一顶部按钮样式")
.put("latestReplyLabel", "09:31")
.put("conversationType", "single_device")
.put("isGroup", false))
.put(new JSONObject()
.put("projectId", "thread-4")
.put("projectTitle", "主Agent")
.put("folderLabel", "Boss")
.put("lastMessagePreview", "系统自动加入")
.put("latestReplyLabel", "09:32")
.put("conversationType", "single_device")
.put("isGroup", false));
return new JSONObject().put("conversations", conversations);
}

View File

@@ -187,6 +187,24 @@ public class WechatSurfaceMapperTest {
assertEquals("版本 v1.2.8\n1. 优化设备状态刷新\n2. 修复主 Agent 会话排序\n3. 提升 OTA 回收稳定性", content);
}
@Test
public void aboutActivity_prefersInstalledPackageVersionOverServerVersion() throws Exception {
JSONObject ota = new StubJSONObject().withString("currentVersion", "v1.4.1");
JSONObject user = new StubJSONObject().withString("version", "v1.4.1");
java.lang.reflect.Method method = AboutActivity.class.getDeclaredMethod(
"resolveInstalledVersionLabel",
JSONObject.class,
JSONObject.class,
String.class
);
method.setAccessible(true);
String installedVersion = (String) method.invoke(null, user, ota, "2.5.3");
assertEquals("2.5.3", installedVersion);
}
@Test
public void aboutActivity_rejectsStaleDownloadedApkWhenAvailableReleaseChanged() throws Exception {
JSONObject availableRelease = new StubJSONObject()