parent
add8163f31
commit
c85734f08d
|
@ -54,7 +54,7 @@ proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitt
|
||||||
result.messagesModule = messages_module.newModule(result, events, sectionId, chatId, belongsToCommunity,
|
result.messagesModule = messages_module.newModule(result, events, sectionId, chatId, belongsToCommunity,
|
||||||
contactService, communityService, chatService, messageService, mailserversService)
|
contactService, communityService, chatService, messageService, mailserversService)
|
||||||
result.usersModule = users_module.newModule(result, events, sectionId, chatId, belongsToCommunity, isUsersListAvailable,
|
result.usersModule = users_module.newModule(result, events, sectionId, chatId, belongsToCommunity, isUsersListAvailable,
|
||||||
contactService, communityService, messageService)
|
contactService, chatService, communityService, messageService)
|
||||||
|
|
||||||
method delete*(self: Module) =
|
method delete*(self: Module) =
|
||||||
self.inputAreaModule.delete
|
self.inputAreaModule.delete
|
||||||
|
|
|
@ -21,12 +21,14 @@ type
|
||||||
belongsToCommunity: bool
|
belongsToCommunity: bool
|
||||||
isUsersListAvailable: bool #users list is not available for 1:1 chat
|
isUsersListAvailable: bool #users list is not available for 1:1 chat
|
||||||
contactService: contact_service.Service
|
contactService: contact_service.Service
|
||||||
|
chatService: chat_service.Service
|
||||||
communityService: community_service.Service
|
communityService: community_service.Service
|
||||||
messageService: message_service.Service
|
messageService: message_service.Service
|
||||||
|
|
||||||
proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string,
|
proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string,
|
||||||
belongsToCommunity: bool, isUsersListAvailable: bool, contactService: contact_service.Service,
|
belongsToCommunity: bool, isUsersListAvailable: bool, contactService: contact_service.Service,
|
||||||
communityService: community_service.Service, messageService: message_service.Service):
|
chatService: chat_service.Service, communityService: community_service.Service,
|
||||||
|
messageService: message_service.Service):
|
||||||
Controller =
|
Controller =
|
||||||
result = Controller()
|
result = Controller()
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
|
@ -36,6 +38,7 @@ proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter
|
||||||
result.belongsToCommunity = belongsToCommunity
|
result.belongsToCommunity = belongsToCommunity
|
||||||
result.isUsersListAvailable = isUsersListAvailable
|
result.isUsersListAvailable = isUsersListAvailable
|
||||||
result.contactService = contactService
|
result.contactService = contactService
|
||||||
|
result.chatService = chatService
|
||||||
result.communityService = communityService
|
result.communityService = communityService
|
||||||
result.messageService = messageService
|
result.messageService = messageService
|
||||||
|
|
||||||
|
@ -84,12 +87,12 @@ method init*(self: Controller) =
|
||||||
self.delegate.onChatMembersAdded(@[args.pubKey])
|
self.delegate.onChatMembersAdded(@[args.pubKey])
|
||||||
|
|
||||||
method getMembersPublicKeys*(self: Controller): seq[string] =
|
method getMembersPublicKeys*(self: Controller): seq[string] =
|
||||||
# in case of 1:1 chat, there is no a members list
|
|
||||||
if(not self.belongsToCommunity):
|
if(not self.belongsToCommunity):
|
||||||
return
|
let chatDto = self.chatService.getChatById(self.chatId)
|
||||||
|
return chatDto.members.map(x => x.id)
|
||||||
|
else:
|
||||||
let communityDto = self.communityService.getCommunityById(self.sectionId)
|
let communityDto = self.communityService.getCommunityById(self.sectionId)
|
||||||
result = communityDto.members.map(x => x.id)
|
return communityDto.members.map(x => x.id)
|
||||||
|
|
||||||
method getContactNameAndImage*(self: Controller, contactId: string):
|
method getContactNameAndImage*(self: Controller, contactId: string):
|
||||||
tuple[name: string, image: string, isIdenticon: bool] =
|
tuple[name: string, image: string, isIdenticon: bool] =
|
||||||
|
|
|
@ -6,6 +6,7 @@ import ../../../../shared_models/[user_model, user_item]
|
||||||
import ../../../../../global/global_singleton
|
import ../../../../../global/global_singleton
|
||||||
import ../../../../../core/eventemitter
|
import ../../../../../core/eventemitter
|
||||||
import ../../../../../../app_service/service/contacts/service as contact_service
|
import ../../../../../../app_service/service/contacts/service as contact_service
|
||||||
|
import ../../../../../../app_service/service/chat/service as chat_service
|
||||||
import ../../../../../../app_service/service/community/service as community_service
|
import ../../../../../../app_service/service/community/service as community_service
|
||||||
import ../../../../../../app_service/service/message/service as message_service
|
import ../../../../../../app_service/service/message/service as message_service
|
||||||
|
|
||||||
|
@ -21,14 +22,15 @@ type
|
||||||
|
|
||||||
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string,
|
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string,
|
||||||
belongsToCommunity: bool, isUsersListAvailable: bool, contactService: contact_service.Service,
|
belongsToCommunity: bool, isUsersListAvailable: bool, contactService: contact_service.Service,
|
||||||
communityService: community_service.Service, messageService: message_service.Service):
|
chatService: chat_service.Service, communityService: community_service.Service,
|
||||||
|
messageService: message_service.Service):
|
||||||
Module =
|
Module =
|
||||||
result = Module()
|
result = Module()
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
result.view = view.newView(result)
|
result.view = view.newView(result)
|
||||||
result.viewVariant = newQVariant(result.view)
|
result.viewVariant = newQVariant(result.view)
|
||||||
result.controller = controller.newController(result, events, sectionId, chatId, belongsToCommunity, isUsersListAvailable,
|
result.controller = controller.newController(result, events, sectionId, chatId, belongsToCommunity, isUsersListAvailable,
|
||||||
contactService, communityService, messageService)
|
contactService, chatService, communityService, messageService)
|
||||||
result.moduleLoaded = false
|
result.moduleLoaded = false
|
||||||
|
|
||||||
method delete*(self: Module) =
|
method delete*(self: Module) =
|
||||||
|
|
Loading…
Reference in New Issue