Skip to content

Commit 902e607

Browse files
committed
feat(backup): send a signal to reset chat cursors on message imports
Needed for status-im/status-desktop#18824
1 parent dbadf55 commit 902e607

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

protocol/messenger_backup_handler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/status-im/status-go/protocol/protobuf"
1717
"github.com/status-im/status-go/protocol/wakusync"
1818
ensservice "github.com/status-im/status-go/services/ens"
19+
"github.com/status-im/status-go/signal"
1920
)
2021

2122
const (
@@ -57,6 +58,8 @@ func (m *Messenger) handleLocalBackup(state *ReceivedMessageState, backup *proto
5758
if err != nil {
5859
errors = append(errors, err)
5960
}
61+
62+
signal.SendChatCursorReset()
6063
}
6164

6265
return errors

signal/events_shhext.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ const (
3939
// EventNewMessages is triggered when we receive new messages
4040
EventNewMessages = "messages.new"
4141

42+
// EventChatCursorReset is triggered when a chat cursor needs to be reset on the client side
43+
EventChatCursorReset = "messages.chat.cursor.reset"
44+
4245
// EventHistoryRequestStarted is triggered before processing a store request
4346
EventHistoryRequestStarted = "history.request.started"
4447

@@ -213,6 +216,10 @@ func SendNewMessages(obj json.Marshaler) {
213216
send(EventNewMessages, obj)
214217
}
215218

219+
func SendChatCursorReset() {
220+
send(EventChatCursorReset, interface{}(nil))
221+
}
222+
216223
func sendStoreNodeSignal(ms *messagingtypes.StoreNode, event string) {
217224
msSignal := StoreNodeSignal{}
218225
if ms != nil {

0 commit comments

Comments
 (0)