style: remove trailing whitespaces

This commit is contained in:
Patryk Osmaczko 2022-02-09 10:43:23 +01:00 committed by osmaczko
parent 914c7b2839
commit ba7a6d5d34
562 changed files with 2516 additions and 2538 deletions

View File

@ -40,10 +40,10 @@ import ../global/global_singleton
import ../core/[main]
type
AppController* = ref object of RootObj
type
AppController* = ref object of RootObj
statusFoundation: StatusFoundation
# Global
localAppSettingsVariant: QVariant
localAccountSettingsVariant: QVariant
@ -122,7 +122,7 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
# Services
result.generalService = general_service.newService()
result.settingsService = settings_service.newService()
result.nodeConfigurationService = node_configuration_service.newService(statusFoundation.fleetConfiguration,
result.nodeConfigurationService = node_configuration_service.newService(statusFoundation.fleetConfiguration,
result.settingsService)
result.osNotificationService = os_notification_service.newService(statusFoundation.events)
result.keychainService = keychain_service.newService(statusFoundation.events)
@ -136,12 +136,12 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
result.contactsService)
result.activityCenterService = activity_center_service.newService(statusFoundation.events,
statusFoundation.threadpool, result.chatService)
result.tokenService = token_service.newService(statusFoundation.events, statusFoundation.threadpool,
result.tokenService = token_service.newService(statusFoundation.events, statusFoundation.threadpool,
result.settingsService)
result.collectibleService = collectible_service.newService(result.settingsService)
result.walletAccountService = wallet_account_service.newService(statusFoundation.events, result.settingsService,
result.walletAccountService = wallet_account_service.newService(statusFoundation.events, result.settingsService,
result.accountsService, result.tokenService)
result.transactionService = transaction_service.newService(statusFoundation.events, statusFoundation.threadpool,
result.transactionService = transaction_service.newService(statusFoundation.events, statusFoundation.threadpool,
result.walletAccountService, result.ethService, result.networkService, result.settingsService)
result.bookmarkService = bookmark_service.newService()
result.profileService = profile_service.newService()
@ -155,30 +155,30 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
result.networkService,
result.chatService
)
result.aboutService = about_service.newService(statusFoundation.events, statusFoundation.threadpool,
result.aboutService = about_service.newService(statusFoundation.events, statusFoundation.threadpool,
result.settingsService)
result.dappPermissionsService = dapp_permissions_service.newService()
result.languageService = language_service.newService()
# result.mnemonicService = mnemonic_service.newService()
result.privacyService = privacy_service.newService(statusFoundation.events, result.settingsService,
result.privacyService = privacy_service.newService(statusFoundation.events, result.settingsService,
result.accountsService)
result.providerService = provider_service.newService(result.dappPermissionsService, result.settingsService)
result.savedAddressService = saved_address_service.newService(statusFoundation.events)
result.devicesService = devices_service.newService(statusFoundation.events, result.settingsService)
result.mailserversService = mailservers_service.newService(statusFoundation.events, statusFoundation.threadpool,
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.nodeService = node_service.newService(statusFoundation.events, statusFoundation.threadpool,
result.settingsService)
result.gifService = gif_service.newService(result.settingsService)
result.ensService = ens_service.newService(statusFoundation.events, statusFoundation.threadpool,
result.settingsService, result.walletAccountService, result.transactionService, result.ethService,
result.ensService = ens_service.newService(statusFoundation.events, statusFoundation.threadpool,
result.settingsService, result.walletAccountService, result.transactionService, result.ethService,
result.networkService, result.tokenService)
# Modules
result.startupModule = startup_module.newModule[AppController](
result,
statusFoundation.events,
result.keychainService,
result.keychainService,
result.accountsService
)
result.mainModule = main_module.newModule[AppController](
@ -228,7 +228,7 @@ proc delete*(self: AppController) =
self.mainModule.delete
self.ethService.delete
self.languageService.delete
self.localAppSettingsVariant.delete
self.localAccountSettingsVariant.delete
self.localAccountSensitiveSettingsVariant.delete
@ -282,7 +282,7 @@ proc start*(self: AppController) =
self.generalService.init()
self.ethService.init()
self.accountsService.init()
self.startupModule.load()
proc load(self: AppController) =
@ -314,7 +314,7 @@ proc load(self: AppController) =
singletonInstance.engine.setRootContextProperty("globalUtils", self.globalUtilsVariant)
# other global instances
self.buildAndRegisterLocalAccountSensitiveSettings()
self.buildAndRegisterLocalAccountSensitiveSettings()
self.buildAndRegisterUserProfile()
# load main module
@ -341,12 +341,12 @@ proc userLoggedIn*(self: AppController) =
self.osNotificationService.userLoggedIn()
proc buildAndRegisterLocalAccountSensitiveSettings(self: AppController) =
proc buildAndRegisterLocalAccountSensitiveSettings(self: AppController) =
var pubKey = self.settingsService.getPublicKey()
singletonInstance.localAccountSensitiveSettings.setFileName(pubKey)
singletonInstance.engine.setRootContextProperty("localAccountSensitiveSettings", self.localAccountSensitiveSettingsVariant)
proc buildAndRegisterUserProfile(self: AppController) =
proc buildAndRegisterUserProfile(self: AppController) =
let pubKey = self.settingsService.getPublicKey()
let preferredName = self.settingsService.getPreferredName()
let ensUsernames = self.settingsService.getEnsUsernames()
@ -365,7 +365,7 @@ proc buildAndRegisterUserProfile(self: AppController) =
let meAsContact = self.contactsService.getContactById(pubKey)
singletonInstance.userProfile.setFixedData(loggedInAccount.name, loggedInAccount.keyUid, loggedInAccount.identicon,
singletonInstance.userProfile.setFixedData(loggedInAccount.name, loggedInAccount.keyUid, loggedInAccount.identicon,
pubKey)
singletonInstance.userProfile.setPreferredName(preferredName)
singletonInstance.userProfile.setEnsName(meAsContact.name)

View File

@ -4,13 +4,13 @@ import # system libs
import # deps
uuids
type
type
Args* = ref object of RootObj # ...args
Handler* = proc (args: Args) {.closure.} # callback function type
EventEmitter* = ref object
events: Table[string, Table[UUID, Handler]]
proc createEventEmitter*(): EventEmitter =
proc createEventEmitter*(): EventEmitter =
result.new
result.events = initTable[string, Table[UUID, Handler]]()
@ -19,10 +19,10 @@ proc on(this: EventEmitter, name: string, handlerId: UUID, handler: Handler): vo
if this.events.hasKey(name):
this.events[name].add handlerId, handler
return
this.events[name] = [(handlerId, handler)].toTable
proc on*(this: EventEmitter, name: string, handler: Handler): void =
proc on*(this: EventEmitter, name: string, handler: Handler): void =
var uuid: UUID
this.on(name, uuid, handler)

View File

@ -8,7 +8,7 @@ type
WakuV2Prod = "wakuv2.prod"
WakuV2Test = "wakuv2.test"
GoWakuTest = "go-waku.test"
FleetNodes* {.pure.} = enum
Bootnodes = "boot",
Mailservers = "mail",
@ -57,11 +57,11 @@ proc getNodes*(self: FleetConfiguration, fleet: Fleet, nodeType: FleetNodes = Fl
result = toSeq(self.fleet[$fleet][$nodeType].values)
proc getMailservers*(self: FleetConfiguration, fleet: Fleet, isWakuV2: bool): Table[string, string] =
# TODO: If using wakuV2, this assumes that Waku nodes in fleet.status.json are also store nodes.
# TODO: If using wakuV2, this assumes that Waku nodes in fleet.status.json are also store nodes.
# Maybe it make senses to add a "waku-store" section in case we want to have separate node types?
# Discuss with @iurimatias, @cammellos and Vac team
let fleetKey = if isWakuV2: $FleetNodes.Waku else: $FleetNodes.Mailservers
if not self.fleet[$fleet].hasKey(fleetKey) :
if not self.fleet[$fleet].hasKey(fleetKey) :
result = initTable[string,string]()
return
result = self.fleet[$fleet][fleetKey]
result = self.fleet[$fleet][fleetKey]

View File

@ -17,7 +17,7 @@ type StatusFoundation* = ref object
proc newStatusFoundation*(fleetConfig: string): StatusFoundation =
result = StatusFoundation()
result.events = createEventEmitter()
result.events = createEventEmitter()
result.fleetConfiguration = newFleetConfiguration(fleetConfig)
result.threadpool = newThreadPool()
result.signalsManager = newSignalsManager(result.events)

View File

@ -5,7 +5,7 @@ import signal_type
type ChroniclesLogsSignal* = ref object of Signal
content*: string
proc fromEvent*(T: type ChroniclesLogsSignal, jsonSignal: JsonNode): ChroniclesLogsSignal =
proc fromEvent*(T: type ChroniclesLogsSignal, jsonSignal: JsonNode): ChroniclesLogsSignal =
result = ChroniclesLogsSignal()
result.signalType = SignalType.ChroniclesLogs
if jsonSignal["event"].kind != JNull:

View File

@ -8,7 +8,7 @@ import signal_type
type CommunitySignal* = ref object of Signal
community*: CommunityDto
proc fromEvent*(T: type CommunitySignal, event: JsonNode): CommunitySignal =
proc fromEvent*(T: type CommunitySignal, event: JsonNode): CommunitySignal =
result = CommunitySignal()
result.signalType = SignalType.CommunityFound
result.community = event["event"].toCommunityDto()

View File

@ -6,7 +6,7 @@ import signal_type
type DiscoverySummarySignal* = ref object of Signal
enodes*: seq[string]
proc fromEvent*(T: type DiscoverySummarySignal, jsonSignal: JsonNode): DiscoverySummarySignal =
proc fromEvent*(T: type DiscoverySummarySignal, jsonSignal: JsonNode): DiscoverySummarySignal =
result = DiscoverySummarySignal()
result.signalType = SignalType.DiscoverySummary
if jsonSignal["event"].kind != JNull:

View File

@ -6,10 +6,9 @@ import signal_type
type EnvelopeSentSignal* = ref object of Signal
messageIds*: seq[string]
proc fromEvent*(T: type EnvelopeSentSignal, jsonSignal: JsonNode): EnvelopeSentSignal =
proc fromEvent*(T: type EnvelopeSentSignal, jsonSignal: JsonNode): EnvelopeSentSignal =
result = EnvelopeSentSignal()
result.signalType = SignalType.EnvelopeSent
if jsonSignal["event"].kind != JNull and jsonSignal["event"].hasKey("ids") and jsonSignal["event"]["ids"].kind != JNull:
for messageId in jsonSignal["event"]["ids"]:
result.messageIds.add(messageId.getStr)

View File

@ -6,10 +6,9 @@ import signal_type
type EnvelopeExpiredSignal* = ref object of Signal
messageIds*: seq[string]
proc fromEvent*(T: type EnvelopeExpiredSignal, jsonSignal: JsonNode): EnvelopeExpiredSignal =
proc fromEvent*(T: type EnvelopeExpiredSignal, jsonSignal: JsonNode): EnvelopeExpiredSignal =
result = EnvelopeExpiredSignal()
result.signalType = SignalType.EnvelopeExpired
if jsonSignal["event"].kind != JNull and jsonSignal["event"].hasKey("ids") and jsonSignal["event"]["ids"].kind != JNull:
for messageId in jsonSignal["event"]["ids"]:
result.messageIds.add(messageId.getStr)

View File

@ -9,7 +9,7 @@ type MailserverRequestCompletedSignal* = ref object of Signal
cursor*: string
errorMessage*: string
error*: bool
type MailserverRequestExpiredSignal* = ref object of Signal
# TODO
@ -21,7 +21,7 @@ type HistoryRequestBatchProcessedSignal* = ref object of Signal
requestId*: string
batchIndex*: int
numBatches*: int
type HistoryRequestCompletedSignal* = ref object of Signal
requestId*: string
@ -36,7 +36,7 @@ type MailserverAvailableSignal* = ref object of Signal
type MailserverChangedSignal* = ref object of Signal
address*: string
proc fromEvent*(T: type MailserverRequestCompletedSignal, jsonSignal: JsonNode): MailserverRequestCompletedSignal =
proc fromEvent*(T: type MailserverRequestCompletedSignal, jsonSignal: JsonNode): MailserverRequestCompletedSignal =
result = MailserverRequestCompletedSignal()
result.signalType = SignalType.MailserverRequestCompleted
if jsonSignal["event"].kind != JNull:
@ -45,31 +45,31 @@ proc fromEvent*(T: type MailserverRequestCompletedSignal, jsonSignal: JsonNode):
result.cursor = jsonSignal["event"]{"cursor"}.getStr()
result.errorMessage = jsonSignal["event"]{"errorMessage"}.getStr()
result.error = result.errorMessage != ""
proc fromEvent*(T: type MailserverRequestExpiredSignal, jsonSignal: JsonNode): MailserverRequestExpiredSignal =
proc fromEvent*(T: type MailserverRequestExpiredSignal, jsonSignal: JsonNode): MailserverRequestExpiredSignal =
# TODO: parse signal
result = MailserverRequestExpiredSignal()
result.signalType = SignalType.MailserverRequestExpired
proc fromEvent*(T: type HistoryRequestStartedSignal, jsonSignal: JsonNode): HistoryRequestStartedSignal =
proc fromEvent*(T: type HistoryRequestStartedSignal, jsonSignal: JsonNode): HistoryRequestStartedSignal =
result = HistoryRequestStartedSignal()
result.signalType = SignalType.HistoryRequestStarted
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
result.numBatches = jsonSIgnal["event"]{"numBatches"}.getInt()
proc fromEvent*(T: type HistoryRequestBatchProcessedSignal, jsonSignal: JsonNode): HistoryRequestBatchProcessedSignal =
proc fromEvent*(T: type HistoryRequestBatchProcessedSignal, jsonSignal: JsonNode): HistoryRequestBatchProcessedSignal =
result = HistoryRequestBatchProcessedSignal()
result.signalType = SignalType.HistoryRequestBatchProcessed
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
result.batchIndex = jsonSIgnal["event"]{"batchIndex"}.getInt()
result.numBatches = jsonSIgnal["event"]{"numBatches"}.getInt()
proc fromEvent*(T: type HistoryRequestCompletedSignal, jsonSignal: JsonNode): HistoryRequestCompletedSignal =
proc fromEvent*(T: type HistoryRequestCompletedSignal, jsonSignal: JsonNode): HistoryRequestCompletedSignal =
result = HistoryRequestCompletedSignal()
result.signalType = SignalType.HistoryRequestCompleted
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
proc fromEvent*(T: type HistoryRequestFailedSignal, jsonSignal: JsonNode): HistoryRequestFailedSignal =
proc fromEvent*(T: type HistoryRequestFailedSignal, jsonSignal: JsonNode): HistoryRequestFailedSignal =
result = HistoryRequestFailedSignal()
result.signalType = SignalType.HistoryRequestStarted
result.requestId = jsonSignal["event"]{"requestId"}.getStr()
@ -77,12 +77,12 @@ proc fromEvent*(T: type HistoryRequestFailedSignal, jsonSignal: JsonNode): Histo
result.errorMessage = jsonSignal["event"]{"errorMessage"}.getStr()
result.error = result.errorMessage != ""
proc fromEvent*(T: type MailserverAvailableSignal, jsonSignal: JsonNode): MailserverAvailableSignal =
proc fromEvent*(T: type MailserverAvailableSignal, jsonSignal: JsonNode): MailserverAvailableSignal =
result = MailserverAvailableSignal()
result.signalType = SignalType.MailserverAvailable
result.address = jsonSignal["event"]{"address"}.getStr()
proc fromEvent*(T: type MailserverChangedSignal, jsonSignal: JsonNode): MailserverChangedSignal =
proc fromEvent*(T: type MailserverChangedSignal, jsonSignal: JsonNode): MailserverChangedSignal =
result = MailserverChangedSignal()
result.signalType = SignalType.MailserverChanged
result.address = jsonSignal["event"]{"address"}.getStr()

View File

@ -22,7 +22,7 @@ type MessageSignal* = ref object of Signal
statusUpdates*: seq[StatusUpdateDto]
deletedMessages*: seq[RemovedMessageDto]
proc fromEvent*(T: type MessageSignal, event: JsonNode): MessageSignal =
proc fromEvent*(T: type MessageSignal, event: JsonNode): MessageSignal =
var signal:MessageSignal = MessageSignal()
signal.messages = @[]
signal.contacts = @[]
@ -44,7 +44,7 @@ proc fromEvent*(T: type MessageSignal, event: JsonNode): MessageSignal =
if event["event"]{"statusUpdates"} != nil:
for jsonStatusUpdate in event["event"]["statusUpdates"]:
var statusUpdate = jsonStatusUpdate.toStatusUpdateDto()
signal.statusUpdates.add(statusUpdate)
signal.statusUpdates.add(statusUpdate)
if event["event"]{"installations"} != nil:
for jsonDevice in event["event"]["installations"]:

View File

@ -5,7 +5,7 @@ import signal_type
type PeerStatsSignal* = ref object of Signal
peers*: seq[string]
proc fromEvent*(T: type PeerStatsSignal, jsonSignal: JsonNode): PeerStatsSignal =
proc fromEvent*(T: type PeerStatsSignal, jsonSignal: JsonNode): PeerStatsSignal =
result = PeerStatsSignal()
result.signalType = SignalType.PeerStats
if jsonSignal["event"].kind != JNull:

View File

@ -16,7 +16,7 @@ proc toStats(jsonMsg: JsonNode): Stats =
downloadRate: uint64(jsonMsg{"downloadRate"}.getBiggestInt())
)
proc fromEvent*(T: type StatsSignal, event: JsonNode): StatsSignal =
proc fromEvent*(T: type StatsSignal, event: JsonNode): StatsSignal =
result = StatsSignal()
result.signalType = SignalType.Stats
result.stats = event["event"].toStats

View File

@ -12,10 +12,10 @@ type WalletSignal* = ref object of Signal
# newTransactions*: ???
erc20*: bool
proc fromEvent*(T: type WalletSignal, jsonSignal: JsonNode): WalletSignal =
proc fromEvent*(T: type WalletSignal, jsonSignal: JsonNode): WalletSignal =
result = WalletSignal()
result.signalType = SignalType.Wallet
result.content = $jsonSignal
result.content = $jsonSignal
if jsonSignal["event"].kind != JNull:
result.eventType = jsonSignal["event"]["type"].getStr
result.blockNumber = jsonSignal["event"]{"blockNumber"}.getInt
@ -25,4 +25,3 @@ proc fromEvent*(T: type WalletSignal, jsonSignal: JsonNode): WalletSignal =
if jsonSignal["event"]["accounts"].kind != JNull:
for account in jsonSignal["event"]["accounts"]:
result.accounts.add(account.getStr)

View File

@ -23,7 +23,7 @@ proc toFilter(jsonMsg: JsonNode): Filter =
topic: jsonMsg{"topic"}.getStr,
)
proc fromEvent*(T: type WhisperFilterSignal, event: JsonNode): WhisperFilterSignal =
proc fromEvent*(T: type WhisperFilterSignal, event: JsonNode): WhisperFilterSignal =
if event["event"]{"filters"} != nil:
for jsonMsg in event["event"]["filters"]:
result.filters.add(jsonMsg.toFilter)

View File

@ -28,14 +28,14 @@ QtObject:
proc processSignal(self: SignalsManager, statusSignal: string) =
var jsonSignal: JsonNode
try:
try:
jsonSignal = statusSignal.parseJson
except:
error "Invalid signal received", data = statusSignal
return
trace "Raw signal data", data = $jsonSignal
var signal:Signal
try:
signal = self.decode(jsonSignal)
@ -86,4 +86,4 @@ QtObject:
of SignalType.MailserverChanged: MailserverChangedSignal.fromEvent(jsonSignal)
else: Signal()
result.signalType = signalType
result.signalType = signalType

View File

@ -1,7 +1,7 @@
{.used.}
import ./remote_signals/[base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages,
import ./remote_signals/[base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages,
peerstats, signal_type, stats, wallet, whisper_filter, keycard]
export base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages, peerstats,
signal_type, stats, wallet, whisper_filter, keycard
export base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages, peerstats,
signal_type, stats, wallet, whisper_filter, keycard

View File

@ -43,4 +43,4 @@ method worker(arg: WorkerThreadArg) {.async, base, gcsafe, nimcall.} =
method workerThread(arg: WorkerThreadArg) {.thread, base, gcsafe, nimcall.} =
# override this base method
raise newException(CatchableError, "Method without implementation override")
raise newException(CatchableError, "Method without implementation override")

View File

@ -8,4 +8,4 @@ type
ToggleSectionArgs* = ref object of Args
sectionType*: SectionType
const TOGGLE_SECTION* = "toggleSection"
const TOGGLE_SECTION* = "toggleSection"

View File

@ -12,8 +12,8 @@ export local_app_settings
export user_profile
export utils
type
GlobalSingleton = object
type
GlobalSingleton = object
# Don't export GlobalSingleton type.
# Other global things like local/global settings will be added here.
@ -66,4 +66,4 @@ proc delete*(self: GlobalSingleton) =
self.localAccountSettings.delete()
self.localAccountSensitiveSettings.delete()
self.localAppSettings.delete()
self.userProfile.delete()
self.userProfile.delete()

View File

@ -107,7 +107,7 @@ QtObject:
type LocalAccountSensitiveSettings* = ref object of QObject
settingsFileDir: string
settings: QSettings
proc setup(self: LocalAccountSensitiveSettings) =
self.QObject.setup
self.settingsFileDir = os.joinPath(DATADIR, "qt")
@ -118,7 +118,7 @@ QtObject:
self.QObject.delete
proc newLocalAccountSensitiveSettings*():
proc newLocalAccountSensitiveSettings*():
LocalAccountSensitiveSettings =
new(result, delete)
result.setup
@ -152,7 +152,7 @@ QtObject:
when T is bool:
result = getSettingsPropBool(self, prop, default)
template setSettingsProp(self: LocalAccountSensitiveSettings, prop: string, value: QVariant, signal: untyped) =
template setSettingsProp(self: LocalAccountSensitiveSettings, prop: string, value: QVariant, signal: untyped) =
if(self.settings.isNil):
return
@ -237,7 +237,7 @@ QtObject:
write = setIsWalletV2Enabled
notify = isWalletV2EnabledChanged
proc nodeManagementEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getNodeManagementEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_NODE_MANAGEMENT_ENABLED, newQVariant(DEFAULT_NODE_MANAGEMENT_ENABLED))
@ -263,7 +263,7 @@ QtObject:
write = setIsBrowserEnabled
notify = isBrowserEnabledChanged
proc isActivityCenterEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getIsActivityCenterEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_IS_ACTIVITY_CENTER_ENABLED, newQVariant(DEFAULT_IS_ACTIVITY_CENTER_ENABLED))
@ -289,7 +289,7 @@ QtObject:
write = setShowOnlineUsers
notify = showOnlineUsersChanged
proc expandUsersListChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getExpandUsersList*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_EXPAND_USERS_LIST, newQVariant(DEFAULT_EXPAND_USERS_LIST))
@ -354,7 +354,7 @@ QtObject:
write = setRecentEmojis
notify = recentEmojisChanged
proc hiddenCommunityWelcomeBannersChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getHiddenCommunityWelcomeBanners*(self: LocalAccountSensitiveSettings): QVariant {.slot.} =
getSettingsPropQVariant(self, LSS_KEY_HIDDEN_COMMUNITY_WELCOME_BANNERS, newQVariant(DEFAULT_HIDDEN_COMMUNITY_WELCOME_BANNERS))
@ -458,7 +458,7 @@ QtObject:
write = setNotifyOnNewRequests
notify = notifyOnNewRequestsChanged
proc whitelistedUnfurlingSitesChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getWhitelistedUnfurlingSites*(self: LocalAccountSensitiveSettings): QVariant {.slot.} =
getSettingsPropQVariant(self, LSS_KEY_WITHLISTED_UNFURLING_SITES, newQVariant(DEFAULT_WITHLISTED_UNFURLING_SITES))
@ -560,7 +560,7 @@ QtObject:
QtProperty[string] skinColor:
read = getSkinColor
write = setSkinColor
notify = skinColorChanged
notify = skinColorChanged
proc showDeleteMessageWarningChanged*(self: LocalAccountSensitiveSettings) {.signal.}
@ -599,7 +599,7 @@ QtObject:
QtProperty[string] activeSection:
read = getActiveSection
write = setActiveSection
notify = activeSectionChanged
notify = activeSectionChanged
proc showBrowserSelectorChanged*(self: LocalAccountSensitiveSettings) {.signal.}
@ -651,7 +651,7 @@ QtObject:
QtProperty[string] browserHomepage:
read = getBrowserHomepage
write = setBrowserHomepage
notify = browserHomepageChanged
notify = browserHomepageChanged
proc shouldShowBrowserSearchEngineChanged*(self: LocalAccountSensitiveSettings) {.signal.}
@ -821,12 +821,12 @@ QtObject:
read = getStickersEnsRopsten
write = setStickersEnsRopsten
notify = stickersEnsRopstenChanged
proc removeKey*(self: LocalAccountSensitiveSettings, key: string) =
if(self.settings.isNil):
return
self.settings.remove(key)
case key:

View File

@ -16,7 +16,7 @@ QtObject:
type LocalAccountSettings* = ref object of QObject
settingsFileDir: string
settings: QSettings
proc setup(self: LocalAccountSettings) =
self.QObject.setup
self.settingsFileDir = os.joinPath(DATADIR, "qt")
@ -27,7 +27,7 @@ QtObject:
self.QObject.delete
proc newLocalAccountSettings*():
proc newLocalAccountSettings*():
LocalAccountSettings =
new(result, delete)
result.setup
@ -45,7 +45,7 @@ QtObject:
proc removeKey*(self: LocalAccountSettings, key: string) =
if(self.settings.isNil):
return
self.settings.remove(key)
if(key == LS_KEY_STORE_TO_KEYCHAIN):
@ -71,7 +71,7 @@ QtObject:
write = setStoreToKeychainValue
notify = storeToKeychainValueChanged
proc getIsKeycardEnabled*(self: LocalAccountSettings): bool {.slot.} =
if(self.settings.isNil):
return DEFAULT_IS_KEYCARD_ENABLED
@ -88,4 +88,4 @@ QtObject:
QtProperty[bool] isKeycardEnabled:
read = getIsKeycardEnabled
write = setIsKeycardEnabled
notify = isKeycardEnabledChanged
notify = isKeycardEnabledChanged

View File

@ -17,7 +17,7 @@ const DEFAULT_APP_SIZE_INITIALIZED = false
QtObject:
type LocalAppSettings* = ref object of QObject
settings: QSettings
proc setup(self: LocalAppSettings) =
self.QObject.setup
@ -43,7 +43,7 @@ QtObject:
QtProperty[string] locale:
read = getLocale
write = setLocale
notify = localeChanged
notify = localeChanged
proc themeChanged*(self: LocalAppSettings) {.signal.}
@ -56,7 +56,7 @@ QtObject:
QtProperty[int] theme:
read = getTheme
write = setTheme
notify = themeChanged
notify = themeChanged
proc appWidthChanged*(self: LocalAppSettings) {.signal.}
proc getAppWidth*(self: LocalAppSettings): int {.slot.} =
@ -97,9 +97,9 @@ QtObject:
proc removeKey*(self: LocalAppSettings, key: string) =
if(self.settings.isNil):
return
self.settings.remove(key)
case key:
of LAS_KEY_LOCALE: self.localeChanged()
of LAS_KEY_THEME: self.themeChanged()
of LAS_KEY_THEME: self.themeChanged()

View File

@ -18,7 +18,7 @@ QtObject:
largeImage: string
userStatus: bool
#currentUserStatus: int
proc setup(self: UserProfile) =
self.QObject.setup
@ -36,38 +36,38 @@ QtObject:
self.pubKey = pubKey
self.isIdenticon = true
proc getAddress*(self: UserProfile): string {.slot.} =
proc getAddress*(self: UserProfile): string {.slot.} =
self.address
QtProperty[string] address:
read = getAddress
proc getPubKey*(self: UserProfile): string {.slot.} =
proc getPubKey*(self: UserProfile): string {.slot.} =
self.pubKey
QtProperty[string] pubKey:
read = getPubKey
proc nameChanged*(self: UserProfile) {.signal.}
proc getUsername*(self: UserProfile): string {.slot.} =
proc getUsername*(self: UserProfile): string {.slot.} =
self.username
QtProperty[string] username:
read = getUsername
notify = nameChanged
# this is not a slot
proc setEnsName*(self: UserProfile, name: string) =
proc setEnsName*(self: UserProfile, name: string) =
if(self.ensName == name):
return
self.ensName = name
self.nameChanged()
proc getEnsName*(self: UserProfile): string {.slot.} =
self.ensName
self.ensName
QtProperty[string] ensName:
read = getEnsName
notify = nameChanged
@ -80,14 +80,14 @@ QtObject:
# this is not a slot
proc setFirstEnsName*(self: UserProfile, name: string) =
proc setFirstEnsName*(self: UserProfile, name: string) =
if(self.firstEnsName == name):
return
self.firstEnsName = name
self.nameChanged()
proc getFirstEnsName*(self: UserProfile): string {.slot.} =
self.firstEnsName
self.firstEnsName
QtProperty[string] firstEnsName:
read = getFirstEnsName
notify = nameChanged
@ -100,12 +100,12 @@ QtObject:
# this is not a slot
proc setPreferredName*(self: UserProfile, name: string) =
proc setPreferredName*(self: UserProfile, name: string) =
if(self.preferredName == name):
return
self.preferredName = name
self.nameChanged()
proc getPreferredName*(self: UserProfile): string {.slot.} =
self.preferredName
QtProperty[string] preferredName:
@ -127,7 +127,7 @@ QtObject:
elif(self.ensName.len > 0):
return self.getPrettyEnsName()
return self.username
QtProperty[string] name:
read = getName
notify = nameChanged
@ -155,7 +155,7 @@ QtObject:
return self.identicon
# this is not a slot
proc setThumbnailImage*(self: UserProfile, image: string) =
proc setThumbnailImage*(self: UserProfile, image: string) =
if(self.thumbnailImage == image):
return
@ -174,7 +174,7 @@ QtObject:
QtProperty[string] thumbnailImage:
read = getThumbnailImage
notify = imageChanged
proc largeImageChanged*(self: UserProfile) {.signal.}
proc getLargeImage*(self: UserProfile): string {.slot.} =
@ -196,8 +196,8 @@ QtObject:
proc userStatusChanged*(self: UserProfile) {.signal.}
proc getUserStatus*(self: UserProfile): bool {.slot.} =
proc getUserStatus*(self: UserProfile): bool {.slot.} =
self.userStatus
# this is not a slot
@ -213,9 +213,9 @@ QtObject:
## This is still not in use.
## Once we decide to differ more than Online/Offline statuses we shouldn't use this code below,
## Once we decide to differ more than Online/Offline statuses we shouldn't use this code below,
## but update current `userStatus` which is a bool to something like the code bellow (`currentUserStatus`).
##
##
## Proposal - some statuses we may have:
## type
## OnlineStatus* {.pure.} = enum
@ -224,8 +224,8 @@ QtObject:
## DoNotDisturb
## Invisible
## Offline
##
##
##
##
## proc currentUserStatusChanged*(self: UserProfile) {.signal.}
## proc getCurrentUserStatus*(self: UserProfile): int {.slot.} =

View File

@ -9,7 +9,7 @@ import ../../app_service/service/accounts/service as procs_from_accounts
QtObject:
type Utils* = ref object of QObject
proc setup(self: Utils) =
self.QObject.setup
@ -42,7 +42,7 @@ QtObject:
proc hex2Ascii*(self: Utils, value: string): string {.slot.} =
result = string.fromBytes(hexToSeqByte(value))
proc ascii2Hex*(self: Utils, value: string): string {.slot.} =
proc ascii2Hex*(self: Utils, value: string): string {.slot.} =
result = "0x" & toHex(value)
proc stripTrailingZeroes(value: string): string =
@ -118,4 +118,4 @@ QtObject:
result = "data:image/svg+xml;utf8," & self.generateQRCodeSVG(text, 2)
proc plainText*(self: Utils, text: string): string {.slot.} =
result = plain_text(text)
result = plain_text(text)

View File

@ -161,4 +161,4 @@ proc qrcodegen_getSize*(qrcode: ptr uint8): cint {.importc: "qrcodegen_getSize".
## If the given coordinates are out of bounds, then false (white) is returned.
##
proc qrcodegen_getModule*(qrcode: ptr uint8; x: cint; y: cint): bool {.importc: "qrcodegen_getModule".}
proc qrcodegen_getModule*(qrcode: ptr uint8; x: cint; y: cint): bool {.importc: "qrcodegen_getModule".}

View File

@ -10,7 +10,7 @@ import ../../../../app_service/service/eth/utils as eth_utils
export controller_interface
type
type
Controller*[T: controller_interface.DelegateInterface] = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
@ -104,4 +104,4 @@ method decodeContentHash*[T](self: Controller[T], hash: string): string =
return eth_utils.decodeContentHash(hash)
method switchTo*[T](self: Controller[T], sectionId, chatId, messageId: string) =
self.messageService.switchTo(sectionId, chatId, messageId)
self.messageService.switchTo(sectionId, chatId, messageId)

View File

@ -2,7 +2,7 @@ import ../../../../app_service/service/contacts/service as contacts_service
import ../../../../app_service/service/activity_center/service as activity_center_service
import ../../../../app_service/service/message/dto/[message]
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
## Abstract class for any input/interaction with this module.
@ -50,6 +50,6 @@ method switchTo*(self: AccessInterface, sectionId, chatId, messageId: string) {.
type
## Abstract class (concept) which must be implemented by object/s used in this
## Abstract class (concept) which must be implemented by object/s used in this
## module.
DelegateInterface* = concept c

View File

@ -2,7 +2,7 @@ import Tables, stint
import ./item
import ../../../../app_service/service/activity_center/service as activity_center_service
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
## Abstract class for any input/interaction with this module.
@ -16,61 +16,61 @@ method isLoaded*(self: AccessInterface): bool {.base.} =
raise newException(ValueError, "No implementation available")
method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method hasMoreToShow*(self: AccessInterface): bool {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method unreadActivityCenterNotificationsCount*(self: AccessInterface): int {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method convertToItems*(self: AccessInterface, activityCenterNotifications: seq[ActivityCenterNotificationDto]): seq[Item] {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method getActivityCenterNotifications*(self: AccessInterface): seq[Item] {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method markAllActivityCenterNotificationsRead*(self: AccessInterface): string {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method markAllActivityCenterNotificationsReadDone*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method dismissActivityCenterNotificationsDone*(self: AccessInterface, notificationIds: seq[string]) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method markActivityCenterNotificationReadDone*(self: AccessInterface, notificationIds: seq[string]) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method markActivityCenterNotificationUnreadDone*(self: AccessInterface, notificationIds: seq[string]) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method acceptActivityCenterNotificationsDone*(self: AccessInterface, notificationIds: seq[string]) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method markActivityCenterNotificationRead*(self: AccessInterface, notificationId: string, communityId: string, channelId: string, nType: int): string {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method markActivityCenterNotificationUnread*(self: AccessInterface, notificationId: string, communityId: string, channelId: string, nType: int): string {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method pushActivityCenterNotifications*(self: AccessInterface, activityCenterNotifications: seq[ActivityCenterNotificationDto]) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method addActivityCenterNotification*(self: AccessInterface, activityCenterNotifications: seq[ActivityCenterNotificationDto]) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method acceptActivityCenterNotifications*(self: AccessInterface, notificationIds: seq[string]): string {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method dismissActivityCenterNotifications*(self: AccessInterface, notificationIds: seq[string]): string {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method switchTo*(self: AccessInterface, sectionId, chatId, messageId: string) {.base.} =
raise newException(ValueError, "No implementation available")
type
## Abstract class (concept) which must be implemented by object/s used in this
## Abstract class (concept) which must be implemented by object/s used in this
## module.
DelegateInterface* = concept c
c.activityCenterDidLoad()

View File

@ -39,7 +39,7 @@ proc initItem*(
proc `$`*(self: Item): string =
result = fmt"""StickerItem(
id: {self.id},
id: {self.id},
name: {$self.name},
chatId: {$self.chatId},
author: {$self.author},
@ -51,35 +51,35 @@ proc `$`*(self: Item): string =
# messageItem: {$self.messageItem},
]"""
proc id*(self: Item): string =
proc id*(self: Item): string =
return self.id
proc name*(self: Item): string =
proc name*(self: Item): string =
return self.name
proc author*(self: Item): string =
proc author*(self: Item): string =
return self.author
proc chatId*(self: Item): string =
proc chatId*(self: Item): string =
return self.chatId
proc notificationType*(self: Item): int =
proc notificationType*(self: Item): int =
return self.notificationType
proc timestamp*(self: Item): int64 =
proc timestamp*(self: Item): int64 =
return self.timestamp
proc read*(self: Item): bool =
proc read*(self: Item): bool =
return self.read
proc `read=`*(self: Item, value: bool) =
proc `read=`*(self: Item, value: bool) =
self.read = value
proc dismissed*(self: Item): bool =
proc dismissed*(self: Item): bool =
return self.dismissed
proc accepted*(self: Item): bool =
proc accepted*(self: Item): bool =
return self.accepted
proc messageItem*(self: Item): MessageItem =
proc messageItem*(self: Item): MessageItem =
return self.messageItem

View File

@ -22,7 +22,7 @@ QtObject:
proc setup(self: Model) = self.QAbstractListModel.setup
proc delete(self: Model) =
proc delete(self: Model) =
self.activityCenterNotifications = @[]
self.QAbstractListModel.delete
@ -52,7 +52,7 @@ QtObject:
for activityCenterNotification in self.activityCenterNotifications:
activityCenterNotification.read = true
let topLeft = self.createIndex(0, 0, nil)
let bottomRight = self.createIndex(self.activityCenterNotifications.len - 1, 0, nil)
self.dataChanged(topLeft, bottomRight, @[NotifRoles.Read.int])
@ -108,7 +108,7 @@ QtObject:
NotifRoles.Dismissed.int: "dismissed",
NotifRoles.Accepted.int: "accepted"
}.toTable
proc reduceUnreadCount(self: Model, numberNotifs: int) =
self.nbUnreadNotifications = self.nbUnreadNotifications - numberNotifs
if (self.nbUnreadNotifications < 0):
@ -152,7 +152,7 @@ QtObject:
indexesToDelete.add(i)
break
i = i + 1
i = 0
for index in indexesToDelete:
let indexUpdated = index - i

View File

@ -12,7 +12,7 @@ import ../../../../app_service/service/message/service as message_service
export io_interface
type
type
Module* [T: io_interface.DelegateInterface] = ref object of io_interface.AccessInterface
delegate: T
controller: controller.AccessInterface
@ -77,7 +77,7 @@ method convertToItems*[T](
n.message.`from`,
contactDetails.displayName,
contactDetails.details.localNickname,
contactDetails.icon,
contactDetails.icon,
contactDetails.isIdenticon,
contactDetails.isCurrentUser,
n.message.outgoingStatus,
@ -86,13 +86,13 @@ method convertToItems*[T](
n.message.containsContactMentions(),
n.message.seen,
n.message.timestamp,
ContentType(n.message.contentType),
ContentType(n.message.contentType),
n.message.messageType,
self.controller.decodeContentHash(n.message.sticker.hash),
n.message.sticker.pack,
n.message.links,
))
return notification_item.initItem(
n.id,
n.chatId,
@ -183,4 +183,4 @@ method dismissActivityCenterNotifications*[T](self: Module[T], notificationIds:
self.controller.dismissActivityCenterNotifications(notificationIds)
method switchTo*[T](self: Module[T], sectionId, chatId, messageId: string) =
self.controller.switchTo(sectionId, chatId, messageId)
self.controller.switchTo(sectionId, chatId, messageId)

View File

@ -32,7 +32,7 @@ QtObject:
QtProperty[QVariant] model:
read = getModel
notify = activityNotificationsChanged
proc hasMoreToShowChanged*(self: View) {.signal.}
proc hasMoreToShow*(self: View): bool {.slot.} =
@ -101,7 +101,7 @@ QtObject:
proc acceptActivityCenterNotificationsDone*(self: View, notificationIds: seq[string]) =
self.model.removeNotifications(notificationIds)
proc acceptActivityCenterNotification(self: View, id: string): string {.slot.} =
self.acceptActivityCenterNotifications(fmt"[""{id}""]")

View File

@ -1,4 +1,4 @@
type
type
BaseItem* {.pure inheritable.} = ref object of RootObj
value: string
text: string
@ -19,23 +19,23 @@ proc initBaseItem*(value, text, image, icon, iconColor: string, isIdenticon: boo
result = BaseItem()
result.setup(value, text, image, icon, iconColor, isIdenticon)
proc delete*(self: BaseItem) =
proc delete*(self: BaseItem) =
discard
method value*(self: BaseItem): string {.inline base.} =
method value*(self: BaseItem): string {.inline base.} =
self.value
method text*(self: BaseItem): string {.inline base.} =
method text*(self: BaseItem): string {.inline base.} =
self.text
method image*(self: BaseItem): string {.inline base.} =
method image*(self: BaseItem): string {.inline base.} =
self.image
method icon*(self: BaseItem): string {.inline base.} =
method icon*(self: BaseItem): string {.inline base.} =
self.icon
method iconColor*(self: BaseItem): string {.inline base.} =
method iconColor*(self: BaseItem): string {.inline base.} =
self.iconColor
method isIdenticon*(self: BaseItem): bool {.inline base.} =
self.isIdenticon
method isIdenticon*(self: BaseItem): bool {.inline base.} =
self.isIdenticon

View File

@ -21,11 +21,11 @@ type ResultItemDetails = object
messageId*: string
method isEmpty(self: ResultItemDetails): bool =
self.sectionId.len == 0 and
self.channelId.len == 0 and
self.sectionId.len == 0 and
self.channelId.len == 0 and
self.messageId.len == 0
type
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
@ -41,7 +41,7 @@ type
resultItems: Table[string, ResultItemDetails] # [resultItemId, ResultItemDetails]
proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter, contactsService: contact_service.Service,
chatService: chat_service.Service, communityService: community_service.Service,
chatService: chat_service.Service, communityService: community_service.Service,
messageService: message_service.Service): Controller =
result = Controller()
result.delegate = delegate
@ -51,11 +51,11 @@ proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter
result.communityService = communityService
result.messageService = messageService
result.resultItems = initTable[string, ResultItemDetails]()
method delete*(self: Controller) =
self.resultItems.clear
method init*(self: Controller) =
method init*(self: Controller) =
self.events.on(SIGNAL_SEARCH_MESSAGES_LOADED) do(e:Args):
let args = MessagesArgs(e)
self.delegate.onSearchMessagesDone(args.messages)
@ -79,8 +79,8 @@ method searchLocation*(self: Controller): string =
method searchSubLocation*(self: Controller): string =
return self.searchSubLocation
method setSearchLocation*(self: Controller, location: string, subLocation: string) =
## Setting location and subLocation to an empty string means we're
method setSearchLocation*(self: Controller, location: string, subLocation: string) =
## Setting location and subLocation to an empty string means we're
## searching in all available chats/channels/communities.
self.searchLocation = location
self.searchSubLocation = subLocation
@ -132,11 +132,11 @@ method searchMessages*(self: Controller, searchTerm: string) =
self.messageService.asyncSearchMessages(communities, chats, self.searchTerm, false)
method getOneToOneChatNameAndImage*(self: Controller, chatId: string):
method getOneToOneChatNameAndImage*(self: Controller, chatId: string):
tuple[name: string, image: string, isIdenticon: bool] =
return self.chatService.getOneToOneChatNameAndImage(chatId)
method getContactNameAndImage*(self: Controller, contactId: string):
method getContactNameAndImage*(self: Controller, contactId: string):
tuple[name: string, image: string, isIdenticon: bool] =
return self.contactsService.getContactNameAndImage(contactId)
@ -149,5 +149,5 @@ method resultItemClicked*(self: Controller, itemId: string) =
# we shouldn't be here ever
info "important: we don't have stored details for a searched result item with id: ", itemId
return
self.messageService.switchTo(itemDetails.sectionId, itemDetails.channelId, itemDetails.messageId)
self.messageService.switchTo(itemDetails.sectionId, itemDetails.channelId, itemDetails.messageId)

View File

@ -2,7 +2,7 @@ import ../../../../app_service/service/contacts/dto/contacts
import ../../../../app_service/service/chat/dto/chat
import ../../../../app_service/service/community/dto/community
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
## Abstract class for any input/interaction with this module.
@ -51,17 +51,17 @@ method getChatDetails*(self: AccessInterface, communityId, chatId: string): Chat
method searchMessages*(self: AccessInterface, searchTerm: string) {.base.} =
raise newException(ValueError, "No implementation available")
method getOneToOneChatNameAndImage*(self: AccessInterface, chatId: string):
method getOneToOneChatNameAndImage*(self: AccessInterface, chatId: string):
tuple[name: string, image: string, isIdenticon: bool] {.base.} =
raise newException(ValueError, "No implementation available")
method getContactNameAndImage*(self: AccessInterface, contactId: string):
method getContactNameAndImage*(self: AccessInterface, contactId: string):
tuple[name: string, image: string, isIdenticon: bool] {.base.} =
raise newException(ValueError, "No implementation available")
method addResultItemDetails*(self: AccessInterface, itemId: string, sectionId = "", channelId = "", messageId = "")
method addResultItemDetails*(self: AccessInterface, itemId: string, sectionId = "", channelId = "", messageId = "")
{.base.} =
raise newException(ValueError, "No implementation available")
method resultItemClicked*(self: AccessInterface, itemId: string) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -2,7 +2,7 @@
import json, strformat
import base_item, location_menu_sub_model, location_menu_sub_item
type
type
Item* = ref object of BaseItem
subItems: SubModel
@ -11,19 +11,19 @@ proc initItem*(value, text, image, icon, iconColor: string = "", isIdenticon: bo
result.setup(value, text, image, icon, iconColor, isIdenticon)
result.subItems = newSubModel()
proc delete*(self: Item) =
proc delete*(self: Item) =
self.subItems.delete
self.BaseItem.delete
proc subItems*(self: Item): SubModel {.inline.} =
proc subItems*(self: Item): SubModel {.inline.} =
self.subItems
proc `$`*(self: Item): string =
result = fmt"""SearchMenuItem(
value: {self.value},
title: {self.text},
value: {self.value},
title: {self.text},
imageSource: {self.image},
iconName: {self.icon},
iconName: {self.icon},
iconColor: {self.iconColor},
isIdenticon: {self.isIdenticon},
subItems:[
@ -44,4 +44,4 @@ proc setSubItems*(self: Item, subItems: seq[SubItem]) =
self.subItems.setItems(subItems)
proc getSubItemForValue*(self: Item, value: string): SubItem =
self.subItems.getItemForValue(value)
self.subItems.getItemForValue(value)

View File

@ -55,19 +55,19 @@ QtObject:
let enumRole = role.ModelRole
case enumRole:
of ModelRole.Value:
of ModelRole.Value:
result = newQVariant(item.value)
of ModelRole.Title:
of ModelRole.Title:
result = newQVariant(item.text)
of ModelRole.ImageSource:
of ModelRole.ImageSource:
result = newQVariant(item.image)
of ModelRole.IconName:
of ModelRole.IconName:
result = newQVariant(item.icon)
of ModelRole.IconColor:
of ModelRole.IconColor:
result = newQVariant(item.iconColor)
of ModelRole.IsIdenticon:
of ModelRole.IsIdenticon:
result = newQVariant(item.isIdenticon)
of ModelRole.SubItems:
of ModelRole.SubItems:
result = newQVariant(item.subItems)
proc setItems*(self: Model, items: seq[Item]) =

View File

@ -3,22 +3,22 @@ import base_item
export base_item
type
type
SubItem* = ref object of BaseItem
proc initSubItem*(value, text, image, icon, iconColor: string, isIdenticon: bool): SubItem =
result = SubItem()
result.setup(value, text, image, icon, iconColor, isIdenticon)
proc delete*(self: SubItem) =
proc delete*(self: SubItem) =
self.BaseItem.delete
proc `$`*(self: SubItem): string =
result = fmt"""SearchMenuSubItem(
value: {self.value},
text: {self.text},
value: {self.value},
text: {self.text},
imageSource: {self.image},
iconName: {self.icon},
iconName: {self.icon},
iconColor: {self.iconColor},
isIdenticon: {self.isIdenticon}
]"""
@ -31,4 +31,4 @@ proc toJsonNode*(self: SubItem): JsonNode =
"iconName": self.icon,
"iconColor": self.iconColor,
"isIdenticon": self.isIdenticon
}
}

View File

@ -68,17 +68,17 @@ QtObject:
let enumRole = role.SubModelRole
case enumRole:
of SubModelRole.Value:
of SubModelRole.Value:
result = newQVariant(item.value)
of SubModelRole.Text:
of SubModelRole.Text:
result = newQVariant(item.text)
of SubModelRole.Image:
of SubModelRole.Image:
result = newQVariant(item.image)
of SubModelRole.Icon:
of SubModelRole.Icon:
result = newQVariant(item.icon)
of SubModelRole.IconColor:
of SubModelRole.IconColor:
result = newQVariant(item.iconColor)
of SubModelRole.IsIdenticon:
of SubModelRole.IsIdenticon:
result = newQVariant(item.isIdenticon)
proc setItems*(self: SubModel, items: seq[SubItem]) =
@ -89,4 +89,4 @@ QtObject:
proc getItemForValue*(self: SubModel, value: string): SubItem =
for i in self.items:
if (i.value == value):
return i
return i

View File

@ -28,7 +28,7 @@ const SEARCH_RESULT_CHATS_SECTION_NAME = "Chats"
const SEARCH_RESULT_CHANNELS_SECTION_NAME = "Channels"
const SEARCH_RESULT_MESSAGES_SECTION_NAME = "Messages"
type
type
Module* = ref object of io_interface.AccessInterface
delegate: delegate_interface.AccessInterface
view: View
@ -36,17 +36,17 @@ type
controller: controller.AccessInterface
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter, contactsService: contact_service.Service,
chatService: chat_service.Service, communityService: community_service.Service, messageService: message_service.Service):
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter, contactsService: contact_service.Service,
chatService: chat_service.Service, communityService: community_service.Service, messageService: message_service.Service):
Module =
result = Module()
result.delegate = delegate
result.view = view.newView(result)
result.viewVariant = newQVariant(result.view)
result.controller = controller.newController(result, events, contactsService, chatService, communityService,
result.controller = controller.newController(result, events, contactsService, chatService, communityService,
messageService)
result.moduleLoaded = false
method delete*(self: Module) =
self.view.delete
self.viewVariant.delete
@ -67,7 +67,7 @@ method getModuleAsVariant*(self: Module): QVariant =
return self.viewVariant
proc buildLocationMenuForChat(self: Module): location_menu_item.Item =
var item = location_menu_item.initItem(conf.CHAT_SECTION_ID, SEARCH_MENU_LOCATION_CHAT_SECTION_NAME, "", "chat", "",
var item = location_menu_item.initItem(conf.CHAT_SECTION_ID, SEARCH_MENU_LOCATION_CHAT_SECTION_NAME, "", "chat", "",
false)
let types = @[ChatType.OneToOne, ChatType.Public, ChatType.PrivateGroupChat]
@ -83,7 +83,7 @@ proc buildLocationMenuForChat(self: Module): location_menu_item.Item =
let subItem = location_menu_sub_item.initSubItem(c.id, chatName, chatImage, "", c.color, isIdenticon)
subItems.add(subItem)
item.setSubItems(subItems)
return item
@ -95,7 +95,7 @@ proc buildLocationMenuForCommunity(self: Module, community: CommunityDto): locat
let chats = self.controller.getAllChatsForCommunity(community.id)
for c in chats:
let chatDto = self.controller.getChatDetails(community.id, c.id)
let subItem = location_menu_sub_item.initSubItem(chatDto.id, chatDto.name, chatDto.identicon, "", chatDto.color,
let subItem = location_menu_sub_item.initSubItem(chatDto.id, chatDto.name, chatDto.identicon, "", chatDto.color,
chatDto.identicon.len == 0)
subItems.add(subItem)
@ -105,7 +105,7 @@ proc buildLocationMenuForCommunity(self: Module, community: CommunityDto): locat
method prepareLocationMenuModel*(self: Module) =
var items: seq[location_menu_item.Item]
items.add(self.buildLocationMenuForChat())
let communities = self.controller.getJoinedCommunities()
for c in communities:
items.add(self.buildLocationMenuForCommunity(c))
@ -118,11 +118,11 @@ method onActiveChatChange*(self: Module, sectionId: string, chatId: string) =
method setSearchLocation*(self: Module, location: string, subLocation: string) =
self.controller.setSearchLocation(location, subLocation)
method getSearchLocationObject*(self: Module): string =
method getSearchLocationObject*(self: Module): string =
## This method returns location and subLocation with their details so we
## may set initial search location on the side of qml.
var jsonObject = %* {
"location": "",
"location": "",
"subLocation": ""
}
@ -144,7 +144,7 @@ method searchMessages*(self: Module, searchTerm: string) =
if (searchTerm.len == 0):
self.view.searchResultModel().clear()
return
self.controller.searchMessages(searchTerm)
method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
@ -155,7 +155,7 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
let communities = self.controller.getJoinedCommunities()
for co in communities:
if(self.controller.searchLocation().len == 0 and co.name.toLower.startsWith(self.controller.searchTerm().toLower)):
let item = result_item.initItem(co.id, "", "", co.id, co.name, SEARCH_RESULT_COMMUNITIES_SECTION_NAME,
let item = result_item.initItem(co.id, "", "", co.id, co.name, SEARCH_RESULT_COMMUNITIES_SECTION_NAME,
co.images.thumbnail, co.color, "", "", co.images.thumbnail, co.color, false)
self.controller.addResultItemDetails(co.id, co.id)
@ -167,8 +167,8 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
for c in co.chats:
let chatDto = self.controller.getChatDetails(co.id, c.id)
if(c.name.toLower.startsWith(self.controller.searchTerm().toLower)):
let item = result_item.initItem(chatDto.id, "", "", chatDto.id, chatDto.name,
SEARCH_RESULT_CHANNELS_SECTION_NAME, chatDto.identicon, chatDto.color, "", "", chatDto.identicon, chatDto.color,
let item = result_item.initItem(chatDto.id, "", "", chatDto.id, chatDto.name,
SEARCH_RESULT_CHANNELS_SECTION_NAME, chatDto.identicon, chatDto.color, "", "", chatDto.identicon, chatDto.color,
false)
self.controller.addResultItemDetails(chatDto.id, co.id, chatDto.id)
@ -192,7 +192,7 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
rawChatName = chatName[1 ..^ 1]
if(rawChatName.toLower.startsWith(self.controller.searchTerm().toLower)):
let item = result_item.initItem(c.id, "", "", c.id, chatName, SEARCH_RESULT_CHATS_SECTION_NAME, chatImage,
let item = result_item.initItem(c.id, "", "", c.id, chatName, SEARCH_RESULT_CHATS_SECTION_NAME, chatImage,
c.color, "", "", chatImage, c.color, isIdenticon)
self.controller.addResultItemDetails(c.id, conf.CHAT_SECTION_ID, c.id)
@ -210,7 +210,7 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
var (senderName, senderImage, senderIsIdenticon) = self.controller.getContactNameAndImage(m.`from`)
if(m.`from` == singletonInstance.userProfile.getPubKey()):
senderName = "You"
if(chatDto.communityId.len == 0):
var chatName = chatDto.name
var chatImage = chatDto.identicon
@ -218,7 +218,7 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
if(chatDto.chatType == ChatType.OneToOne):
(chatName, chatImage, isIdenticon) = self.controller.getOneToOneChatNameAndImage(chatDto.id)
let item = result_item.initItem(m.id, m.text, $m.timestamp, m.`from`, senderName,
let item = result_item.initItem(m.id, m.text, $m.timestamp, m.`from`, senderName,
SEARCH_RESULT_MESSAGES_SECTION_NAME, senderImage, "", chatName, "", chatImage, chatDto.color, isIdenticon)
self.controller.addResultItemDetails(m.id, conf.CHAT_SECTION_ID, chatDto.id, m.id)
@ -227,8 +227,8 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
let community = self.controller.getCommunityById(chatDto.communityId)
let channelName = "#" & chatDto.name
let item = result_item.initItem(m.id, m.text, $m.timestamp, m.`from`, senderName,
SEARCH_RESULT_MESSAGES_SECTION_NAME, senderImage, "", community.name, channelName, community.images.thumbnail,
let item = result_item.initItem(m.id, m.text, $m.timestamp, m.`from`, senderName,
SEARCH_RESULT_MESSAGES_SECTION_NAME, senderImage, "", community.name, channelName, community.images.thumbnail,
community.color, false)
self.controller.addResultItemDetails(m.id, chatDto.communityId, chatDto.id, m.id)

View File

@ -13,4 +13,4 @@ method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} =
raise newException(ValueError, "No implementation available")
method onActiveChatChange*(self: AccessInterface, sectionId: string, chatId: string) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -1,5 +1,5 @@
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.

View File

@ -1,4 +1,4 @@
import ../../../../../app_service/service/message/dto/message
method onSearchMessagesDone*(self: AccessInterface, messages: seq[MessageDto]) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -1,5 +1,5 @@
method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method prepareLocationMenuModel*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
@ -14,4 +14,4 @@ method searchMessages*(self: AccessInterface, searchTerm: string) {.base.} =
raise newException(ValueError, "No implementation available")
method resultItemClicked*(self: AccessInterface, itemId: string) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -5,7 +5,7 @@ type Item* = object
content: string
time: string
titleId: string
title: string
title: string
sectionName: string
image: string
color: string
@ -15,8 +15,8 @@ type Item* = object
badgeIconColor: string
badgeIsLetterIdenticon: bool
proc initItem*(itemId, content, time, titleId, title, sectionName: string, image, color, badgePrimaryText,
badgeSecondaryText, badgeImage, badgeIconColor: string, badgeIsLetterIdenticon: bool):
proc initItem*(itemId, content, time, titleId, title, sectionName: string, image, color, badgePrimaryText,
badgeSecondaryText, badgeImage, badgeIconColor: string, badgeIsLetterIdenticon: bool):
Item =
result.itemId = itemId
@ -40,7 +40,7 @@ proc `$`*(self: Item): string =
result &= fmt"time:{self.time}, "
result &= fmt"titleId:{self.titleId}, "
result &= fmt"title:{self.title}"
result &= fmt"sectionName:{self.sectionName}"
result &= fmt"sectionName:{self.sectionName}"
result &= fmt"image:{self.image}"
result &= fmt"color:{self.color}"
result &= fmt"badgePrimaryText:{self.badgePrimaryText}"
@ -87,4 +87,4 @@ proc badgeIconColor*(self: Item): string =
return self.badgeIconColor
proc badgeIsLetterIdenticon*(self: Item): bool =
return self.badgeIsLetterIdenticon
return self.badgeIsLetterIdenticon

View File

@ -38,7 +38,7 @@ QtObject:
result &= fmt"""SearchResultMessageModel:
[{i}]:({$self.resultList[i]})
"""
proc countChanged*(self: Model) {.signal.}
proc count*(self: Model): int {.slot.} =
self.resultList.len
@ -77,31 +77,31 @@ QtObject:
let enumRole = role.ModelRole
case enumRole:
of ModelRole.ItemId:
of ModelRole.ItemId:
result = newQVariant(item.itemId)
of ModelRole.Content:
of ModelRole.Content:
result = newQVariant(item.content)
of ModelRole.Time:
of ModelRole.Time:
result = newQVariant(item.time)
of ModelRole.TitleId:
of ModelRole.TitleId:
result = newQVariant(item.titleId)
of ModelRole.Title:
of ModelRole.Title:
result = newQVariant(item.title)
of ModelRole.SectionName:
of ModelRole.SectionName:
result = newQVariant(item.sectionName)
of ModelRole.Image:
of ModelRole.Image:
result = newQVariant(item.image)
of ModelRole.Color:
of ModelRole.Color:
result = newQVariant(item.color)
of ModelRole.BadgePrimaryText:
of ModelRole.BadgePrimaryText:
result = newQVariant(item.badgePrimaryText)
of ModelRole.BadgeSecondaryText:
of ModelRole.BadgeSecondaryText:
result = newQVariant(item.badgeSecondaryText)
of ModelRole.BadgeImage:
of ModelRole.BadgeImage:
result = newQVariant(item.badgeImage)
of ModelRole.BadgeIconColor:
of ModelRole.BadgeIconColor:
result = newQVariant(item.badgeIconColor)
of ModelRole.BadgeIsLetterIdenticon:
of ModelRole.BadgeIsLetterIdenticon:
result = newQVariant(item.badgeIsLetterIdentIcon)
proc add*(self: Model, item: Item) =
@ -117,4 +117,4 @@ QtObject:
proc clear*(self: Model) =
self.beginResetModel()
self.resultList = @[]
self.endResetModel()
self.endResetModel()

View File

@ -10,7 +10,7 @@ QtObject:
searchResultModelVariant: QVariant
locationMenuModel: location_menu_model.Model
locationMenuModelVariant: QVariant
proc delete*(self: View) =
self.searchResultModel.delete
self.searchResultModelVariant.delete
@ -36,33 +36,33 @@ QtObject:
proc locationMenuModel*(self: View): location_menu_model.Model =
return self.locationMenuModel
proc getSearchResultModel*(self: View): QVariant {.slot.} =
proc getSearchResultModel*(self: View): QVariant {.slot.} =
return newQVariant(self.searchResultModel)
QtProperty[QVariant] resultModel:
read = getSearchResultModel
proc getLocationMenuModel*(self: View): QVariant {.slot.} =
proc getLocationMenuModel*(self: View): QVariant {.slot.} =
newQVariant(self.locationMenuModel)
QtProperty[QVariant] locationMenuModel:
read = getLocationMenuModel
proc prepareLocationMenuModel*(self: View) {.slot.} =
proc prepareLocationMenuModel*(self: View) {.slot.} =
self.delegate.prepareLocationMenuModel()
proc setSearchLocation*(self: View, location: string = "", subLocation: string = "") {.slot.} =
proc setSearchLocation*(self: View, location: string = "", subLocation: string = "") {.slot.} =
self.delegate.setSearchLocation(location, subLocation)
proc getSearchLocationObject*(self: View): string {.slot.} =
proc getSearchLocationObject*(self: View): string {.slot.} =
self.delegate.getSearchLocationObject()
proc searchMessages*(self: View, searchTerm: string) {.slot.} =
proc searchMessages*(self: View, searchTerm: string) {.slot.} =
self.delegate.searchMessages(searchTerm)
proc resultItemClicked*(self: View, itemId: string) {.slot.} =
proc resultItemClicked*(self: View, itemId: string) {.slot.} =
self.delegate.resultItemClicked(itemId)
proc appSearchCompleted(self: View) {.signal.}
proc emitAppSearchCompletedSignal*(self: View) =
self.appSearchCompleted()
self.appSearchCompleted()

View File

@ -7,22 +7,22 @@ import ../../../../../app_service/service/bookmarks/service as bookmark_service
export controller_interface
type
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
bookmarkService: bookmark_service.ServiceInterface
proc newController*(delegate: io_interface.AccessInterface,
bookmarkService: bookmark_service.ServiceInterface):
proc newController*(delegate: io_interface.AccessInterface,
bookmarkService: bookmark_service.ServiceInterface):
Controller =
result = Controller()
result.delegate = delegate
result.bookmarkService = bookmarkService
method delete*(self: Controller) =
discard
method init*(self: Controller) =
method init*(self: Controller) =
discard
method getBookmarks*(self: Controller): seq[bookmark_service.BookmarkDto] =

View File

@ -1,6 +1,6 @@
import ../../../../../app_service/service/bookmarks/service_interface as bookmark_service
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
## Abstract class for any input/interaction with this module.

View File

@ -1,6 +1,6 @@
import json, strformat
type
type
Item* = object
name: string
url: string
@ -13,16 +13,16 @@ proc initItem*(name, url, imageUrl: string): Item =
proc `$`*(self: Item): string =
result = fmt"""BrowserItem(
name: {self.name},
name: {self.name},
url: {self.url},
imageUrl: {self.imageUrl}
]"""
proc getName*(self: Item): string =
proc getName*(self: Item): string =
return self.name
proc getUrl*(self: Item): string =
proc getUrl*(self: Item): string =
return self.url
proc getImageUrl*(self: Item): string =
proc getImageUrl*(self: Item): string =
return self.imageUrl

View File

@ -60,11 +60,11 @@ QtObject:
let enumRole = role.ModelRole
case enumRole:
of ModelRole.Name:
of ModelRole.Name:
result = newQVariant(item.getName())
of ModelRole.Url:
of ModelRole.Url:
result = newQVariant(item.getUrl())
of ModelRole.ImageUrl:
of ModelRole.ImageUrl:
result = newQVariant(item.getImageUrl())
proc rowData(self: Model, index: int, column: string): string {.slot.} =

View File

@ -9,7 +9,7 @@ import ../../../../../app_service/service/bookmarks/service as bookmark_service
export io_interface
type
type
Module* = ref object of io_interface.AccessInterface
delegate: delegate_interface.AccessInterface
view: View
@ -41,7 +41,7 @@ method viewDidLoad*(self: Module) =
let bookmarks = self.controller.getBookmarks()
for b in bookmarks:
self.view.addItem(initItem(b.name, b.url, b.imageUrl))
self.moduleLoaded = true
self.delegate.bookmarkDidLoad()

View File

@ -1,5 +1,5 @@
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.

View File

@ -1,2 +1,2 @@
method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -9,8 +9,8 @@ QtObject:
delegate: io_interface.AccessInterface
model: Model
modelVariant: QVariant
proc setup(self: View) =
proc setup(self: View) =
self.QObject.setup
proc delete*(self: View) =
@ -53,4 +53,4 @@ QtObject:
self.delegate.updateBookmark(oldUrl, newUrl, newName)
proc updateBookmarkByUrl*(self: View, oldUrl: string, item: Item) =
self.model.updateItemByUrl(oldUrl, item)
self.model.updateItemByUrl(oldUrl, item)

View File

@ -7,22 +7,22 @@ import ../../../../../app_service/service/dapp_permissions/service as dapp_permi
export controller_interface
type
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
dappPermissionsService: dapp_permissions_service.ServiceInterface
proc newController*(delegate: io_interface.AccessInterface,
dappPermissionsService: dapp_permissions_service.ServiceInterface):
proc newController*(delegate: io_interface.AccessInterface,
dappPermissionsService: dapp_permissions_service.ServiceInterface):
Controller =
result = Controller()
result.delegate = delegate
result.dappPermissionsService = dappPermissionsService
method delete*(self: Controller) =
discard
method init*(self: Controller) =
method init*(self: Controller) =
discard
method getDapps*(self: Controller): seq[dapp_permissions_service.Dapp] =

View File

@ -1,7 +1,7 @@
import ../../../../../app_service/service/dapp_permissions/service_interface as dapp_permissions_service
import options
import options
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
## Abstract class for any input/interaction with this module.

View File

@ -59,7 +59,7 @@ QtObject:
for i in self.items:
if i == item:
return
self.beginInsertRows(parentModelIndex, self.items.len, self.items.len)
self.items.add(item)
self.endInsertRows()

View File

@ -9,7 +9,7 @@ import ../../../../../app_service/service/dapp_permissions/service as dapp_permi
import options
export io_interface
type
type
Module* = ref object of io_interface.AccessInterface
delegate: delegate_interface.AccessInterface
view: View

View File

@ -66,4 +66,4 @@ QtObject:
proc clear*(self: PermissionsModel) {.slot.} =
self.beginResetModel()
self.items = @[]
self.endResetModel()
self.endResetModel()

View File

@ -1,5 +1,5 @@
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.

View File

@ -1,2 +1,2 @@
method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -12,7 +12,7 @@ QtObject:
dappsModelVariant: QVariant
permissionsModelVariant: QVariant
proc setup(self: View) =
proc setup(self: View) =
self.QObject.setup
proc delete*(self: View) =
@ -58,7 +58,7 @@ QtObject:
proc hasPermission(self: View, hostname: string, permission: string): bool {.slot.} =
return self.delegate.hasPermission(hostname, permission)
proc addPermission(self: View, hostname: string, permission: string) {.slot.} =
self.delegate.addPermission(hostname, permission)

View File

@ -12,7 +12,7 @@ import ../../../../app_service/service/dapp_permissions/service as dapp_permissi
import ../../../../app_service/service/provider/service as provider_service
export io_interface
type
type
Module* = ref object of io_interface.AccessInterface
delegate: delegate_interface.AccessInterface
view: View

View File

@ -1,5 +1,5 @@
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.

View File

@ -1,2 +1,2 @@
method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -7,7 +7,7 @@ import ../../../../../app_service/service/dapp_permissions/service as dapp_permi
import ../../../../../app_service/service/provider/service as provider_service
export controller_interface
type
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
settingsService: settings_service.ServiceInterface
@ -17,18 +17,18 @@ type
proc newController*(delegate: io_interface.AccessInterface,
settingsService: settings_service.ServiceInterface,
dappPermissionsService: dapp_permissions_service.ServiceInterface,
providerService: provider_service.ServiceInterface):
providerService: provider_service.ServiceInterface):
Controller =
result = Controller()
result.delegate = delegate
result.settingsService = settingsService
result.dappPermissionsService = dappPermissionsService
result.providerService = providerService
method delete*(self: Controller) =
discard
method init*(self: Controller) =
method init*(self: Controller) =
discard
method getDappsAddress*(self: Controller): string =

View File

@ -1,4 +1,4 @@
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
## Abstract class for any input/interaction with this module.

View File

@ -9,7 +9,7 @@ import ../../../../../app_service/service/provider/service as provider_service
import ../../../../global/global_singleton
export io_interface
type
type
Module* = ref object of io_interface.AccessInterface
delegate: delegate_interface.AccessInterface
view: View

View File

@ -1,5 +1,5 @@
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.

View File

@ -1,2 +1,2 @@
method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -16,7 +16,7 @@ QtObject:
new(result, delete)
result.QObject.setup
result.delegate = delegate
proc load*(self: View) =
self.delegate.viewDidLoad()
@ -67,4 +67,4 @@ QtObject:
proc ensResourceURL*(self: View, ens: string, url: string): string {.slot.} =
let (url, base, http_scheme, path_prefix, hasContentHash) = self.delegate.ensResourceURL(ens, url)
result = url_replaceHostAndAddPath(url, (if hasContentHash: base else: url_host(base)), http_scheme, path_prefix)
result = url_replaceHostAndAddPath(url, (if hasContentHash: base else: url_host(base)), http_scheme, path_prefix)

View File

@ -5,8 +5,8 @@ QtObject:
type
View* = ref object of QObject
delegate: io_interface.AccessInterface
proc setup(self: View) =
proc setup(self: View) =
self.QObject.setup
proc delete*(self: View) =

View File

@ -23,7 +23,7 @@ QtObject:
#################################################
# Forward declaration section
proc activeSubItemChanged(self: ActiveItem) {.signal.}
proc activeSubItemChanged(self: ActiveItem) {.signal.}
#################################################
@ -32,7 +32,7 @@ QtObject:
self.activeSubItem.setActiveSubItemData(subItem)
self.activeSubItemChanged()
proc getId(self: ActiveItem): string {.slot.} =
proc getId(self: ActiveItem): string {.slot.} =
if(self.item.isNil):
return ""
return self.item.id
@ -40,7 +40,7 @@ QtObject:
QtProperty[string] id:
read = getId
proc getIsSubItemActive(self: ActiveItem): bool {.slot.} =
proc getIsSubItemActive(self: ActiveItem): bool {.slot.} =
if(self.activeSubItem.getId().len > 0):
return true
@ -49,7 +49,7 @@ QtObject:
QtProperty[bool] isSubItemActive:
read = getIsSubItemActive
proc getName(self: ActiveItem): string {.slot.} =
proc getName(self: ActiveItem): string {.slot.} =
if(self.item.isNil):
return ""
return self.item.name
@ -57,7 +57,7 @@ QtObject:
QtProperty[string] name:
read = getName
proc getAmIChatAdmin(self: ActiveItem): bool {.slot.} =
proc getAmIChatAdmin(self: ActiveItem): bool {.slot.} =
if(self.item.isNil):
return false
return self.item.amIChatAdmin
@ -89,7 +89,7 @@ QtObject:
QtProperty[string] color:
read = getColor
proc getDescription(self: ActiveItem): string {.slot.} =
proc getDescription(self: ActiveItem): string {.slot.} =
if(self.item.isNil):
return ""
return self.item.description
@ -97,7 +97,7 @@ QtObject:
QtProperty[string] description:
read = getDescription
proc getType(self: ActiveItem): int {.slot.} =
proc getType(self: ActiveItem): int {.slot.} =
if(self.item.isNil):
return 0
return self.item.`type`
@ -105,7 +105,7 @@ QtObject:
QtProperty[int] type:
read = getType
proc getHasUnreadMessages(self: ActiveItem): bool {.slot.} =
proc getHasUnreadMessages(self: ActiveItem): bool {.slot.} =
if(self.item.isNil):
return false
return self.item.hasUnreadMessages
@ -113,7 +113,7 @@ QtObject:
QtProperty[bool] hasUnreadMessages:
read = getHasUnreadMessages
proc getNotificationCount(self: ActiveItem): int {.slot.} =
proc getNotificationCount(self: ActiveItem): int {.slot.} =
if(self.item.isNil):
return 0
return self.item.notificationsCount
@ -121,21 +121,21 @@ QtObject:
QtProperty[int] notificationCount:
read = getNotificationCount
proc getMuted(self: ActiveItem): bool {.slot.} =
proc getMuted(self: ActiveItem): bool {.slot.} =
if(self.item.isNil):
return false
return self.item.muted
QtProperty[bool] muted:
read = getMuted
proc getBlocked(self: ActiveItem): bool {.slot.} =
proc getBlocked(self: ActiveItem): bool {.slot.} =
if(self.item.isNil):
return false
return self.item.blocked
QtProperty[bool] blocked:
read = getBlocked
proc getPosition(self: ActiveItem): int {.slot.} =
proc getPosition(self: ActiveItem): int {.slot.} =
if(self.item.isNil):
return 0
return self.item.position
@ -143,11 +143,10 @@ QtObject:
QtProperty[int] position:
read = getPosition
proc getActiveSubItem(self: ActiveItem): QVariant {.slot.} =
proc getActiveSubItem(self: ActiveItem): QVariant {.slot.} =
return self.activeSubItemVariant
QtProperty[QVariant] activeSubItem:
read = getActiveSubItem
notify = activeSubItemChanged

View File

@ -18,7 +18,7 @@ QtObject:
proc setActiveSubItemData*(self: ActiveSubItem, item: SubItem) =
self.item = item
proc getId*(self: ActiveSubItem): string {.slot.} =
proc getId*(self: ActiveSubItem): string {.slot.} =
if(self.item.isNil):
return ""
return self.item.id
@ -26,7 +26,7 @@ QtObject:
QtProperty[string] id:
read = getId
proc getName(self: ActiveSubItem): string {.slot.} =
proc getName(self: ActiveSubItem): string {.slot.} =
if(self.item.isNil):
return ""
return self.item.name
@ -34,7 +34,7 @@ QtObject:
QtProperty[string] name:
read = getName
proc getAmIChatAdmin(self: ActiveSubItem): bool {.slot.} =
proc getAmIChatAdmin(self: ActiveSubItem): bool {.slot.} =
if(self.item.isNil):
return false
return self.item.amIChatAdmin
@ -66,7 +66,7 @@ QtObject:
QtProperty[string] color:
read = getColor
proc getDescription(self: ActiveSubItem): string {.slot.} =
proc getDescription(self: ActiveSubItem): string {.slot.} =
if(self.item.isNil):
return ""
return self.item.description
@ -74,7 +74,7 @@ QtObject:
QtProperty[string] description:
read = getDescription
proc getHasUnreadMessages(self: ActiveSubItem): bool {.slot.} =
proc getHasUnreadMessages(self: ActiveSubItem): bool {.slot.} =
if(self.item.isNil):
return false
return self.item.hasUnreadMessages
@ -82,7 +82,7 @@ QtObject:
QtProperty[bool] hasUnreadMessages:
read = getHasUnreadMessages
proc getNotificationCount(self: ActiveSubItem): int {.slot.} =
proc getNotificationCount(self: ActiveSubItem): int {.slot.} =
if(self.item.isNil):
return 0
return self.item.notificationsCount
@ -90,21 +90,21 @@ QtObject:
QtProperty[int] notificationCount:
read = getNotificationCount
proc getMuted(self: ActiveSubItem): bool {.slot.} =
proc getMuted(self: ActiveSubItem): bool {.slot.} =
if(self.item.isNil):
return false
return self.item.muted
QtProperty[bool] muted:
read = getMuted
proc getBlocked(self: ActiveSubItem): bool {.slot.} =
proc getBlocked(self: ActiveSubItem): bool {.slot.} =
if(self.item.isNil):
return false
return self.item.blocked
QtProperty[bool] blocked:
read = getBlocked
proc getPosition(self: ActiveSubItem): int {.slot.} =
proc getPosition(self: ActiveSubItem): int {.slot.} =
if(self.item.isNil):
return 0
return self.item.position
@ -112,4 +112,3 @@ QtObject:
QtProperty[int] position:
read = getPosition

View File

@ -1,4 +1,4 @@
type
type
BaseItem* {.pure inheritable.} = ref object of RootObj
id: string
name: string
@ -35,90 +35,90 @@ proc setup*(self: BaseItem, id, name, icon: string, isIdenticon: bool, color, de
self.position = position
self.categoryId = categoryId
proc initBaseItem*(id, name, icon: string, isIdenticon: bool, color, description: string, `type`: int,
proc initBaseItem*(id, name, icon: string, isIdenticon: bool, color, description: string, `type`: int,
amIChatAdmin: bool, hasUnreadMessages: bool, notificationsCount: int, muted, blocked, active: bool,
position: int, categoryId: string = ""): BaseItem =
result = BaseItem()
result.setup(id, name, icon, isIdenticon, color, description, `type`, amIChatAdmin, hasUnreadMessages,
result.setup(id, name, icon, isIdenticon, color, description, `type`, amIChatAdmin, hasUnreadMessages,
notificationsCount, muted, blocked, active, position, categoryId)
proc delete*(self: BaseItem) =
proc delete*(self: BaseItem) =
discard
method id*(self: BaseItem): string {.inline base.} =
method id*(self: BaseItem): string {.inline base.} =
self.id
method name*(self: BaseItem): string {.inline base.} =
method name*(self: BaseItem): string {.inline base.} =
self.name
method `name=`*(self: var BaseItem, value: string) {.inline base.} =
method `name=`*(self: var BaseItem, value: string) {.inline base.} =
self.name = value
method amIChatAdmin*(self: BaseItem): bool {.inline base.} =
method amIChatAdmin*(self: BaseItem): bool {.inline base.} =
self.amIChatAdmin
method icon*(self: BaseItem): string {.inline base.} =
method icon*(self: BaseItem): string {.inline base.} =
self.icon
method `icon=`*(self: var BaseItem, value: string) {.inline base.} =
method `icon=`*(self: var BaseItem, value: string) {.inline base.} =
self.icon = value
method isIdenticon*(self: BaseItem): bool {.inline base.} =
method isIdenticon*(self: BaseItem): bool {.inline base.} =
self.isIdenticon
method `isIdenticon=`*(self: var BaseItem, value: bool) {.inline base.} =
method `isIdenticon=`*(self: var BaseItem, value: bool) {.inline base.} =
self.isIdenticon = value
method color*(self: BaseItem): string {.inline base.} =
method color*(self: BaseItem): string {.inline base.} =
self.color
method description*(self: BaseItem): string {.inline base.} =
method description*(self: BaseItem): string {.inline base.} =
self.description
method `description=`*(self: var BaseItem, value: string) {.inline base.} =
self.description = value
method type*(self: BaseItem): int {.inline base.} =
method type*(self: BaseItem): int {.inline base.} =
self.`type`
method hasUnreadMessages*(self: BaseItem): bool {.inline base.} =
method hasUnreadMessages*(self: BaseItem): bool {.inline base.} =
self.hasUnreadMessages
method `hasUnreadMessages=`*(self: var BaseItem, value: bool) {.inline base.} =
method `hasUnreadMessages=`*(self: var BaseItem, value: bool) {.inline base.} =
self.hasUnreadMessages = value
method notificationsCount*(self: BaseItem): int {.inline base.} =
method notificationsCount*(self: BaseItem): int {.inline base.} =
self.notificationsCount
method `notificationsCount=`*(self: var BaseItem, value: int) {.inline base.} =
method `notificationsCount=`*(self: var BaseItem, value: int) {.inline base.} =
self.notificationsCount = value
method muted*(self: BaseItem): bool {.inline base.} =
method muted*(self: BaseItem): bool {.inline base.} =
self.muted
method `muted=`*(self: var BaseItem, value: bool) {.inline base.} =
method `muted=`*(self: var BaseItem, value: bool) {.inline base.} =
self.muted = value
method blocked*(self: BaseItem): bool {.inline base.} =
method blocked*(self: BaseItem): bool {.inline base.} =
self.blocked
method `blocked=`*(self: var BaseItem, value: bool) {.inline base.} =
method `blocked=`*(self: var BaseItem, value: bool) {.inline base.} =
self.blocked = value
method active*(self: BaseItem): bool {.inline base.} =
method active*(self: BaseItem): bool {.inline base.} =
self.active
method `active=`*(self: var BaseItem, value: bool) {.inline base.} =
method `active=`*(self: var BaseItem, value: bool) {.inline base.} =
self.active = value
method position*(self: BaseItem): int {.inline base.} =
method position*(self: BaseItem): int {.inline base.} =
self.position
method `position=`*(self: var BaseItem, value: int) {.inline base.} =
method `position=`*(self: var BaseItem, value: int) {.inline base.} =
self.position = value
method categoryId*(self: BaseItem): string {.inline base.} =
method categoryId*(self: BaseItem): string {.inline base.} =
self.categoryId
method `categoryId=`*(self: var BaseItem, value: string) {.inline base.} =
method `categoryId=`*(self: var BaseItem, value: string) {.inline base.} =
self.categoryId = value

View File

@ -36,18 +36,18 @@ QtObject:
self.icon = icon
self.isIdenticon = isIdenticon
self.color = color
self.description = description
self.description = description
self.hasUnreadMessages = hasUnreadMessages
self.notificationsCount = notificationsCount
self.muted = muted
self.position = position
proc getId(self: ChatDetails): string {.slot.} =
proc getId(self: ChatDetails): string {.slot.} =
return self.id
QtProperty[string] id:
read = getId
proc getType(self: ChatDetails): int {.slot.} =
proc getType(self: ChatDetails): int {.slot.} =
return self.`type`
QtProperty[int] type:
read = getType
@ -61,19 +61,19 @@ QtObject:
return self.isUsersListAvailable
QtProperty[bool] isUsersListAvailable:
read = getIsUsersListAvailable
proc nameChanged(self: ChatDetails) {.signal.}
proc getName(self: ChatDetails): string {.slot.} =
proc nameChanged(self: ChatDetails) {.signal.}
proc getName(self: ChatDetails): string {.slot.} =
return self.name
QtProperty[string] name:
read = getName
notify = nameChanged
proc setName*(self: ChatDetails, value: string) = # this is not a slot
self.name = value
self.nameChanged()
proc iconChanged(self: ChatDetails) {.signal.}
proc iconChanged(self: ChatDetails) {.signal.}
proc getIcon(self: ChatDetails): string {.slot.} =
return self.icon
QtProperty[string] icon:
@ -91,7 +91,7 @@ QtObject:
self.isIdenticon = isIdenticon
self.iconChanged()
proc colorChanged(self: ChatDetails) {.signal.}
proc colorChanged(self: ChatDetails) {.signal.}
proc getColor(self: ChatDetails): string {.slot.} =
return self.color
QtProperty[string] color:
@ -102,8 +102,8 @@ QtObject:
self.color = value
self.colorChanged()
proc descriptionChanged(self: ChatDetails) {.signal.}
proc getDescription(self: ChatDetails): string {.slot.} =
proc descriptionChanged(self: ChatDetails) {.signal.}
proc getDescription(self: ChatDetails): string {.slot.} =
return self.description
QtProperty[string] description:
read = getDescription
@ -113,8 +113,8 @@ QtObject:
self.description = value
self.descriptionChanged()
proc hasUnreadMessagesChanged(self: ChatDetails) {.signal.}
proc getHasUnreadMessages(self: ChatDetails): bool {.slot.} =
proc hasUnreadMessagesChanged(self: ChatDetails) {.signal.}
proc getHasUnreadMessages(self: ChatDetails): bool {.slot.} =
return self.hasUnreadMessages
QtProperty[bool] hasUnreadMessages:
read = getHasUnreadMessages
@ -124,8 +124,8 @@ QtObject:
self.hasUnreadMessages = value
self.hasUnreadMessagesChanged()
proc notificationCountChanged(self: ChatDetails) {.signal.}
proc getNotificationCount(self: ChatDetails): int {.slot.} =
proc notificationCountChanged(self: ChatDetails) {.signal.}
proc getNotificationCount(self: ChatDetails): int {.slot.} =
return self.notificationsCount
QtProperty[int] notificationCount:
read = getNotificationCount
@ -135,8 +135,8 @@ QtObject:
self.notificationsCount = value
self.notificationCountChanged()
proc mutedChanged(self: ChatDetails) {.signal.}
proc getMuted(self: ChatDetails): bool {.slot.} =
proc mutedChanged(self: ChatDetails) {.signal.}
proc getMuted(self: ChatDetails): bool {.slot.} =
return self.muted
QtProperty[bool] muted:
read = getMuted
@ -146,8 +146,8 @@ QtObject:
self.muted = value
self.mutedChanged()
proc positionChanged(self: ChatDetails) {.signal.}
proc getPosition(self: ChatDetails): int {.slot.} =
proc positionChanged(self: ChatDetails) {.signal.}
proc getPosition(self: ChatDetails): int {.slot.} =
return self.position
QtProperty[int] position:
read = getPosition
@ -155,4 +155,4 @@ QtObject:
proc setPotion*(self: ChatDetails, value: int) = # this is not a slot
self.position = value
self.positionChanged()
self.positionChanged()

View File

@ -15,7 +15,7 @@ import ../../../../core/eventemitter
export controller_interface
type
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
@ -29,9 +29,9 @@ type
communityService: community_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, settingsService: settings_service.ServiceInterface,
contactService: contact_service.Service, chatService: chat_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,11 +45,11 @@ proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter
result.chatService = chatService
result.communityService = communityService
result.messageService = messageService
method delete*(self: Controller) =
discard
method init*(self: Controller) =
method init*(self: Controller) =
self.events.on(SIGNAL_MESSAGES_LOADED) do(e:Args):
let args = MessagesLoadedArgs(e)
if(self.chatId != args.chatId or args.pinnedMessages.len == 0):
@ -143,7 +143,7 @@ method belongsToCommunity*(self: Controller): bool =
method unpinMessage*(self: Controller, messageId: string) =
self.messageService.pinUnpinMessage(self.chatId, messageId, false)
method getMessageDetails*(self: Controller, messageId: string):
method getMessageDetails*(self: Controller, messageId: string):
tuple[message: MessageDto, reactions: seq[ReactionDto], error: string] =
return self.messageService.getDetailsForMessage(self.chatId, messageId)

View File

@ -4,7 +4,7 @@ import ../../../../../app_service/service/community/dto/[community]
import ../../../../../app_service/service/chat/dto/[chat]
import ../../../../../app_service/service/contacts/service
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
## Abstract class for any input/interaction with this module.
@ -19,11 +19,11 @@ method getMyChatId*(self: AccessInterface): string {.base.} =
method getChatDetails*(self: AccessInterface): ChatDto {.base.} =
raise newException(ValueError, "No implementation available")
method getCommunityDetails*(self: AccessInterface): CommunityDto {.base.} =
raise newException(ValueError, "No implementation available")
method getOneToOneChatNameAndImage*(self: AccessInterface): tuple[name: string, image: string, isIdenticon: bool]
method getOneToOneChatNameAndImage*(self: AccessInterface): tuple[name: string, image: string, isIdenticon: bool]
{.base.} =
raise newException(ValueError, "No implementation available")
@ -33,7 +33,7 @@ method belongsToCommunity*(self: AccessInterface): bool {.base.} =
method unpinMessage*(self: AccessInterface, messageId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method getMessageDetails*(self: AccessInterface, messageId: string):
method getMessageDetails*(self: AccessInterface, messageId: string):
tuple[message: MessageDto, reactions: seq[ReactionDto], error: string] {.base.} =
raise newException(ValueError, "No implementation available")
@ -71,4 +71,4 @@ method getRenderedText*(self: AccessInterface, parsedTextArray: seq[ParsedText])
raise newException(ValueError, "No implementation available")
method decodeContentHash*(self: AccessInterface, hash: string): string {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -8,7 +8,7 @@ import ../../../../../../app_service/service/gif/dto
export controller_interface
type
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
sectionId: string
@ -23,7 +23,7 @@ proc newController*(
sectionId: string,
chatId: string,
belongsToCommunity: bool,
chatService: chat_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
gifService: gif_service.Service
): Controller =
@ -35,11 +35,11 @@ proc newController*(
result.chatService = chatService
result.communityService = communityService
result.gifService = gifService
method delete*(self: Controller) =
discard
method init*(self: Controller) =
method init*(self: Controller) =
discard
method getChatId*(self: Controller): string =
@ -97,4 +97,4 @@ method addToRecentsGif*(self: Controller, item: GifDto) =
self.gifService.addToRecents(item)
method isFavorite*(self: Controller, item: GifDto): bool =
return self.gifService.isFavorite(item)
return self.gifService.isFavorite(item)

View File

@ -1,6 +1,6 @@
import ../../../../../../app_service/service/gif/dto
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
## Abstract class for any input/interaction with this module.
@ -39,7 +39,7 @@ method acceptRequestAddressForTransaction*(self: AccessInterface, messageId: str
method acceptRequestTransaction*(self: AccessInterface, transactionHash: string, messageId: string, signature: string) {.base.} =
raise newException(ValueError, "No implementation available")
method searchGifs*(self: AccessInterface, query: string): seq[GifDto] {.base.} =
raise newException(ValueError, "No implementation available")
@ -59,4 +59,4 @@ method addToRecentsGif*(self: AccessInterface, item: GifDto) {.base.} =
raise newException(ValueError, "No implementation available")
method isFavorite*(self: AccessInterface, item: GifDto): bool {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -28,7 +28,7 @@ QtObject:
self.gifs = gifs
self.endResetModel()
method rowCount(self: GifColumnModel, index: QModelIndex = nil): int =
method rowCount(self: GifColumnModel, index: QModelIndex = nil): int =
self.gifs.len
method data(self: GifColumnModel, index: QModelIndex, role: int): QVariant =
@ -51,4 +51,4 @@ QtObject:
GifRoles.Id.int:"id",
GifRoles.Title.int:"title",
GifRoles.TinyUrl.int:"tinyUrl",
}.toTable
}.toTable

View File

@ -9,4 +9,4 @@ include ./private_interfaces/module_view_delegate_interface
include ./private_interfaces/module_controller_delegate_interface
# Defines how submodules of this module communicate with this module
# will be added if needed
# will be added if needed

View File

@ -3,8 +3,8 @@ import NimQml
QtObject:
type
Item* = ref object of QObject
proc setup(self: Item) =
proc setup(self: Item) =
self.QObject.setup
proc delete*(self: Item) =
@ -14,8 +14,8 @@ QtObject:
new(result, delete)
result.setup()
proc id*(self: Item): string {.slot.} =
proc id*(self: Item): string {.slot.} =
self.id
QtProperty[string] id:
read = id
read = id

View File

@ -2,11 +2,11 @@ import NimQml
import item
QtObject:
type
type
Model* = ref object of QAbstractListModel
sections: seq[Item]
proc setup(self: Model) =
proc setup(self: Model) =
self.QAbstractListModel.setup
proc delete*(self: Model) =
@ -14,4 +14,4 @@ QtObject:
proc newModel*(): Model =
new(result, delete)
result.setup
result.setup

View File

@ -11,7 +11,7 @@ import ../../../../../../app_service/service/gif/dto
export io_interface
type
type
Module* = ref object of io_interface.AccessInterface
delegate: delegate_interface.AccessInterface
view: View
@ -23,7 +23,7 @@ proc newModule*(
delegate: delegate_interface.AccessInterface,
sectionId: string,
chatId: string,
belongsToCommunity: bool,
belongsToCommunity: bool,
chatService: chat_service.Service,
communityService: community_service.Service,
gifService: gif_service.Service,
@ -108,4 +108,4 @@ method addToRecentsGif*(self: Module, item: GifDto) =
self.controller.addToRecentsGif(item)
method isFavorite*(self: Module, item: GifDto): bool =
return self.controller.isFavorite(item)
return self.controller.isFavorite(item)

View File

@ -58,4 +58,4 @@ method addToRecentsGif*(self: AccessInterface, item: GifDto) {.base.} =
raise newException(ValueError, "No implementation available")
method isFavorite*(self: AccessInterface, item: GifDto): bool {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -1,5 +1,5 @@
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.

View File

@ -1,2 +1,2 @@
method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -12,7 +12,7 @@ QtObject:
gifColumnAModel: GifColumnModel
gifColumnBModel: GifColumnModel
gifColumnCModel: GifColumnModel
proc delete*(self: View) =
self.model.delete
self.QObject.delete
@ -28,7 +28,7 @@ QtObject:
proc load*(self: View) =
self.delegate.viewDidLoad()
proc sendMessage*(
self: View,
msg: string,
@ -53,7 +53,7 @@ QtObject:
proc declineRequest*(self: View, messageId: string) {.slot.} =
self.delegate.declineRequestTransaction(messageId)
proc acceptRequestTransaction*(self: View, transactionHash: string, messageId: string, signature: string) {.slot.} =
self.delegate.acceptRequestTransaction(transactionHash, messageId, signature)
@ -108,11 +108,11 @@ QtObject:
proc searchGifs*(self: View, query: string) {.slot.} =
let data = self.delegate.searchGifs(query)
self.updateGifColumns(data)
proc getTrendingsGifs*(self: View) {.slot.} =
let data = self.delegate.getTrendingsGifs()
self.updateGifColumns(data)
proc getRecentsGifs*(self: View) {.slot.} =
let data = self.delegate.getRecentsGifs()
self.updateGifColumns(data)
@ -149,4 +149,4 @@ QtObject:
proc isFavorite*(self: View, id: string): bool {.slot.} =
let gifItem = self.findGifDto(id)
return self.delegate.isFavorite(gifItem)
return self.delegate.isFavorite(gifItem)

View File

@ -11,4 +11,4 @@ include ./private_interfaces/module_controller_delegate_interface
# Defines how submodules of this module communicate with this module
include ./private_interfaces/module_input_area_delegate_interface
include ./private_interfaces/module_messages_delegate_interface
include ./private_interfaces/module_users_delegate_interface
include ./private_interfaces/module_users_delegate_interface

View File

@ -16,7 +16,7 @@ export controller_interface
logScope:
topics = "messages-controller"
type
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
@ -31,9 +31,9 @@ type
messageService: message_service.Service
mailserversService: mailservers_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, contactService: contact_service.Service, communityService: community_service.Service,
chatService: chat_service.Service, messageService: message_service.Service, mailserversService: mailservers_service.Service):
chatService: chat_service.Service, messageService: message_service.Service, mailserversService: mailservers_service.Service):
Controller =
result = Controller()
result.delegate = delegate
@ -47,11 +47,11 @@ proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter
result.chatService = chatService
result.messageService = messageService
result.mailserversService = mailserversService
method delete*(self: Controller) =
discard
method init*(self: Controller) =
method init*(self: Controller) =
self.events.on(SIGNAL_MESSAGES_LOADED) do(e:Args):
let args = MessagesLoadedArgs(e)
if(self.chatId != args.chatId):
@ -195,7 +195,7 @@ method getNumOfPinnedMessages*(self: Controller): int =
method getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText]): string =
return self.messageService.getRenderedText(parsedTextArray)
method getMessageDetails*(self: Controller, messageId: string):
method getMessageDetails*(self: Controller, messageId: string):
tuple[message: MessageDto, reactions: seq[ReactionDto], error: string] =
return self.messageService.getDetailsForMessage(self.chatId, messageId)
@ -208,7 +208,7 @@ method decodeContentHash*(self: Controller, hash: string): string =
method editMessage*(self: Controller, messageId: string, updatedMsg: string) =
self.messageService.editMessage(messageId, updatedMsg)
method getLinkPreviewData*(self: Controller, link: string, uuid: string): string =
method getLinkPreviewData*(self: Controller, link: string, uuid: string): string =
self.messageService.asyncGetLinkPreviewData(link, uuid)
method getSearchedMessageId*(self: Controller): string =

View File

@ -3,7 +3,7 @@ import ../../../../../../app_service/service/community/dto/[community]
import ../../../../../../app_service/service/chat/dto/[chat]
import ../../../../../../app_service/service/message/dto/[message, reaction]
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
## Abstract class for any input/interaction with this module.
@ -25,7 +25,7 @@ method getChatDetails*(self: AccessInterface): ChatDto {.base.} =
method getCommunityDetails*(self: AccessInterface): CommunityDto {.base.} =
raise newException(ValueError, "No implementation available")
method getOneToOneChatNameAndImage*(self: AccessInterface): tuple[name: string, image: string, isIdenticon: bool]
method getOneToOneChatNameAndImage*(self: AccessInterface): tuple[name: string, image: string, isIdenticon: bool]
{.base.} =
raise newException(ValueError, "No implementation available")
@ -34,7 +34,7 @@ method belongsToCommunity*(self: AccessInterface): bool {.base.} =
method loadMoreMessages*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method addReaction*(self: AccessInterface, messageId: string, emojiId: int) {.base.} =
raise newException(ValueError, "No implementation available")
@ -56,7 +56,7 @@ method getNumOfPinnedMessages*(self: AccessInterface): int {.base.} =
method getRenderedText*(self: AccessInterface, parsedTextArray: seq[ParsedText]): string {.base.} =
raise newException(ValueError, "No implementation available")
method getMessageDetails*(self: AccessInterface, messageId: string):
method getMessageDetails*(self: AccessInterface, messageId: string):
tuple[message: MessageDto, reactions: seq[ReactionDto], error: string] {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -9,4 +9,4 @@ include ./private_interfaces/module_view_delegate_interface
include ./private_interfaces/module_controller_delegate_interface
# Defines how submodules of this module communicate with this module
# will be added if needed
# will be added if needed

View File

@ -21,7 +21,7 @@ logScope:
const CHAT_IDENTIFIER_MESSAGE_ID = "chat-identifier-message-id"
const FETCH_MORE_MESSAGES_MESSAGE_ID = "fetch-more_messages-message-id"
type
type
Module* = ref object of io_interface.AccessInterface
delegate: delegate_interface.AccessInterface
view: View
@ -29,15 +29,15 @@ type
controller: controller.AccessInterface
moduleLoaded: bool
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, contactService: contact_service.Service, communityService: community_service.Service,
chatService: chat_service.Service, messageService: message_service.Service, mailserversService: mailservers_service.Service):
chatService: chat_service.Service, messageService: message_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, sectionId, chatId, belongsToCommunity, contactService,
result.controller = controller.newController(result, events, sectionId, chatId, belongsToCommunity, contactService,
communityService, chatService, messageService, mailserversService)
result.moduleLoaded = false
@ -81,7 +81,7 @@ proc createFetchMoreMessagesItem(self: Module): Item =
amISender = false,
outgoingStatus = "",
text = "",
image = "",
image = "",
messageContainsMentions = false,
seen = true,
timestamp = 0,
@ -111,7 +111,7 @@ proc createChatIdentifierItem(self: Module): Item =
amISender = false,
outgoingStatus = "",
text = "",
image = "",
image = "",
messageContainsMentions = false,
seen = true,
timestamp = 0,
@ -135,10 +135,10 @@ proc checkIfMessageLoadedAndScrollToItIfItIs(self: Module): bool =
return true
return false
method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: seq[ReactionDto],
pinnedMessages: seq[PinnedMessageDto]) =
method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: seq[ReactionDto],
pinnedMessages: seq[PinnedMessageDto]) =
var viewItems: seq[Item]
if(messages.len > 0):
for m in messages:
let sender = self.controller.getContactDetails(m.`from`)
@ -150,12 +150,12 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
m.`from`,
sender.displayName,
sender.details.localNickname,
sender.icon,
sender.icon,
sender.isIdenticon,
sender.isCurrentUser,
m.outgoingStatus,
renderedMessageText,
m.image,
m.image,
m.containsContactMentions(),
m.seen,
m.timestamp,
@ -172,7 +172,7 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
if(message_reaction_item.toEmojiIdAsEnum(r.emojiId, emojiIdAsEnum)):
let userWhoAddedThisReaction = self.controller.getContactById(r.`from`)
let didIReactWithThisEmoji = userWhoAddedThisReaction.id == singletonInstance.userProfile.getPubKey()
item.addReaction(emojiIdAsEnum, didIReactWithThisEmoji, userWhoAddedThisReaction.id,
item.addReaction(emojiIdAsEnum, didIReactWithThisEmoji, userWhoAddedThisReaction.id,
userWhoAddedThisReaction.userNameOrAlias(), r.id)
else:
error "wrong emoji id found when loading messages", methodName="newMessagesLoaded"
@ -202,7 +202,7 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
# check if this loading was caused by the click on a messages from the app search result
discard self.checkIfMessageLoadedAndScrollToItIfItIs()
method messageAdded*(self: Module, message: MessageDto) =
let sender = self.controller.getContactDetails(message.`from`)
@ -212,13 +212,13 @@ method messageAdded*(self: Module, message: MessageDto) =
message.responseTo,
message.`from`,
sender.displayName,
sender.details.localNickname,
sender.details.localNickname,
sender.icon,
sender.isIdenticon,
sender.isCurrentUser,
message.outgoingStatus,
renderedMessageText,
message.image,
message.image,
message.containsContactMentions(),
message.seen,
message.timestamp,
@ -260,7 +260,7 @@ method onReactionAdded*(self: Module, messageId: string, emojiId: int, reactionI
if(message_reaction_item.toEmojiIdAsEnum(emojiId, emojiIdAsEnum)):
let myPublicKey = singletonInstance.userProfile.getPubKey()
let myName = singletonInstance.userProfile.getName()
self.view.model().addReaction(messageId, emojiIdAsEnum, didIReactWithThisEmoji = true, myPublicKey, myName,
self.view.model().addReaction(messageId, emojiIdAsEnum, didIReactWithThisEmoji = true, myPublicKey, myName,
reactionId)
else:
error "wrong emoji id found on reaction added response", emojiId, methodName="onReactionAdded"
@ -272,7 +272,7 @@ method onReactionRemoved*(self: Module, messageId: string, emojiId: int, reactio
else:
error "wrong emoji id found on reaction remove response", emojiId, methodName="onReactionRemoved"
method toggleReactionFromOthers*(self: Module, messageId: string, emojiId: int, reactionId: string,
method toggleReactionFromOthers*(self: Module, messageId: string, emojiId: int, reactionId: string,
reactionFrom: string) =
var emojiIdAsEnum: EmojiId
if(message_reaction_item.toEmojiIdAsEnum(emojiId, emojiIdAsEnum)):
@ -282,7 +282,7 @@ method toggleReactionFromOthers*(self: Module, messageId: string, emojiId: int,
return
if(item.shouldAddReaction(emojiIdAsEnum, reactionFrom)):
let userWhoAddedThisReaction = self.controller.getContactById(reactionFrom)
self.view.model().addReaction(messageId, emojiIdAsEnum, didIReactWithThisEmoji = false,
self.view.model().addReaction(messageId, emojiIdAsEnum, didIReactWithThisEmoji = false,
userWhoAddedThisReaction.id, userWhoAddedThisReaction.userNameOrAlias(), reactionId)
else:
self.view.model().removeReaction(messageId, emojiIdAsEnum, reactionId, didIRemoveThisReaction = false)

View File

@ -13,4 +13,4 @@ method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} =
raise newException(ValueError, "No implementation available")
method updateChatIdentifier*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")

View File

@ -1,5 +1,5 @@
type
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.
# Since nim doesn't support using concepts in second level nested types we
# define delegate interfaces within access interface.

View File

@ -1,8 +1,8 @@
import ../../../../../../../app_service/service/message/dto/[message, reaction, pinned_message]
method newMessagesLoaded*(self: AccessInterface, messages: seq[MessageDto], reactions: seq[ReactionDto],
method newMessagesLoaded*(self: AccessInterface, messages: seq[MessageDto], reactions: seq[ReactionDto],
pinnedMessages: seq[PinnedMessageDto]) {.base.} =
raise newException(ValueError, "No implementation available")
raise newException(ValueError, "No implementation available")
method onReactionAdded*(self: AccessInterface, messageId: string, emojiId: int, reactionId: string) {.base.} =
raise newException(ValueError, "No implementation available")
@ -10,7 +10,7 @@ method onReactionAdded*(self: AccessInterface, messageId: string, emojiId: int,
method onReactionRemoved*(self: AccessInterface, messageId: string, emojiId: int, reactionId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method toggleReactionFromOthers*(self: AccessInterface, messageId: string, emojiId: int, reactionId: string,
method toggleReactionFromOthers*(self: AccessInterface, messageId: string, emojiId: int, reactionId: string,
reactionFrom: string) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -3,7 +3,7 @@ method viewDidLoad*(self: AccessInterface) {.base.} =
method loadMoreMessages*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method toggleReaction*(self: AccessInterface, messageId: string, emojiId: int) {.base.} =
raise newException(ValueError, "No implementation available")

Some files were not shown because too many files have changed in this diff Show More