2023-02-15 08:27:18 +00:00
import QtQuick 2.15
2020-06-17 19:18:31 +00:00
import QtQuick . Controls 2.13
import QtQuick . Layouts 1.13
2021-02-18 19:14:31 +00:00
import QtMultimedia 5.13
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
2022-09-02 14:56:14 +00:00
import QtQml . Models 2.14
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 . Browser 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
2023-04-03 17:13:23 +00:00
import shared . stores 1.0
2023-09-05 15:27:30 +00:00
import shared . popups . send 1.0
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
2021-06-11 12:17:23 +00:00
import StatusQ . Core . Theme 0.1
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-10-21 23:34:35 +00:00
import StatusQ . Core 0.1
2021-06-11 12:17:23 +00:00
2022-05-16 15:02:03 +00:00
import AppLayouts . Browser . stores 1.0 as BrowserStores
2022-03-08 18:49:33 +00:00
import AppLayouts . stores 1.0
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
2023-10-26 21:11:20 +00:00
import AppLayouts . Wallet . stores 1.0 as WalletStore
2023-12-26 10:19:41 +00:00
import AppLayouts . Wallet . popups 1.0 as WalletPopups
2024-04-10 20:56:10 +00:00
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
2022-10-06 15:47:55 +00:00
import "panels"
2022-07-12 08:56:47 +00:00
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
2023-12-26 10:20:38 +00:00
property RootStore rootStore: RootStore {
profileSectionStore.sendModalPopup: sendModal
}
2023-02-09 21:49:36 +00:00
property var rootChatStore: ChatStores . RootStore {
contactsStore: appMain . rootStore . contactStore
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
}
2023-05-04 18:36:35 +00:00
property var createChatPropertiesStore: ChatStores . CreateChatPropertiesStore { }
2022-10-26 16:00:20 +00:00
property ActivityCenterStore activityCenterStore: ActivityCenterStore { }
2023-04-03 17:13:23 +00:00
property NetworkConnectionStore networkConnectionStore: NetworkConnectionStore { }
2023-04-11 08:09:01 +00:00
property CommunityTokensStore communityTokensStore: CommunityTokensStore { }
2023-04-28 10:35:18 +00:00
property CommunitiesStore communitiesStore: CommunitiesStore { }
2023-10-26 21:11:20 +00:00
readonly property WalletStore . TokensStore tokensStore: WalletStore . RootStore . tokensStore
2023-11-24 12:16:13 +00:00
readonly property WalletStore . WalletAssetsStore walletAssetsStore: WalletStore . RootStore . walletAssetsStore
2024-01-29 18:02:59 +00:00
readonly property WalletStore . CollectiblesStore walletCollectiblesStore: WalletStore . RootStore . collectiblesStore
2024-01-31 18:09:44 +00:00
readonly property CurrenciesStore currencyStore: 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
2023-11-28 19:16:18 +00:00
}
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
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-03-14 16:38:30 +00:00
profileStore: appMain . rootStore . profileSectionStore . 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
2023-12-06 10:54:36 +00:00
Global . 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 (
qsTr ( "You successfully renamed your keypair\nfrom \"%1\" to \"%2\"" ) . arg ( oldName ) . arg ( newName ) ,
"" ,
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 (
2023-08-23 12:01:26 +00:00
qsTr ( "“%1” keypair 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" ) ) {
notification = qsTr ( "Make sure you're importing the exported keypair on paired device" )
}
}
else {
notification = qsTr ( "%1 keypair successfully imported" ) . arg ( keypairName )
if ( keypairsCount > 1 ) {
notification = qsTr ( "%n keypair(s) successfully imported" , "" , keypairsCount )
}
}
Global . displayToastMessage (
notification ,
"" ,
error !== "" ? "info" : "checkmark-circle" ,
false ,
error !== "" ? Constants.ephemeralNotificationType.normal : Constants . ephemeralNotificationType . success ,
""
)
}
2023-09-28 17:29:31 +00:00
function onShowToastTransactionSent ( chainId: int , txHash: string , uuid: string , error: string ) {
if ( ! error ) {
Global . displayToastMessage ( qsTr ( "Transaction pending..." ) ,
qsTr ( "View on etherscan" ) ,
"" ,
true ,
Constants . ephemeralNotificationType . normal ,
"%1/%2" . arg ( appMain . rootStore . getEtherscanLink ( chainId ) ) . arg ( txHash ) )
}
}
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 ,
""
)
}
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
}
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
popupParent: appMain
2022-10-21 13:37:39 +00:00
rootStore: appMain . rootStore
2023-10-23 11:32:50 +00:00
communityTokensStore: appMain . communityTokensStore
2023-04-28 10:35:18 +00:00
communitiesStore: appMain . communitiesStore
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-02-02 09:55:56 +00:00
networkConnectionStore: appMain . networkConnectionStore
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 onOpenLinkInBrowser ( link: string ) {
2023-01-10 13:19:02 +00:00
changeAppSectionBySectionId ( Constants . appSection . browser )
Qt . callLater ( ( ) = > browserLayoutContainer . item . openUrlInNewTab ( link ) ) ;
2021-12-06 21:10:54 +00:00
}
2022-10-18 09:06:18 +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)
2023-02-07 14:21:32 +00:00
link = appMain . rootStore . plainText ( link )
2023-07-21 23:08:44 +00:00
2022-12-14 14:40:50 +00:00
if ( appMain . rootStore . showBrowserSelector ) {
2023-02-07 14:21:32 +00:00
popups . openChooseBrowserPopup ( link )
2022-12-14 14:40:50 +00:00
} else {
if ( appMain . rootStore . openLinksInStatus ) {
2023-02-07 14:21:32 +00:00
globalConns . onAppSectionBySectionTypeChanged ( Constants . appSection . browser )
globalConns . onOpenLinkInBrowser ( link )
2022-12-14 14:40:50 +00:00
} else {
2023-02-07 14:21:32 +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 ) {
2023-10-18 09:03:32 +00:00
if ( appMainLocalSettings . whitelistedUnfurledDomains . includes ( domain ) )
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 ) {
Global . settingsSubsection = subsection ;
2024-01-24 12:02:03 +00:00
Global . settingsSubSubsection = subSubsection ;
} 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 {
target: Global . applicationWindow
function onActiveChanged ( ) {
if ( Global . applicationWindow . active ) appMain . rootStore . windowActivated ( )
else appMain . rootStore . windowDeactivated ( )
}
}
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
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 {
width: 360
height: 440
}
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 {
id: statusStickersPopup
2023-02-09 21:49:36 +00:00
store: appMain . rootChatStore
2023-11-28 19:16:18 +00:00
transactionStore: appMain . transactionStore
2024-02-05 16:44:49 +00:00
walletAssetsStore: appMain . walletAssetsStore
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 {
2022-11-28 11:32:29 +00:00
chatItemsModel: SortFilterProxyModel {
sourceModel: appMain . rootStore . mainModuleInst . sectionsModel
filters: [
ValueFilter {
roleName: "sectionType"
value: Constants . appSection . chat
} ,
ValueFilter {
roleName: "enabled"
value: true
}
]
2021-06-17 18:41:11 +00:00
}
2022-11-28 11:32:29 +00:00
chatItemDelegate: navbarButton
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
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"
minimumValue: Constants . appSection . wallet
maximumValue: Constants . appSection . communitiesPortal
} ,
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
2022-03-30 15:30:28 +00:00
name: appMain . rootStore . userProfileInst . name
2021-12-01 12:46:21 +00:00
icon.source: appMain . rootStore . userProfileInst . 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
2022-08-11 11:55:08 +00:00
identicon.asset.color: Utils . colorForPubkey ( appMain . rootStore . userProfileInst . pubKey )
2022-12-01 10:24:25 +00:00
identicon.ringSettings.ringSpecModel: Utils . getColorHashAsJson ( appMain . rootStore . userProfileInst . pubKey ,
2022-12-13 09:37:27 +00:00
appMain . rootStore . userProfileInst . 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: {
switch ( appMain . rootStore . userProfileInst . currentUserStatus ) {
case Constants.currentUserStatus.automatic:
case Constants.currentUserStatus.alwaysOnline:
return Style . current . green ;
default:
return Style . current . midGrey ;
}
}
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
2022-07-04 10:47:29 +00:00
y: profileButton . y - userStatusContextMenu . height + profileButton . height
x: profileButton . x + profileButton . width + 5
2021-11-04 23:38:57 +00:00
store: appMain . rootStore
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 &&
appMain . rootStore . contactStore . receivedContactRequestsModel . count ? true // pending CR request
: model . hasNotification
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 . browser )
2022-05-13 15:27:26 +00:00
return Constants . appViewStackIndex . browser
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
2023-02-27 12:11:51 +00:00
Binding {
target: rootDropAreaPanel
property: "enabled"
value: chatLayoutContainer . currentIndex === 0 // Meaning: Chats / channels view
when: visible
restoreMode: Binding . RestoreBindingOrValue
}
2023-02-09 21:49:36 +00:00
2023-03-17 18:58:07 +00:00
rootStore: ChatStores . RootStore {
contactsStore: appMain . rootStore . contactStore
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
2021-12-21 09:26:13 +00:00
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"
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
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
}
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-05-13 15:27:26 +00:00
Loader {
id: browserLayoutContainer
2023-01-10 13:19:02 +00:00
active: appView . currentIndex === Constants . appViewStackIndex . browser
2022-10-18 09:06:18 +00:00
asynchronous: true
sourceComponent: BrowserLayout {
globalStore: appMain . rootStore
sendTransactionModal: sendModal
2023-11-28 19:16:18 +00:00
transactionStore: appMain . transactionStore
2024-01-31 18:09:44 +00:00
assetsStore: appMain . walletAssetsStore
currencyStore: appMain . currencyStore
2024-05-20 12:18:44 +00:00
tokensStore: appMain . tokensStore
2022-10-18 09:06:18 +00:00
}
2022-05-13 15:27:26 +00:00
// Loaders do not have access to the context, so props need to be set
// Adding a "_" to avoid a binding loop
// Not Refactored Yet
// property var _chatsModel: chatsModel.messageView
// Not Refactored Yet
// property var _walletModel: walletModel
// Not Refactored Yet
// property var _utilsModel: utilsModel
2022-10-18 09:06:18 +00:00
// property var _web3Provider: BrowserStores.Web3ProviderStore.web3ProviderInst
2022-05-13 15:27:26 +00:00
}
2021-11-10 08:09:31 +00:00
2022-10-18 09:06:18 +00:00
Loader {
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 {
store: appMain . rootStore . profileSectionStore
globalStore: appMain . rootStore
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
2023-11-28 19:16:18 +00:00
transactionStore: appMain . transactionStore
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
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-04-17 20:45:17 +00:00
Binding {
target: rootDropAreaPanel
property: "enabled"
value: chatLayoutComponent . currentIndex === 0 // Meaning: Chats / channels view
when: visible
restoreMode: Binding . RestoreBindingOrValue
}
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 )
2023-04-17 20:45:17 +00:00
rootStore: ChatStores . RootStore {
contactsStore: appMain . rootStore . contactStore
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
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 {
2023-03-17 18:58:07 +00:00
rootStore: ChatStores . RootStore {
contactsStore: appMain . rootStore . contactStore
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
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
x: parent . width - width - Style . current . smallPadding
y: parent . y + _buttonSize
height: appView . height - _buttonSize * 2
2023-03-22 18:05:31 +00:00
store: ChatStores . RootStore {
contactsStore: appMain . rootStore . contactStore
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-02-19 13:58:20 +00:00
walletStore: WalletStore . 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
preSelectedRecipientType = TabAddressSelectorView . Type . Address
}
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
property var preSelectedAccount
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
2023-09-18 09:45:37 +00:00
property bool onlyAssets: false
2023-09-20 13:01:37 +00:00
2021-06-17 18:41:11 +00:00
sourceComponent: SendModal {
2023-11-28 19:16:18 +00:00
onlyAssets: sendModal . onlyAssets
store: appMain . transactionStore
2021-06-17 18:41:11 +00:00
onClosed: {
sendModal . closed ( )
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
2023-09-20 13:01:37 +00:00
sendModal . preSelectedAccount = undefined
2023-09-27 13:41:55 +00:00
sendModal . preSelectedRecipient = undefined
sendModal . preDefinedAmountToSend = ""
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: {
2023-09-20 13:01:37 +00:00
if ( ! ! sendModal . preSelectedAccount ) {
item . preSelectedAccount = sendModal . preSelectedAccount
}
2023-09-27 13:41:55 +00:00
if ( ! ! sendModal . preSelectedRecipient ) {
item . preSelectedRecipient = sendModal . preSelectedRecipient
item . preSelectedRecipientType = sendModal . preSelectedRecipientType
}
2023-09-20 16:07:09 +00:00
if ( sendModal . preSelectedSendType !== Constants . SendType . Unknown ) {
item . preSelectedSendType = sendModal . preSelectedSendType
2023-09-12 14:26:38 +00:00
}
2023-11-07 22:45:47 +00:00
if ( preSelectedHoldingType !== Constants . TokenType . Unknown ) {
2023-09-11 10:20:36 +00:00
item . preSelectedHoldingID = sendModal . preSelectedHoldingID
item . preSelectedHoldingType = sendModal . preSelectedHoldingType
}
2023-09-27 13:41:55 +00:00
if ( preDefinedAmountToSend != "" ) {
item . preDefinedAmountToSend = preDefinedAmountToSend
}
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
delegate: StatusListItem {
property var modelData
property bool isCurrentItem: true
function filterAccepts ( searchText ) {
2022-12-07 15:14:48 +00:00
const lowerCaseSearchText = searchText . toLowerCase ( )
return title . toLowerCase ( ) . includes ( lowerCaseSearchText ) || label . toLowerCase ( ) . includes ( lowerCaseSearchText )
2022-10-18 09:06:18 +00:00
}
2022-02-04 13:07:48 +00:00
2022-10-18 09:06:18 +00:00
title: modelData ? modelData.name : ""
label: modelData ? modelData.sectionName : ""
highlighted: isCurrentItem
sensor.hoverEnabled: false
statusListItemIcon {
name: modelData ? modelData.name : ""
active: true
}
asset.width: 30
asset.height: 30
2023-06-14 20:18:03 +00:00
asset.color: modelData ? modelData . color ? modelData.color : Utils . colorForColorId ( modelData . colorId ) : ""
2022-10-18 09:06:18 +00:00
asset.name: modelData ? modelData.icon : ""
2023-06-14 20:18:03 +00:00
asset.charactersLen: 2
asset.letterSize: asset . _twoLettersSize
ringSettings.ringSpecModel: modelData ? modelData.colorHash : undefined
2022-02-04 13:07:48 +00:00
}
2022-10-18 09:06:18 +00:00
onAboutToShow: rootStore . rebuildChatSearchModel ( )
onSelected: {
rootStore . setActiveSectionChat ( modelData . sectionId , modelData . chatId )
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-01-19 11:40:41 +00:00
property bool isSquare : isSquareShape ( model . actionData )
// 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 {
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 {
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-03-13 17:38:16 +00:00
flatNetworks: WalletStore . RootStore . filteredFlatModel
2023-12-26 10:19:41 +00:00
onClosed: {
addEditSavedAddress . close ( )
}
}
Connections {
target: WalletStore . RootStore . walletSectionSavedAddressesInst
2024-01-09 13:50:01 +00:00
function onSavedAddressAddedOrUpdated ( added: bool , name: string , address: string , errorMsg: string ) {
2023-12-26 10:19:41 +00:00
WalletStore . RootStore . addingSavedAddress = false
2024-01-09 13:50:01 +00:00
WalletStore . 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"
deleteSavedAddress . item . chainShortNames = deleteSavedAddress . params . chainShortNames ? ? ""
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-01-09 13:50:01 +00:00
WalletStore . RootStore . deleteSavedAddress ( address )
2024-01-05 10:57:15 +00:00
close ( )
}
2023-12-26 10:19:41 +00:00
}
Connections {
target: WalletStore . RootStore . walletSectionSavedAddressesInst
2024-01-09 13:50:01 +00:00
function onSavedAddressDeleted ( name: string , address: string , errorMsg: string ) {
2023-12-26 10:19:41 +00:00
WalletStore . 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: "" ,
preferredSharingChainIds: "" ,
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 . preferredSharingChainIds = params . preferredSharingChainIds ? ? ""
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 . changingPreferredChainsEnabled = showQR . params . changingPreferredChainsEnabled ? ? true
showQR . item . hasFloatingButtons = showQR . params . hasFloatingButtons ? ? true
showQR . item . open ( )
}
sourceComponent: WalletPopups . ReceiveModal {
accounts: {
if ( showQR . showSingleAccount || showQR . showForSavedAddress ) {
return null
}
return WalletStore . RootStore . receiveAccounts
}
selectedAccount: {
if ( showQR . showSingleAccount || showQR . showForSavedAddress ) {
return showQR . selectedAccount
}
return WalletStore . RootStore . selectedReceiveAccount
}
onSelectedAccountIndexChanged: {
if ( showQR . showSingleAccount || showQR . showForSavedAddress ) {
return
}
WalletStore . RootStore . switchReceiveAccount ( selectedIndex )
}
onUpdatePreferredChains: {
if ( showQR . showForSavedAddress ) {
let shortNames = WalletStore . RootStore . getNetworkShortNames ( preferredChains )
WalletStore . RootStore . updatePreferredChains ( address , shortNames )
return
}
WalletStore . RootStore . updateWalletAccountPreferredChains ( address , preferredChains )
}
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 ( )
}
}
}
2022-10-06 15:47:55 +00:00
DropAreaPanel {
2022-12-09 11:35:29 +00:00
id: rootDropAreaPanel
2023-02-27 12:11:51 +00:00
2022-10-06 15:47:55 +00:00
width: appMain . width
height: appMain . height
}
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
Loader {
id: walletConnectServiceLoader
active: Global . featureFlags . dappsEnabled
sourceComponent: WalletConnectService {
id: walletConnectService
wcSDK: WalletConnectSDK {
active: WalletStore . RootStore . walletSectionInst . walletReady
projectId: WalletStore . RootStore . appSettings . walletConnectProjectID
}
2024-05-20 18:42:31 +00:00
store: DAppsStore {
2024-05-21 10:42:50 +00:00
controller: WalletStore . RootStore . walletConnectController
2024-05-06 20:22:43 +00:00
}
walletStore: appMain . rootStore . profileSectionStore . walletStore
Component.onCompleted: {
Global . walletConnectService = walletConnectService
}
}
}
2020-05-11 21:24:08 +00:00
}