parent
a306d3a9d7
commit
219d7b46c0
|
@ -119,6 +119,12 @@ method init*(self: Controller) =
|
|||
return
|
||||
self.delegate.onChatEdited(args.chat)
|
||||
|
||||
self.events.on(SIGNAL_CHAT_RENAMED) do(e: Args):
|
||||
var args = ChatRenameArgs(e)
|
||||
if(self.chatId != args.id):
|
||||
return
|
||||
self.delegate.onChatRenamed(args.newName)
|
||||
|
||||
method getMyChatId*(self: Controller): string =
|
||||
return self.chatId
|
||||
|
||||
|
|
|
@ -293,3 +293,6 @@ method onNotificationsUpdated*(self: Module, hasUnreadMessages: bool, notificati
|
|||
method onChatEdited*(self: Module, chatDto: ChatDto) =
|
||||
self.view.updateChatDetails(chatDto.name, chatDto.description)
|
||||
self.messagesModule.updateChatIdentifier()
|
||||
|
||||
method onChatRenamed*(self: Module, newName: string) =
|
||||
self.view.updateChatDetailsName(newName)
|
||||
|
|
|
@ -31,3 +31,6 @@ method onContactDetailsUpdated*(self: AccessInterface, contactId: string) {.base
|
|||
|
||||
method onChatEdited*(self: AccessInterface, chatDto: ChatDto) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method onChatRenamed*(self: AccessInterface, newName: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
|
|
@ -118,3 +118,7 @@ QtObject:
|
|||
self.chatDetails.setName(name)
|
||||
self.chatDetails.setDescription(description)
|
||||
self.chatDetailsChanged()
|
||||
|
||||
proc updateChatDetailsName*(self: View, name: string) =
|
||||
self.chatDetails.setName(name)
|
||||
self.chatDetailsChanged()
|
||||
|
|
|
@ -391,8 +391,12 @@ QtObject:
|
|||
method renameGroupChat*(self: Service, chatId: string, newName: string) =
|
||||
try:
|
||||
let response = status_chat.renameGroupChat(chatId, newName)
|
||||
if (response.error.isNil):
|
||||
self.events.emit(SIGNAL_CHAT_RENAMED, ChatRenameArgs(id: chatId, newName: newName))
|
||||
if (not response.error.isNil):
|
||||
let msg = response.error.message & " chatId=" & chatId
|
||||
error "error while renaming group chat", msg
|
||||
return
|
||||
|
||||
self.events.emit(SIGNAL_CHAT_RENAMED, ChatRenameArgs(id: chatId, newName: newName))
|
||||
except Exception as e:
|
||||
error "error while renaming group chat: ", msg = e.msg
|
||||
|
||||
|
|
Loading…
Reference in New Issue