2021-12-06 21:10:54 +00:00
|
|
|
pragma Singleton
|
|
|
|
|
|
|
|
import QtQuick 2.13
|
2022-03-08 18:49:33 +00:00
|
|
|
import AppLayouts.Chat.popups 1.0
|
2021-12-06 21:10:54 +00:00
|
|
|
|
|
|
|
QtObject {
|
2021-12-07 20:33:12 +00:00
|
|
|
id: root
|
2021-12-21 09:26:13 +00:00
|
|
|
|
2021-12-08 21:20:43 +00:00
|
|
|
property var applicationWindow
|
2022-02-28 20:14:04 +00:00
|
|
|
property var appMain
|
2021-12-08 21:20:43 +00:00
|
|
|
property bool popupOpened: false
|
2022-02-25 13:32:46 +00:00
|
|
|
property int settingsSubsection: Constants.settingsSubsection.profile
|
2022-01-11 23:16:17 +00:00
|
|
|
property var errorSound
|
2021-12-07 20:33:12 +00:00
|
|
|
|
2022-01-11 23:16:17 +00:00
|
|
|
property var mainModuleInst
|
2021-12-08 21:20:43 +00:00
|
|
|
property var toastMessage
|
|
|
|
property bool profilePopupOpened: false
|
2022-01-13 19:25:38 +00:00
|
|
|
property string currentNetworkId: ""
|
|
|
|
property bool networkGuarded: root.currentNetworkId === Constants.networkMainnet ||
|
|
|
|
(root.currentNetworkId === Constants.networkRopsten && localAccountSensitiveSettings.stickersEnsRopsten)
|
2021-12-08 21:20:43 +00:00
|
|
|
|
2022-02-01 13:10:24 +00:00
|
|
|
signal openImagePopup(var image, var contextMenu)
|
2021-12-06 21:10:54 +00:00
|
|
|
signal openLinkInBrowser(string link)
|
|
|
|
signal openChooseBrowserPopup(string link)
|
2021-12-07 20:33:12 +00:00
|
|
|
signal openPopupRequested(var popupComponent, var params)
|
2021-12-09 13:28:02 +00:00
|
|
|
signal openDownloadModalRequested()
|
|
|
|
signal settingsLoaded()
|
2021-12-30 12:39:47 +00:00
|
|
|
signal openBackUpSeedPopup()
|
2021-12-09 13:28:02 +00:00
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
signal openProfilePopupRequested(string publicKey, var parentPopup)
|
2022-02-04 08:43:55 +00:00
|
|
|
signal openChangeProfilePicPopup()
|
2021-12-08 21:20:43 +00:00
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
function openProfilePopup(publicKey, parentPopup){
|
|
|
|
openProfilePopupRequested(publicKey, parentPopup);
|
2021-12-09 13:28:02 +00:00
|
|
|
}
|
2021-12-07 20:33:12 +00:00
|
|
|
|
|
|
|
function openPopup(popupComponent, params = {}) {
|
|
|
|
root.openPopupRequested(popupComponent, params);
|
|
|
|
}
|
2021-12-06 21:10:54 +00:00
|
|
|
|
2021-12-08 21:20:43 +00:00
|
|
|
function openDownloadModal(){
|
|
|
|
openDownloadModalRequested();
|
2021-12-21 09:26:13 +00:00
|
|
|
}
|
|
|
|
|
2022-02-25 13:32:46 +00:00
|
|
|
function changeAppSectionBySectionType(sectionType, subsection = 0) {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.mainModuleInst)
|
|
|
|
return
|
|
|
|
|
2021-12-06 21:10:54 +00:00
|
|
|
mainModuleInst.setActiveSectionBySectionType(sectionType)
|
2022-02-25 13:32:46 +00:00
|
|
|
if (sectionType === Constants.appSection.profile) {
|
|
|
|
settingsSubsection = subsection;
|
2021-12-08 21:20:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getProfileImage(pubkey, isCurrentUser, useLargeImage) {
|
|
|
|
if (isCurrentUser || (isCurrentUser === undefined && pubkey === userProfile.pubKey)) {
|
|
|
|
return userProfile.icon;
|
|
|
|
}
|
|
|
|
|
2022-01-05 15:50:03 +00:00
|
|
|
let contactDetails = Utils.getContactDetailsAsJson(pubkey)
|
2021-12-31 12:29:51 +00:00
|
|
|
if (localAccountSensitiveSettings.onlyShowContactsProfilePics && !contactDetails.isContact) {
|
2021-12-08 21:20:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-31 12:29:51 +00:00
|
|
|
return contactDetails.displayIcon
|
2021-12-06 21:10:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function openLink(link) {
|
|
|
|
if (localAccountSensitiveSettings.showBrowserSelector) {
|
|
|
|
openChooseBrowserPopup(link);
|
|
|
|
} else {
|
|
|
|
if (localAccountSensitiveSettings.openLinksInStatus) {
|
|
|
|
changeAppSectionBySectionType(Constants.appSection.browser);
|
|
|
|
openLinkInBrowser(link);
|
|
|
|
} else {
|
|
|
|
Qt.openUrlExternally(link);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function playErrorSound() {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(errorSound)
|
|
|
|
errorSound.play();
|
2021-12-06 21:10:54 +00:00
|
|
|
}
|
2021-12-09 13:28:02 +00:00
|
|
|
|
|
|
|
function settingsHasLoaded() {
|
|
|
|
settingsLoaded()
|
|
|
|
}
|
2022-02-01 13:10:24 +00:00
|
|
|
}
|