refactor(@desktop/general): many errors from the log are fixed

- various issues on app start in console
- various issues when logging out in console
- `node_section` module delete method error
- SyntaxError: JSON.parse: Parse error from the MessageStore
This commit is contained in:
Sale Djenic 2022-01-12 00:16:17 +01:00
parent 4cb3126513
commit f0ca1a4cc3
20 changed files with 225 additions and 89 deletions

View File

@ -207,6 +207,7 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
result.connect() result.connect()
proc delete*(self: AppController) = proc delete*(self: AppController) =
singletonInstance.delete
self.osNotificationService.delete self.osNotificationService.delete
self.keychainService.delete self.keychainService.delete
self.contactsService.delete self.contactsService.delete

View File

@ -34,7 +34,7 @@ proc newController*(delegate: io_interface.AccessInterface,
result.nodeService = nodeService result.nodeService = nodeService
result.nodeConfigurationService = nodeConfigurationService result.nodeConfigurationService = nodeConfigurationService
proc delete*(self: Controller) = method delete*(self: Controller) =
discard discard
proc setPeers(self: Controller, peers: seq[string]) = proc setPeers(self: Controller, peers: seq[string]) =

View File

@ -33,7 +33,7 @@ import shared.panels 1.0
Rectangle { Rectangle {
id: container id: container
property QtObject model: undefined property QtObject model
property Item delegate property Item delegate
property alias suggestionsModel: filterItem.model property alias suggestionsModel: filterItem.model
property alias filter: filterItem.filter property alias filter: filterItem.filter

View File

@ -5,7 +5,13 @@ QtObject {
id: root id: root
property var messageModule property var messageModule
property var messagesModel: messageModule.model property var messagesModel
onMessageModuleChanged: {
if(!messageModule)
return
root.messagesModel = messageModule.model
}
function loadMoreMessages () { function loadMoreMessages () {
if(!messageModule) if(!messageModule)
@ -21,6 +27,9 @@ QtObject {
return false return false
let jsonObj = messageModule.getMessageByIdAsJson(id) let jsonObj = messageModule.getMessageByIdAsJson(id)
if(jsonObj === "")
return
let obj = JSON.parse(jsonObj) let obj = JSON.parse(jsonObj)
if (obj.error) { if (obj.error) {
// This log is available only in debug mode, if it's annoying we can remove it // This log is available only in debug mode, if it's annoying we can remove it
@ -36,6 +45,9 @@ QtObject {
return false return false
let jsonObj = messageModule.getMessageByIndexAsJson(index) let jsonObj = messageModule.getMessageByIndexAsJson(index)
if(jsonObj === "")
return
let obj = JSON.parse(jsonObj) let obj = JSON.parse(jsonObj)
if (obj.error) { if (obj.error) {
// This log is available only in debug mode, if it's annoying we can remove it // This log is available only in debug mode, if it's annoying we can remove it

View File

@ -67,8 +67,6 @@ QtObject {
property var userProfileInst: userProfile property var userProfileInst: userProfile
property bool isDebugEnabled: profileSectionModule.isDebugEnabled
property var accounts: walletSectionAccounts.model property var accounts: walletSectionAccounts.model
property var currentAccount: walletSectionCurrent property var currentAccount: walletSectionCurrent
property var currentCurrency: walletSection.currentCurrency property var currentCurrency: walletSection.currentCurrency

View File

@ -52,9 +52,9 @@ Item {
property Timer timer: Timer { } property Timer timer: Timer { }
property var userList property var userList
property var contactDetails: Utils.getContactDetailsAsJson(publicKey) property var contactDetails: Utils.getContactDetailsAsJson(root.activeChatId)
property bool isBlocked: root.contactDetails.isContact property bool isBlocked: root.contactDetails.isBlocked
property bool isContact: root.contactDetails.isBlocked property bool isContact: root.contactDetails.isContact
property bool contactRequestReceived: root.contactDetails.requestReceived property bool contactRequestReceived: root.contactDetails.requestReceived
signal openAppSearch() signal openAppSearch()
@ -172,10 +172,6 @@ Item {
} }
} }
// Should never be here, correct index must be returned from the `for` loop above
console.error("Wrong chat/channel index, active item id: ", root.activeChatId,
" active subitem id: ", root.activeSubItemId)
} }
return 0 return 0

View File

@ -42,8 +42,11 @@ ColumnLayout {
id: topBar id: topBar
Layout.fillWidth: true Layout.fillWidth: true
chatInfoButton.title: chatContentModule.chatDetails.name chatInfoButton.title: chatContentModule? chatContentModule.chatDetails.name : ""
chatInfoButton.subTitle: { chatInfoButton.subTitle: {
if(!chatContentModule)
return ""
// In some moment in future this should be part of the backend logic. // In some moment in future this should be part of the backend logic.
// (once we add transaltion on the backend side) // (once we add transaltion on the backend side)
switch (chatContentModule.chatDetails.type) { switch (chatContentModule.chatDetails.type) {
@ -68,24 +71,39 @@ ColumnLayout {
return "" return ""
} }
} }
chatInfoButton.image.source: chatContentModule.chatDetails.icon chatInfoButton.image.source: chatContentModule? chatContentModule.chatDetails.icon : ""
chatInfoButton.image.isIdenticon: chatContentModule.chatDetails.isIdenticon chatInfoButton.image.isIdenticon: chatContentModule? chatContentModule.chatDetails.isIdenticon : false
chatInfoButton.icon.color: chatContentModule.chatDetails.color chatInfoButton.icon.color: chatContentModule? chatContentModule.chatDetails.color : ""
chatInfoButton.type: chatContentModule.chatDetails.type chatInfoButton.type: chatContentModule? chatContentModule.chatDetails.type : Constants.chatType.unknown
chatInfoButton.pinnedMessagesCount: chatContentModule.pinnedMessagesModel.count chatInfoButton.pinnedMessagesCount: chatContentModule? chatContentModule.pinnedMessagesModel.count : 0
chatInfoButton.muted: chatContentModule.chatDetails.muted chatInfoButton.muted: chatContentModule? chatContentModule.chatDetails.muted : false
chatInfoButton.onPinnedMessagesCountClicked: { chatInfoButton.onPinnedMessagesCountClicked: {
if(!chatContentModule) {
console.debug("error on open pinned messages - chat content module is not set")
return
}
Global.openPopup(pinnedMessagesPopupComponent, { Global.openPopup(pinnedMessagesPopupComponent, {
messageStore: messageStore, messageStore: messageStore,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel, pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
messageToPin: "" messageToPin: ""
}) })
} }
chatInfoButton.onUnmute: chatContentModule.unmuteChat() chatInfoButton.onUnmute: {
if(!chatContentModule) {
console.debug("error on unmute chat - chat content module is not set")
return
}
chatContentModule.unmuteChat()
}
chatInfoButton.sensor.enabled: chatContentModule.chatDetails.type !== Constants.chatType.publicChat && chatInfoButton.sensor.enabled: {
if(!chatContentModule)
return false
return chatContentModule.chatDetails.type !== Constants.chatType.publicChat &&
chatContentModule.chatDetails.type !== Constants.chatType.communityChat chatContentModule.chatDetails.type !== Constants.chatType.communityChat
}
chatInfoButton.onClicked: { chatInfoButton.onClicked: {
// Not Refactored Yet // Not Refactored Yet
// switch (chatContentRoot.rootStore.chatsModelInst.channelView.activeChannel.chatType) { // switch (chatContentRoot.rootStore.chatsModelInst.channelView.activeChannel.chatType) {
@ -101,12 +119,23 @@ ColumnLayout {
// } // }
} }
membersButton.visible: localAccountSensitiveSettings.showOnlineUsers && chatContentModule.chatDetails.isUsersListAvailable membersButton.visible: {
if(!chatContentModule)
return false
return localAccountSensitiveSettings.showOnlineUsers &&
chatContentModule.chatDetails.isUsersListAvailable
}
membersButton.highlighted: localAccountSensitiveSettings.expandUsersList membersButton.highlighted: localAccountSensitiveSettings.expandUsersList
notificationButton.visible: localAccountSensitiveSettings.isActivityCenterEnabled notificationButton.visible: localAccountSensitiveSettings.isActivityCenterEnabled
notificationButton.tooltip.offset: localAccountSensitiveSettings.expandUsersList ? 0 : 14 notificationButton.tooltip.offset: localAccountSensitiveSettings.expandUsersList ? 0 : 14
notificationCount: chatContentModule.chatDetails.notificationCount notificationCount: {
if(!chatContentModule)
return 0
return chatContentModule.chatDetails.notificationCount
}
onSearchButtonClicked: root.openAppSearch() onSearchButtonClicked: root.openAppSearch()
@ -115,6 +144,10 @@ ColumnLayout {
popupMenu: ChatContextMenuView { popupMenu: ChatContextMenuView {
openHandler: function () { openHandler: function () {
if(!chatContentModule) {
console.debug("error on open chat context menu handler - chat content module is not set")
return
}
currentFleet = chatContentModule.getCurrentFleet() currentFleet = chatContentModule.getCurrentFleet()
isCommunityChat = chatContentModule.chatDetails.belongsToCommunity isCommunityChat = chatContentModule.chatDetails.belongsToCommunity
amIChatAdmin = chatContentModule.amIChatAdmin() amIChatAdmin = chatContentModule.amIChatAdmin()
@ -126,18 +159,34 @@ ColumnLayout {
} }
onMuteChat: { onMuteChat: {
if(!chatContentModule) {
console.debug("error on mute chat from context menu - chat content module is not set")
return
}
chatContentModule.muteChat() chatContentModule.muteChat()
} }
onUnmuteChat: { onUnmuteChat: {
if(!chatContentModule) {
console.debug("error on unmute chat from context menu - chat content module is not set")
return
}
chatContentModule.unmuteChat() chatContentModule.unmuteChat()
} }
onMarkAllMessagesRead: { onMarkAllMessagesRead: {
if(!chatContentModule) {
console.debug("error on mark all messages read from context menu - chat content module is not set")
return
}
chatContentModule.markAllMessagesRead() chatContentModule.markAllMessagesRead()
} }
onClearChatHistory: { onClearChatHistory: {
if(!chatContentModule) {
console.debug("error on clear chat history from context menu - chat content module is not set")
return
}
chatContentModule.clearChatHistory() chatContentModule.clearChatHistory()
} }
@ -146,6 +195,10 @@ ColumnLayout {
} }
onLeaveChat: { onLeaveChat: {
if(!chatContentModule) {
console.debug("error on leave chat from context menu - chat content module is not set")
return
}
chatContentModule.leaveChat() chatContentModule.leaveChat()
} }
@ -170,6 +223,10 @@ ColumnLayout {
} }
onOpenPinnedMessagesList: { onOpenPinnedMessagesList: {
if(!chatContentModule) {
console.debug("error on open pinned messages from context menu - chat content module is not set")
return
}
Global.openPopup(pinnedMessagesPopupComponent, { Global.openPopup(pinnedMessagesPopupComponent, {
messageStore: messageStore, messageStore: messageStore,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel, pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
@ -245,7 +302,7 @@ ColumnLayout {
MessageStore{ MessageStore{
id: messageStore id: messageStore
messageModule: chatContentModule.messagesModule messageModule: chatContentModule? chatContentModule.messagesModule : null
} }
MessageContextMenuView { MessageContextMenuView {
@ -260,6 +317,10 @@ ColumnLayout {
} }
onPinnedMessagesLimitReached: { onPinnedMessagesLimitReached: {
if(!chatContentModule) {
console.debug("error on open pinned messages limit reached from message context menu - chat content module is not set")
return
}
Global.openPopup(pinnedMessagesPopupComponent, { Global.openPopup(pinnedMessagesPopupComponent, {
messageStore: messageStore, messageStore: messageStore,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel, pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
@ -355,8 +416,13 @@ ColumnLayout {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
recentStickers: chatContentRoot.rootStore.stickersModuleInst.recent recentStickers: chatContentRoot.rootStore.stickersModuleInst.recent
stickerPackList: chatContentRoot.rootStore.stickersModuleInst.stickerPacks stickerPackList: chatContentRoot.rootStore.stickersModuleInst.stickerPacks
chatType: chatContentModule.chatDetails.type chatType: chatContentModule? chatContentModule.chatDetails.type : Constants.chatType.unknown
onSendTransactionCommandButtonClicked: { onSendTransactionCommandButtonClicked: {
if(!chatContentModule) {
console.debug("error on sending transaction command - chat content module is not set")
return
}
if (Utils.getContactDetailsAsJson(chatContentModule.getMyChatId()).ensVerified) { if (Utils.getContactDetailsAsJson(chatContentModule.getMyChatId()).ensVerified) {
Global.openPopup(chatContentRoot.sendTransactionWithEnsModal) Global.openPopup(chatContentRoot.sendTransactionWithEnsModal)
} else { } else {
@ -373,6 +439,11 @@ ColumnLayout {
packId) packId)
} }
onSendMessage: { onSendMessage: {
if(!chatContentModule) {
console.debug("error on sending message - chat content module is not set")
return
}
if (chatInput.fileUrls.length > 0){ if (chatInput.fileUrls.length > 0){
chatContentModule.inputAreaModule.sendImages(JSON.stringify(fileUrls)); chatContentModule.inputAreaModule.sendImages(JSON.stringify(fileUrls));
} }

View File

@ -39,14 +39,14 @@ Item {
Item { Item {
id: loadingMessagesIndicator id: loadingMessagesIndicator
visible: messageStore.messageModule.loadingHistoryMessagesInProgress visible: messageStore.messageModule? messageStore.messageModule.loadingHistoryMessagesInProgress : false
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
height: visible? 20 : 0 height: visible? 20 : 0
width: parent.width width: parent.width
Loader { Loader {
active: messageStore.messageModule.loadingHistoryMessagesInProgress active: messageStore.messageModule? messageStore.messageModule.loadingHistoryMessagesInProgress : false
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
sourceComponent: Component { sourceComponent: Component {

View File

@ -94,6 +94,9 @@ Item {
// TODO: replace with StatusTextArea once it lives in StatusQ. // TODO: replace with StatusTextArea once it lives in StatusQ.
StyledTextArea { StyledTextArea {
id: mailserverLogTxt id: mailserverLogTxt
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
text: "" text: ""
customHeight: 200 customHeight: 200
textField.readOnly: true textField.readOnly: true
@ -116,6 +119,9 @@ Item {
// TODO: replace with StatusTextArea once it lives in StatusQ. // TODO: replace with StatusTextArea once it lives in StatusQ.
StyledTextArea { StyledTextArea {
id: logsTxt id: logsTxt
Layout.rightMargin: Style.current.padding
Layout.leftMargin: Style.current.padding
Layout.fillWidth: true
text: "" text: ""
customHeight: 200 customHeight: 200
textField.readOnly: true textField.readOnly: true

View File

@ -7,16 +7,16 @@ QtObject {
property var advancedModule property var advancedModule
// Advanced Module Properties // Advanced Module Properties
property string currentNetworkName: advancedModule.currentNetworkName property string currentNetworkName: advancedModule? advancedModule.currentNetworkName : ""
property string currentNetworkId: advancedModule.currentNetworkId property string currentNetworkId: advancedModule? advancedModule.currentNetworkId : ""
property string fleet: advancedModule.fleet property string fleet: advancedModule? advancedModule.fleet : ""
property string bloomLevel: advancedModule.bloomLevel property string bloomLevel: advancedModule? advancedModule.bloomLevel : ""
property bool wakuV2LightClientEnabled: advancedModule.wakuV2LightClientEnabled property bool wakuV2LightClientEnabled: advancedModule? advancedModule.wakuV2LightClientEnabled : false
property bool isTelemetryEnabled: advancedModule.isTelemetryEnabled property bool isTelemetryEnabled: advancedModule? advancedModule.isTelemetryEnabled : false
property bool isAutoMessageEnabled: advancedModule.isAutoMessageEnabled property bool isAutoMessageEnabled: advancedModule? advancedModule.isAutoMessageEnabled : false
property bool isDebugEnabled: advancedModule.isDebugEnabled property bool isDebugEnabled: advancedModule? advancedModule.isDebugEnabled : false
property var customNetworksModel: advancedModule.customNetworksModel property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
property bool isWakuV2: root.fleet === Constants.waku_prod || property bool isWakuV2: root.fleet === Constants.waku_prod ||
root.fleet === Constants.waku_test root.fleet === Constants.waku_test
@ -33,42 +33,72 @@ QtObject {
} }
function logDir() { function logDir() {
if(!root.advancedModule)
return ""
return root.advancedModule.logDir() return root.advancedModule.logDir()
} }
function setNetworkName(networkName) { function setNetworkName(networkName) {
if(!root.advancedModule)
return
root.advancedModule.setNetworkName(networkName) root.advancedModule.setNetworkName(networkName)
} }
function setFleet(fleetName) { function setFleet(fleetName) {
if(!root.advancedModule)
return
root.advancedModule.setFleet(fleetName) root.advancedModule.setFleet(fleetName)
} }
function setBloomLevel(mode) { function setBloomLevel(mode) {
if(!root.advancedModule)
return
root.advancedModule.setBloomLevel(mode) root.advancedModule.setBloomLevel(mode)
} }
function setWakuV2LightClientEnabled(mode) { function setWakuV2LightClientEnabled(mode) {
if(!root.advancedModule)
return
root.advancedModule.setWakuV2LightClientEnabled(mode) root.advancedModule.setWakuV2LightClientEnabled(mode)
} }
function toggleTelemetry() { function toggleTelemetry() {
if(!root.advancedModule)
return
root.advancedModule.toggleTelemetry() root.advancedModule.toggleTelemetry()
} }
function toggleAutoMessage() { function toggleAutoMessage() {
if(!root.advancedModule)
return
root.advancedModule.toggleAutoMessage() root.advancedModule.toggleAutoMessage()
} }
function toggleDebug() { function toggleDebug() {
if(!root.advancedModule)
return
root.advancedModule.toggleDebug() root.advancedModule.toggleDebug()
} }
function addCustomNetwork(name, endpoint, networkId, networkType) { function addCustomNetwork(name, endpoint, networkId, networkType) {
if(!root.advancedModule)
return
root.advancedModule.addCustomNetwork(name, endpoint, networkId, networkType) root.advancedModule.addCustomNetwork(name, endpoint, networkId, networkType)
} }
function toggleExperimentalFeature(feature) { function toggleExperimentalFeature(feature) {
if(!root.advancedModule)
return
if (feature === experimentalFeatures.wallet) { if (feature === experimentalFeatures.wallet) {
advancedModule.toggleWalletSection() advancedModule.toggleWalletSection()
} }

View File

@ -43,11 +43,14 @@ Item {
anchors.leftMargin: 24 anchors.leftMargin: 24
from: 0.0 from: 0.0
to: 1.0 to: 1.0
value: localAccountSensitiveSettings.volume
stepSize: 0.1 stepSize: 0.1
onValueChanged: { onValueChanged: {
localAccountSensitiveSettings.volume = volume.value localAccountSensitiveSettings.volume = volume.value
} }
Component.onCompleted: {
value = localAccountSensitiveSettings.volume
}
} }
} }
} }

View File

@ -24,7 +24,7 @@ Item {
locale: RootStore.locale locale: RootStore.locale
currency: RootStore.currentCurrency currency: RootStore.currentCurrency
currentAccount: RootStore.currentAccount currentAccount: RootStore.currentAccount
changeSelectedAccount: changeSelectedAccount changeSelectedAccount: walletContainer.changeSelectedAccount
} }
RowLayout { RowLayout {

View File

@ -36,7 +36,7 @@ Item {
StyledText { StyledText {
id: title id: title
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: walletHeader.currentAccount.name text: walletHeader.currentAccount? walletHeader.currentAccount.name : ""
font.weight: Font.Medium font.weight: Font.Medium
font.pixelSize: 28 font.pixelSize: 28
} }
@ -54,7 +54,7 @@ Item {
StyledText { StyledText {
id: walletBalance id: walletBalance
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: walletHeader.currentAccount.balance.toUpperCase() text: walletHeader.currentAccount? walletHeader.currentAccount.balance.toUpperCase() : ""
font.pixelSize: 22 font.pixelSize: 22
} }
} }
@ -72,7 +72,7 @@ Item {
anchors.top: accountRow.bottom anchors.top: accountRow.bottom
anchors.left: accountRow.left anchors.left: accountRow.left
addressWidth: 180 addressWidth: 180
address: walletHeader.currentAccount.address address: walletHeader.currentAccount? walletHeader.currentAccount.address : ""
} }
NetworkSelectPanel { NetworkSelectPanel {

View File

@ -16,6 +16,7 @@ import "./AppLayouts/Chat/popups"
import "./AppLayouts/Chat/popups/community" import "./AppLayouts/Chat/popups/community"
import "./AppLayouts/Profile/popups" import "./AppLayouts/Profile/popups"
import "./AppLayouts/stores" import "./AppLayouts/stores"
import "./AppLayouts/Browser/stores" as BrowserStores
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import Qt.labs.settings 1.0 import Qt.labs.settings 1.0
@ -150,13 +151,19 @@ Item {
Audio { Audio {
id: sendMessageSound id: sendMessageSound
store: rootStore store: rootStore
track: "send_message.wav" track: Qt.resolvedUrl("../imports/assets/audio/send_message.wav")
} }
Audio { Audio {
id: notificationSound id: notificationSound
store: rootStore store: rootStore
track: "notification.wav" track: Qt.resolvedUrl("../imports/assets/audio/notification.wav")
}
Audio {
id: errorSound
track: Qt.resolvedUrl("../imports/assets/audio/error.mp3")
store: rootStore
} }
AppSearch{ AppSearch{
@ -470,7 +477,7 @@ Item {
// property var _walletModel: walletModel // property var _walletModel: walletModel
// Not Refactored Yet // Not Refactored Yet
// property var _utilsModel: utilsModel // property var _utilsModel: utilsModel
property var _web3Provider: web3Provider property var _web3Provider: BrowserStores.Web3ProviderStore.web3ProviderInst
} }
ProfileLayout { ProfileLayout {
@ -831,5 +838,6 @@ Item {
// console.error('Could not parse the whitelist for sites', e) // console.error('Could not parse the whitelist for sites', e)
// } // }
Global.settingsHasLoaded(); Global.settingsHasLoaded();
Global.errorSound = errorSound;
} }
} }

View File

@ -24,8 +24,6 @@ Item {
id: inputBox id: inputBox
height: inputRectangle.height + (hasLabel ? inputLabel.height + labelMargin : 0) + (!!validationError ? validationErrorText.height : 0) height: inputRectangle.height + (hasLabel ? inputLabel.height + labelMargin : 0) + (!!validationError ? validationErrorText.height : 0)
anchors.right: parent.right
anchors.left: parent.left
StyledText { StyledText {
id: inputLabel id: inputLabel

View File

@ -853,7 +853,8 @@ Rectangle {
anchors.rightMargin: 2 anchors.rightMargin: 2
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 2 anchors.topMargin: 2
stickerData: sticker // Not Refactored Yet
// stickerData: sticker
onCloseButtonClicked: { onCloseButtonClicked: {
isReply = false isReply = false
} }
@ -941,7 +942,7 @@ Rectangle {
icon.name: "bold" icon.name: "bold"
//% "Bold" //% "Bold"
text: qsTrId("bold") text: qsTrId("bold")
selectedTextWithFormationChars: RootStore.selectedTextWithFormationChars selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
onActionTriggered: checked ? onActionTriggered: checked ?
unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) : unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
wrapSelection(wrapper) wrapSelection(wrapper)
@ -951,7 +952,7 @@ Rectangle {
icon.name: "italic" icon.name: "italic"
//% "Italic" //% "Italic"
text: qsTrId("italic") text: qsTrId("italic")
selectedTextWithFormationChars: RootStore.selectedTextWithFormationChars selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
checked: (surroundedBy("*") && !surroundedBy("**")) || surroundedBy("***") checked: (surroundedBy("*") && !surroundedBy("**")) || surroundedBy("***")
onActionTriggered: checked ? onActionTriggered: checked ?
unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) : unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
@ -962,7 +963,7 @@ Rectangle {
icon.name: "strikethrough" icon.name: "strikethrough"
//% "Strikethrough" //% "Strikethrough"
text: qsTrId("strikethrough") text: qsTrId("strikethrough")
selectedTextWithFormationChars: RootStore.selectedTextWithFormationChars selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
onActionTriggered: checked ? onActionTriggered: checked ?
unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) : unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
wrapSelection(wrapper) wrapSelection(wrapper)
@ -972,7 +973,7 @@ Rectangle {
icon.name: "code" icon.name: "code"
//% "Code" //% "Code"
text: qsTrId("code") text: qsTrId("code")
selectedTextWithFormationChars: RootStore.selectedTextWithFormationChars selectedTextWithFormationChars: RootStore.getSelectedTextWithFormationChars(messageInputField)
onActionTriggered: checked ? onActionTriggered: checked ?
unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) : unwrapSelection(wrapper, RootStore.getSelectedTextWithFormationChars(messageInputField)) :
wrapSelection(wrapper) wrapSelection(wrapper)

View File

@ -9,7 +9,13 @@ import shared 1.0
StatusInputListPopup { StatusInputListPopup {
id: emojiSuggestions id: emojiSuggestions
property string shortname property string shortname
property string unicode: emojiSuggestions.modelList[listView.currentIndex].unicode_alternates || emojiSuggestions.modelList[listView.currentIndex].unicode property string unicode: {
if(listView.currentIndex < 0 || listView.currentIndex >= emojiSuggestions.modelList.count)
return ""
return emojiSuggestions.modelList[listView.currentIndex].unicode_alternates ||
emojiSuggestions.modelList[listView.currentIndex].unicode
}
getImageSource: function (modelData) { getImageSource: function (modelData) {
return `../../assets/twemoji/72x72/${modelData.unicode}.png` return `../../assets/twemoji/72x72/${modelData.unicode}.png`

View File

@ -4,12 +4,12 @@ import QtQuick 2.12
QtObject { QtObject {
id: root id: root
property var utilsModelInst: !!utilsModel ? utilsModel : null // property var utilsModelInst: !!utilsModel ? utilsModel : null
property var chatsModelInst: !!chatsModel ?chatsModel : null // property var chatsModelInst: !!chatsModel ?chatsModel : null
property var userProfileInst: !!userProfile ? userProfile : null // property var userProfileInst: !!userProfile ? userProfile : null
property var walletModelInst: !!walletModel ? walletModel : null // property var walletModelInst: !!walletModel ? walletModel : null
property var keycardModelInst: !!keycardModel ? keycardModel : null // property var keycardModelInst: !!keycardModel ? keycardModel : null
property var profileModelInst: !!profileModel ? profileModel : null // property var profileModelInst: !!profileModel ? profileModel : null
property var walletSectionInst: !!walletSection ? walletSection : null property var walletSectionInst: !!walletSection ? walletSection : null
property var appSettings: !!localAppSettings ? localAppSettings : null property var appSettings: !!localAppSettings ? localAppSettings : null
property var accountSensitiveSettings: !!localAccountSensitiveSettings ? localAccountSensitiveSettings : null property var accountSensitiveSettings: !!localAccountSensitiveSettings ? localAccountSensitiveSettings : null
@ -22,13 +22,13 @@ QtObject {
property bool displayChatImages: !!accountSensitiveSettings ? accountSensitiveSettings.displayChatImages : false property bool displayChatImages: !!accountSensitiveSettings ? accountSensitiveSettings.displayChatImages : false
property string locale: !!appSettings ? appSettings.locale : "" property string locale: !!appSettings ? appSettings.locale : ""
property string signingPhrase: !!walletModelInst ? walletModelInst.utilsView.signingPhrase : "" // property string signingPhrase: !!walletModelInst ? walletModelInst.utilsView.signingPhrase : ""
property string gasPrice: !!walletModelInst ? walletModelInst.gasView.gasPrice : "0" // property string gasPrice: !!walletModelInst ? walletModelInst.gasView.gasPrice : "0"
property string gasEthValue: !!walletModelInst ? walletModelInst.gasView.getGasEthValue : "0" // property string gasEthValue: !!walletModelInst ? walletModelInst.gasView.getGasEthValue : "0"
property string currentCurrency: !!walletSectionInst ? walletSectionInst.currentCurrency : "" // property string currentCurrency: !!walletSectionInst ? walletSectionInst.currentCurrency : ""
property string defaultCurrency: !!walletModelInst ? walletModelInst.balanceView.defaultCurrency : "0" // property string defaultCurrency: !!walletModelInst ? walletModelInst.balanceView.defaultCurrency : "0"
property string fiatValue: !!walletModelInst ? walletModelInst.balanceView.getFiatValue : "0" // property string fiatValue: !!walletModelInst ? walletModelInst.balanceView.getFiatValue : "0"
property string cryptoValue: !!walletModelInst ? walletModelInst.balanceView.getCryptoValue : "0" // property string cryptoValue: !!walletModelInst ? walletModelInst.balanceView.getCryptoValue : "0"
readonly property var formationChars: (["*", "`", "~"]) readonly property var formationChars: (["*", "`", "~"])
function getSelectedTextWithFormationChars(messageInputField) { function getSelectedTextWithFormationChars(messageInputField) {
let i = 1 let i = 1
@ -62,14 +62,14 @@ QtObject {
} }
function transferEth(from, to, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid) { function transferEth(from, to, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid) {
return walletModelInst.transactionsView.transferEth(from, to, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid); // return walletModelInst.transactionsView.transferEth(from, to, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid);
} }
function transferTokens(from, to, address, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid) { function transferTokens(from, to, address, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid) {
return walletModelInst.transactionsView.transferTokens(from, to, address, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid); // return walletModelInst.transactionsView.transferTokens(from, to, address, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, uuid);
} }
function copyToClipboard(textToCopy) { function copyToClipboard(textToCopy) {
chatsModelInst.copyToClipboard(textToCopy) // chatsModelInst.copyToClipboard(textToCopy)
} }
} }

View File

@ -9,12 +9,9 @@ QtObject {
property var applicationWindow property var applicationWindow
property bool popupOpened: false property bool popupOpened: false
property int currentMenuTab: 0 property int currentMenuTab: 0
property var errorSound: Audio { property var errorSound
id: errorSound
track: Qt.resolvedUrl("../assets/audio/error.mp3")
}
property var mainModuleInst: !!mainModule ? mainModule : null property var mainModuleInst
property var toastMessage property var toastMessage
property bool profilePopupOpened: false property bool profilePopupOpened: false
//Not refactored yet //Not refactored yet
@ -43,6 +40,9 @@ QtObject {
} }
function changeAppSectionBySectionType(sectionType, profileSectionId = -1) { function changeAppSectionBySectionType(sectionType, profileSectionId = -1) {
if(!root.mainModuleInst)
return
mainModuleInst.setActiveSectionBySectionType(sectionType) mainModuleInst.setActiveSectionBySectionType(sectionType)
if (profileSectionId > -1) { if (profileSectionId > -1) {
currentMenuTab = profileSectionId; currentMenuTab = profileSectionId;
@ -76,6 +76,7 @@ QtObject {
} }
function playErrorSound() { function playErrorSound() {
if(errorSound)
errorSound.play(); errorSound.play();
} }

View File

@ -95,6 +95,10 @@ StatusWindow {
Connections { Connections {
target: startupModule target: startupModule
onAppStateChanged: { onAppStateChanged: {
if(state === Constants.appState.main) {
// We set main module to the Global singleton once user is logged in and we move to the main app.
Global.mainModuleInst = mainModule
mainModule.openStoreToKeychainPopup.connect(function(){ mainModule.openStoreToKeychainPopup.connect(function(){
storeToKeychainConfirmationPopup.open() storeToKeychainConfirmationPopup.open()
}) })
@ -112,6 +116,7 @@ StatusWindow {
} }
} }
} }
}
//! Workaround for custom QQuickWindow //! Workaround for custom QQuickWindow
Connections { Connections {