Skip to content

Commit

Permalink
feat(api): refresh group notify
Browse files Browse the repository at this point in the history
  • Loading branch information
ilharp committed Aug 23, 2024
1 parent 23ace14 commit 1472926
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
8 changes: 8 additions & 0 deletions packages/engine-chronocat-api/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions packages/engine-chronocat-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,6 +38,7 @@ export const version = __DEFINE_CHRONO_VERSION__
export const apply = async (ctx: ChronocatContext) => {
ctx.chronocatEngineChronocatApi = {
msgBoxActiv: msgBoxActiv(ctx),
groupNotify,
}

ipcMan<RedIpcArgs>({
Expand Down
18 changes: 18 additions & 0 deletions packages/engine-chronocat-api/src/services/groupNotify.ts
Original file line number Diff line number Diff line change
@@ -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,
}
2 changes: 2 additions & 0 deletions packages/engine-chronocat-api/src/types.ts
Original file line number Diff line number Diff line change
@@ -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
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions packages/engine-chronocat-event/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,6 @@ const dispatcher = async (
return
}

case 'nodeIKernelGroupListener/onGroupNotifiesUnreadCountUpdated': {
// const {} = payload as OnGroupNotifiesUnreadCountUpdated

return
}

case 'nodeIKernelGroupListener/onGroupSingleScreenNotifies': {
const { notifies } = payload as OnGroupSingleScreenNotifies

Expand Down

0 comments on commit 1472926

Please sign in to comment.