File tree Expand file tree Collapse file tree 3 files changed +17
-13
lines changed
ViewModels/ConversationViewModels Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -323,14 +323,24 @@ private extension ConversationViewModel {
323
323
324
324
func subscribeToConversationTopic( ) {
325
325
let topic : String
326
- if conversation. baseConversation. type == . channel {
326
+ if conversation. baseConversation. type == . channel,
327
+ let channel = conversation. baseConversation as? Channel ,
328
+ channel. isCourseWide == true {
327
329
topic = WebSocketTopic . makeChannelNotifications ( courseId: course. id)
328
330
} else if let id = userSession. user? . id {
329
331
topic = WebSocketTopic . makeConversationNotifications ( userId: id)
330
332
} else {
331
333
return
332
334
}
333
335
if stompClient. didSubscribeTopic ( topic) {
336
+ /// These web socket topics are the same across multiple channels.
337
+ /// We might need to wait until a previously open conversation has unsubscribed
338
+ /// before we can subscribe again
339
+ Timer . scheduledTimer ( withTimeInterval: 5 , repeats: false ) { [ weak self] _ in
340
+ DispatchQueue . main. async { [ weak self] in
341
+ self ? . subscribeToConversationTopic ( )
342
+ }
343
+ }
334
344
return
335
345
}
336
346
subscription = Task { [ weak self] in
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ struct SendMessageView: View {
33
33
}
34
34
textField
35
35
. padding ( isFocused ? [ . horizontal, . bottom] : . all, . l)
36
- if viewModel . isEditing && isFocused {
36
+ if isFocused {
37
37
keyboardToolbarContent
38
38
. padding ( . horizontal, . l)
39
39
. padding ( . vertical, . m)
@@ -101,13 +101,6 @@ private extension SendMessageView {
101
101
. textFieldStyle ( . roundedBorder)
102
102
. lineLimit ( 10 )
103
103
. focused ( $isFocused)
104
- . toolbar {
105
- if isFocused && !viewModel. isEditing {
106
- ToolbarItem ( placement: . keyboard) {
107
- keyboardToolbarContent
108
- }
109
- }
110
- }
111
104
if !isFocused {
112
105
sendButton
113
106
}
Original file line number Diff line number Diff line change @@ -64,10 +64,11 @@ class NotificationWebsocketServiceImpl: NotificationWebsocketService {
64
64
await subscribeToTutorialGroupNotificationUpdates ( )
65
65
}
66
66
addTask ( subscribeToTutorialGroupNotificationUpdatesTask)
67
- let subscribeToConversationNotificationUpdatesTask = Task {
68
- await subscribeToConversationNotificationUpdates ( )
69
- }
70
- addTask ( subscribeToConversationNotificationUpdatesTask)
67
+ #warning("We can't subscribe to this here and in the conversation simultaneously")
68
+ // let subscribeToConversationNotificationUpdatesTask = Task {
69
+ // await subscribeToConversationNotificationUpdates()
70
+ // }
71
+ // addTask(subscribeToConversationNotificationUpdatesTask)
71
72
72
73
return stream
73
74
}
You can’t perform that action at this time.
0 commit comments