diff --git a/packages/engine-chronocat-api/src/handler.ts b/packages/engine-chronocat-api/src/handler.ts index 1930ac8..57a54db 100644 --- a/packages/engine-chronocat-api/src/handler.ts +++ b/packages/engine-chronocat-api/src/handler.ts @@ -210,6 +210,14 @@ const responseDispatcher = async ( return } + case 'nodeIKernelGroupListener/onGroupNotifiesUnreadCountUpdated': { + // const {} = payload as OnGroupNotifiesUnreadCountUpdated + + void ctx.chronocatEngineChronocatApi.groupNotify.refresh() + + return + } + case 'onBuddyListChange': case 'nodeIKernelBuddyListener/onBuddyListChange': { const { data } = payload as OnBuddyListChange diff --git a/packages/engine-chronocat-api/src/index.ts b/packages/engine-chronocat-api/src/index.ts index 5dba42e..13383e8 100644 --- a/packages/engine-chronocat-api/src/index.ts +++ b/packages/engine-chronocat-api/src/index.ts @@ -27,6 +27,7 @@ import { buildMessageList } from './api/message/list' import { buildUserChannelCreate } from './api/user/channel/create' import { buildUserGet } from './api/user/get' import { buildHandler } from './handler' +import { groupNotify } from './services/groupNotify' import { msgBoxActiv } from './services/msgBoxActiv' declare const __DEFINE_CHRONO_VERSION__: string @@ -37,6 +38,7 @@ export const version = __DEFINE_CHRONO_VERSION__ export const apply = async (ctx: ChronocatContext) => { ctx.chronocatEngineChronocatApi = { msgBoxActiv: msgBoxActiv(ctx), + groupNotify, } ipcMan({ diff --git a/packages/engine-chronocat-api/src/services/groupNotify.ts b/packages/engine-chronocat-api/src/services/groupNotify.ts new file mode 100644 index 0000000..42d6c34 --- /dev/null +++ b/packages/engine-chronocat-api/src/services/groupNotify.ts @@ -0,0 +1,18 @@ +import { getSingleScreenNotifies } from '../definitions/groupService' + +const refresh = async () => { + void getSingleScreenNotifies({ + doubt: false, + startSeq: '', + number: 16, + }) + void getSingleScreenNotifies({ + doubt: true, + startSeq: '', + number: 16, + }) +} + +export const groupNotify = { + refresh, +} diff --git a/packages/engine-chronocat-api/src/types.ts b/packages/engine-chronocat-api/src/types.ts index 0468d68..01f6b32 100644 --- a/packages/engine-chronocat-api/src/types.ts +++ b/packages/engine-chronocat-api/src/types.ts @@ -1,9 +1,11 @@ +import type { groupNotify } from './services/groupNotify' import type { MsgBoxActiv } from './services/msgBoxActiv' declare module '@chronocat/shell' { interface ChronocatContext { chronocatEngineChronocatApi: { msgBoxActiv: MsgBoxActiv + groupNotify: typeof groupNotify } } } diff --git a/packages/engine-chronocat-event/src/handler.ts b/packages/engine-chronocat-event/src/handler.ts index ec1c369..f1840ef 100644 --- a/packages/engine-chronocat-event/src/handler.ts +++ b/packages/engine-chronocat-event/src/handler.ts @@ -214,12 +214,6 @@ const dispatcher = async ( return } - case 'nodeIKernelGroupListener/onGroupNotifiesUnreadCountUpdated': { - // const {} = payload as OnGroupNotifiesUnreadCountUpdated - - return - } - case 'nodeIKernelGroupListener/onGroupSingleScreenNotifies': { const { notifies } = payload as OnGroupSingleScreenNotifies