fix: read fleet from nodeconfig if not available in settings
This commit is contained in:
parent
0c66b9fc2d
commit
97190ce716
|
@ -184,7 +184,7 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
|
|||
result.mailserversService = mailservers_service.newService(statusFoundation.events, statusFoundation.threadpool,
|
||||
result.settingsService, result.nodeConfigurationService, statusFoundation.fleetConfiguration)
|
||||
result.nodeService = node_service.newService(statusFoundation.events, statusFoundation.threadpool,
|
||||
result.settingsService)
|
||||
result.settingsService, result.nodeConfigurationService)
|
||||
result.gifService = gif_service.newService(result.settingsService)
|
||||
result.ensService = ens_service.newService(statusFoundation.events, statusFoundation.threadpool,
|
||||
result.settingsService, result.walletAccountService, result.transactionService,
|
||||
|
@ -348,6 +348,7 @@ proc load(self: AppController) =
|
|||
self.mainModule.load(
|
||||
self.statusFoundation.events,
|
||||
self.settingsService,
|
||||
self.nodeConfigurationService,
|
||||
self.contactsService,
|
||||
self.chatService,
|
||||
self.communityService,
|
||||
|
|
|
@ -2,6 +2,7 @@ import json, typetraits, tables, sequtils
|
|||
|
||||
type
|
||||
Fleet* {.pure.} = enum
|
||||
Undefined = "",
|
||||
Prod = "eth.prod",
|
||||
Staging = "eth.staging",
|
||||
Test = "eth.test",
|
||||
|
|
|
@ -4,6 +4,7 @@ import json
|
|||
import io_interface
|
||||
|
||||
import ../../../../../app_service/service/settings/service as settings_service
|
||||
import ../../../../../app_service/service/node_configuration/service as node_configuration_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
|
||||
|
@ -24,6 +25,7 @@ type
|
|||
chatId: string
|
||||
belongsToCommunity: bool
|
||||
isUsersListAvailable: bool #users list is not available for 1:1 chat
|
||||
nodeConfigurationService: node_configuration_service.Service
|
||||
settingsService: settings_service.Service
|
||||
contactService: contact_service.Service
|
||||
chatService: chat_service.Service
|
||||
|
@ -35,7 +37,7 @@ proc getChatDetails*(self: Controller): ChatDto
|
|||
|
||||
proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string,
|
||||
belongsToCommunity: bool, isUsersListAvailable: bool, settingsService: settings_service.Service,
|
||||
contactService: contact_service.Service, chatService: chat_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service, contactService: contact_service.Service, chatService: chat_service.Service,
|
||||
communityService: community_service.Service, messageService: message_service.Service): Controller =
|
||||
result = Controller()
|
||||
result.delegate = delegate
|
||||
|
@ -45,6 +47,7 @@ proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter
|
|||
result.belongsToCommunity = belongsToCommunity
|
||||
result.isUsersListAvailable = isUsersListAvailable
|
||||
result.settingsService = settingsService
|
||||
result.nodeConfigurationService = nodeConfigurationService
|
||||
result.contactService = contactService
|
||||
result.chatService = chatService
|
||||
result.communityService = communityService
|
||||
|
@ -230,7 +233,7 @@ proc getContactDetails*(self: Controller, contactId: string): ContactDetails =
|
|||
return self.contactService.getContactDetails(contactId)
|
||||
|
||||
proc getCurrentFleet*(self: Controller): string =
|
||||
return self.settingsService.getFleetAsString()
|
||||
return self.nodeConfigurationService.getFleetAsString()
|
||||
|
||||
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText]): string =
|
||||
return self.messageService.getRenderedText(parsedTextArray)
|
||||
|
|
|
@ -14,6 +14,7 @@ import messages/module as messages_module
|
|||
import users/module as users_module
|
||||
|
||||
import ../../../../../app_service/service/settings/service as settings_service
|
||||
import ../../../../../app_service/service/node_configuration/service as node_configuration_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
|
||||
|
@ -39,7 +40,7 @@ type
|
|||
|
||||
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string,
|
||||
belongsToCommunity: bool, isUsersListAvailable: bool, settingsService: settings_service.Service,
|
||||
contactService: contact_service.Service, chatService: chat_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service, contactService: contact_service.Service, chatService: chat_service.Service,
|
||||
communityService: community_service.Service, messageService: message_service.Service, gifService: gif_service.Service,
|
||||
mailserversService: mailservers_service.Service):
|
||||
Module =
|
||||
|
@ -48,7 +49,7 @@ proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitt
|
|||
result.view = view.newView(result)
|
||||
result.viewVariant = newQVariant(result.view)
|
||||
result.controller = controller.newController(result, events, sectionId, chatId, belongsToCommunity,
|
||||
isUsersListAvailable, settingsService, contactService, chatService, communityService, messageService)
|
||||
isUsersListAvailable, settingsService, nodeConfigurationService, contactService, chatService, communityService, messageService)
|
||||
result.moduleLoaded = false
|
||||
|
||||
result.inputAreaModule = input_area_module.newModule(result, sectionId, chatId, belongsToCommunity, chatService, communityService, gifService)
|
||||
|
|
|
@ -3,6 +3,7 @@ import Tables
|
|||
import io_interface
|
||||
|
||||
import ../../../../app_service/service/settings/service as settings_service
|
||||
import ../../../../app_service/service/node_configuration/service as node_configuration_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
|
||||
|
@ -25,6 +26,7 @@ type
|
|||
activeSubItemId: string
|
||||
events: EventEmitter
|
||||
settingsService: settings_service.Service
|
||||
nodeConfigurationService: node_configuration_service.Service
|
||||
contactService: contact_service.Service
|
||||
chatService: chat_service.Service
|
||||
communityService: community_service.Service
|
||||
|
@ -33,8 +35,8 @@ type
|
|||
mailserversService: mailservers_service.Service
|
||||
|
||||
proc newController*(delegate: io_interface.AccessInterface, sectionId: string, isCommunity: bool, events: EventEmitter,
|
||||
settingsService: settings_service.Service, contactService: contact_service.Service,
|
||||
chatService: chat_service.Service, communityService: community_service.Service,
|
||||
settingsService: settings_service.Service, nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service, chatService: chat_service.Service, communityService: community_service.Service,
|
||||
messageService: message_service.Service, gifService: gif_service.Service,
|
||||
mailserversService: mailservers_service.Service): Controller =
|
||||
result = Controller()
|
||||
|
@ -43,6 +45,7 @@ proc newController*(delegate: io_interface.AccessInterface, sectionId: string, i
|
|||
result.isCommunitySection = isCommunity
|
||||
result.events = events
|
||||
result.settingsService = settingsService
|
||||
result.nodeConfigurationService = nodeConfigurationService
|
||||
result.contactService = contactService
|
||||
result.chatService = chatService
|
||||
result.communityService = communityService
|
||||
|
@ -112,14 +115,14 @@ proc init*(self: Controller) =
|
|||
var args = ChatUpdateArgs(e)
|
||||
for chat in args.chats:
|
||||
let belongsToCommunity = chat.communityId.len > 0
|
||||
self.delegate.addChatIfDontExist(chat, belongsToCommunity, self.events, self.settingsService,
|
||||
self.delegate.addChatIfDontExist(chat, belongsToCommunity, self.events, self.settingsService, self.nodeConfigurationService,
|
||||
self.contactService, self.chatService, self.communityService, self.messageService, self.gifService,
|
||||
self.mailserversService, setChatAsActive = false)
|
||||
|
||||
self.events.on(SIGNAL_CHAT_CREATED) do(e: Args):
|
||||
var args = CreatedChatArgs(e)
|
||||
let belongsToCommunity = args.chat.communityId.len > 0
|
||||
self.delegate.addChatIfDontExist(args.chat, belongsToCommunity, self.events, self.settingsService,
|
||||
self.delegate.addChatIfDontExist(args.chat, belongsToCommunity, self.events, self.settingsService, self.nodeConfigurationService,
|
||||
self.contactService, self.chatService, self.communityService, self.messageService, self.gifService,
|
||||
self.mailserversService, setChatAsActive = true)
|
||||
|
||||
|
@ -127,7 +130,7 @@ proc init*(self: Controller) =
|
|||
self.events.on(SIGNAL_COMMUNITY_CHANNEL_CREATED) do(e:Args):
|
||||
let args = CommunityChatArgs(e)
|
||||
let belongsToCommunity = args.chat.communityId.len > 0
|
||||
self.delegate.addChatIfDontExist(args.chat, belongsToCommunity, self.events, self.settingsService,
|
||||
self.delegate.addChatIfDontExist(args.chat, belongsToCommunity, self.events, self.settingsService, self.nodeConfigurationService,
|
||||
self.contactService, self.chatService, self.communityService, self.messageService, self.gifService,
|
||||
self.mailserversService, setChatAsActive = true)
|
||||
|
||||
|
@ -291,14 +294,14 @@ proc getOneToOneChatNameAndImage*(self: Controller, chatId: string):
|
|||
proc createPublicChat*(self: Controller, chatId: string) =
|
||||
let response = self.chatService.createPublicChat(chatId)
|
||||
if(response.success):
|
||||
self.delegate.addChatIfDontExist(response.chatDto, false, self.events, self.settingsService,
|
||||
self.delegate.addChatIfDontExist(response.chatDto, false, self.events, self.settingsService, self.nodeConfigurationService,
|
||||
self.contactService, self.chatService, self.communityService, self.messageService,
|
||||
self.gifService, self.mailserversService)
|
||||
|
||||
proc createOneToOneChat*(self: Controller, communityID: string, chatId: string, ensName: string) =
|
||||
let response = self.chatService.createOneToOneChat(communityID, chatId, ensName)
|
||||
if(response.success):
|
||||
self.delegate.addChatIfDontExist(response.chatDto, false, self.events, self.settingsService,
|
||||
self.delegate.addChatIfDontExist(response.chatDto, false, self.events, self.settingsService, self.nodeConfigurationService,
|
||||
self.contactService, self.chatService, self.communityService, self.messageService,
|
||||
self.gifService, self.mailserversService)
|
||||
|
||||
|
@ -321,7 +324,7 @@ proc clearChatHistory*(self: Controller, chatId: string) =
|
|||
self.chatService.clearChatHistory(chatId)
|
||||
|
||||
proc getCurrentFleet*(self: Controller): string =
|
||||
return self.settingsService.getFleetAsString()
|
||||
return self.nodeConfigurationService.getFleetAsString()
|
||||
|
||||
proc getContacts*(self: Controller, group: ContactsGroup): seq[ContactsDto] =
|
||||
return self.contactService.getContactsByGroup(group)
|
||||
|
@ -368,14 +371,14 @@ proc makeAdmin*(self: Controller, communityID: string, chatId: string, pubKey: s
|
|||
proc createGroupChat*(self: Controller, communityID: string, groupName: string, pubKeys: seq[string]) =
|
||||
let response = self.chatService.createGroupChat(communityID, groupName, pubKeys)
|
||||
if(response.success):
|
||||
self.delegate.addChatIfDontExist(response.chatDto, false, self.events, self.settingsService,
|
||||
self.delegate.addChatIfDontExist(response.chatDto, false, self.events, self.settingsService, self.nodeConfigurationService,
|
||||
self.contactService, self.chatService, self.communityService, self.messageService,
|
||||
self.gifService, self.mailserversService)
|
||||
|
||||
proc joinGroupChatFromInvitation*(self: Controller, groupName: string, chatId: string, adminPK: string) =
|
||||
let response = self.chatService.createGroupChatFromInvitation(groupName, chatId, adminPK)
|
||||
if(response.success):
|
||||
self.delegate.addChatIfDontExist(response.chatDto, false, self.events, self.settingsService,
|
||||
self.delegate.addChatIfDontExist(response.chatDto, false, self.events, self.settingsService, self.nodeConfigurationService,
|
||||
self.contactService, self.chatService, self.communityService, self.messageService,
|
||||
self.gifService, self.mailserversService)
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import NimQml
|
||||
|
||||
import ../../../../app_service/service/settings/service as settings_service
|
||||
import ../../../../app_service/service/node_configuration/service as node_configuration_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
|
||||
|
@ -22,6 +23,7 @@ method load*(self: AccessInterface,
|
|||
channelGroup: ChannelGroupDto,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -72,6 +74,7 @@ method addChatIfDontExist*(self: AccessInterface,
|
|||
belongsToCommunity: bool,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
|
|
@ -15,6 +15,7 @@ import ../../../core/eventemitter
|
|||
import ../../../core/notifications/details as notification_details
|
||||
import ../../../../app_service/common/types
|
||||
import ../../../../app_service/service/settings/service as settings_service
|
||||
import ../../../../app_service/service/node_configuration/service as node_configuration_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
|
||||
|
@ -43,6 +44,7 @@ proc buildChatSectionUI(self: Module,
|
|||
channelGroup: ChannelGroupDto,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -57,6 +59,7 @@ proc newModule*(
|
|||
# channels: seq[ChatDto],
|
||||
isCommunity: bool,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -66,8 +69,8 @@ proc newModule*(
|
|||
): Module =
|
||||
result = Module()
|
||||
result.delegate = delegate
|
||||
result.controller = controller.newController(result, sectionId, isCommunity, events, settingsService, contactService,
|
||||
chatService, communityService, messageService, gifService, mailserversService)
|
||||
result.controller = controller.newController(result, sectionId, isCommunity, events, settingsService, nodeConfigurationService,
|
||||
contactService, chatService, communityService, messageService, gifService, mailserversService)
|
||||
result.view = view.newView(result)
|
||||
result.viewVariant = newQVariant(result.view)
|
||||
result.moduleLoaded = false
|
||||
|
@ -96,6 +99,7 @@ proc amIMarkedAsAdminUser(self: Module, members: seq[ChatMember]): bool =
|
|||
|
||||
proc addSubmodule(self: Module, chatId: string, belongToCommunity: bool, isUsersListAvailable: bool, events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -103,7 +107,7 @@ proc addSubmodule(self: Module, chatId: string, belongToCommunity: bool, isUsers
|
|||
gifService: gif_service.Service,
|
||||
mailserversService: mailservers_service.Service) =
|
||||
self.chatContentModules[chatId] = chat_content_module.newModule(self, events, self.controller.getMySectionId(), chatId,
|
||||
belongToCommunity, isUsersListAvailable, settingsService, contactService, chatService, communityService,
|
||||
belongToCommunity, isUsersListAvailable, settingsService, nodeConfigurationService, contactService, chatService, communityService,
|
||||
messageService, gifService, mailserversService)
|
||||
|
||||
proc removeSubmodule(self: Module, chatId: string) =
|
||||
|
@ -116,6 +120,7 @@ proc buildChatSectionUI(
|
|||
channelGroup: ChannelGroupDto,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -165,7 +170,7 @@ proc buildChatSectionUI(
|
|||
notificationsCount, chatDto.muted, blocked, chatDto.active, chatDto.position,
|
||||
chatDto.categoryId, colorId, colorHash, onlineStatus = onlineStatus)
|
||||
self.view.chatsModel().appendItem(channelItem)
|
||||
self.addSubmodule(chatDto.id, belongToCommunity, isUsersListAvailable, events, settingsService,
|
||||
self.addSubmodule(chatDto.id, belongToCommunity, isUsersListAvailable, events, settingsService, nodeConfigurationService,
|
||||
contactService, chatService, communityService, messageService, gifService, mailserversService)
|
||||
|
||||
# make the first channel which doesn't belong to any category active when load the app
|
||||
|
@ -195,7 +200,7 @@ proc buildChatSectionUI(
|
|||
active=false, chatDto.position)
|
||||
categoryChannels.add(channelItem)
|
||||
self.addSubmodule(chatDto.id, belongToCommunity=true, isUsersListAvailable=true, events,
|
||||
settingsService, contactService, chatService, communityService, messageService, gifService,
|
||||
settingsService, nodeConfigurationService, contactService, chatService, communityService, messageService, gifService,
|
||||
mailserversService)
|
||||
|
||||
# in case there is no channels beyond categories,
|
||||
|
@ -258,6 +263,7 @@ method load*(
|
|||
channelGroup: ChannelGroupDto,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -267,8 +273,8 @@ method load*(
|
|||
self.controller.init()
|
||||
self.view.load()
|
||||
|
||||
self.buildChatSectionUI(channelGroup, events, settingsService, contactService, chatService,
|
||||
communityService, messageService, gifService, mailserversService)
|
||||
self.buildChatSectionUI(channelGroup, events, settingsService, nodeConfigurationService,
|
||||
contactService, chatService, communityService, messageService, gifService, mailserversService)
|
||||
|
||||
if(not self.controller.isCommunity()):
|
||||
# we do this only in case of chat section (not in case of communities)
|
||||
|
@ -403,6 +409,7 @@ method addNewChat*(
|
|||
belongsToCommunity: bool,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -437,8 +444,8 @@ method addNewChat*(
|
|||
chatDto.description, chatDto.chatType.int, amIChatAdmin, chatDto.timestamp.int, hasNotification, notificationsCount,
|
||||
chatDto.muted, blocked=false, active=false, chatDto.position, chatDto.categoryId, colorId, colorHash, chatDto.highlight,
|
||||
onlineStatus = onlineStatus)
|
||||
self.addSubmodule(chatDto.id, belongsToCommunity, isUsersListAvailable, events, settingsService, contactService, chatService,
|
||||
communityService, messageService, gifService, mailserversService)
|
||||
self.addSubmodule(chatDto.id, belongsToCommunity, isUsersListAvailable, events, settingsService, nodeConfigurationService,
|
||||
contactService, chatService, communityService, messageService, gifService, mailserversService)
|
||||
self.chatContentModules[chatDto.id].load()
|
||||
self.view.chatsModel().appendItem(item)
|
||||
if setChatAsActive:
|
||||
|
@ -453,8 +460,8 @@ method addNewChat*(
|
|||
chatDto.color, chatDto.emoji, chatDto.description, chatDto.chatType.int,
|
||||
amIChatAdmin, chatDto.timestamp.int, hasNotification, notificationsCount, chatDto.muted, blocked=false, active=false,
|
||||
chatDto.position)
|
||||
self.addSubmodule(chatDto.id, belongsToCommunity, isUsersListAvailable, events, settingsService, contactService, chatService,
|
||||
communityService, messageService, gifService, mailserversService)
|
||||
self.addSubmodule(chatDto.id, belongsToCommunity, isUsersListAvailable, events, settingsService, nodeConfigurationService,
|
||||
contactService, chatService, communityService, messageService, gifService, mailserversService)
|
||||
self.chatContentModules[chatDto.id].load()
|
||||
categoryItem.appendSubItem(channelItem)
|
||||
if setChatAsActive:
|
||||
|
@ -884,6 +891,7 @@ method addChatIfDontExist*(self: Module,
|
|||
belongsToCommunity: bool,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactService: contact_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -902,8 +910,9 @@ method addChatIfDontExist*(self: Module,
|
|||
elif (chat.chatType != ChatType.OneToOne):
|
||||
self.onChatRenamed(chat.id, chat.name)
|
||||
return
|
||||
self.addNewChat(chat, belongsToCommunity, events, settingsService, contactService, chatService,
|
||||
communityService, messageService, gifService, mailserversService, setChatAsActive)
|
||||
self.addNewChat(chat, belongsToCommunity, events, settingsService, nodeConfigurationService,
|
||||
contactService, chatService, communityService, messageService, gifService, mailserversService,
|
||||
setChatAsActive)
|
||||
|
||||
method downloadMessages*(self: Module, chatId: string, filePath: string) =
|
||||
if(not self.chatContentModules.contains(chatId)):
|
||||
|
|
|
@ -7,6 +7,7 @@ import ../../core/eventemitter
|
|||
import ../../core/notifications/notifications_manager
|
||||
import ../../../app_service/common/types
|
||||
import ../../../app_service/service/settings/service as settings_service
|
||||
import ../../../app_service/service/node_configuration/service as node_configuration_service
|
||||
import ../../../app_service/service/keychain/service as keychain_service
|
||||
import ../../../app_service/service/accounts/service as accounts_service
|
||||
import ../../../app_service/service/chat/service as chat_service
|
||||
|
@ -31,6 +32,7 @@ type
|
|||
delegate: io_interface.AccessInterface
|
||||
events: EventEmitter
|
||||
settingsService: settings_service.Service
|
||||
nodeConfigurationService: node_configuration_service.Service
|
||||
keychainService: keychain_service.Service
|
||||
accountsService: accounts_service.Service
|
||||
chatService: chat_service.Service
|
||||
|
@ -50,6 +52,7 @@ proc setActiveSection*(self: Controller, sectionId: string)
|
|||
proc newController*(delegate: io_interface.AccessInterface,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
keychainService: keychain_service.Service,
|
||||
accountsService: accounts_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
|
@ -66,6 +69,7 @@ proc newController*(delegate: io_interface.AccessInterface,
|
|||
result.delegate = delegate
|
||||
result.events = events
|
||||
result.settingsService = settingsService
|
||||
result.nodeConfigurationService = nodeConfigurationService
|
||||
result.keychainService = keychainService
|
||||
result.accountsService = accountsService
|
||||
result.chatService = chatService
|
||||
|
@ -110,6 +114,7 @@ proc init*(self: Controller) =
|
|||
args.community,
|
||||
self.events,
|
||||
self.settingsService,
|
||||
self.nodeConfigurationService,
|
||||
self.contactsService,
|
||||
self.chatService,
|
||||
self.communityService,
|
||||
|
@ -125,6 +130,7 @@ proc init*(self: Controller) =
|
|||
args.community,
|
||||
self.events,
|
||||
self.settingsService,
|
||||
self.nodeConfigurationService,
|
||||
self.contactsService,
|
||||
self.chatService,
|
||||
self.communityService,
|
||||
|
@ -144,6 +150,7 @@ proc init*(self: Controller) =
|
|||
args.community,
|
||||
self.events,
|
||||
self.settingsService,
|
||||
self.nodeConfigurationService,
|
||||
self.contactsService,
|
||||
self.chatService,
|
||||
self.communityService,
|
||||
|
@ -161,6 +168,7 @@ proc init*(self: Controller) =
|
|||
args.community,
|
||||
self.events,
|
||||
self.settingsService,
|
||||
self.nodeConfigurationService,
|
||||
self.contactsService,
|
||||
self.chatService,
|
||||
self.communityService,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import NimQml
|
||||
|
||||
import ../../../app_service/service/settings/service as settings_service
|
||||
import ../../../app_service/service/node_configuration/service as node_configuration_service
|
||||
import ../../../app_service/service/contacts/service as contacts_service
|
||||
import ../../../app_service/service/chat/service as chat_service
|
||||
import ../../../app_service/service/community/service as community_service
|
||||
|
@ -24,6 +25,7 @@ method load*(
|
|||
self: AccessInterface,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactsService: contacts_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -102,6 +104,7 @@ method toggleSection*(self: AccessInterface, sectionType: SectionType) {.base.}
|
|||
|
||||
method communityJoined*(self: AccessInterface, community: CommunityDto, events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactsService: contacts_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
|
|
@ -142,6 +142,7 @@ proc newModule*[T](
|
|||
result,
|
||||
events,
|
||||
settingsService,
|
||||
nodeConfigurationService,
|
||||
keychainService,
|
||||
accountsService,
|
||||
chatService,
|
||||
|
@ -330,6 +331,7 @@ method load*[T](
|
|||
self: Module[T],
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactsService: contacts_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -354,6 +356,7 @@ method load*[T](
|
|||
channelGroup.id,
|
||||
isCommunity = channelGroup.channelGroupType == ChannelGroupType.Community,
|
||||
settingsService,
|
||||
nodeConfigurationService,
|
||||
contactsService,
|
||||
chatService,
|
||||
communityService,
|
||||
|
@ -366,7 +369,7 @@ method load*[T](
|
|||
if(activeSectionId == channelGroupItem.id):
|
||||
activeSection = channelGroupItem
|
||||
|
||||
self.channelGroupModules[channelGroup.id].load(channelGroup, events, settingsService,
|
||||
self.channelGroupModules[channelGroup.id].load(channelGroup, events, settingsService, nodeConfigurationService,
|
||||
contactsService, chatService, communityService, messageService, gifService, mailserversService)
|
||||
|
||||
# Communities Portal Section
|
||||
|
@ -689,6 +692,7 @@ method communityJoined*[T](
|
|||
community: CommunityDto,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
contactsService: contacts_service.Service,
|
||||
chatService: chat_service.Service,
|
||||
communityService: community_service.Service,
|
||||
|
@ -706,6 +710,7 @@ method communityJoined*[T](
|
|||
community.id,
|
||||
isCommunity = true,
|
||||
settingsService,
|
||||
nodeConfigurationService,
|
||||
contactsService,
|
||||
chatService,
|
||||
communityService,
|
||||
|
@ -714,7 +719,7 @@ method communityJoined*[T](
|
|||
mailserversService
|
||||
)
|
||||
let channelGroup = community.toChannelGroupDto()
|
||||
self.channelGroupModules[community.id].load(channelGroup, events, settingsService, contactsService,
|
||||
self.channelGroupModules[community.id].load(channelGroup, events, settingsService, nodeConfigurationService, contactsService,
|
||||
chatService, communityService, messageService, gifService, mailserversService)
|
||||
|
||||
let communitySectionItem = self.createChannelGroupItem(channelGroup)
|
||||
|
|
|
@ -89,7 +89,7 @@ proc fetchBitsSet*(self: Controller) =
|
|||
self.nodeService.fetchBitsSet()
|
||||
|
||||
proc getWakuVersion*(self: Controller): int =
|
||||
var fleet = self.settingsService.getFleet()
|
||||
var fleet = self.nodeConfigurationService.getFleet()
|
||||
let isWakuV2 = if fleet == WakuV2Prod or fleet == WakuV2Test or fleet == StatusTest or fleet == StatusProd:
|
||||
true
|
||||
else:
|
||||
|
|
|
@ -37,7 +37,7 @@ proc init*(self: Controller) =
|
|||
discard
|
||||
|
||||
proc getFleet*(self: Controller): string =
|
||||
self.settingsService.getFleetAsString()
|
||||
self.nodeConfigurationService.getFleetAsString()
|
||||
|
||||
proc changeFleetTo*(self: Controller, fleet: string) =
|
||||
if (not self.nodeConfigurationService.setFleet(fleet)):
|
||||
|
|
|
@ -95,7 +95,7 @@ proc newModule*(delegate: delegate_interface.AccessInterface,
|
|||
result.aboutModule = about_module.newModule(result, events, aboutService)
|
||||
result.advancedModule = advanced_module.newModule(result, events, settingsService, stickersService, nodeConfigurationService)
|
||||
result.devicesModule = devices_module.newModule(result, events, settingsService, devicesService)
|
||||
result.syncModule = sync_module.newModule(result, events, settingsService, mailserversService)
|
||||
result.syncModule = sync_module.newModule(result, events, settingsService, nodeConfigurationService, mailserversService)
|
||||
result.notificationsModule = notifications_module.newModule(result, events, settingsService, chatService, contactsService)
|
||||
result.ensUsernamesModule = ens_usernames_module.newModule(
|
||||
result, events, settingsService, ensService, walletAccountService, networkService
|
||||
|
|
|
@ -5,6 +5,7 @@ import ../../../../core/eventemitter
|
|||
import ../../../../core/fleets/fleet_configuration
|
||||
import ../../../../../app_service/service/settings/service as settings_service
|
||||
import ../../../../../app_service/service/mailservers/service as mailservers_service
|
||||
import ../../../../../app_service/service/node_configuration/service as node_configuration_service
|
||||
|
||||
logScope:
|
||||
topics = "profile-section-sync-module-controller"
|
||||
|
@ -14,16 +15,19 @@ type
|
|||
delegate: io_interface.AccessInterface
|
||||
events: EventEmitter
|
||||
settingsService: settings_service.Service
|
||||
nodeConfigurationService: node_configuration_service.Service
|
||||
mailserversService: mailservers_service.Service
|
||||
|
||||
proc newController*(delegate: io_interface.AccessInterface,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
mailserversService: mailservers_service.Service): Controller =
|
||||
result = Controller()
|
||||
result.delegate = delegate
|
||||
result.events = events
|
||||
result.settingsService = settingsService
|
||||
result.nodeConfigurationService = nodeConfigurationService
|
||||
result.mailserversService = mailserversService
|
||||
|
||||
proc delete*(self: Controller) =
|
||||
|
@ -38,11 +42,11 @@ proc getAllMailservers*(self: Controller): seq[tuple[name: string, nodeAddress:
|
|||
return self.mailserversService.getAllMailservers()
|
||||
|
||||
proc getPinnedMailserver*(self: Controller): string =
|
||||
let fleet = self.settingsService.getFleet()
|
||||
let fleet = self.nodeConfigurationService.getFleet()
|
||||
self.settingsService.getPinnedMailserver(fleet)
|
||||
|
||||
proc pinMailserver*(self: Controller, mailserverID: string) =
|
||||
let fleet = self.settingsService.getFleet()
|
||||
let fleet = self.nodeConfigurationService.getFleet()
|
||||
discard self.settingsService.pinMailserver(mailserverID, fleet)
|
||||
|
||||
proc saveNewMailserver*(self: Controller, name: string, nodeAddress: string) =
|
||||
|
|
|
@ -6,6 +6,7 @@ import view, controller, model, item
|
|||
import ../../../../core/eventemitter
|
||||
import ../../../../../app_service/service/settings/service as settings_service
|
||||
import ../../../../../app_service/service/mailservers/service as mailservers_service
|
||||
import ../../../../../app_service/service/node_configuration/service as node_configuration_service
|
||||
|
||||
export io_interface
|
||||
|
||||
|
@ -23,12 +24,13 @@ type
|
|||
proc newModule*(delegate: delegate_interface.AccessInterface,
|
||||
events: EventEmitter,
|
||||
settingsService: settings_service.Service,
|
||||
nodeConfigurationService: node_configuration_service.Service,
|
||||
mailserversService: mailservers_service.Service): Module =
|
||||
result = Module()
|
||||
result.delegate = delegate
|
||||
result.view = view.newView(result)
|
||||
result.viewVariant = newQVariant(result.view)
|
||||
result.controller = controller.newController(result, events, settingsService, mailserversService)
|
||||
result.controller = controller.newController(result, events, settingsService, nodeConfigurationService, mailserversService)
|
||||
result.moduleLoaded = false
|
||||
|
||||
method delete*(self: Module) =
|
||||
|
|
|
@ -108,7 +108,7 @@ QtObject:
|
|||
self.initMailservers()
|
||||
self.fetchMailservers()
|
||||
|
||||
let fleet = self.settingsService.getFleet()
|
||||
let fleet = self.nodeConfigurationService.getFleet()
|
||||
if TEST_PEER_ENR != "":
|
||||
var found = false
|
||||
for mailserver in self.mailservers:
|
||||
|
@ -188,7 +188,7 @@ QtObject:
|
|||
proc initMailservers(self: Service) =
|
||||
let wakuVersion = self.nodeConfigurationService.getWakuVersion()
|
||||
let isWakuV2 = wakuVersion == WAKU_VERSION_2
|
||||
let fleet = self.settingsService.getFleet()
|
||||
let fleet = self.nodeConfigurationService.getFleet()
|
||||
let mailservers = self.fleetConfiguration.getMailservers(fleet, isWakuV2)
|
||||
|
||||
for (name, nodeAddress) in mailservers.pairs():
|
||||
|
@ -214,7 +214,7 @@ QtObject:
|
|||
|
||||
proc saveMailserver*(self: Service, name: string, nodeAddress: string): string =
|
||||
try:
|
||||
let fleet = self.settingsService.getFleetAsString()
|
||||
let fleet = self.nodeConfigurationService.getFleetAsString()
|
||||
let id = $genUUID()
|
||||
|
||||
let response = status_mailservers.saveMailserver(id, name, nodeAddress, fleet)
|
||||
|
@ -231,7 +231,7 @@ QtObject:
|
|||
|
||||
proc enableAutomaticSelection*(self: Service, value: bool) =
|
||||
if value:
|
||||
let fleet = self.settingsService.getFleet()
|
||||
let fleet = self.nodeConfigurationService.getFleet()
|
||||
discard self.settingsService.unpinMailserver(fleet)
|
||||
else:
|
||||
discard # TODO: handle pin mailservers in status-go (in progress)
|
||||
|
@ -244,5 +244,5 @@ QtObject:
|
|||
#mailserverWorker.start(task)
|
||||
|
||||
proc onActiveMailserverResult*(self: Service, response: string) {.slot.} =
|
||||
let fleet = self.settingsService.getFleet()
|
||||
let fleet = self.nodeConfigurationService.getFleet()
|
||||
discard self.settingsService.pinMailserver(response, fleet)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import NimQml, chronicles, strutils, json, nimcrypto
|
||||
|
||||
import ../settings/service as settings_service
|
||||
import ../node_configuration/service as node_configuration_service
|
||||
|
||||
import ../../../app/core/eventemitter
|
||||
import ../../../app/core/tasks/[qt, threadpool]
|
||||
|
@ -25,6 +26,7 @@ QtObject:
|
|||
events*: EventEmitter
|
||||
threadpool: ThreadPool
|
||||
settingsService: settings_service.Service
|
||||
nodeConfigurationService: node_configuration_service.Service
|
||||
bloomBitsSet: int
|
||||
peers*: seq[string]
|
||||
connected: bool
|
||||
|
@ -32,12 +34,13 @@ QtObject:
|
|||
proc delete*(self: Service) =
|
||||
self.QObject.delete
|
||||
|
||||
proc newService*(events: EventEmitter, threadpool: ThreadPool, settingsService: settings_service.Service): Service =
|
||||
proc newService*(events: EventEmitter, threadpool: ThreadPool, settingsService: settings_service.Service, nodeConfigurationService: node_configuration_service.Service): Service =
|
||||
new(result, delete)
|
||||
result.QObject.setup
|
||||
result.events = events
|
||||
result.threadpool = threadpool
|
||||
result.settingsService = settingsService
|
||||
result.nodeConfigurationService = nodeConfigurationService
|
||||
result.peers = @[]
|
||||
result.connected = false
|
||||
|
||||
|
@ -77,7 +80,7 @@ QtObject:
|
|||
result.add(id)
|
||||
|
||||
proc fetchPeers*(self: Service): seq[string] =
|
||||
var fleet = self.settingsService.getFleet()
|
||||
var fleet = self.nodeConfigurationService.getFleet()
|
||||
let isWakuV2 = if fleet == WakuV2Prod or fleet == WakuV2Test or fleet == StatusTest or fleet == StatusProd:
|
||||
true
|
||||
else:
|
||||
|
|
|
@ -187,6 +187,15 @@ proc setBloomLevel*(self: Service, bloomLevel: string): bool =
|
|||
|
||||
return false
|
||||
|
||||
proc getFleet*(self: Service): Fleet =
|
||||
result = self.settingsService.getFleet()
|
||||
if result == Fleet.Undefined:
|
||||
let fleetFromNodeConfig = self.configuration.ClusterConfig.Fleet
|
||||
result = parseEnum[Fleet](fleetFromNodeConfig)
|
||||
|
||||
proc getFleetAsString*(self: Service): string =
|
||||
result = $self.getFleet()
|
||||
|
||||
proc setFleet*(self: Service, fleet: string): bool =
|
||||
if(not self.settingsService.saveFleet(fleet)):
|
||||
error "error saving fleet ", procName="setFleet"
|
||||
|
|
|
@ -329,14 +329,11 @@ QtObject:
|
|||
return true
|
||||
|
||||
proc getFleetAsString*(self: Service): string =
|
||||
if(self.settings.fleet.len == 0):
|
||||
self.settings.fleet = DEFAULT_FLEET
|
||||
return self.settings.fleet
|
||||
result = self.settings.fleet
|
||||
|
||||
proc getFleet*(self: Service): Fleet =
|
||||
let fleetAsString = self.getFleetAsString()
|
||||
let fleet = parseEnum[Fleet](fleetAsString)
|
||||
return fleet
|
||||
return parseEnum[Fleet](fleetAsString)
|
||||
|
||||
proc getCurrentUserStatus*(self: Service): CurrentUserStatus =
|
||||
self.settings.currentUserStatus
|
||||
|
|
Loading…
Reference in New Issue