@@ -40,9 +40,8 @@ type BadgeState struct {
4040 env * libkb.Env
4141 state keybase1.BadgeState
4242
43- inboxVers chat1.InboxVers
44- // Map from ConversationID.String to BadgeConversationInfo.
45- chatUnreadMap map [string ]keybase1.BadgeConversationInfo
43+ inboxVers chat1.InboxVers
44+ chatUnreadMap map [chat1.ConvIDStr ]keybase1.BadgeConversationInfo
4645
4746 walletUnreadMap map [stellar1.AccountID ]int
4847}
@@ -63,7 +62,7 @@ func newBadgeState(log logger.Logger, env *libkb.Env) *BadgeState {
6362 log : log ,
6463 env : env ,
6564 inboxVers : chat1 .InboxVers (0 ),
66- chatUnreadMap : make (map [string ]keybase1.BadgeConversationInfo ),
65+ chatUnreadMap : make (map [chat1. ConvIDStr ]keybase1.BadgeConversationInfo ),
6766 walletUnreadMap : make (map [stellar1.AccountID ]int ),
6867 localChatState : dummyLocalChatState {},
6968 }
@@ -171,7 +170,7 @@ func homeStateLessThan(a *homeStateBody, b homeStateBody) bool {
171170 return false
172171}
173172
174- func (b * BadgeState ) ConversationBadgeStr (ctx context.Context , convIDStr string ,
173+ func (b * BadgeState ) ConversationBadgeStr (ctx context.Context , convIDStr chat1. ConvIDStr ,
175174 deviceType keybase1.DeviceType ) int {
176175 b .Lock ()
177176 defer b .Unlock ()
@@ -183,7 +182,7 @@ func (b *BadgeState) ConversationBadgeStr(ctx context.Context, convIDStr string,
183182
184183func (b * BadgeState ) ConversationBadge (ctx context.Context , convID chat1.ConversationID ,
185184 deviceType keybase1.DeviceType ) int {
186- return b .ConversationBadgeStr (ctx , convID .String (), deviceType )
185+ return b .ConversationBadgeStr (ctx , convID .ConvIDStr (), deviceType )
187186}
188187
189188// UpdateWithGregor updates the badge state from a gregor state.
@@ -433,7 +432,7 @@ func (b *BadgeState) UpdateWithChatFull(ctx context.Context, update chat1.Unread
433432 case chat1 .SyncInboxResType_CURRENT :
434433 case chat1 .SyncInboxResType_INCREMENTAL :
435434 case chat1 .SyncInboxResType_CLEAR :
436- b .chatUnreadMap = make (map [string ]keybase1.BadgeConversationInfo )
435+ b .chatUnreadMap = make (map [chat1. ConvIDStr ]keybase1.BadgeConversationInfo )
437436 }
438437
439438 for _ , upd := range update .Updates {
@@ -449,14 +448,14 @@ func (b *BadgeState) Clear() {
449448
450449 b .state = keybase1.BadgeState {}
451450 b .inboxVers = chat1 .InboxVers (0 )
452- b .chatUnreadMap = make (map [string ]keybase1.BadgeConversationInfo )
451+ b .chatUnreadMap = make (map [chat1. ConvIDStr ]keybase1.BadgeConversationInfo )
453452 b .walletUnreadMap = make (map [stellar1.AccountID ]int )
454453}
455454
456455func (b * BadgeState ) updateWithChat (ctx context.Context , update chat1.UnreadUpdate ) {
457456 b .log .CDebugf (ctx , "updateWithChat: %s" , update )
458457 if update .Diff {
459- cur := b .chatUnreadMap [update .ConvID .String ()]
458+ cur := b .chatUnreadMap [update .ConvID .ConvIDStr ()]
460459 cur .ConvID = keybase1 .ChatConversationID (update .ConvID )
461460 cur .UnreadMessages += update .UnreadMessages
462461 if cur .BadgeCounts == nil {
@@ -465,9 +464,9 @@ func (b *BadgeState) updateWithChat(ctx context.Context, update chat1.UnreadUpda
465464 for dt , c := range update .UnreadNotifyingMessages {
466465 cur .BadgeCounts [dt ] += c
467466 }
468- b .chatUnreadMap [update .ConvID .String ()] = cur
467+ b .chatUnreadMap [update .ConvID .ConvIDStr ()] = cur
469468 } else {
470- b .chatUnreadMap [update .ConvID .String ()] = keybase1.BadgeConversationInfo {
469+ b .chatUnreadMap [update .ConvID .ConvIDStr ()] = keybase1.BadgeConversationInfo {
471470 ConvID : keybase1 .ChatConversationID (update .ConvID ),
472471 UnreadMessages : update .UnreadMessages ,
473472 BadgeCounts : update .UnreadNotifyingMessages ,
0 commit comments