通知模型补全(agent-107: SDK icon+update_progress / IPC urgency+MSG_NOTIFY_PROGRESS / 存储 urgency+icon回退+progress / CSV加3列) + 全屏收合视觉+滑条(agent-108)

This commit is contained in:
MeowOS Dev committed 2026-08-30 13:02:17 +08:00
1 parent b3e57d4b55
commit e8fa373a2f
18 files changed
+410 -56

No files matched your search

+25 -3
View File
@@ -41,7 +41,7 @@ uint64_t meow_ui_time_ms(void)
/* ---- stub server 捕获(每次连接一帧) ---- */
#define MAXCAP 16
typedef struct { int type; m_notify_t n; uint32_t dismiss_id; uint32_t nid; } srec_t;
typedef struct { int type; m_notify_t n; m_notify_progress_t prog; uint32_t dismiss_id; uint32_t nid; } srec_t;
static srec_t g_rec[MAXCAP];
static int g_nrec = 0;
static int g_stop = 0;
@@ -77,6 +77,7 @@ static void *server(void *arg)
memset(&g_rec[idx], 0, sizeof g_rec[idx]);
g_rec[idx].type = (int)type;
if (type == MSG_NOTIFY && len >= sizeof(m_notify_t)) memcpy(&g_rec[idx].n, pay, sizeof(m_notify_t));
if (type == MSG_NOTIFY_PROGRESS && len >= sizeof(m_notify_progress_t)) memcpy(&g_rec[idx].prog, pay, sizeof(m_notify_progress_t));
if (type == MSG_NOTIFY_DISMISS && len >= 4) memcpy(&g_rec[idx].dismiss_id, pay, 4);
/* 分配 nid = 100 + NOTIFY 序号 */
uint32_t seq = 0;
@@ -85,7 +86,7 @@ static void *server(void *arg)
uint32_t ack_nid = g_rec[idx].nid;
pthread_mutex_unlock(&g_mu);
if (type == MSG_NOTIFY || type == MSG_NOTIFY_DISMISS) {
if (type == MSG_NOTIFY || type == MSG_NOTIFY_DISMISS || type == MSG_NOTIFY_PROGRESS) {
m_ack_t a; memset(&a, 0, sizeof a); a.code = MEOW_OK; a.status = ack_nid;
uint8_t rhdr[MEOW_IPC_HDR_LEN];
uint32_t mag = MEOW_IPC_MAGIC; uint16_t ver = MEOW_IPC_VERSION, t = (uint16_t)
@@ -140,11 +141,13 @@ int main(void)
/* S1 通用通知 */
meow_notify nt; memset(&nt, 0, sizeof nt);
nt.cat = MEOW_NOTIFY_CAT_GENERAL; nt.urgency = MEOW_NOTIFY_URG_NORMAL;
nt.title = "t1"; nt.timeout_ms = 0;
nt.title = "t1"; nt.timeout_ms = 0; nt.icon = "os.meow.hello/icon.png";
uint32_t id1 = meow_notify_send(&nt);
check("S1 send 返回本地 id=1", id1 == 1);
check("S1 active_count=1", meow_notify_active_count() == 1);
check("S1 stub 回 nid=101", rec_at(0).nid == 101);
check("S1 映射 urgency=NORMAL(1)", rec_at(0).n.urgency == MEOW_NOTIFY_URG_NORMAL);
check("S1 映射 icon→app_icon", !strcmp(rec_at(0).n.app_icon, "os.meow.hello/icon.png"));
/* S2 媒体通知:单例 + media=1 */
memset(&nt, 0, sizeof nt);
@@ -182,6 +185,25 @@ int main(void)
触发丢最旧的是 S5 循环第 4 次 send = 第 7 条 NOTIFY(rec[7]),其 replaces_id==103。 */
check("S5 丢最旧后 send replaces_id=被丢nid(103)", rec_at(7).n.replaces_id == 103);
/* S5b update_progress:新发一条 progress → 本地 id → update → stub 捕获 MSG_NOTIFY_PROGRESS */
memset(&nt, 0, sizeof nt);
nt.cat = MEOW_NOTIFY_CAT_PROGRESS; nt.title = "prog"; nt.timeout_ms = 0;
nt.progress = 10;
uint32_t idp = meow_notify_send(&nt);
int ni = -1;
for (int i = 0; i < MAXCAP; i++) {
srec_t r = rec_at(i);
if (r.type == MSG_NOTIFY && !strcmp(r.n.summary, "prog")) { ni = i; break; }
}
check("S5b 找到 prog 通知帧", ni >= 0);
int rc_up = meow_notify_update_progress(idp, 70);
check("S5b update_progress 返回 1", rc_up == 1);
srec_t pr = rec_at(ni + 1);
check("S5b stub 捕获 MSG_NOTIFY_PROGRESS 帧", pr.type == MSG_NOTIFY_PROGRESS);
check("S5b progress nid=该通知 launcher nid", ni >= 0 && pr.prog.nid == rec_at(ni).nid);
check("S5b progress 载=70", pr.prog.progress == 70);
check("S5b update_progress(未知 id) 返回 0", meow_notify_update_progress(0xFFFFFF, 50) == 0);
stop_server();
pthread_join(th, NULL);