parent
60ed62231e
commit
2449c8840e
|
@ -1,5 +1,6 @@
|
||||||
import Tables
|
import Tables
|
||||||
|
import NimQml
|
||||||
|
import json
|
||||||
import io_interface
|
import io_interface
|
||||||
|
|
||||||
import ../../../../../app_service/service/settings/service as settings_service
|
import ../../../../../app_service/service/settings/service as settings_service
|
||||||
|
@ -12,6 +13,7 @@ import ../../../../../app_service/service/wallet_account/service as wallet_accou
|
||||||
|
|
||||||
import ../../../../core/signals/types
|
import ../../../../core/signals/types
|
||||||
import ../../../../core/eventemitter
|
import ../../../../core/eventemitter
|
||||||
|
import ../../../shared_models/message_item
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -196,3 +198,13 @@ proc getTransactionDetails*(self: Controller, message: MessageDto): (string,stri
|
||||||
|
|
||||||
proc getWalletAccounts*(self: Controller): seq[wallet_account_service.WalletAccountDto] =
|
proc getWalletAccounts*(self: Controller): seq[wallet_account_service.WalletAccountDto] =
|
||||||
return self.messageService.getWalletAccounts()
|
return self.messageService.getWalletAccounts()
|
||||||
|
|
||||||
|
proc downloadMessages*(self: Controller, messages: seq[message_item.Item], filePath: string) =
|
||||||
|
let data = newJArray()
|
||||||
|
for message in messages:
|
||||||
|
data.elems.add(%*{
|
||||||
|
"id": message.id(), "text": message.messageText(), "timestamp": message.timestamp(),
|
||||||
|
"sender": message.senderDisplayName()
|
||||||
|
})
|
||||||
|
|
||||||
|
writeFile(url_toLocalFile(filePath), $data)
|
||||||
|
|
|
@ -108,3 +108,6 @@ method getCurrentFleet*(self: AccessInterface): string {.base.} =
|
||||||
|
|
||||||
method amIChatAdmin*(self: AccessInterface): bool {.base.} =
|
method amIChatAdmin*(self: AccessInterface): bool {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method downloadMessages*(self: AccessInterface, filePath: string) =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import NimQml
|
import NimQml
|
||||||
|
|
||||||
import ../../../../../../app_service/service/message/dto/[message, reaction, pinned_message]
|
import ../../../../../../app_service/service/message/dto/[message, reaction, pinned_message]
|
||||||
|
import ../../../../shared_models/message_item
|
||||||
|
|
||||||
type
|
type
|
||||||
AccessInterface* {.pure inheritable.} = ref object of RootObj
|
AccessInterface* {.pure inheritable.} = ref object of RootObj
|
||||||
|
@ -123,3 +124,6 @@ method leaveChat*(self: AccessInterface) {.base.} =
|
||||||
|
|
||||||
method didIJoinedChat*(self: AccessInterface): bool {.base.} =
|
method didIJoinedChat*(self: AccessInterface): bool {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method getMessages*(self: AccessInterface): seq[message_item.Item] =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
|
@ -486,3 +486,6 @@ method onChatMemberUpdated*(self: Module, publicKey: string, admin: bool, joined
|
||||||
return
|
return
|
||||||
|
|
||||||
self.view.model().refreshItemWithId(CHAT_IDENTIFIER_MESSAGE_ID)
|
self.view.model().refreshItemWithId(CHAT_IDENTIFIER_MESSAGE_ID)
|
||||||
|
|
||||||
|
method getMessages*(self: Module): seq[message_item.Item] =
|
||||||
|
return self.view.model().items
|
||||||
|
|
|
@ -331,3 +331,7 @@ method onChatEdited*(self: Module, chatDto: ChatDto) =
|
||||||
method onChatRenamed*(self: Module, newName: string) =
|
method onChatRenamed*(self: Module, newName: string) =
|
||||||
self.view.updateChatDetailsName(newName)
|
self.view.updateChatDetailsName(newName)
|
||||||
self.messagesModule.updateChatIdentifier()
|
self.messagesModule.updateChatIdentifier()
|
||||||
|
|
||||||
|
method downloadMessages*(self: Module, filePath: string) =
|
||||||
|
let messages = self.messagesModule.getMessages()
|
||||||
|
self.controller.downloadMessages(messages, filePath)
|
||||||
|
|
|
@ -122,3 +122,6 @@ QtObject:
|
||||||
proc updateChatDetailsName*(self: View, name: string) =
|
proc updateChatDetailsName*(self: View, name: string) =
|
||||||
self.chatDetails.setName(name)
|
self.chatDetails.setName(name)
|
||||||
self.chatDetailsChanged()
|
self.chatDetailsChanged()
|
||||||
|
|
||||||
|
proc downloadMessages*(self: View, filePath: string) {.slot.} =
|
||||||
|
self.delegate.downloadMessages(filePath)
|
|
@ -284,3 +284,6 @@ method reorderCommunityChat*(self: AccessInterface, categoryId: string, chatId:
|
||||||
|
|
||||||
method onMeMentionedInEditedMessage*(self: AccessInterface, chatId: string, editedMessage : MessageDto) {.base.} =
|
method onMeMentionedInEditedMessage*(self: AccessInterface, chatId: string, editedMessage : MessageDto) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method downloadMessages*(self: AccessInterface, chatId: string, filePath: string) =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
|
@ -807,3 +807,10 @@ method addChatIfDontExist*(self: Module,
|
||||||
return
|
return
|
||||||
self.addNewChat(chat, belongsToCommunity, events, settingsService, contactService, chatService,
|
self.addNewChat(chat, belongsToCommunity, events, settingsService, contactService, chatService,
|
||||||
communityService, messageService, gifService, mailserversService, setChatAsActive)
|
communityService, messageService, gifService, mailserversService, setChatAsActive)
|
||||||
|
|
||||||
|
method downloadMessages*(self: Module, chatId: string, filePath: string) =
|
||||||
|
if(not self.chatContentModules.contains(chatId)):
|
||||||
|
error "unexisting chat key: ", chatId, methodName="downloadMessages"
|
||||||
|
return
|
||||||
|
|
||||||
|
self.chatContentModules[chatId].downloadMessages(filePath)
|
||||||
|
|
|
@ -293,3 +293,6 @@ QtObject:
|
||||||
return
|
return
|
||||||
self.loadingHistoryMessagesInProgress = value
|
self.loadingHistoryMessagesInProgress = value
|
||||||
self.loadingHistoryMessagesInProgressChanged()
|
self.loadingHistoryMessagesInProgressChanged()
|
||||||
|
|
||||||
|
proc downloadMessages*(self: View, chatId: string, filePath: string) {.slot.} =
|
||||||
|
self.delegate.downloadMessages(chatId, filePath)
|
|
@ -38,7 +38,7 @@ type
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
Model* = ref object of QAbstractListModel
|
Model* = ref object of QAbstractListModel
|
||||||
items: seq[Item]
|
items*: seq[Item]
|
||||||
allKeys: seq[int]
|
allKeys: seq[int]
|
||||||
|
|
||||||
proc delete(self: Model) =
|
proc delete(self: Model) =
|
||||||
|
|
|
@ -256,7 +256,11 @@ ColumnLayout {
|
||||||
onDeleteCommunityChat: root.rootStore.removeCommunityChat(chatId)
|
onDeleteCommunityChat: root.rootStore.removeCommunityChat(chatId)
|
||||||
|
|
||||||
onDownloadMessages: {
|
onDownloadMessages: {
|
||||||
// Not Refactored Yet
|
if(!chatContentModule) {
|
||||||
|
console.debug("error on leave chat from context menu - chat content module is not set")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
chatContentModule.downloadMessages(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
onDisplayProfilePopup: {
|
onDisplayProfilePopup: {
|
||||||
|
|
|
@ -327,7 +327,7 @@ Item {
|
||||||
onDeleteCommunityChat: root.store.removeCommunityChat(chatId)
|
onDeleteCommunityChat: root.store.removeCommunityChat(chatId)
|
||||||
|
|
||||||
onDownloadMessages: {
|
onDownloadMessages: {
|
||||||
// Not Refactored Yet
|
root.communitySectionModule.downloadMessages(chatId, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
onDisplayProfilePopup: {
|
onDisplayProfilePopup: {
|
||||||
|
|
|
@ -232,7 +232,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onDownloadMessages: {
|
onDownloadMessages: {
|
||||||
// Not Refactored Yet
|
root.chatSectionModule.downloadMessages(chatId, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
onDisplayProfilePopup: {
|
onDisplayProfilePopup: {
|
||||||
|
|
Loading…
Reference in New Issue