2023-02-15 08:27:18 +00:00
import QtQuick 2.15
2024-08-10 12:39:56 +00:00
import QtQuick . Controls 2.15
2024-10-04 11:01:08 +00:00
import QtQuick . Window 2.15
2024-08-10 12:39:56 +00:00
import QtQuick . Layouts 1.15
import QtMultimedia 5.15
2022-03-03 22:50:53 +00:00
import Qt . labs . platform 1.1
2023-10-10 14:23:48 +00:00
import Qt . labs . settings 1.1
2024-08-10 12:39:56 +00:00
import QtQml . Models 2.15
2023-02-27 12:11:51 +00:00
import QtQml 2.15
2022-03-03 22:50:53 +00:00
2022-03-08 18:49:33 +00:00
import AppLayouts . Wallet 1.0
import AppLayouts . Node 1.0
import AppLayouts . Chat 1.0
2022-05-13 15:27:26 +00:00
import AppLayouts . Chat . views 1.0
2022-03-08 18:49:33 +00:00
import AppLayouts . Profile 1.0
2023-06-23 06:17:04 +00:00
import AppLayouts . Communities 1.0
2024-05-06 11:46:48 +00:00
import AppLayouts . Wallet . services . dapps 1.0
2021-09-28 15:04:06 +00:00
import utils 1.0
2021-10-27 21:27:49 +00:00
import shared 1.0
2022-03-17 16:15:38 +00:00
import shared . controls 1.0
2023-06-07 10:54:31 +00:00
import shared . controls . chat . menuItems 1.0
2021-10-27 21:27:49 +00:00
import shared . panels 1.0
import shared . popups 1.0
2022-09-13 10:03:25 +00:00
import shared . popups . keycard 1.0
2021-10-27 21:27:49 +00:00
import shared . status 1.0
2024-10-02 21:02:57 +00:00
import shared . stores 1.0 as SharedStores
2024-07-02 11:19:37 +00:00
import shared . popups . send 1.0 as SendPopups
2023-09-27 13:41:55 +00:00
import shared . popups . send . views 1.0
2023-11-28 19:16:18 +00:00
import shared . stores . send 1.0
2020-05-11 21:24:08 +00:00
2024-07-12 13:57:04 +00:00
import StatusQ 0.1
import StatusQ . Core 0.1
2021-06-11 12:17:23 +00:00
import StatusQ . Core . Theme 0.1
2024-07-12 13:57:04 +00:00
import StatusQ . Core . Utils 0.1 as SQUtils
2021-10-21 23:34:35 +00:00
import StatusQ . Components 0.1
2021-06-11 12:17:23 +00:00
import StatusQ . Controls 0.1
import StatusQ . Layout 0.1
import StatusQ . Popups 0.1
2022-09-02 14:56:14 +00:00
import StatusQ . Popups . Dialog 0.1
2021-06-11 12:17:23 +00:00
2023-02-09 21:49:36 +00:00
import AppLayouts . Chat . stores 1.0 as ChatStores
2023-06-23 06:17:04 +00:00
import AppLayouts . Communities . stores 1.0
2024-10-15 09:31:46 +00:00
import AppLayouts . Profile . stores 1.0 as ProfileStores
2023-12-26 10:19:41 +00:00
import AppLayouts . Wallet . popups 1.0 as WalletPopups
2024-10-15 09:31:46 +00:00
import AppLayouts . Wallet . stores 1.0 as WalletStores
import AppLayouts . stores 1.0 as AppStores
2024-04-10 20:56:10 +00:00
2024-11-28 14:15:34 +00:00
import mainui . adaptors 1.0
2023-04-17 08:31:32 +00:00
import mainui . activitycenter . stores 1.0
import mainui . activitycenter . popups 1.0
2022-11-28 11:32:29 +00:00
import SortFilterProxyModel 0.2
2021-06-17 18:41:11 +00:00
Item {
2020-09-15 19:47:13 +00:00
id: appMain
2020-05-11 21:24:08 +00:00
2021-09-15 11:40:07 +00:00
property alias appLayout: appLayout
2024-10-02 21:02:57 +00:00
2024-10-04 10:04:59 +00:00
readonly property SharedStores . RootStore sharedRootStore: SharedStores . RootStore {
currencyStore: appMain . currencyStore
}
2024-10-02 21:02:57 +00:00
2024-10-21 22:01:34 +00:00
property SharedStores . UtilsStore utilsStore
2024-10-21 10:14:48 +00:00
2024-10-15 09:31:46 +00:00
readonly property AppStores . RootStore rootStore: AppStores . RootStore { }
readonly property ProfileStores . ProfileSectionStore profileSectionStore: rootStore . profileSectionStore
readonly property ProfileStores . ProfileStore profileStore: profileSectionStore . profileStore
2024-10-15 08:14:36 +00:00
2024-05-22 08:13:39 +00:00
property ChatStores . RootStore rootChatStore: ChatStores . RootStore {
2023-02-09 21:49:36 +00:00
contactsStore: appMain . rootStore . contactStore
2024-10-04 10:04:59 +00:00
currencyStore: appMain . currencyStore
2023-04-11 08:09:01 +00:00
communityTokensStore: appMain . communityTokensStore
2023-02-09 21:49:36 +00:00
emojiReactionsModel: appMain . rootStore . emojiReactionsModel
openCreateChat: createChatView . opened
2023-04-04 11:31:04 +00:00
networkConnectionStore: appMain . networkConnectionStore
2023-02-09 21:49:36 +00:00
}
2024-05-22 08:13:39 +00:00
property ChatStores . CreateChatPropertiesStore createChatPropertiesStore: ChatStores . CreateChatPropertiesStore { }
2022-10-26 16:00:20 +00:00
property ActivityCenterStore activityCenterStore: ActivityCenterStore { }
2024-10-02 21:02:57 +00:00
property SharedStores . NetworkConnectionStore networkConnectionStore: SharedStores . NetworkConnectionStore { }
property SharedStores . CommunityTokensStore communityTokensStore: SharedStores . CommunityTokensStore { }
2023-04-28 10:35:18 +00:00
property CommunitiesStore communitiesStore: CommunitiesStore { }
2024-05-22 08:13:39 +00:00
readonly property WalletStores . TokensStore tokensStore: WalletStores . RootStore . tokensStore
readonly property WalletStores . WalletAssetsStore walletAssetsStore: WalletStores . RootStore . walletAssetsStore
readonly property WalletStores . CollectiblesStore walletCollectiblesStore: WalletStores . RootStore . collectiblesStore
2024-10-02 21:02:57 +00:00
readonly property SharedStores . CurrenciesStore currencyStore: SharedStores . CurrenciesStore { }
2024-01-30 13:15:58 +00:00
readonly property TransactionStore transactionStore: TransactionStore {
2023-11-28 19:16:18 +00:00
walletAssetStore: appMain . walletAssetsStore
2024-01-30 13:15:58 +00:00
tokensStore: appMain . tokensStore
2024-05-28 17:39:41 +00:00
currencyStore: appMain . currencyStore
2023-11-28 19:16:18 +00:00
}
2024-08-13 12:03:35 +00:00
readonly property WalletStores . BuyCryptoStore buyCryptoStore: WalletStores . BuyCryptoStore { }
2024-09-25 17:02:35 +00:00
readonly property AppStores . FeatureFlagsStore featureFlagsStore: AppStores . FeatureFlagsStore {
2024-08-12 10:41:27 +00:00
readonly property var featureFlags: typeof featureFlagsRootContextProperty !== undefined ? featureFlagsRootContextProperty : null
connectorEnabled: featureFlags ? featureFlags.connectorEnabled : false
dappsEnabled: featureFlags ? featureFlags.dappsEnabled : false
swapEnabled: featureFlags ? featureFlags.swapEnabled : false
2024-09-17 11:34:24 +00:00
sendViaPersonalChatEnabled: featureFlags ? featureFlags.sendViaPersonalChatEnabled : false
2024-08-12 10:41:27 +00:00
}
2024-07-19 12:15:50 +00:00
required property bool isCentralizedMetricsEnabled
2023-10-26 21:11:20 +00:00
2021-12-09 13:28:02 +00:00
// set from main.qml
property var sysPalette
2021-10-20 09:50:50 +00:00
2024-11-21 15:10:58 +00:00
AllContactsAdaptor {
id: allContacsAdaptor
contactsModel: appMain . rootStore . contactStore . contactsModel
selfPubKey: appMain . profileStore . pubkey
selfDisplayName : appMain . profileStore . displayName
selfName: appMain . profileStore . name
selfPreferredDisplayName: appMain . profileStore . preferredName
selfAlias: appMain . profileStore . username
selfIcon: appMain . profileStore . icon
selfColorId: appMain . profileStore . colorId
selfColorHash: appMain . profileStore . colorHash
selfOnlineStatus: appMain . profileStore . currentUserStatus
selfThumbnailImage: appMain . profileStore . thumbnailImage
selfLargeImage: appMain . profileStore . largeImage
selfBio: appMain . profileStore . bio
}
2024-11-28 14:15:34 +00:00
ContactsModelAdaptor {
id: contactsModelAdaptor
allContacts: appMain . profileSectionStore . contactsStore . contactsModel
}
2023-11-03 15:55:04 +00:00
// Central UI point for managing app toasts:
ToastsManager {
id: toastsManager
rootStore: appMain . rootStore
rootChatStore: appMain . rootChatStore
communityTokensStore: appMain . communityTokensStore
2024-10-15 09:31:46 +00:00
profileStore: appMain . profileStore
2023-11-03 15:55:04 +00:00
sendModalPopup: sendModal
}
2022-03-17 16:24:50 +00:00
Connections {
target: rootStore . mainModuleInst
2022-09-13 10:03:25 +00:00
2023-01-18 09:25:36 +00:00
function onDisplayUserProfile ( publicKey: string ) {
2023-02-07 14:21:32 +00:00
popups . openProfilePopup ( publicKey )
2023-01-18 09:25:36 +00:00
}
2022-09-13 10:03:25 +00:00
2023-10-27 17:19:25 +00:00
function onDisplayKeycardSharedModuleForAuthenticationOrSigning ( ) {
keycardPopupForAuthenticationOrSigning . active = true
2023-09-04 16:06:51 +00:00
}
2023-10-27 17:19:25 +00:00
function onDestroyKeycardSharedModuleForAuthenticationOrSigning ( ) {
keycardPopupForAuthenticationOrSigning . active = false
2023-09-04 16:06:51 +00:00
}
2023-01-18 09:25:36 +00:00
function onDisplayKeycardSharedModuleFlow ( ) {
2023-06-30 09:24:08 +00:00
keycardPopup . active = true
2022-09-13 10:03:25 +00:00
}
2023-01-18 09:25:36 +00:00
function onDestroyKeycardSharedModuleFlow ( ) {
2023-06-30 09:24:08 +00:00
keycardPopup . active = false
2022-09-13 10:03:25 +00:00
}
2022-10-18 09:06:18 +00:00
2023-01-18 09:25:36 +00:00
function onMailserverWorking ( ) {
2023-01-18 13:55:23 +00:00
mailserverConnectionBanner . hide ( )
}
2023-01-18 09:25:36 +00:00
function onMailserverNotWorking ( ) {
2023-01-18 10:36:28 +00:00
mailserverConnectionBanner . show ( )
2022-10-18 09:06:18 +00:00
}
2023-01-18 09:25:36 +00:00
function onActiveSectionChanged ( ) {
2022-10-18 09:06:18 +00:00
createChatView . opened = false
2024-10-18 22:50:21 +00:00
profileLoader . settingsSubSubsection = - 1
2022-10-18 09:06:18 +00:00
}
2023-01-12 19:06:18 +00:00
2023-01-18 09:25:36 +00:00
function onOpenActivityCenter ( ) {
2023-04-17 08:31:32 +00:00
d . openActivityCenterPopup ( )
}
2023-07-17 20:06:34 +00:00
function onShowToastAccountAdded ( name: string ) {
Global . displayToastMessage (
2023-10-24 15:21:46 +00:00
qsTr ( "\"%1\" successfully added" ) . arg ( name ) ,
2023-07-17 20:06:34 +00:00
"" ,
2023-08-07 18:47:16 +00:00
"checkmark-circle" ,
2023-07-17 20:06:34 +00:00
false ,
Constants . ephemeralNotificationType . success ,
""
)
}
2023-11-09 10:26:09 +00:00
function onShowToastAccountRemoved ( name: string ) {
Global . displayToastMessage (
qsTr ( "\"%1\" successfully removed" ) . arg ( name ) ,
"" ,
"checkmark-circle" ,
false ,
Constants . ephemeralNotificationType . success ,
""
)
}
2023-07-17 20:06:34 +00:00
function onShowToastKeypairRenamed ( oldName: string , newName: string ) {
Global . displayToastMessage (
2024-06-07 13:29:09 +00:00
qsTr ( "You successfully renamed your key pair\nfrom \"%1\" to \"%2\"" ) . arg ( oldName ) . arg ( newName ) ,
2023-07-17 20:06:34 +00:00
"" ,
2023-08-07 18:47:16 +00:00
"checkmark-circle" ,
2023-07-17 20:06:34 +00:00
false ,
Constants . ephemeralNotificationType . success ,
""
)
}
2023-08-07 18:47:16 +00:00
2023-10-06 12:33:33 +00:00
function onShowNetworkEndpointUpdated ( name: string , isTest: bool , revertToDefault: bool ) {
let mainText = revertToDefault ?
( isTest ? qsTr ( "Test network settings for %1 reverted to default" ) . arg ( name ) : qsTr ( "Live network settings for %1 reverted to default" ) . arg ( name ) ) :
( isTest ? qsTr ( "Test network settings for %1 updated" ) . arg ( name ) : qsTr ( "Live network settings for %1 updated" ) . arg ( name ) )
2023-08-07 18:47:16 +00:00
Global . displayToastMessage (
2023-10-06 12:33:33 +00:00
mainText ,
2023-08-07 18:47:16 +00:00
"" ,
"checkmark-circle" ,
false ,
Constants . ephemeralNotificationType . success ,
""
)
}
2023-08-08 19:01:19 +00:00
function onShowToastKeypairRemoved ( keypairName: string ) {
Global . displayToastMessage (
2024-06-07 13:29:09 +00:00
qsTr ( "“%1” key pair and its derived accounts were successfully removed from all devices" ) . arg ( keypairName ) ,
2023-08-08 19:01:19 +00:00
"" ,
"checkmark-circle" ,
false ,
Constants . ephemeralNotificationType . success ,
""
)
}
2023-08-21 10:58:21 +00:00
function onShowToastKeypairsImported ( keypairName: string , keypairsCount: int , error: string ) {
let notification = qsTr ( "Please re-generate QR code and try importing again" )
if ( error !== "" ) {
if ( error . startsWith ( "one or more expected keystore files are not found among the sent files" ) ) {
2024-06-07 13:29:09 +00:00
notification = qsTr ( "Make sure you're importing the exported key pair on paired device" )
2023-08-21 10:58:21 +00:00
}
}
else {
2024-06-07 13:29:09 +00:00
notification = qsTr ( "%1 key pair successfully imported" ) . arg ( keypairName )
2023-08-21 10:58:21 +00:00
if ( keypairsCount > 1 ) {
2024-06-07 13:29:09 +00:00
notification = qsTr ( "%n key pair(s) successfully imported" , "" , keypairsCount )
2023-08-21 10:58:21 +00:00
}
}
Global . displayToastMessage (
notification ,
"" ,
error !== "" ? "info" : "checkmark-circle" ,
false ,
error !== "" ? Constants.ephemeralNotificationType.normal : Constants . ephemeralNotificationType . success ,
""
)
}
2023-09-28 17:29:31 +00:00
2024-11-20 07:34:05 +00:00
function onShowTransactionToast ( uuid: string ,
txType: int ,
fromChainId: int ,
toChainId: int ,
fromAddr: string ,
fromName: string ,
toAddr: string ,
toName: string ,
txToAddr: string ,
txToName: string ,
txHash: string ,
approvalTx: bool ,
fromAmount: string ,
toAmount: string ,
fromAsset: string ,
toAsset: string ,
username: string ,
publicKey: string ,
packId: string ,
status: string ,
error: string ) {
let toastTitle = ""
let toastSubtitle = ""
let toastIcon = ""
let toastLoading = false
let toastType = Constants . ephemeralNotificationType . normal
let toastLink = ""
const sender = ! ! fromName ? fromName : SQUtils . Utils . elideAndFormatWalletAddress ( fromAddr )
let senderChainName = qsTr ( "unknown" )
let sentAmount = ""
const recipient = ! ! toName ? toName : SQUtils . Utils . elideAndFormatWalletAddress ( toAddr )
const txRecipient = ! ! txToName ? txToName : SQUtils . Utils . elideAndFormatWalletAddress ( txToAddr )
let recipientChainName = qsTr ( "unknown" )
let receivedAmount = ""
let assetName = qsTr ( "unknown" )
let ensName = d . ensName ( username )
let stickersPackName = qsTr ( "unknown" )
if ( ! ! txHash ) {
toastLink = "%1/%2" . arg ( appMain . rootStore . getEtherscanTxLink ( fromChainId ) ) . arg ( txHash )
}
const fromChainName = SQUtils . ModelUtils . getByKey ( WalletStores . RootStore . filteredFlatModel , "chainId" , fromChainId , "chainName" )
if ( ! ! fromChainName ) {
senderChainName = fromChainName
toastSubtitle = qsTr ( "View on %1" ) . arg ( senderChainName )
}
const toChainName = SQUtils . ModelUtils . getByKey ( WalletStores . RootStore . filteredFlatModel , "chainId" , toChainId , "chainName" )
if ( ! ! toChainName ) {
recipientChainName = toChainName
}
const fromToken = SQUtils . ModelUtils . getByKey ( appMain . tokensStore . plainTokensBySymbolModel , "key" , fromAsset )
if ( ! ! fromToken ) {
sentAmount = currencyStore . formatCurrencyAmountFromBigInt ( fromAmount , fromToken . symbol , fromToken . decimals )
}
const toToken = SQUtils . ModelUtils . getByKey ( appMain . tokensStore . plainTokensBySymbolModel , "key" , toAsset )
if ( ! ! toToken ) {
receivedAmount = currencyStore . formatCurrencyAmountFromBigInt ( toAmount , toToken . symbol , toToken . decimals )
}
if ( txType === Constants . SendType . ERC721Transfer || txType === Constants . SendType . ERC1155Transfer ) {
const key = "%1+%2+%3" . arg ( fromChainId ) . arg ( txToAddr ) . arg ( fromAsset )
const entry = SQUtils . ModelUtils . getByKey ( appMain . walletCollectiblesStore . allCollectiblesModel , "symbol" , key )
if ( ! ! entry ) {
assetName = entry . name
2024-07-10 18:33:51 +00:00
}
}
2024-11-20 07:34:05 +00:00
if ( txType === Constants . SendType . StickersBuy ) {
const idx = appMain . rootChatStore . stickersModuleInst . stickerPacks . findIndexById ( packId , false )
if ( idx >= 0 ) {
const entry = SQUtils . ModelUtils . get ( appMain . rootChatStore . stickersModuleInst . stickerPacks , idx )
if ( ! ! entry ) {
stickersPackName = entry . name
2024-07-10 18:33:51 +00:00
}
}
}
2024-11-20 07:34:05 +00:00
switch ( status ) {
case Constants.txStatus.sending: {
toastTitle = qsTr ( "Sending %1 from %2 to %3" )
toastLoading = true
switch ( txType ) {
case Constants.SendType.Transfer: {
toastTitle = toastTitle . arg ( sentAmount ) . arg ( sender ) . arg ( recipient )
break
}
case Constants.SendType.ENSRegister: {
toastTitle = qsTr ( "Registering %1 ENS name using %2" ) . arg ( ensName ) . arg ( sender )
break
}
case Constants.SendType.ENSRelease: {
toastTitle = qsTr ( "Releasing %1 ENS username using %2" ) . arg ( ensName ) . arg ( sender )
break
}
case Constants.SendType.ENSSetPubKey: {
toastTitle = qsTr ( "Setting public key %1 using %2" ) . arg ( ensName ) . arg ( sender )
break
}
case Constants.SendType.StickersBuy: {
toastTitle = qsTr ( "Purchasing %1 sticker pack using %2" ) . arg ( stickersPackName ) . arg ( sender )
break
}
case Constants.SendType.Bridge: {
toastTitle = qsTr ( "Bridging %1 from %2 to %3 in %4" ) . arg ( sentAmount ) . arg ( senderChainName ) . arg ( recipientChainName ) . arg ( sender )
if ( approvalTx ) {
toastTitle = qsTr ( "Setting spending cap: %1 in %2 for %3" ) . arg ( sentAmount ) . arg ( sender ) . arg ( txRecipient )
2024-07-10 18:33:51 +00:00
}
2024-11-20 07:34:05 +00:00
break
}
case Constants.SendType.ERC721Transfer: {
toastTitle = toastTitle . arg ( assetName ) . arg ( sender ) . arg ( recipient )
break
}
case Constants.SendType.ERC1155Transfer: {
toastTitle = qsTr ( "Sending %1 %2 from %3 to %4" ) . arg ( fromAmount ) . arg ( assetName ) . arg ( sender ) . arg ( recipient )
break
}
case Constants.SendType.Swap: {
toastTitle = qsTr ( "Swapping %1 to %2 in %3" ) . arg ( sentAmount ) . arg ( receivedAmount ) . arg ( sender )
if ( approvalTx ) {
toastTitle = qsTr ( "Setting spending cap: %1 in %2 for %3" ) . arg ( sentAmount ) . arg ( sender ) . arg ( txRecipient )
}
break
}
case Constants.SendType.Approve: {
console . warn ( "tx type approve not yet identified as a stand alone path" )
break
}
default:
console . warn ( "status: sending - tx type not supproted" )
return
2024-07-10 18:33:51 +00:00
}
break
}
2024-11-20 07:34:05 +00:00
case Constants.txStatus.pending: {
// So far we don't display notification when it's accepted by the network and its status is pending
// discussed in wallet group chat, we considered that pending status will be displayed almost at the
// same time as sending and decided to skip it.
return
2024-07-10 18:33:51 +00:00
}
2024-11-20 07:34:05 +00:00
case Constants.txStatus.success: {
toastTitle = qsTr ( "Sent %1 from %2 to %3" )
toastIcon = "checkmark-circle"
toastType = Constants . ephemeralNotificationType . success
switch ( txType ) {
case Constants.SendType.Transfer: {
toastTitle = toastTitle . arg ( sentAmount ) . arg ( sender ) . arg ( recipient )
break
}
case Constants.SendType.ENSRegister: {
toastTitle = qsTr ( "Registered %1 ENS name using %2" ) . arg ( ensName ) . arg ( sender )
break
}
case Constants.SendType.ENSRelease: {
toastTitle = qsTr ( "Released %1 ENS username using %2" ) . arg ( ensName ) . arg ( sender )
break
}
case Constants.SendType.ENSSetPubKey: {
toastTitle = qsTr ( "Set public key %1 using %2" ) . arg ( ensName ) . arg ( sender )
break
}
case Constants.SendType.StickersBuy: {
toastTitle = qsTr ( "Purchased %1 sticker pack using %2" ) . arg ( stickersPackName ) . arg ( sender )
break
}
case Constants.SendType.Bridge: {
toastTitle = qsTr ( "Bridged %1 from %2 to %3 in %4" ) . arg ( sentAmount ) . arg ( senderChainName ) . arg ( recipientChainName ) . arg ( sender )
if ( approvalTx ) {
toastTitle = qsTr ( "Spending spending cap: %1 in %2 for %3" ) . arg ( sentAmount ) . arg ( sender ) . arg ( txRecipient )
2024-07-10 18:33:51 +00:00
}
2024-11-20 07:34:05 +00:00
break
}
case Constants.SendType.ERC721Transfer: {
toastTitle = toastTitle . arg ( assetName ) . arg ( sender ) . arg ( recipient )
break
}
case Constants.SendType.ERC1155Transfer: {
toastTitle = qsTr ( "Sent %1 %2 from %3 to %4" ) . arg ( fromAmount ) . arg ( assetName ) . arg ( sender ) . arg ( recipient )
break
}
case Constants.SendType.Swap: {
toastTitle = qsTr ( "Swapped %1 to %2 in %3" ) . arg ( sentAmount ) . arg ( receivedAmount ) . arg ( sender )
if ( approvalTx ) {
toastTitle = qsTr ( "Spending cap set: %1 in %2 for %3" ) . arg ( sentAmount ) . arg ( sender ) . arg ( txRecipient )
}
break
}
case Constants.SendType.Approve: {
console . warn ( "tx type approve not yet identified as a stand alone path" )
break
}
default:
console . warn ( "status: success - tx type not supproted" )
return
2024-07-10 18:33:51 +00:00
}
break
}
2024-11-20 07:34:05 +00:00
case Constants.txStatus.failed: {
toastTitle = qsTr ( "Send failed: %1 from %2 to %3" )
toastIcon = "warning"
toastType = Constants . ephemeralNotificationType . danger
switch ( txType ) {
case Constants.SendType.Transfer: {
toastTitle = toastTitle . arg ( sentAmount ) . arg ( sender ) . arg ( recipient )
break
}
case Constants.SendType.ENSRegister: {
toastTitle = qsTr ( "ENS username registeration failed: %1 using %2" ) . arg ( ensName ) . arg ( sender )
break
}
case Constants.SendType.ENSRelease: {
toastTitle = qsTr ( "ENS username release failed: %1 using %2" ) . arg ( ensName ) . arg ( sender )
break
}
case Constants.SendType.ENSSetPubKey: {
toastTitle = qsTr ( "Set public key failed: %1 using %2" ) . arg ( ensName ) . arg ( sender )
break
}
case Constants.SendType.StickersBuy: {
toastTitle = qsTr ( "Sticker pack purchase failed: %1 using %2" ) . arg ( stickersPackName ) . arg ( sender )
break
}
case Constants.SendType.Bridge: {
toastTitle = qsTr ( "Bridge failed: %1 from %2 to %3 in %4" ) . arg ( sentAmount ) . arg ( senderChainName ) . arg ( recipientChainName ) . arg ( sender )
if ( approvalTx ) {
toastTitle = qsTr ( "Spending spending failed: %1 in %2 for %3" ) . arg ( sentAmount ) . arg ( sender ) . arg ( txRecipient )
2024-07-10 18:33:51 +00:00
}
2024-11-20 07:34:05 +00:00
break
}
case Constants.SendType.ERC721Transfer: {
toastTitle = toastTitle . arg ( assetName ) . arg ( sender ) . arg ( recipient )
break
}
case Constants.SendType.ERC1155Transfer: {
toastTitle = qsTr ( "Send failed: %1 %2 from %3 to %4" ) . arg ( fromAmount ) . arg ( assetName ) . arg ( sender ) . arg ( recipient )
break
}
case Constants.SendType.Swap: {
toastTitle = qsTr ( "Swap failed: %1 to %2 in %3" ) . arg ( sentAmount ) . arg ( receivedAmount ) . arg ( sender )
if ( approvalTx ) {
toastTitle = qsTr ( "Spending cap failed: %1 in %2 for %3" ) . arg ( sentAmount ) . arg ( sender ) . arg ( txRecipient )
}
break
}
case Constants.SendType.Approve: {
console . warn ( "tx type approve not yet identified as a stand alone path" )
break
}
default:
console . warn ( "status: failed - tx type not supproted" )
return
2024-07-10 18:33:51 +00:00
}
break
}
2024-11-20 07:34:05 +00:00
default:
console . warn ( "not supported status" )
return
2023-09-28 17:29:31 +00:00
}
2024-11-20 07:34:05 +00:00
Global . displayToastMessage ( toastTitle , toastSubtitle , toastIcon , toastLoading , toastType , toastLink )
2023-09-28 17:29:31 +00:00
}
2024-03-06 18:19:12 +00:00
function onCommunityMemberStatusEphemeralNotification ( communityName: string , memberName: string , state: CommunityMembershipRequestState ) {
var text = ""
switch ( state ) {
case Constants.CommunityMembershipRequestState.Banned:
2024-03-19 15:17:02 +00:00
case Constants.CommunityMembershipRequestState.BannedWithAllMessagesDelete:
2024-03-06 18:19:12 +00:00
text = qsTr ( "%1 was banned from %2" ) . arg ( memberName ) . arg ( communityName )
break
case Constants.CommunityMembershipRequestState.Unbanned:
text = qsTr ( "%1 unbanned from %2" ) . arg ( memberName ) . arg ( communityName )
break
case Constants.CommunityMembershipRequestState.Kicked:
text = qsTr ( "%1 was kicked from %2" ) . arg ( memberName ) . arg ( communityName )
break
default: return
}
Global . displayToastMessage (
text ,
"" ,
"checkmark-circle" ,
false ,
Constants . ephemeralNotificationType . success ,
""
)
}
2024-10-02 13:54:35 +00:00
function onShowToastPairingFallbackCompleted ( ) {
Global . displayToastMessage (
qsTr ( "Device paired" ) ,
qsTr ( "Sync in process. Keep device powered and app open." ) ,
"checkmark-circle" ,
false ,
Constants . ephemeralNotificationType . success ,
""
)
}
2023-04-17 08:31:32 +00:00
}
QtObject {
id: d
property var activityCenterPopupObj: null
function openActivityCenterPopup ( ) {
if ( ! activityCenterPopupObj ) {
activityCenterPopupObj = activityCenterPopupComponent . createObject ( appMain )
}
if ( activityCenterPopupObj . opened ) {
activityCenterPopupObj . close ( )
} else {
activityCenterPopupObj . open ( )
}
2023-01-12 19:06:18 +00:00
}
2024-11-20 07:34:05 +00:00
function ensName ( username ) {
if ( ! username . endsWith ( ".stateofus.eth" ) && ! username . endsWith ( ".eth" ) ) {
return "%1.%2" . arg ( username ) . arg ( "stateofus.eth" )
}
return username
}
2022-03-17 16:24:50 +00:00
}
2023-10-10 14:23:48 +00:00
Settings {
id: appMainLocalSettings
property var whitelistedUnfurledDomains: [ ]
}
2022-10-21 13:37:39 +00:00
Popups {
2023-02-07 14:21:32 +00:00
id: popups
2024-10-02 20:47:14 +00:00
2024-10-02 21:02:57 +00:00
sharedRootStore: appMain . sharedRootStore
2023-02-07 14:21:32 +00:00
popupParent: appMain
2022-10-21 13:37:39 +00:00
rootStore: appMain . rootStore
2024-10-21 22:01:34 +00:00
utilsStore: appMain . utilsStore
2023-10-23 11:32:50 +00:00
communityTokensStore: appMain . communityTokensStore
2023-04-28 10:35:18 +00:00
communitiesStore: appMain . communitiesStore
2024-10-15 12:26:45 +00:00
profileStore: appMain . profileStore
2023-09-12 09:26:57 +00:00
devicesStore: appMain . rootStore . profileSectionStore . devicesStore
2024-01-24 16:35:53 +00:00
currencyStore: appMain . currencyStore
walletAssetsStore: appMain . walletAssetsStore
2024-01-29 15:37:17 +00:00
walletCollectiblesStore: appMain . walletCollectiblesStore
2024-08-13 12:03:35 +00:00
buyCryptoStore: appMain . buyCryptoStore
2024-02-02 09:55:56 +00:00
networkConnectionStore: appMain . networkConnectionStore
2024-11-28 14:15:34 +00:00
2024-11-21 15:10:58 +00:00
allContactsModel: allContacsAdaptor . allContactsModel
2024-11-28 14:15:34 +00:00
mutualContactsModel: contactsModelAdaptor . mutualContacts
2023-06-26 11:44:56 +00:00
isDevBuild: ! production
2023-10-10 14:23:48 +00:00
onOpenExternalLink: globalConns . onOpenLink ( link )
onSaveDomainToUnfurledWhitelist: {
const whitelistedHostnames = appMainLocalSettings . whitelistedUnfurledDomains || [ ]
if ( ! whitelistedHostnames . includes ( domain ) ) {
whitelistedHostnames . push ( domain )
appMainLocalSettings . whitelistedUnfurledDomains = whitelistedHostnames
}
}
2022-10-21 13:37:39 +00:00
}
2021-12-06 21:10:54 +00:00
Connections {
2023-02-07 14:21:32 +00:00
id: globalConns
2021-12-06 21:10:54 +00:00
target: Global
2023-02-07 14:21:32 +00:00
2023-01-18 09:25:36 +00:00
function onOpenCreateChatView ( ) {
2022-10-18 09:06:18 +00:00
createChatView . opened = true
}
2023-01-18 09:25:36 +00:00
function onCloseCreateChatView ( ) {
2022-10-18 09:06:18 +00:00
createChatView . opened = false
}
2023-02-07 14:21:32 +00:00
function onOpenActivityCenterPopupRequested ( ) {
2023-04-17 08:31:32 +00:00
d . openActivityCenterPopup ( )
2022-07-26 14:23:45 +00:00
}
2023-01-18 09:25:36 +00:00
function onOpenLink ( link: string ) {
2022-12-14 14:40:50 +00:00
// Qt sometimes inserts random HTML tags; and this will break on invalid URL inside QDesktopServices::openUrl(link)
2024-10-08 11:20:50 +00:00
link = SQUtils . StringUtils . plainText ( link )
2024-08-05 10:55:28 +00:00
Qt . openUrlExternally ( link )
2022-12-14 14:40:50 +00:00
}
2023-10-10 14:23:48 +00:00
function onOpenLinkWithConfirmation ( link: string , domain: string ) {
2024-08-19 20:40:55 +00:00
if ( appMainLocalSettings . whitelistedUnfurledDomains . includes ( domain ) || link . startsWith ( "mailto:" ) )
2023-10-10 14:23:48 +00:00
globalConns . onOpenLink ( link )
else
popups . openConfirmExternalLinkPopup ( link , domain )
}
2023-10-25 15:20:02 +00:00
function onActivateDeepLink ( link: string ) {
appMain . rootStore . mainModuleInst . activateStatusDeepLink ( link )
}
2023-02-07 14:21:32 +00:00
function onPlaySendMessageSound ( ) {
sendMessageSound . stop ( )
sendMessageSound . play ( )
}
function onPlayNotificationSound ( ) {
notificationSound . stop ( )
notificationSound . play ( )
}
function onPlayErrorSound ( ) {
errorSound . stop ( )
errorSound . play ( )
}
2023-01-18 09:25:36 +00:00
function onSetNthEnabledSectionActive ( nthSection: int ) {
2022-12-14 14:40:50 +00:00
if ( ! appMain . rootStore . mainModuleInst )
return
appMain . rootStore . mainModuleInst . setNthEnabledSectionActive ( nthSection )
}
2024-01-16 07:50:25 +00:00
function onAppSectionBySectionTypeChanged ( sectionType , subsection , subSubsection = - 1 , data = { } ) {
2022-12-14 14:40:50 +00:00
if ( ! appMain . rootStore . mainModuleInst )
return
appMain . rootStore . mainModuleInst . setActiveSectionBySectionType ( sectionType )
2024-01-24 12:02:03 +00:00
2022-12-14 14:40:50 +00:00
if ( sectionType === Constants . appSection . profile ) {
2024-10-18 21:43:29 +00:00
profileLoader . settingsSubsection = subsection
2024-10-18 22:50:21 +00:00
profileLoader . settingsSubSubsection = subSubsection ;
2024-01-24 12:02:03 +00:00
} else if ( sectionType === Constants . appSection . wallet ) {
appView . children [ Constants . appViewStackIndex . wallet ] . item . openDesiredView ( subsection , subSubsection , data )
2022-12-14 14:40:50 +00:00
}
}
2023-02-28 15:00:10 +00:00
function onOpenSendModal ( address: string ) {
sendModal . open ( address )
}
function onSwitchToCommunity ( communityId: string ) {
2023-04-28 10:35:18 +00:00
appMain . communitiesStore . setActiveCommunity ( communityId )
2023-02-28 15:00:10 +00:00
}
2023-12-26 10:19:41 +00:00
function onOpenAddEditSavedAddressesPopup ( params ) {
addEditSavedAddress . open ( params )
}
function onOpenDeleteSavedAddressesPopup ( params ) {
deleteSavedAddress . open ( params )
}
2024-01-15 09:19:25 +00:00
function onOpenShowQRPopup ( params ) {
showQR . open ( params )
}
2024-02-19 08:40:16 +00:00
function onOpenSavedAddressActivityPopup ( params ) {
savedAddressActivity . open ( params )
}
2021-10-19 10:27:41 +00:00
}
2023-07-27 12:33:33 +00:00
Connections {
target: appMain . communitiesStore
function onImportingCommunityStateChanged ( communityId , state , errorMsg ) {
let title = ""
let subTitle = ""
let loading = false
let notificationType = Constants . ephemeralNotificationType . normal
let icon = ""
2023-10-27 17:19:25 +00:00
2023-07-27 12:33:33 +00:00
switch ( state )
{
case Constants.communityImported:
2023-10-07 08:47:48 +00:00
const community = appMain . communitiesStore . getCommunityDetailsAsJson ( communityId )
2023-07-27 12:33:33 +00:00
if ( community . isControlNode ) {
title = qsTr ( "This device is now the control node for the %1 Community" ) . arg ( community . name )
notificationType = Constants . ephemeralNotificationType . success
icon = "checkmark-circle"
} else {
title = qsTr ( "'%1' community imported" ) . arg ( community . name )
}
break
case Constants.communityImportingInProgress:
title = qsTr ( "Importing community is in progress" )
loading = true
break
case Constants.communityImportingError:
2023-10-07 08:47:48 +00:00
title = qsTr ( "Failed to import community '%1'" ) . arg ( communityId )
2023-07-27 12:33:33 +00:00
subTitle = errorMsg
break
2023-10-27 20:11:10 +00:00
case Constants.communityImportingCanceled:
title = qsTr ( "Import community '%1' was canceled" ) . arg ( community . name )
break ;
2023-07-27 12:33:33 +00:00
default:
console . error ( "unknown state while importing community: %1" ) . arg ( state )
return
}
Global . displayToastMessage ( title ,
subTitle ,
icon ,
loading ,
notificationType ,
"" )
}
}
2023-06-05 15:30:53 +00:00
Connections {
2024-10-04 11:01:08 +00:00
target: Window . window
2023-06-05 15:30:53 +00:00
function onActiveChanged ( ) {
2024-10-04 11:01:08 +00:00
if ( Window . window . active )
appMain . rootStore . windowActivated ( )
else
appMain . rootStore . windowDeactivated ( )
2023-06-05 15:30:53 +00:00
}
}
2021-10-19 10:27:41 +00:00
function changeAppSectionBySectionId ( sectionId ) {
2022-10-18 09:06:18 +00:00
appMain . rootStore . mainModuleInst . setActiveSectionById ( sectionId )
2021-06-11 12:17:23 +00:00
}
2021-02-18 19:14:31 +00:00
Audio {
id: sendMessageSound
2021-12-08 21:20:43 +00:00
store: rootStore
2022-12-08 15:49:14 +00:00
source: "qrc:/imports/assets/audio/send_message.wav"
2021-02-18 19:14:31 +00:00
}
Audio {
id: notificationSound
2021-12-08 21:20:43 +00:00
store: rootStore
2022-12-08 15:49:14 +00:00
source: "qrc:/imports/assets/audio/notification.wav"
2022-01-11 23:16:17 +00:00
}
Audio {
id: errorSound
2022-12-08 15:49:14 +00:00
source: "qrc:/imports/assets/audio/error.mp3"
2022-01-11 23:16:17 +00:00
store: rootStore
2021-02-18 19:14:31 +00:00
}
2022-10-18 09:06:18 +00:00
Loader {
2021-11-10 08:09:31 +00:00
id: appSearch
2022-10-18 09:06:18 +00:00
active: false
asynchronous: true
function openSearchPopup ( ) {
if ( ! active )
active = true
item . openSearchPopup ( )
}
function closeSearchPopup ( ) {
if ( item )
item . closeSearchPopup ( )
2022-11-07 14:56:59 +00:00
2022-10-18 09:06:18 +00:00
active = false
}
sourceComponent: AppSearch {
store: appMain . rootStore . appSearchStore
2024-10-21 10:14:48 +00:00
utilsStore: appMain . utilsStore
2022-11-07 14:56:59 +00:00
onClosed: appSearch . active = false
2022-10-18 09:06:18 +00:00
}
2021-11-10 08:09:31 +00:00
}
2023-04-28 10:35:18 +00:00
Loader {
2022-03-07 14:56:05 +00:00
id: statusEmojiPopup
2023-04-28 10:35:18 +00:00
active: appMain . rootStore . mainModuleInst . sectionsLoaded
sourceComponent: StatusEmojiPopup {
2024-08-28 09:07:11 +00:00
height: 440
2024-08-23 10:58:48 +00:00
settings: localAccountSensitiveSettings
2024-08-26 08:16:59 +00:00
emojiModel: SQUtils . Emoji . emojiModel
2023-04-28 10:35:18 +00:00
}
2022-03-07 14:56:05 +00:00
}
2023-01-30 21:05:34 +00:00
Loader {
id: statusStickersPopupLoader
2023-03-16 19:05:05 +00:00
active: appMain . rootStore . mainModuleInst . sectionsLoaded
2023-01-30 21:05:34 +00:00
sourceComponent: StatusStickersPopup {
2023-02-09 21:49:36 +00:00
store: appMain . rootChatStore
2024-02-05 16:44:49 +00:00
walletAssetsStore: appMain . walletAssetsStore
2024-10-04 07:46:53 +00:00
sendModalPopup: sendModal
2024-10-02 09:08:52 +00:00
2024-10-15 09:31:46 +00:00
isWalletEnabled: appMain . profileStore . isWalletEnabled
2023-01-30 21:05:34 +00:00
}
2022-11-14 20:21:00 +00:00
}
2022-08-09 15:08:39 +00:00
StatusMainLayout {
2021-09-15 11:40:07 +00:00
id: appLayout
2022-07-26 08:24:59 +00:00
anchors.fill: parent
2021-06-17 18:41:11 +00:00
2022-08-09 15:08:39 +00:00
leftPanel: StatusAppNavBar {
2024-11-20 08:09:35 +00:00
topSectionModel: SortFilterProxyModel {
2022-11-28 11:32:29 +00:00
sourceModel: appMain . rootStore . mainModuleInst . sectionsModel
filters: [
2024-11-20 08:09:35 +00:00
AnyOf {
ValueFilter {
roleName: "sectionType"
value: Constants . appSection . wallet
}
ValueFilter {
roleName: "sectionType"
value: Constants . appSection . chat
}
2022-11-28 11:32:29 +00:00
} ,
ValueFilter {
roleName: "enabled"
value: true
}
]
2021-06-17 18:41:11 +00:00
}
2024-11-20 08:09:35 +00:00
topSectionDelegate: navbarButton
2022-11-28 11:32:29 +00:00
communityItemsModel: SortFilterProxyModel {
sourceModel: appMain . rootStore . mainModuleInst . sectionsModel
filters: [
ValueFilter {
roleName: "sectionType"
value: Constants . appSection . community
} ,
ValueFilter {
roleName: "enabled"
value: true
}
]
2021-10-19 10:27:41 +00:00
}
2022-11-28 11:32:29 +00:00
communityItemDelegate: StatusNavBarTabButton {
2022-08-11 12:24:49 +00:00
objectName: "CommunityNavBarButton"
2021-06-17 18:41:11 +00:00
anchors.horizontalCenter: parent . horizontalCenter
2021-10-19 10:27:41 +00:00
name: model . icon . length > 0 ? "" : model . name
icon.name: model . icon
icon.source: model . image
2022-10-12 15:22:23 +00:00
identicon.asset.color: ( hovered || identicon . highlighted || checked ) ? model.color : icon . color
2021-06-17 18:41:11 +00:00
tooltip.text: model . name
2021-10-19 10:27:41 +00:00
checked: model . active
badge.value: model . notificationsCount
badge.visible: model . hasNotification
2021-06-17 18:41:11 +00:00
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme . palette . statusBadge . borderColor
badge.border.width: 2
2024-02-27 11:55:56 +00:00
stateIcon.color: Theme . palette . dangerColor1
stateIcon.border.color: Theme . palette . baseColor2
stateIcon.border.width: 2
stateIcon.visible: model . amIBanned
stateIcon.asset.name: "cancel"
stateIcon.asset.color: Theme . palette . baseColor2
stateIcon.asset.width: 14
2021-10-19 10:27:41 +00:00
onClicked: {
changeAppSectionBySectionId ( model . id )
}
2021-06-17 18:41:11 +00:00
2023-01-10 13:19:02 +00:00
popupMenu: Component {
StatusMenu {
id: communityContextMenu
property var chatCommunitySectionModule
2022-01-18 20:54:14 +00:00
2023-08-02 17:39:42 +00:00
readonly property bool isSpectator: model . spectated && ! model . joined
2023-01-10 13:19:02 +00:00
openHandler: function ( ) {
// we cannot return QVariant if we pass another parameter in a function call
// that's why we're using it this way
appMain . rootStore . mainModuleInst . prepareCommunitySectionModuleForCommunityId ( model . id )
communityContextMenu . chatCommunitySectionModule = appMain . rootStore . mainModuleInst . getCommunitySectionModule ( )
}
2021-06-17 18:41:11 +00:00
2023-01-10 13:19:02 +00:00
StatusAction {
text: qsTr ( "Invite People" )
icon.name: "share-ios"
2023-09-12 08:55:40 +00:00
objectName: "invitePeople"
2023-01-10 13:19:02 +00:00
onTriggered: {
2023-02-07 14:21:32 +00:00
popups . openInviteFriendsToCommunityPopup ( model ,
2023-01-10 13:19:02 +00:00
communityContextMenu . chatCommunitySectionModule ,
null )
}
2022-09-28 21:07:18 +00:00
}
2021-06-17 18:41:11 +00:00
2023-01-10 13:19:02 +00:00
StatusAction {
text: qsTr ( "View Community" )
icon.name: "group-chat"
2023-02-07 14:21:32 +00:00
onTriggered: popups . openCommunityProfilePopup ( appMain . rootStore , model , communityContextMenu . chatCommunitySectionModule )
2023-01-10 13:19:02 +00:00
}
2021-06-17 18:41:11 +00:00
2023-06-14 08:42:52 +00:00
StatusMenuSeparator { }
2023-06-07 10:54:31 +00:00
MuteChatMenuItem {
enabled: ! model . muted
title: qsTr ( "Mute Community" )
onMuteTriggered: {
communityContextMenu . chatCommunitySectionModule . setCommunityMuted ( interval )
communityContextMenu . close ( )
}
}
2023-04-11 16:48:32 +00:00
StatusAction {
2023-06-07 10:54:31 +00:00
enabled: model . muted
text: qsTr ( "Unmute Community" )
2023-06-21 20:37:51 +00:00
icon.name: "notification"
2023-04-11 16:48:32 +00:00
onTriggered: {
2023-06-07 10:54:31 +00:00
communityContextMenu . chatCommunitySectionModule . setCommunityMuted ( Constants . MutingVariations . Unmuted )
2023-04-11 16:48:32 +00:00
}
}
2023-08-02 17:39:42 +00:00
StatusAction {
text: qsTr ( "Edit Shared Addresses" )
icon.name: "wallet"
enabled: {
2024-04-08 11:35:12 +00:00
if ( model . memberRole === Constants . memberRole . owner || communityContextMenu . isSpectator )
2023-08-02 17:39:42 +00:00
return false
return true
}
onTriggered: {
communityContextMenu . close ( )
Global . openEditSharedAddressesFlow ( model . id )
}
}
2023-06-14 08:42:52 +00:00
StatusMenuSeparator { visible: leaveCommunityMenuItem . enabled }
2021-06-17 18:41:11 +00:00
2023-01-10 13:19:02 +00:00
StatusAction {
2023-06-14 08:42:52 +00:00
id: leaveCommunityMenuItem
2024-10-21 09:16:42 +00:00
objectName: "leaveCommunityMenuItem"
2023-12-04 19:14:13 +00:00
// allow to leave community for the owner in non-production builds
enabled: model . memberRole !== Constants . memberRole . owner || ! production
2023-06-14 08:42:52 +00:00
text: {
2023-08-02 17:39:42 +00:00
if ( communityContextMenu . isSpectator )
2023-06-14 08:42:52 +00:00
return qsTr ( "Close Community" )
return qsTr ( "Leave Community" )
}
2023-08-02 17:39:42 +00:00
icon.name: communityContextMenu . isSpectator ? "close-circle" : "arrow-left"
2023-01-10 13:19:02 +00:00
type: StatusAction . Type . Danger
2023-08-02 17:39:42 +00:00
onTriggered: communityContextMenu . isSpectator ? communityContextMenu . chatCommunitySectionModule . leaveCommunity ( )
: popups . openLeaveCommunityPopup ( model . name , model . id , model . outroMessage )
2023-01-10 13:19:02 +00:00
}
2021-06-17 18:41:11 +00:00
}
}
}
2022-11-28 11:32:29 +00:00
regularItemsModel: SortFilterProxyModel {
sourceModel: appMain . rootStore . mainModuleInst . sectionsModel
filters: [
RangeFilter {
roleName: "sectionType"
2024-11-20 08:09:35 +00:00
minimumValue: Constants . appSection . profile
2024-11-01 14:32:20 +00:00
maximumValue: Constants . appSection . loadingSection
2022-11-28 11:32:29 +00:00
} ,
ValueFilter {
roleName: "enabled"
value: true
}
]
}
regularItemDelegate: navbarButton
delegateHeight: 40
profileComponent: StatusNavBarTabButton {
2021-06-17 18:41:11 +00:00
id: profileButton
2022-08-12 13:19:16 +00:00
objectName: "statusProfileNavBarTabButton"
2021-09-27 10:31:17 +00:00
property bool opened: false
2021-10-19 10:27:41 +00:00
2024-10-15 09:31:46 +00:00
name: appMain . profileStore . name
icon.source: appMain . profileStore . icon
2022-11-28 11:32:29 +00:00
implicitWidth: 32
implicitHeight: 32
2022-09-05 09:24:37 +00:00
identicon.asset.width: width
identicon.asset.height: height
2024-05-17 17:29:05 +00:00
identicon.asset.useAcronymForLetterIdenticon: true
2024-10-15 09:31:46 +00:00
identicon.asset.color: Utils . colorForPubkey ( appMain . profileStore . pubkey )
identicon.ringSettings.ringSpecModel: Utils . getColorHashAsJson ( appMain . profileStore . pubkey ,
appMain . profileStore . preferredName )
2022-04-01 11:46:32 +00:00
2021-06-17 18:41:11 +00:00
badge.visible: true
2022-07-26 08:24:59 +00:00
badge . anchors {
left: undefined
top: undefined
right: profileButton . right
bottom: profileButton . bottom
margins: 0
rightMargin: - badge . border . width
bottomMargin: - badge . border . width
}
badge.implicitHeight: 12
badge.implicitWidth: 12
badge.border.width: 2
2021-06-17 18:41:11 +00:00
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme . palette . statusAppNavBar . backgroundColor
2022-06-10 09:01:31 +00:00
badge.color: {
2024-10-15 09:31:46 +00:00
switch ( appMain . profileStore . currentUserStatus ) {
2022-06-10 09:01:31 +00:00
case Constants.currentUserStatus.automatic:
case Constants.currentUserStatus.alwaysOnline:
2024-10-15 19:26:12 +00:00
return Theme . palette . successColor1
2022-06-10 09:01:31 +00:00
default:
2024-10-15 19:26:12 +00:00
return Theme . palette . baseColor1
2022-06-10 09:01:31 +00:00
}
}
2022-07-26 08:24:59 +00:00
onClicked: userStatusContextMenu . opened ? userStatusContextMenu . close ( ) : userStatusContextMenu . open ( )
2021-06-17 18:41:11 +00:00
UserStatusContextMenu {
id: userStatusContextMenu
2024-10-15 08:13:36 +00:00
2024-11-07 10:43:06 +00:00
readonly property string pubKey: appMain . profileStore . pubkey
2022-07-04 10:47:29 +00:00
y: profileButton . y - userStatusContextMenu . height + profileButton . height
x: profileButton . x + profileButton . width + 5
2024-10-15 08:13:36 +00:00
2024-11-07 10:43:06 +00:00
compressedPubKey: appMain . profileStore . compressedPubKey
2024-10-22 12:39:42 +00:00
emojiHash: appMain . utilsStore . getEmojiHash ( pubKey )
2024-11-06 20:08:22 +00:00
colorHash: appMain . profileStore . colorHash
colorId: appMain . profileStore . colorId
2024-10-15 09:31:46 +00:00
name: appMain . profileStore . name
icon: appMain . profileStore . icon
isEnsVerified: ! ! appMain . profileStore . preferredName
2024-10-15 08:13:36 +00:00
2024-10-15 09:31:46 +00:00
currentUserStatus: appMain . profileStore . currentUserStatus
2024-10-15 08:13:36 +00:00
onViewProfileRequested: Global . openProfilePopup ( pubKey )
onCopyLinkRequested: ClipboardUtils . setText ( appMain . rootStore . contactStore . getLinkToProfile ( pubKey ) )
onSetCurrentUserStatusRequested: appMain . rootStore . setCurrentUserStatus ( status )
2021-06-17 18:41:11 +00:00
}
2022-11-28 11:32:29 +00:00
}
Component {
id: navbarButton
StatusNavBarTabButton {
id: navbar
objectName: model . name + "-navbar"
anchors.horizontalCenter: parent . horizontalCenter
name: model . icon . length > 0 ? "" : model . name
icon.name: model . icon
icon.source: model . image
2022-12-12 12:39:25 +00:00
tooltip.text: Utils . translatedSectionName ( model . sectionType , model . name )
2022-11-28 11:32:29 +00:00
checked: model . active
badge.value: model . notificationsCount
2024-02-08 12:54:32 +00:00
badge.visible: model . sectionType === Constants . appSection . profile &&
2024-11-28 14:15:34 +00:00
( contactsModelAdaptor . pendingReceivedRequestContacts . ModelCount . empty ? // pending contact request
model.hasNotification : true )
2022-11-28 11:32:29 +00:00
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme . palette . statusBadge . borderColor
badge.border.width: 2
onClicked: {
changeAppSectionBySectionId ( model . id )
}
}
2021-06-17 18:41:11 +00:00
}
2021-07-28 12:50:48 +00:00
}
2021-06-17 18:41:11 +00:00
2022-08-09 15:08:39 +00:00
rightPanel: ColumnLayout {
spacing: 0
2022-08-31 10:55:42 +00:00
objectName: "mainRightView"
2022-09-02 14:56:14 +00:00
ColumnLayout {
id: bannersLayout
2023-01-30 10:42:26 +00:00
enabled: ! localAppSettings . testEnvironment
visible: enabled
2022-09-02 14:56:14 +00:00
property var updateBanner: null
property var connectedBanner: null
2022-10-18 09:06:18 +00:00
readonly property bool isConnected: appMain . rootStore . mainModuleInst . isOnline
2022-09-02 14:56:14 +00:00
function processUpdateAvailable ( ) {
if ( ! updateBanner )
updateBanner = updateBannerComponent . createObject ( this )
2022-03-03 21:00:52 +00:00
}
2022-09-02 14:56:14 +00:00
function processConnected ( ) {
if ( ! connectedBanner )
connectedBanner = connectedBannerComponent . createObject ( this )
2021-10-19 10:27:41 +00:00
}
2022-03-17 16:15:38 +00:00
2022-09-02 14:56:14 +00:00
Layout.fillWidth: true
Layout.maximumHeight: implicitHeight
spacing: 1
onIsConnectedChanged: {
processConnected ( )
2023-01-11 14:06:31 +00:00
}
Component.onCompleted: {
if ( ! isConnected )
processConnected ( )
2022-03-17 16:15:38 +00:00
}
2022-09-02 14:56:14 +00:00
Connections {
target: rootStore . aboutModuleInst
2023-01-18 09:25:36 +00:00
function onAppVersionFetched ( available: bool , version: string , url: string ) {
2022-09-02 14:56:14 +00:00
rootStore . setLatestVersionInfo ( available , version , url ) ;
2023-06-12 17:54:19 +00:00
// TODO when we re-implement check for updates, uncomment this
// bannersLayout.processUpdateAvailable()
2022-09-02 14:56:14 +00:00
}
2022-03-17 16:15:38 +00:00
}
2022-09-02 14:56:14 +00:00
ModuleWarning {
id: testnetBanner
2022-09-29 14:30:25 +00:00
objectName: "testnetBanner"
2022-09-02 14:56:14 +00:00
Layout.fillWidth: true
2023-06-27 19:56:44 +00:00
text: qsTr ( "Testnet mode enabled. All balances, transactions and dApp interactions will be on testnets." )
2022-09-02 14:56:14 +00:00
buttonText: qsTr ( "Turn off" )
2023-06-27 19:56:44 +00:00
type: ModuleWarning . Warning
iconName: "warning"
2022-09-02 14:56:14 +00:00
active: appMain . rootStore . profileSectionStore . walletStore . areTestNetworksEnabled
2023-11-02 14:50:58 +00:00
delay: false
2023-06-27 19:56:44 +00:00
onClicked: Global . openTestnetPopup ( )
2023-12-06 10:54:36 +00:00
closeBtnVisible: false
2022-03-17 16:15:38 +00:00
}
2022-09-02 14:56:14 +00:00
ModuleWarning {
id: secureYourSeedPhrase
2022-09-29 14:30:25 +00:00
objectName: "secureYourSeedPhraseBanner"
2022-09-02 14:56:14 +00:00
Layout.fillWidth: true
2022-09-14 19:05:44 +00:00
active: ! appMain . rootStore . profileSectionStore . profileStore . userDeclinedBackupBanner
2022-09-02 14:56:14 +00:00
&& ! appMain . rootStore . profileSectionStore . profileStore . privacyStore . mnemonicBackedUp
type: ModuleWarning . Danger
text: qsTr ( "Secure your seed phrase" )
buttonText: qsTr ( "Back up now" )
2023-11-02 14:50:58 +00:00
delay: false
2023-02-07 14:21:32 +00:00
onClicked: popups . openBackUpSeedPopup ( )
2022-09-02 14:56:14 +00:00
onCloseClicked: {
appMain . rootStore . profileSectionStore . profileStore . userDeclinedBackupBanner = true
}
2022-03-17 16:15:38 +00:00
}
2021-12-17 17:42:12 +00:00
2022-09-15 07:31:38 +00:00
ModuleWarning {
Layout.fillWidth: true
2023-04-28 10:35:18 +00:00
readonly property int progress: appMain . communitiesStore . discordImportProgress
readonly property bool inProgress: ( progress > 0 && progress < 100 ) || appMain . communitiesStore . discordImportInProgress
2022-09-15 07:31:38 +00:00
readonly property bool finished: progress >= 100
2023-04-28 10:35:18 +00:00
readonly property bool cancelled: appMain . communitiesStore . discordImportCancelled
readonly property bool stopped: appMain . communitiesStore . discordImportProgressStopped
readonly property int errors: appMain . communitiesStore . discordImportErrorsCount
readonly property int warnings: appMain . communitiesStore . discordImportWarningsCount
readonly property string communityId: appMain . communitiesStore . discordImportCommunityId
readonly property string communityName: appMain . communitiesStore . discordImportCommunityName
2023-09-01 07:58:48 +00:00
readonly property string channelId: appMain . communitiesStore . discordImportChannelId
readonly property string channelName: appMain . communitiesStore . discordImportChannelName
readonly property string channelOrCommunityName: channelName || communityName
2023-11-02 14:50:58 +00:00
delay: false
2022-09-15 07:31:38 +00:00
active: ! cancelled && ( inProgress || finished || stopped )
type: errors ? ModuleWarning.Type.Danger : ModuleWarning . Type . Success
text: {
if ( finished || stopped ) {
if ( errors )
2023-09-01 07:58:48 +00:00
return qsTr ( "The import of ‘ %1’ from Discord to Status was stopped: <a href='#'>Critical issues found</a>" ) . arg ( channelOrCommunityName )
2022-09-15 07:31:38 +00:00
2023-09-01 07:58:48 +00:00
let result = qsTr ( "‘ %1’ was successfully imported from Discord to Status" ) . arg ( channelOrCommunityName ) + " <a href='#'>"
2022-09-15 07:31:38 +00:00
if ( warnings )
result += qsTr ( "Details (%1)" ) . arg ( qsTr ( "%n issue(s)" , "" , warnings ) )
else
result += qsTr ( "Details" )
result += "</a>"
return result
}
if ( inProgress ) {
2023-09-01 07:58:48 +00:00
let result = qsTr ( "Importing ‘ %1’ from Discord to Status" ) . arg ( channelOrCommunityName ) + " <a href='#'>"
2022-09-15 07:31:38 +00:00
if ( warnings )
result += qsTr ( "Check progress (%1)" ) . arg ( qsTr ( "%n issue(s)" , "" , warnings ) )
else
result += qsTr ( "Check progress" )
result += "</a>"
return result
}
2022-12-09 11:35:29 +00:00
return ""
2022-09-15 07:31:38 +00:00
}
2023-09-01 07:58:48 +00:00
onLinkActivated: popups . openDiscordImportProgressPopup ( ! ! channelId )
2022-09-15 07:31:38 +00:00
progressValue: progress
closeBtnVisible: finished || stopped
2023-09-01 07:58:48 +00:00
buttonText: finished && ! errors ? ! ! channelId ? qsTr ( "Visit your new channel" ) : qsTr ( "Visit your Community" ) : ""
2022-09-15 07:31:38 +00:00
onClicked: function ( ) {
2023-09-01 07:58:48 +00:00
if ( ! ! channelId )
rootStore . setActiveSectionChat ( communityId , channelId )
else
appMain . communitiesStore . setActiveCommunity ( communityId )
2022-09-15 07:31:38 +00:00
}
2023-09-01 07:58:48 +00:00
onCloseClicked: hide ( )
2022-09-15 07:31:38 +00:00
}
2022-12-01 15:10:51 +00:00
ModuleWarning {
id: downloadingArchivesBanner
Layout.fillWidth: true
2023-04-28 10:35:18 +00:00
active: appMain . communitiesStore . downloadingCommunityHistoryArchives
2022-12-01 15:10:51 +00:00
type: ModuleWarning . Danger
text: qsTr ( "Downloading message history archives, DO NOT CLOSE THE APP until this banner disappears." )
closeBtnVisible: false
2023-11-02 14:50:58 +00:00
delay: false
2022-12-01 15:10:51 +00:00
}
2022-09-15 07:31:38 +00:00
2023-01-18 10:36:28 +00:00
ModuleWarning {
id: mailserverConnectionBanner
2023-01-18 16:37:36 +00:00
type: ModuleWarning . Warning
text: qsTr ( "Can not connect to store node. Retrying automatically" )
2023-01-18 10:36:28 +00:00
onCloseClicked: hide ( )
Layout.fillWidth: true
}
2022-09-02 14:56:14 +00:00
Component {
id: connectedBannerComponent
ModuleWarning {
2022-10-04 16:38:52 +00:00
id: connectedBanner
property bool isConnected: true
2022-09-02 14:56:14 +00:00
2022-09-29 14:30:25 +00:00
objectName: "connectionInfoBanner"
2022-09-02 14:56:14 +00:00
Layout.fillWidth: true
2023-03-01 20:59:08 +00:00
text: isConnected ? qsTr ( "You are back online" ) : qsTr ( "Internet connection lost. Reconnect to ensure everything is up to date." )
2022-09-02 14:56:14 +00:00
type: isConnected ? ModuleWarning.Success : ModuleWarning . Danger
function updateState ( ) {
if ( isConnected )
showFor ( )
else
show ( ) ;
}
Component.onCompleted: {
2022-10-04 16:38:52 +00:00
connectedBanner . isConnected = Qt . binding ( ( ) = > bannersLayout . isConnected ) ;
2022-09-02 14:56:14 +00:00
}
onIsConnectedChanged: {
updateState ( ) ;
}
onCloseClicked: {
hide ( ) ;
}
onHideFinished: {
destroy ( )
2023-01-30 10:42:26 +00:00
bannersLayout . connectedBanner = null
2022-09-02 14:56:14 +00:00
}
}
}
Component {
id: updateBannerComponent
ModuleWarning {
readonly property string version: appMain . rootStore . latestVersion
readonly property bool updateAvailable: appMain . rootStore . newVersionAvailable
2022-09-29 14:35:16 +00:00
objectName: "appVersionUpdateBanner"
2022-09-02 14:56:14 +00:00
Layout.fillWidth: true
type: ModuleWarning . Success
2023-11-02 14:50:58 +00:00
delay: false
2022-09-02 14:56:14 +00:00
text: updateAvailable ? qsTr ( "A new version of Status (%1) is available" ) . arg ( version )
: qsTr ( "Your version is up to date" )
buttonText: updateAvailable ? qsTr ( "Update" )
: qsTr ( "Close" )
function updateState ( ) {
if ( updateAvailable )
show ( )
else
showFor ( 5000 )
}
Component.onCompleted: {
updateState ( )
}
onUpdateAvailableChanged: {
updateState ( ) ;
}
onClicked: {
if ( updateAvailable )
Global . openDownloadModal ( appMain . rootStore . newVersionAvailable ,
appMain . rootStore . latestVersion ,
appMain . rootStore . downloadURL )
else
close ( )
}
onCloseClicked: {
if ( updateAvailable )
appMain . rootStore . resetLastVersion ( ) ;
hide ( )
}
onHideFinished: {
destroy ( )
2023-01-30 10:42:26 +00:00
bannersLayout . updateBanner = null
2022-09-02 14:56:14 +00:00
}
}
}
2023-03-01 20:59:08 +00:00
ConnectionWarnings {
id: walletBlockchainConnectionBanner
objectName: "walletBlockchainConnectionBanner"
Layout.fillWidth: true
websiteDown: Constants . walletConnections . blockchains
2023-03-23 10:23:02 +00:00
withCache: networkConnectionStore . balanceCache
2023-04-03 17:13:23 +00:00
networkConnectionStore: appMain . networkConnectionStore
tooltipMessage: qsTr ( "Pocket Network (POKT) & Infura are currently both unavailable for %1. Balances for those chains are as of %2." ) . arg ( jointChainIdString ) . arg ( lastCheckedAt )
toastText: {
2023-03-01 20:59:08 +00:00
switch ( connectionState ) {
case Constants.ConnectionStatus.Success:
return qsTr ( "Pocket Network (POKT) connection successful" )
case Constants.ConnectionStatus.Failure:
if ( completelyDown ) {
if ( withCache )
2023-04-03 17:13:23 +00:00
return qsTr ( "POKT & Infura down. Token balances are as of %1." ) . arg ( lastCheckedAt )
2023-03-01 20:59:08 +00:00
else
2023-04-03 17:13:23 +00:00
return qsTr ( "POKT & Infura down. Token balances cannot be retrieved." )
2023-03-01 20:59:08 +00:00
}
else if ( chainIdsDown . length > 0 ) {
if ( chainIdsDown . length > 2 ) {
2023-04-03 17:13:23 +00:00
return qsTr ( "POKT & Infura down for <a href='#'>multiple chains </a>. Token balances for those chains cannot be retrieved." )
2023-03-01 20:59:08 +00:00
}
else if ( chainIdsDown . length === 1 ) {
2023-04-03 17:13:23 +00:00
return qsTr ( "POKT & Infura down for %1. %1 token balances are as of %2." ) . arg ( jointChainIdString ) . arg ( lastCheckedAt )
2023-03-01 20:59:08 +00:00
}
else {
2023-04-03 17:13:23 +00:00
return qsTr ( "POKT & Infura down for %1. %1 token balances cannot be retrieved." ) . arg ( jointChainIdString )
2023-03-01 20:59:08 +00:00
}
}
else
return ""
case Constants.ConnectionStatus.Retrying:
2024-01-11 15:24:10 +00:00
return qsTr ( "Retrying connection to POKT Network (grove.city)." )
2023-03-01 20:59:08 +00:00
default:
return ""
}
}
}
ConnectionWarnings {
id: walletCollectiblesConnectionBanner
objectName: "walletCollectiblesConnectionBanner"
Layout.fillWidth: true
websiteDown: Constants . walletConnections . collectibles
2023-09-25 17:51:01 +00:00
withCache: lastCheckedAtUnix > 0
2023-04-03 17:13:23 +00:00
networkConnectionStore: appMain . networkConnectionStore
2023-09-25 17:51:01 +00:00
tooltipMessage: {
if ( withCache )
return qsTr ( "Collectibles providers are currently unavailable for %1. Collectibles for those chains are as of %2." ) . arg ( jointChainIdString ) . arg ( lastCheckedAt )
else
return qsTr ( "Collectibles providers are currently unavailable for %1." ) . arg ( jointChainIdString )
}
2023-04-03 17:13:23 +00:00
toastText: {
2023-03-01 20:59:08 +00:00
switch ( connectionState ) {
case Constants.ConnectionStatus.Success:
2023-09-25 17:51:01 +00:00
return qsTr ( "Collectibles providers connection successful" )
2023-03-01 20:59:08 +00:00
case Constants.ConnectionStatus.Failure:
2023-09-25 17:51:01 +00:00
if ( completelyDown ) {
if ( withCache )
return qsTr ( "Collectibles providers down. Collectibles are as of %1." ) . arg ( lastCheckedAt )
else
return qsTr ( "Collectibles providers down. Collectibles cannot be retrieved." )
2023-03-01 20:59:08 +00:00
}
2023-09-25 17:51:01 +00:00
else if ( chainIdsDown . length > 0 ) {
if ( chainIdsDown . length > 2 ) {
if ( withCache )
return qsTr ( "Collectibles providers down for <a href='#'>multiple chains</a>. Collectibles for these chains are as of %1." . arg ( lastCheckedAt ) )
else
return qsTr ( "Collectibles providers down for <a href='#'>multiple chains</a>. Collectibles for these chains cannot be retrieved." )
}
else if ( chainIdsDown . length === 1 ) {
if ( withCache )
return qsTr ( "Collectibles providers down for %1. Collectibles for this chain are as of %2." ) . arg ( jointChainIdString ) . arg ( lastCheckedAt )
else
return qsTr ( "Collectibles providers down for %1. Collectibles for this chain cannot be retrieved." ) . arg ( jointChainIdString )
}
else {
if ( withCache )
return qsTr ( "Collectibles providers down for %1. Collectibles for these chains are as of %2." ) . arg ( jointChainIdString ) . arg ( lastCheckedAt )
else
return qsTr ( "Collectibles providers down for %1. Collectibles for these chains cannot be retrieved." ) . arg ( jointChainIdString )
}
2023-03-01 20:59:08 +00:00
}
2023-09-25 17:51:01 +00:00
else
return ""
2023-03-01 20:59:08 +00:00
case Constants.ConnectionStatus.Retrying:
2023-09-25 17:51:01 +00:00
return qsTr ( "Retrying connection to collectibles providers..." )
2023-03-01 20:59:08 +00:00
default:
return ""
}
}
}
ConnectionWarnings {
id: walletMarketConnectionBanner
objectName: "walletMarketConnectionBanner"
Layout.fillWidth: true
websiteDown: Constants . walletConnections . market
2023-03-23 10:23:02 +00:00
withCache: networkConnectionStore . marketValuesCache
2023-04-03 17:13:23 +00:00
networkConnectionStore: appMain . networkConnectionStore
toastText: {
2023-03-01 20:59:08 +00:00
switch ( connectionState ) {
case Constants.ConnectionStatus.Success:
return qsTr ( "CryptoCompare and CoinGecko connection successful" )
case Constants.ConnectionStatus.Failure: {
if ( withCache ) {
2023-04-03 17:13:23 +00:00
return qsTr ( "CryptoCompare and CoinGecko down. Market values are as of %1." ) . arg ( lastCheckedAt )
2023-03-01 20:59:08 +00:00
}
else {
2023-04-03 17:13:23 +00:00
return qsTr ( "CryptoCompare and CoinGecko down. Market values cannot be retrieved." )
2023-03-01 20:59:08 +00:00
}
}
case Constants.ConnectionStatus.Retrying:
return qsTr ( "Retrying connection to CryptoCompare and CoinGecko..." )
2023-04-03 17:13:23 +00:00
default:
return ""
2023-03-01 20:59:08 +00:00
}
}
}
2022-09-02 14:56:14 +00:00
}
2022-07-12 08:56:47 +00:00
2022-05-13 15:27:26 +00:00
Item {
2022-06-23 15:28:30 +00:00
Layout.fillWidth: true
2021-12-17 17:42:12 +00:00
Layout.fillHeight: true
2022-05-13 15:27:26 +00:00
StackLayout {
id: appView
anchors.fill: parent
currentIndex: {
2022-10-18 09:06:18 +00:00
const activeSectionType = appMain . rootStore . mainModuleInst . activeSection . sectionType
if ( activeSectionType === Constants . appSection . chat )
2022-05-13 15:27:26 +00:00
return Constants . appViewStackIndex . chat
2022-10-18 09:06:18 +00:00
if ( activeSectionType === Constants . appSection . community ) {
2023-01-10 13:19:02 +00:00
for ( let i = this . children . length - 1 ; i >= 0 ; i -- ) {
2022-10-18 09:06:18 +00:00
var obj = this . children [ i ]
2023-01-10 13:19:02 +00:00
if ( obj && obj . sectionId && obj . sectionId === appMain . rootStore . mainModuleInst . activeSection . id ) {
2022-05-13 15:27:26 +00:00
return i
}
2021-12-17 17:42:12 +00:00
}
2022-05-13 15:27:26 +00:00
// Should never be here, correct index must be returned from the for loop above
2023-01-10 13:19:02 +00:00
console . error ( "Wrong section type:" , appMain . rootStore . mainModuleInst . activeSection . sectionType ,
"or section id: " , appMain . rootStore . mainModuleInst . activeSection . id )
2022-05-13 15:27:26 +00:00
return Constants . appViewStackIndex . community
}
2022-10-18 09:06:18 +00:00
if ( activeSectionType === Constants . appSection . communitiesPortal )
2022-05-13 15:27:26 +00:00
return Constants . appViewStackIndex . communitiesPortal
2022-10-18 09:06:18 +00:00
if ( activeSectionType === Constants . appSection . wallet )
2022-05-13 15:27:26 +00:00
return Constants . appViewStackIndex . wallet
2022-10-18 09:06:18 +00:00
if ( activeSectionType === Constants . appSection . profile )
2022-05-13 15:27:26 +00:00
return Constants . appViewStackIndex . profile
2022-10-18 09:06:18 +00:00
if ( activeSectionType === Constants . appSection . node )
2022-05-13 15:27:26 +00:00
return Constants . appViewStackIndex . node
2021-12-17 17:42:12 +00:00
2022-05-13 15:27:26 +00:00
// We should never end up here
2022-10-18 09:06:18 +00:00
console . error ( "AppMain: Unknown section type" )
2021-11-01 20:10:50 +00:00
}
2021-10-19 10:27:41 +00:00
2022-05-13 15:27:26 +00:00
// NOTE:
// If we ever change stack layout component order we need to updade
// Constants.appViewStackIndex accordingly
2023-01-30 21:05:34 +00:00
Loader {
id: personalChatLayoutLoader
2023-02-07 14:21:32 +00:00
asynchronous: true
2023-04-17 20:45:17 +00:00
active: false
2023-01-30 21:05:34 +00:00
sourceComponent: {
if ( appMain . rootStore . mainModuleInst . chatsLoadingFailed ) {
return errorStateComponent
}
2023-03-16 19:05:05 +00:00
if ( appMain . rootStore . mainModuleInst . sectionsLoaded ) {
2023-01-30 21:05:34 +00:00
return personalChatLayoutComponent
}
return loadingStateComponent
}
2023-04-17 20:45:17 +00:00
// Do not unload section data from the memory in order not
// to reset scroll, not send text input and etc during the
// sections switching
Binding on active {
when: appView . currentIndex === Constants . appViewStackIndex . chat
value: true
restoreMode: Binding . RestoreNone
}
2023-06-07 11:37:44 +00:00
2023-01-30 21:05:34 +00:00
Component {
id: loadingStateComponent
Item {
anchors.fill: parent
Row {
anchors.centerIn: parent
spacing: 6
StatusBaseText {
2023-05-02 09:37:12 +00:00
anchors.verticalCenter: parent . verticalCenter
2023-03-16 19:05:05 +00:00
text: qsTr ( "Loading sections..." )
2023-01-30 21:05:34 +00:00
}
2023-04-28 10:35:18 +00:00
LoadingAnimation { anchors.verticalCenter: parent . verticalCenter }
2023-01-30 21:05:34 +00:00
}
}
}
2023-06-07 11:37:44 +00:00
2023-01-30 21:05:34 +00:00
Component {
id: errorStateComponent
Item {
anchors.fill: parent
StatusBaseText {
text: qsTr ( "Error loading chats, try closing the app and restarting" )
anchors.centerIn: parent
}
}
}
Component {
id: personalChatLayoutComponent
2021-06-17 18:41:11 +00:00
2023-01-30 21:05:34 +00:00
ChatLayout {
id: chatLayoutContainer
2021-12-17 17:42:12 +00:00
2024-10-02 21:02:57 +00:00
sharedRootStore: appMain . sharedRootStore
2024-10-22 12:39:42 +00:00
utilsStore: appMain . utilsStore
2023-03-17 18:58:07 +00:00
rootStore: ChatStores . RootStore {
contactsStore: appMain . rootStore . contactStore
2024-10-04 10:04:59 +00:00
currencyStore: appMain . currencyStore
2023-04-11 08:09:01 +00:00
communityTokensStore: appMain . communityTokensStore
2023-03-17 18:58:07 +00:00
emojiReactionsModel: appMain . rootStore . emojiReactionsModel
openCreateChat: createChatView . opened
chatCommunitySectionModule: appMain . rootStore . mainModuleInst . getChatSectionModule ( )
2023-04-04 11:31:04 +00:00
networkConnectionStore: appMain . networkConnectionStore
2023-03-17 18:58:07 +00:00
}
2023-05-04 18:36:35 +00:00
createChatPropertiesStore: appMain . createChatPropertiesStore
2023-11-22 13:50:07 +00:00
tokensStore: appMain . tokensStore
2023-11-28 19:16:18 +00:00
transactionStore: appMain . transactionStore
2024-01-24 16:35:53 +00:00
walletAssetsStore: appMain . walletAssetsStore
currencyStore: appMain . currencyStore
2023-04-28 10:35:18 +00:00
emojiPopup: statusEmojiPopup . item
2023-03-07 16:34:36 +00:00
stickersPopup: statusStickersPopupLoader . item
2024-09-17 17:41:04 +00:00
sendViaPersonalChatEnabled: featureFlagsStore . sendViaPersonalChatEnabled && appMain . networkConnectionStore . sendBuyBridgeEnabled
2021-12-21 09:26:13 +00:00
2024-11-28 14:15:34 +00:00
mutualContactsModel: contactsModelAdaptor . mutualContacts
2023-03-07 16:34:36 +00:00
onProfileButtonClicked: {
2023-01-30 21:05:34 +00:00
Global . changeAppSectionBySectionType ( Constants . appSection . profile ) ;
}
2022-01-04 12:06:05 +00:00
2023-03-07 16:34:36 +00:00
onOpenAppSearch: {
2023-01-30 21:05:34 +00:00
appSearch . openSearchPopup ( )
}
}
2022-05-13 15:27:26 +00:00
}
2021-12-17 17:42:12 +00:00
}
2021-06-17 18:41:11 +00:00
2023-04-28 10:35:18 +00:00
Loader {
active: appView . currentIndex === Constants . appViewStackIndex . communitiesPortal
asynchronous: true
CommunitiesPortalLayout {
anchors.fill: parent
communitiesStore: appMain . communitiesStore
2024-02-15 09:25:40 +00:00
assetsModel: appMain . rootStore . globalAssetsModel
collectiblesModel: appMain . rootStore . globalCollectiblesModel
2023-04-28 10:35:18 +00:00
notificationCount: appMain . activityCenterStore . unreadNotificationsCount
hasUnseenNotifications: activityCenterStore . hasUnseenNotifications
}
2021-12-17 17:42:12 +00:00
}
2021-11-10 12:48:22 +00:00
2022-10-18 09:06:18 +00:00
Loader {
2024-01-16 07:50:25 +00:00
id: walletLoader
2023-01-10 13:19:02 +00:00
active: appView . currentIndex === Constants . appViewStackIndex . wallet
2022-10-18 09:06:18 +00:00
asynchronous: true
sourceComponent: WalletLayout {
2024-01-16 07:50:25 +00:00
objectName: "walletLayoutReal"
2024-10-02 21:02:57 +00:00
sharedRootStore: appMain . sharedRootStore
2022-10-18 09:06:18 +00:00
store: appMain . rootStore
contactsStore: appMain . rootStore . profileSectionStore . contactsStore
2024-02-22 14:41:19 +00:00
communitiesStore: appMain . communitiesStore
2024-07-03 03:55:05 +00:00
transactionStore: appMain . transactionStore
2023-04-28 10:35:18 +00:00
emojiPopup: statusEmojiPopup . item
2022-10-17 10:17:25 +00:00
sendModalPopup: sendModal
2023-04-04 11:31:04 +00:00
networkConnectionStore: appMain . networkConnectionStore
2024-01-02 10:24:22 +00:00
appMainVisible: appMain . visible
2024-08-12 10:41:27 +00:00
swapEnabled: featureFlagsStore . swapEnabled
2024-11-20 08:09:35 +00:00
hideSignPhraseModal: userAgreementLoader . active
2024-01-02 10:24:22 +00:00
}
onLoaded: {
2023-12-26 10:19:41 +00:00
item . resetView ( )
2022-05-13 15:27:26 +00:00
}
}
2022-05-23 13:11:30 +00:00
2022-10-18 09:06:18 +00:00
Loader {
2024-10-18 21:43:29 +00:00
id: profileLoader
property int settingsSubsection: Constants . settingsSubsection . profile
2024-10-18 22:50:21 +00:00
property int settingsSubSubsection: - 1
2024-10-18 21:43:29 +00:00
2023-01-10 13:19:02 +00:00
active: appView . currentIndex === Constants . appViewStackIndex . profile
2022-10-18 09:06:18 +00:00
asynchronous: true
sourceComponent: ProfileLayout {
2024-10-02 21:02:57 +00:00
sharedRootStore: appMain . sharedRootStore
2024-10-21 22:01:34 +00:00
utilsStore: appMain . utilsStore
2022-10-18 09:06:18 +00:00
store: appMain . rootStore . profileSectionStore
globalStore: appMain . rootStore
2024-10-16 07:56:23 +00:00
communitiesStore: appMain . communitiesStore
2024-10-03 13:14:27 +00:00
sendModalPopup: sendModal
2022-10-18 09:06:18 +00:00
systemPalette: appMain . sysPalette
2023-04-28 10:35:18 +00:00
emojiPopup: statusEmojiPopup . item
2023-04-04 11:31:04 +00:00
networkConnectionStore: appMain . networkConnectionStore
2023-10-26 21:11:20 +00:00
tokensStore: appMain . tokensStore
2024-01-13 03:24:57 +00:00
walletAssetsStore: appMain . walletAssetsStore
2024-01-29 18:02:59 +00:00
collectiblesStore: appMain . walletCollectiblesStore
2024-01-13 03:24:57 +00:00
currencyStore: appMain . currencyStore
2024-07-19 12:15:50 +00:00
isCentralizedMetricsEnabled: appMain . isCentralizedMetricsEnabled
2024-10-18 22:50:21 +00:00
settingsSubSubsection: profileLoader . settingsSubSubsection
2024-10-18 21:43:29 +00:00
2024-11-28 14:15:34 +00:00
mutualContactsModel: contactsModelAdaptor . mutualContacts
blockedContactsModel: contactsModelAdaptor . blockedContacts
pendingReceivedRequestContactsModel: contactsModelAdaptor . pendingReceivedRequestContacts
pendingSentRequestContactsModel: contactsModelAdaptor . pendingSentRequestContacts
2024-10-18 21:43:29 +00:00
Binding on settingsSubsection {
value: profileLoader . settingsSubsection
}
onSettingsSubsectionChanged: profileLoader . settingsSubsection = settingsSubsection
2022-10-18 09:06:18 +00:00
}
2021-12-17 17:42:12 +00:00
}
2022-01-31 13:29:27 +00:00
2022-10-18 09:06:18 +00:00
Loader {
2023-01-10 13:19:02 +00:00
active: appView . currentIndex === Constants . appViewStackIndex . node
2022-10-18 09:06:18 +00:00
asynchronous: true
sourceComponent: NodeLayout { }
2022-05-13 15:27:26 +00:00
}
2021-06-17 18:41:11 +00:00
2022-05-13 15:27:26 +00:00
Repeater {
2023-04-17 20:45:17 +00:00
model: SortFilterProxyModel {
sourceModel: appMain . rootStore . mainModuleInst . sectionsModel
filters: ValueFilter {
roleName: "sectionType"
value: Constants . appSection . community
}
}
delegate: Loader {
id: communityLoader
readonly property string sectionId: model . id
Layout.fillWidth: true
Layout.alignment: Qt . AlignLeft | Qt . AlignTop
Layout.fillHeight: true
asynchronous: true
active: false
// Do not unload section data from the memory in order not
// to reset scroll, not send text input and etc during the
// sections switching
Binding on active {
when: sectionId === appMain . rootStore . mainModuleInst . activeSection . id
value: true
restoreMode: Binding . RestoreNone
}
sourceComponent: ChatLayout {
id: chatLayoutComponent
2023-10-10 10:31:45 +00:00
readonly property bool isManageCommunityEnabledInAdvanced: appMain . rootStore . profileSectionStore . advancedStore . isManageCommunityOnTestModeEnabled
2023-06-21 20:37:51 +00:00
Connections {
target: Global
function onSwitchToCommunitySettings ( communityId: string ) {
if ( communityId !== model . id )
return
chatLayoutComponent . currentIndex = 1 // Settings
}
}
2023-04-17 20:45:17 +00:00
2024-03-20 10:50:10 +00:00
Connections {
target: Global
function onSwitchToCommunityChannelsView ( communityId: string ) {
if ( communityId !== model . id )
return
chatLayoutComponent . currentIndex = 0
}
}
2023-09-14 10:02:51 +00:00
sendModalPopup: sendModal
2023-04-28 10:35:18 +00:00
emojiPopup: statusEmojiPopup . item
2023-04-17 20:45:17 +00:00
stickersPopup: statusStickersPopupLoader . item
sectionItemModel: model
2023-08-02 17:39:42 +00:00
createChatPropertiesStore: appMain . createChatPropertiesStore
2023-09-01 07:58:48 +00:00
communitiesStore: appMain . communitiesStore
2023-10-10 10:31:45 +00:00
communitySettingsDisabled: ! chatLayoutComponent . isManageCommunityEnabledInAdvanced &&
( production && appMain . rootStore . profileSectionStore . walletStore . areTestNetworksEnabled )
2024-10-02 21:02:57 +00:00
sharedRootStore: appMain . sharedRootStore
2024-10-22 12:39:42 +00:00
utilsStore: appMain . utilsStore
2023-04-17 20:45:17 +00:00
rootStore: ChatStores . RootStore {
contactsStore: appMain . rootStore . contactStore
2024-10-04 10:04:59 +00:00
currencyStore: appMain . currencyStore
2023-04-17 20:45:17 +00:00
communityTokensStore: appMain . communityTokensStore
emojiReactionsModel: appMain . rootStore . emojiReactionsModel
openCreateChat: createChatView . opened
chatCommunitySectionModule: {
appMain . rootStore . mainModuleInst . prepareCommunitySectionModuleForCommunityId ( model . id )
return appMain . rootStore . mainModuleInst . getCommunitySectionModule ( )
2022-05-13 15:27:26 +00:00
}
}
2023-11-22 13:50:07 +00:00
tokensStore: appMain . tokensStore
2023-11-28 19:16:18 +00:00
transactionStore: appMain . transactionStore
2024-01-24 16:35:53 +00:00
walletAssetsStore: appMain . walletAssetsStore
currencyStore: appMain . currencyStore
2023-04-17 20:45:17 +00:00
2024-11-28 14:15:34 +00:00
mutualContactsModel: contactsModelAdaptor . mutualContacts
2023-04-17 20:45:17 +00:00
onProfileButtonClicked: {
Global . changeAppSectionBySectionType ( Constants . appSection . profile ) ;
}
onOpenAppSearch: {
appSearch . openSearchPopup ( )
}
2022-05-13 15:27:26 +00:00
}
}
}
2021-12-17 17:42:12 +00:00
}
2021-06-17 18:41:11 +00:00
2022-10-18 09:06:18 +00:00
Loader {
2022-07-22 11:24:28 +00:00
id: createChatView
2022-05-13 15:27:26 +00:00
property bool opened: false
2023-03-16 19:05:05 +00:00
active: appMain . rootStore . mainModuleInst . sectionsLoaded && opened
2021-12-30 12:39:47 +00:00
2022-10-18 09:06:18 +00:00
asynchronous: true
2022-05-13 15:27:26 +00:00
anchors.top: parent . top
anchors.topMargin: 8
anchors.rightMargin: 8
anchors.bottom: parent . bottom
anchors.right: parent . right
2023-01-30 21:05:34 +00:00
width: active ?
parent . width - Constants . chatSectionLeftColumnWidth -
anchors . rightMargin - anchors.leftMargin : 0
2022-07-12 08:56:47 +00:00
2022-10-18 09:06:18 +00:00
sourceComponent: CreateChatView {
2024-10-02 21:02:57 +00:00
sharedRootStore: appMain . sharedRootStore
2024-10-21 10:14:48 +00:00
utilsStore: appMain . utilsStore
2023-03-17 18:58:07 +00:00
rootStore: ChatStores . RootStore {
contactsStore: appMain . rootStore . contactStore
2024-10-04 10:04:59 +00:00
currencyStore: appMain . currencyStore
2023-04-11 08:09:01 +00:00
communityTokensStore: appMain . communityTokensStore
2023-03-17 18:58:07 +00:00
emojiReactionsModel: appMain . rootStore . emojiReactionsModel
openCreateChat: createChatView . opened
chatCommunitySectionModule: appMain . rootStore . mainModuleInst . getChatSectionModule ( )
}
2023-05-04 18:36:35 +00:00
createChatPropertiesStore: appMain . createChatPropertiesStore
2024-11-28 14:15:34 +00:00
mutualContactsModel: contactsModelAdaptor . mutualContacts
2023-04-28 10:35:18 +00:00
emojiPopup: statusEmojiPopup . item
2023-01-30 21:05:34 +00:00
stickersPopup: statusStickersPopupLoader . item
2022-06-01 14:49:57 +00:00
}
2022-05-17 14:09:22 +00:00
}
}
2022-06-01 14:49:57 +00:00
} // ColumnLayout
2021-06-17 18:41:11 +00:00
2022-07-26 14:23:45 +00:00
Component {
id: activityCenterPopupComponent
ActivityCenterPopup {
2022-11-04 14:23:33 +00:00
// TODO get screen size // Taken from old code top bar height was fixed there to 56
2023-04-17 08:31:32 +00:00
readonly property int _buttonSize : 56
2022-11-04 14:23:33 +00:00
2024-10-15 19:26:12 +00:00
x: parent . width - width - Theme . smallPadding
2022-11-04 14:23:33 +00:00
y: parent . y + _buttonSize
height: appView . height - _buttonSize * 2
2023-03-22 18:05:31 +00:00
store: ChatStores . RootStore {
contactsStore: appMain . rootStore . contactStore
2024-10-04 10:04:59 +00:00
currencyStore: appMain . currencyStore
2023-04-11 08:09:01 +00:00
communityTokensStore: appMain . communityTokensStore
2023-03-22 18:05:31 +00:00
emojiReactionsModel: appMain . rootStore . emojiReactionsModel
openCreateChat: createChatView . opened
2024-05-22 08:13:39 +00:00
walletStore: WalletStores . RootStore
2023-03-22 18:05:31 +00:00
chatCommunitySectionModule: appMain . rootStore . mainModuleInst . getChatSectionModule ( )
}
2022-10-26 16:00:20 +00:00
activityCenterStore: appMain . activityCenterStore
2022-07-26 14:23:45 +00:00
}
}
2021-10-19 10:27:41 +00:00
// Add SendModal here as it is used by the Wallet as well as the Browser
2021-06-17 18:41:11 +00:00
Loader {
id: sendModal
active: false
2022-02-04 13:07:48 +00:00
2023-12-06 10:54:36 +00:00
function open ( address = "" ) {
if ( ! ! address ) {
preSelectedRecipient = address
2024-07-02 11:19:37 +00:00
preSelectedRecipientType = SendPopups . Helpers . RecipientAddressObjectType . Address
2023-12-06 10:54:36 +00:00
}
2021-06-17 18:41:11 +00:00
this . active = true
this . item . open ( )
2020-11-03 10:29:56 +00:00
}
2023-09-27 13:41:55 +00:00
2021-06-17 18:41:11 +00:00
function closed ( ) {
// this.sourceComponent = undefined // kill an opened instance
this . active = false
2020-11-03 10:29:56 +00:00
}
2023-09-20 13:01:37 +00:00
2024-10-03 13:14:27 +00:00
property string modalHeaderText
property bool interactive: true
2024-07-17 14:49:42 +00:00
property string preSelectedAccountAddress
2023-09-27 13:41:55 +00:00
property var preSelectedRecipient
property int preSelectedRecipientType
2023-09-11 10:20:36 +00:00
property string preSelectedHoldingID
2023-11-07 22:45:47 +00:00
property int preSelectedHoldingType: Constants . TokenType . Unknown
2023-09-20 16:07:09 +00:00
property int preSelectedSendType: Constants . SendType . Unknown
2023-09-27 13:41:55 +00:00
property string preDefinedAmountToSend
2024-07-31 11:58:05 +00:00
property int preSelectedChainId: 0
2023-09-18 09:45:37 +00:00
property bool onlyAssets: false
2023-09-20 13:01:37 +00:00
2024-10-03 13:14:27 +00:00
property string stickersPackId: ""
property string publicKey: ""
property string ensName: ""
2024-07-02 11:19:37 +00:00
sourceComponent: SendPopups . SendModal {
2024-10-03 13:14:27 +00:00
interactive: sendModal . interactive
2023-11-28 19:16:18 +00:00
onlyAssets: sendModal . onlyAssets
2024-07-09 22:10:13 +00:00
2024-07-08 20:14:30 +00:00
loginType: appMain . rootStore . loginType
2024-07-09 22:10:13 +00:00
store: appMain . transactionStore
collectiblesStore: appMain . walletCollectiblesStore
2024-08-10 12:39:56 +00:00
showCustomRoutingMode: ! production
2021-06-17 18:41:11 +00:00
onClosed: {
sendModal . closed ( )
2024-10-03 13:14:27 +00:00
sendModal . modalHeaderText = ""
sendModal . interactive = true
2023-09-20 16:07:09 +00:00
sendModal . preSelectedSendType = Constants . SendType . Unknown
2023-09-11 10:20:36 +00:00
sendModal . preSelectedHoldingID = ""
2023-11-07 22:45:47 +00:00
sendModal . preSelectedHoldingType = Constants . TokenType . Unknown
2024-07-17 14:49:42 +00:00
sendModal . preSelectedAccountAddress = ""
2023-09-27 13:41:55 +00:00
sendModal . preSelectedRecipient = undefined
sendModal . preDefinedAmountToSend = ""
2024-07-31 11:58:05 +00:00
sendModal . preSelectedChainId = 0
2024-10-03 13:14:27 +00:00
sendModal . stickersPackId = ""
sendModal . publicKey = ""
sendModal . ensName = ""
2021-06-17 18:41:11 +00:00
}
2020-12-28 20:03:57 +00:00
}
2021-12-07 23:15:17 +00:00
onLoaded: {
2024-07-17 14:49:42 +00:00
if ( ! ! sendModal . preSelectedAccountAddress ) {
item . preSelectedAccountAddress = sendModal . preSelectedAccountAddress
2023-09-20 13:01:37 +00:00
}
2023-09-27 13:41:55 +00:00
if ( ! ! sendModal . preSelectedRecipient ) {
2024-07-31 11:58:05 +00:00
// NOTE Should be assigned in that order: type then recipient
2023-09-27 13:41:55 +00:00
item . preSelectedRecipientType = sendModal . preSelectedRecipientType
2024-07-31 11:58:05 +00:00
item . preSelectedRecipient = sendModal . preSelectedRecipient
2023-09-27 13:41:55 +00:00
}
2024-10-03 13:14:27 +00:00
if ( sendModal . preSelectedSendType !== Constants . SendType . Unknown ) {
2023-09-20 16:07:09 +00:00
item . preSelectedSendType = sendModal . preSelectedSendType
2023-09-12 14:26:38 +00:00
}
2024-10-03 13:14:27 +00:00
if ( sendModal . preSelectedHoldingType !== Constants . TokenType . Unknown ) {
2023-09-11 10:20:36 +00:00
item . preSelectedHoldingID = sendModal . preSelectedHoldingID
item . preSelectedHoldingType = sendModal . preSelectedHoldingType
}
2024-10-03 13:14:27 +00:00
if ( sendModal . preDefinedAmountToSend != "" ) {
item . preDefinedAmountToSend = sendModal . preDefinedAmountToSend
2023-09-27 13:41:55 +00:00
}
2024-10-03 13:14:27 +00:00
if ( ! ! sendModal . preSelectedChainId ) {
2024-07-31 11:58:05 +00:00
item . preSelectedChainId = sendModal . preSelectedChainId
}
2024-10-03 13:14:27 +00:00
if ( ! ! sendModal . stickersPackId ) {
item . stickersPackId = sendModal . stickersPackId
}
if ( ! ! sendModal . publicKey ) {
item . publicKey = sendModal . publicKey
}
if ( ! ! sendModal . ensName ) {
item . ensName = sendModal . ensName
}
2021-12-07 23:15:17 +00:00
}
2020-12-28 20:03:57 +00:00
}
2021-06-17 18:41:11 +00:00
Action {
shortcut: "Ctrl+1"
2022-09-28 10:50:15 +00:00
onTriggered: {
Global . setNthEnabledSectionActive ( 0 )
}
2020-12-28 20:03:57 +00:00
}
2021-06-17 18:41:11 +00:00
Action {
shortcut: "Ctrl+2"
2022-09-28 10:50:15 +00:00
onTriggered: {
Global . setNthEnabledSectionActive ( 1 )
}
2020-12-28 20:03:57 +00:00
}
2021-06-17 18:41:11 +00:00
Action {
shortcut: "Ctrl+3"
2022-09-28 10:50:15 +00:00
onTriggered: {
Global . setNthEnabledSectionActive ( 2 )
}
2021-06-17 18:41:11 +00:00
}
Action {
2022-09-28 10:50:15 +00:00
shortcut: "Ctrl+4"
onTriggered: {
Global . setNthEnabledSectionActive ( 3 )
}
2021-06-17 18:41:11 +00:00
}
2022-09-28 10:50:15 +00:00
Action {
shortcut: "Ctrl+5"
onTriggered: {
Global . setNthEnabledSectionActive ( 4 )
}
}
Action {
shortcut: "Ctrl+6"
onTriggered: {
Global . setNthEnabledSectionActive ( 5 )
}
}
Action {
shortcut: "Ctrl+7"
onTriggered: {
Global . setNthEnabledSectionActive ( 6 )
}
}
Action {
shortcut: "Ctrl+8"
onTriggered: {
Global . setNthEnabledSectionActive ( 7 )
}
}
Action {
shortcut: "Ctrl+9"
onTriggered: {
Global . setNthEnabledSectionActive ( 8 )
}
}
2021-06-17 18:41:11 +00:00
Action {
shortcut: "Ctrl+K"
onTriggered: {
2022-02-16 16:13:45 +00:00
// FIXME the focus is no longer on the AppMain when the popup is opened, so this does not work to close
2022-10-18 09:06:18 +00:00
if ( ! channelPickerLoader . active )
channelPickerLoader . active = true
if ( channelPickerLoader . item . opened ) {
channelPickerLoader . item . close ( )
channelPickerLoader . active = false
2021-06-17 18:41:11 +00:00
} else {
2022-10-18 09:06:18 +00:00
channelPickerLoader . item . open ( )
2021-06-17 18:41:11 +00:00
}
}
}
2022-02-16 16:13:45 +00:00
Action {
shortcut: "Ctrl+F"
onTriggered: {
// FIXME the focus is no longer on the AppMain when the popup is opened, so this does not work to close
2022-10-18 09:06:18 +00:00
if ( appSearch . active ) {
2022-02-16 16:13:45 +00:00
appSearch . closeSearchPopup ( )
} else {
appSearch . openSearchPopup ( )
}
}
}
2021-06-17 18:41:11 +00:00
2022-10-18 09:06:18 +00:00
Loader {
id: channelPickerLoader
active: false
asynchronous: true
sourceComponent: StatusSearchListPopup {
searchBoxPlaceholder: qsTr ( "Where do you want to go?" )
model: rootStore . chatSearchModel
2022-02-04 13:07:48 +00:00
2022-10-18 09:06:18 +00:00
onAboutToShow: rootStore . rebuildChatSearchModel ( )
onSelected: {
2024-09-27 16:05:23 +00:00
rootStore . setActiveSectionChat ( sectionId , chatId )
2022-10-18 09:06:18 +00:00
close ( )
2022-02-04 13:07:48 +00:00
}
2022-01-24 17:59:59 +00:00
}
2020-12-28 20:03:57 +00:00
}
}
2021-09-23 11:59:29 +00:00
2022-07-14 11:03:36 +00:00
StatusListView {
2022-05-05 10:28:54 +00:00
id: toastArea
2022-10-20 12:58:56 +00:00
objectName: "ephemeralNotificationList"
2022-05-05 10:28:54 +00:00
anchors.right: parent . right
anchors.rightMargin: 8
anchors.bottom: parent . bottom
anchors.bottomMargin: 60
2023-10-17 08:11:26 +00:00
width: 374
2022-08-22 12:56:28 +00:00
height: Math . min ( parent . height - 120 , toastArea . contentHeight )
2022-05-05 10:28:54 +00:00
spacing: 8
verticalLayoutDirection: ListView . BottomToTop
model: appMain . rootStore . mainModuleInst . ephemeralNotificationModel
2023-05-03 08:37:19 +00:00
clip: false
2022-08-22 12:56:28 +00:00
2022-05-05 10:28:54 +00:00
delegate: StatusToastMessage {
2024-08-19 20:40:55 +00:00
readonly property bool isSquare : isSquareShape ( model . actionData )
2024-01-19 11:40:41 +00:00
// Specific method to calculate image radius depending on if the toast represents some info about a collectible or an asset
function isSquareShape ( data ) {
// It expects the data is a JSON file containing `tokenType`
if ( data ) {
var parsedData = JSON . parse ( data )
var tokenType = parsedData . tokenType
return tokenType === Constants . TokenType . ERC721
}
return false
}
2023-10-25 07:20:03 +00:00
objectName: "statusToastMessage"
2023-10-17 08:11:26 +00:00
width: ListView . view . width
2022-05-05 10:28:54 +00:00
primaryText: model . title
secondaryText: model . subTitle
2024-01-19 11:40:41 +00:00
image: model . image
imageRadius: model . image && isSquare ? 8 : imageSize / 2
2022-05-05 10:28:54 +00:00
icon.name: model . icon
2023-11-03 15:55:04 +00:00
iconColor: model . iconColor
2022-05-05 10:28:54 +00:00
loading: model . loading
type: model . ephNotifType
linkUrl: model . url
2023-11-03 15:55:04 +00:00
actionRequired: model . actionType !== ToastsManager . ActionType . None
2022-05-05 10:28:54 +00:00
duration: model . durationInMs
2022-06-21 10:42:27 +00:00
onClicked: {
2022-09-29 13:45:34 +00:00
appMain . rootStore . mainModuleInst . ephemeralNotificationClicked ( model . timestamp )
2022-06-21 10:42:27 +00:00
this . open = false
}
2022-05-05 10:28:54 +00:00
onLinkActivated: {
2023-11-17 14:08:43 +00:00
this . open = false
2023-11-03 15:55:04 +00:00
if ( actionRequired ) {
toastsManager . doAction ( model . actionType , model . actionData )
return
}
2023-10-17 08:11:26 +00:00
if ( link . startsWith ( "#" ) && link !== "#" ) { // internal link to section
const sectionArgs = link . substring ( 1 ) . split ( "/" )
const section = sectionArgs [ 0 ]
let subsection = sectionArgs . length > 1 ? sectionArgs [ 1 ] : 0
2023-12-06 10:54:36 +00:00
let subsubsection = sectionArgs . length > 2 ? sectionArgs [ 2 ] : - 1
Global . changeAppSectionBySectionType ( section , subsection , subsubsection )
2023-10-17 08:11:26 +00:00
}
2023-02-28 15:00:10 +00:00
else
Global . openLink ( link )
2022-05-05 10:28:54 +00:00
}
onClose: {
2022-09-29 13:45:34 +00:00
appMain . rootStore . mainModuleInst . removeEphemeralNotification ( model . timestamp )
2022-05-05 10:28:54 +00:00
}
}
}
2023-09-04 16:06:51 +00:00
Loader {
2023-10-27 17:19:25 +00:00
id: keycardPopupForAuthenticationOrSigning
2023-09-04 16:06:51 +00:00
active: false
sourceComponent: KeycardPopup {
2024-10-15 12:26:45 +00:00
myKeyUid: appMain . profileStore . keyUid
2023-10-27 17:19:25 +00:00
sharedKeycardModule: appMain . rootStore . mainModuleInst . keycardSharedModuleForAuthenticationOrSigning
2023-09-04 16:06:51 +00:00
}
onLoaded: {
2023-10-27 17:19:25 +00:00
keycardPopupForAuthenticationOrSigning . item . open ( )
2023-09-04 16:06:51 +00:00
}
}
2023-06-30 09:24:08 +00:00
Loader {
2022-09-13 10:03:25 +00:00
id: keycardPopup
2023-06-30 09:24:08 +00:00
active: false
sourceComponent: KeycardPopup {
2024-10-15 12:26:45 +00:00
myKeyUid: appMain . profileStore . keyUid
2022-10-18 09:06:18 +00:00
sharedKeycardModule: appMain . rootStore . mainModuleInst . keycardSharedModule
2022-09-13 10:03:25 +00:00
}
2023-06-30 09:24:08 +00:00
onLoaded: {
keycardPopup . item . open ( )
}
2022-09-13 10:03:25 +00:00
}
2022-10-06 15:47:55 +00:00
2023-12-26 10:19:41 +00:00
Loader {
id: addEditSavedAddress
active: false
property var params
function open ( params = { } ) {
addEditSavedAddress . params = params
addEditSavedAddress . active = true
}
function close ( ) {
addEditSavedAddress . active = false
}
onLoaded: {
2023-12-29 13:10:55 +00:00
addEditSavedAddress . item . initWithParams ( addEditSavedAddress . params )
2023-12-26 10:19:41 +00:00
addEditSavedAddress . item . open ( )
}
sourceComponent: WalletPopups . AddEditSavedAddressPopup {
2024-05-22 08:13:39 +00:00
store: WalletStores . RootStore
2024-10-02 21:02:57 +00:00
sharedRootStore: appMain . sharedRootStore
2023-12-26 10:19:41 +00:00
onClosed: {
addEditSavedAddress . close ( )
}
}
Connections {
2024-05-22 08:13:39 +00:00
target: WalletStores . RootStore
2023-12-26 10:19:41 +00:00
2024-01-09 13:50:01 +00:00
function onSavedAddressAddedOrUpdated ( added: bool , name: string , address: string , errorMsg: string ) {
2024-05-22 08:13:39 +00:00
WalletStores . RootStore . addingSavedAddress = false
WalletStores . RootStore . lastCreatedSavedAddress = { address: address , error: errorMsg }
2023-12-26 10:19:41 +00:00
if ( ! ! errorMsg ) {
2024-01-04 14:35:57 +00:00
let mode = qsTr ( "adding" )
if ( ! added ) {
mode = qsTr ( "editing" )
}
2024-01-05 10:57:15 +00:00
Global . displayToastMessage ( qsTr ( "An error occurred while %1 %2 address" ) . arg ( mode ) . arg ( name ) ,
2023-12-29 13:10:55 +00:00
"" ,
"warning" ,
false ,
Constants . ephemeralNotificationType . danger ,
""
)
2023-12-26 10:19:41 +00:00
return
}
2024-01-04 14:35:57 +00:00
let msg = qsTr ( "%1 successfully added to your saved addresses" )
if ( ! added ) {
msg = qsTr ( "%1 saved address successfully edited" )
}
Global . displayToastMessage ( msg . arg ( name ) ,
2023-12-29 13:10:55 +00:00
"" ,
"checkmark-circle" ,
false ,
Constants . ephemeralNotificationType . success ,
""
)
2023-12-26 10:19:41 +00:00
}
}
}
Loader {
id: deleteSavedAddress
active: false
property var params
function open ( params = { } ) {
deleteSavedAddress . params = params
deleteSavedAddress . active = true
}
function close ( ) {
deleteSavedAddress . active = false
}
onLoaded: {
deleteSavedAddress . item . address = deleteSavedAddress . params . address ? ? ""
deleteSavedAddress . item . ens = deleteSavedAddress . params . ens ? ? ""
deleteSavedAddress . item . name = deleteSavedAddress . params . name ? ? ""
2024-01-05 10:57:15 +00:00
deleteSavedAddress . item . colorId = deleteSavedAddress . params . colorId ? ? "blue"
2023-12-26 10:19:41 +00:00
deleteSavedAddress . item . open ( )
}
2024-01-05 10:57:15 +00:00
sourceComponent: WalletPopups . RemoveSavedAddressPopup {
2023-12-26 10:19:41 +00:00
onClosed: {
deleteSavedAddress . close ( )
}
2024-01-05 10:57:15 +00:00
onRemoveSavedAddress: {
2024-05-22 08:13:39 +00:00
WalletStores . RootStore . deleteSavedAddress ( address )
2024-01-05 10:57:15 +00:00
close ( )
}
2023-12-26 10:19:41 +00:00
}
Connections {
2024-05-22 08:13:39 +00:00
target: WalletStores . RootStore
2023-12-26 10:19:41 +00:00
2024-01-09 13:50:01 +00:00
function onSavedAddressDeleted ( name: string , address: string , errorMsg: string ) {
2024-05-22 08:13:39 +00:00
WalletStores . RootStore . deletingSavedAddress = false
2024-01-05 10:57:15 +00:00
if ( ! ! errorMsg ) {
Global . displayToastMessage ( qsTr ( "An error occurred while removing %1 address" ) . arg ( name ) ,
"" ,
"warning" ,
false ,
Constants . ephemeralNotificationType . danger ,
""
)
return
}
Global . displayToastMessage ( qsTr ( "%1 was successfully removed from your saved addresses" ) . arg ( name ) ,
"" ,
"checkmark-circle" ,
false ,
Constants . ephemeralNotificationType . success ,
""
)
2023-12-26 10:19:41 +00:00
}
}
}
2024-01-15 09:19:25 +00:00
Loader {
id: showQR
active: false
property bool showSingleAccount: false
property bool showForSavedAddress: false
property var params
property var selectedAccount: ( {
name: "" ,
address: "" ,
colorId: "" ,
emoji: ""
} )
function open ( params = { } ) {
showQR . showSingleAccount = params . showSingleAccount ? ? false
showQR . showForSavedAddress = params . showForSavedAddress ? ? false
showQR . params = params
if ( showQR . showSingleAccount || showQR . showForSavedAddress ) {
showQR . selectedAccount . name = params . name ? ? ""
showQR . selectedAccount . address = params . address ? ? ""
showQR . selectedAccount . colorId = params . colorId ? ? ""
showQR . selectedAccount . emoji = params . emoji ? ? ""
}
showQR . active = true
}
function close ( ) {
showQR . active = false
}
onLoaded: {
showQR . item . switchingAccounsEnabled = showQR . params . switchingAccounsEnabled ? ? true
showQR . item . hasFloatingButtons = showQR . params . hasFloatingButtons ? ? true
showQR . item . open ( )
}
sourceComponent: WalletPopups . ReceiveModal {
2024-07-03 03:55:05 +00:00
ModelEntry {
id: selectedReceiverAccount
key: "address"
sourceModel: appMain . transactionStore . accounts
value: appMain . transactionStore . selectedReceiverAccountAddress
}
2024-01-15 09:19:25 +00:00
accounts: {
if ( showQR . showSingleAccount || showQR . showForSavedAddress ) {
return null
}
2024-05-22 08:13:39 +00:00
return WalletStores . RootStore . accounts
2024-01-15 09:19:25 +00:00
}
selectedAccount: {
if ( showQR . showSingleAccount || showQR . showForSavedAddress ) {
return showQR . selectedAccount
}
2024-07-12 13:57:04 +00:00
return selectedReceiverAccount . item ? ? SQUtils . ModelUtils . get ( appMain . transactionStore . accounts , 0 )
2024-01-15 09:19:25 +00:00
}
2024-06-07 12:27:56 +00:00
onUpdateSelectedAddress: ( address ) = > {
2024-01-15 09:19:25 +00:00
if ( showQR . showSingleAccount || showQR . showForSavedAddress ) {
return
}
2024-07-03 03:55:05 +00:00
appMain . transactionStore . setReceiverAccount ( address )
2024-01-15 09:19:25 +00:00
}
onClosed: {
showQR . close ( )
}
}
}
2024-02-19 08:40:16 +00:00
Loader {
id: savedAddressActivity
active: false
property var params
function open ( params = { } ) {
savedAddressActivity . params = params
savedAddressActivity . active = true
}
function close ( ) {
savedAddressActivity . active = false
}
onLoaded: {
savedAddressActivity . item . initWithParams ( savedAddressActivity . params )
savedAddressActivity . item . open ( )
}
sourceComponent: WalletPopups . SavedAddressActivityPopup {
networkConnectionStore: appMain . networkConnectionStore
contactsStore: appMain . rootStore . contactStore
sendModalPopup: sendModal
onClosed: {
savedAddressActivity . close ( )
}
}
}
2023-06-14 19:06:13 +00:00
Loader {
id: userAgreementLoader
active: production && ! localAppSettings . testEnvironment
sourceComponent: UserAgreementPopup {
visible: appMain . visible
onClosed: userAgreementLoader . active = false
}
}
2024-05-06 20:22:43 +00:00
2024-07-19 19:21:36 +00:00
Loader {
2024-11-07 09:10:10 +00:00
id: dAppsServiceLoader
2024-07-19 19:21:36 +00:00
2024-11-07 09:10:10 +00:00
// It seems some of the functionality of the dapp connector depends on the DAppsService
active: {
return ( featureFlagsStore . dappsEnabled || featureFlagsStore . connectorEnabled ) && appMain . visible
}
2024-05-06 20:22:43 +00:00
2024-11-07 09:10:10 +00:00
sourceComponent: DAppsService {
id: dAppsService
Component.onCompleted: {
Global . dAppsService = dAppsService
2024-10-30 15:18:24 +00:00
}
2024-05-06 20:22:43 +00:00
2024-11-07 09:10:10 +00:00
// DAppsModule provides the middleware for the dapps
dappsModule: DAppsModule {
currenciesStore: WalletStores . RootStore . currencyStore
groupedAccountAssetsModel: WalletStores . RootStore . walletAssetsStore . groupedAccountAssetsModel
accountsModel: WalletStores . RootStore . nonWatchAccounts
networksModel: SortFilterProxyModel {
sourceModel: WalletStores . RootStore . filteredFlatModel
proxyRoles: [
FastExpressionRole {
name: "isOnline"
expression: ! appMain . networkConnectionStore . blockchainNetworksDown . map ( Number ) . includes ( model . chainId )
expectedRoles: "chainId"
}
]
}
wcSdk: WalletConnectSDK {
enabled: featureFlagsStore . dappsEnabled && WalletStores . RootStore . walletSectionInst . walletReady
userUID: appMain . rootStore . profileSectionStore . profileStore . pubkey
projectId: WalletStores . RootStore . appSettings . walletConnectProjectID
}
bcSdk: DappsConnectorSDK {
enabled: featureFlagsStore . connectorEnabled && WalletStores . RootStore . walletSectionInst . walletReady
store: SharedStores . BrowserConnectStore {
controller: WalletStores . RootStore . dappsConnectorController
}
networksModel: WalletStores . RootStore . filteredFlatModel
accountsModel: WalletStores . RootStore . nonWatchAccounts
}
store: SharedStores . DAppsStore {
controller: WalletStores . RootStore . walletConnectController
}
}
selectedAddress: WalletStores . RootStore . selectedAddress
accountsModel: WalletStores . RootStore . nonWatchAccounts
2024-10-25 19:28:45 +00:00
connectorFeatureEnabled: featureFlagsStore . connectorEnabled
walletConnectFeatureEnabled: featureFlagsStore . dappsEnabled
2024-10-04 12:49:16 +00:00
onDisplayToastMessage: ( message , type ) = > {
const icon = type === Constants . ephemeralNotificationType . danger ? "warning" :
type === Constants . ephemeralNotificationType . success ? "checkmark-circle" : "info"
Global . displayToastMessage ( message , "" , icon , false , type , "" )
2024-06-04 20:45:03 +00:00
}
2024-05-06 20:22:43 +00:00
}
}
2024-08-28 09:07:11 +00:00
Connections {
target: ClipboardUtils
function onContentChanged ( ) {
if ( ! ClipboardUtils . hasText )
return
const text = ClipboardUtils . text
if ( text . length === 0 || text . length > 100 )
return
const isAddress = SQUtils . ModelUtils . contains (
WalletStores . RootStore . accounts , "address" ,
text , Qt . CaseInsensitive )
if ( isAddress )
WalletStores . RootStore . addressWasShown ( text )
}
}
2020-05-11 21:24:08 +00:00
}