summaryrefslogtreecommitdiff
path: root/internal/client/ui/core/chat
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-02-05 19:41:34 +0200
committerKyren223 <Kyren223@proton.me>2025-02-05 19:41:34 +0200
commit0bf5515629f1cfe1557dba4f8d588ac64b77d408 (patch)
tree2bfc56b990c6edd6bab6ddf7b10964b0efb1dbcb /internal/client/ui/core/chat
parent8a8c4e9abc1006da92969e0234bb2d42f587c149 (diff)
When a user sends a message "signal" and the receiving user doesn't have
the signal already open, it will be added as the first signal
Diffstat (limited to 'internal/client/ui/core/chat')
-rw-r--r--internal/client/ui/core/chat/chat.go28
1 files changed, 24 insertions, 4 deletions
diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go
index aba65a2..37fc1a8 100644
--- a/internal/client/ui/core/chat/chat.go
+++ b/internal/client/ui/core/chat/chat.go
@@ -277,6 +277,26 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
state.State.LastReadMessages[receiverId] = lastMsg
}
+
+ m.hasReadAccess = true
+ m.hasWriteAccess = true // TODO: implement blocking users
+
+ if m.locked {
+ m.vi.Placeholder = SendMessagePlaceholder
+ m.borderStyle = ViFocusedBorder
+ m.style = focusStyle
+ m.vi.SetInactive(false)
+ m.vi.Focus()
+ if m.editingMessage != nil {
+ m.borderStyle = ViEditBorder
+ m.style = editStyle
+ }
+ } else {
+ m.vi.Placeholder = SendMessagePlaceholder
+ m.borderStyle = ViBlurredBorder
+ m.style = blurStyle
+ m.vi.SetInactive(false)
+ }
}
if !m.focus {
@@ -734,8 +754,6 @@ func (m *Model) ResetBeforeSwitch() {
MaxHeight: m.maxMessagesHeight,
}
- state.SendUserDatUpdate()
-
} else if m.receiverIndex != -1 {
receiverId := state.Data.Signals[m.receiverIndex]
log.Println("Saving signal:", receiverId)
@@ -744,8 +762,6 @@ func (m *Model) ResetBeforeSwitch() {
Base: m.base,
MaxHeight: m.maxMessagesHeight,
}
-
- state.SendUserDatUpdate()
}
}
@@ -772,6 +788,8 @@ func (m *Model) RestoreAfterSwitch() tea.Cmd {
// Don't ask for messages if you already visited this frequency
return nil
}
+
+ log.Println("Requesting frequency messages")
return gateway.Send(&packet.RequestMessages{
ReceiverID: nil,
FrequencyID: &frequency.ID,
@@ -795,6 +813,8 @@ func (m *Model) RestoreAfterSwitch() tea.Cmd {
// Don't ask for messages if you already visited this frequency
return nil
}
+
+ log.Println("Requesting signal messages:", receiverId)
return gateway.Send(&packet.RequestMessages{
ReceiverID: &receiverId,
FrequencyID: nil,