2021-10-01 18:58:36 +03:00
|
|
|
import QtQuick 2.13
|
|
|
|
|
2021-12-30 13:39:47 +01:00
|
|
|
import "../Profile/stores"
|
2021-10-15 11:00:45 +03:00
|
|
|
|
2021-10-01 18:58:36 +03:00
|
|
|
QtObject {
|
|
|
|
id: root
|
2022-07-01 13:24:32 +02:00
|
|
|
|
|
|
|
property string locale: localAppSettings.locale
|
|
|
|
|
2021-11-22 12:08:09 +01:00
|
|
|
property var mainModuleInst: mainModule
|
2021-12-20 13:21:21 -05:00
|
|
|
property var aboutModuleInst: aboutModule
|
2022-01-05 10:11:26 -05:00
|
|
|
property var communitiesModuleInst: communitiesModule
|
2022-01-10 11:44:54 -05:00
|
|
|
property var observedCommunity: communitiesModuleInst.observedCommunity
|
2021-11-22 12:08:09 +01:00
|
|
|
|
2022-03-03 17:00:52 -04:00
|
|
|
property bool newVersionAvailable: false
|
|
|
|
property string latestVersion
|
|
|
|
property string downloadURL
|
|
|
|
|
|
|
|
function setLatestVersionInfo(newVersionAvailable, latestVersion, downloadURL) {
|
|
|
|
root.newVersionAvailable = newVersionAvailable;
|
|
|
|
root.latestVersion = latestVersion;
|
|
|
|
root.downloadURL = downloadURL;
|
|
|
|
}
|
|
|
|
|
|
|
|
function resetLastVersion(){
|
|
|
|
root.newVersionAvailable = false
|
|
|
|
}
|
|
|
|
|
2022-01-27 12:28:27 +01:00
|
|
|
property AppSearchStore appSearchStore: AppSearchStore {
|
|
|
|
appSearchModule: root.mainModuleInst.appSearchModule
|
|
|
|
}
|
|
|
|
|
2021-12-30 13:39:47 +01:00
|
|
|
property ProfileSectionStore profileSectionStore: ProfileSectionStore {
|
|
|
|
}
|
|
|
|
|
2022-01-05 16:50:03 +01:00
|
|
|
property EmojiReactions emojiReactionsModel: EmojiReactions {
|
|
|
|
}
|
|
|
|
|
2022-02-04 14:07:48 +01:00
|
|
|
property var chatSearchModel: mainModuleInst.chatSearchModel
|
|
|
|
|
|
|
|
function rebuildChatSearchModel() {
|
|
|
|
mainModuleInst.rebuildChatSearchModel()
|
|
|
|
}
|
|
|
|
|
|
|
|
function setActiveSectionChat(sectionId, chatId) {
|
|
|
|
mainModuleInst.switchTo(sectionId, chatId)
|
|
|
|
}
|
|
|
|
|
2021-12-13 15:24:21 +01:00
|
|
|
// Not Refactored Yet
|
|
|
|
// property var chatsModelInst: chatsModel
|
|
|
|
// Not Refactored Yet
|
|
|
|
// property var walletModelInst: walletModel
|
2021-11-22 12:08:09 +01:00
|
|
|
property var userProfileInst: userProfile
|
2021-11-04 14:55:21 -04:00
|
|
|
|
|
|
|
property var accounts: walletSectionAccounts.model
|
|
|
|
property var currentAccount: walletSectionCurrent
|
2021-12-13 15:24:21 +01:00
|
|
|
// Not Refactored Yet
|
|
|
|
// property var profileModelInst: profileModel
|
2021-11-22 12:08:09 +01:00
|
|
|
|
2022-01-10 11:44:54 -05:00
|
|
|
property var contactStore: profileSectionStore.contactsStore
|
2022-02-10 15:02:02 -05:00
|
|
|
property var privacyStore: profileSectionStore.privacyStore
|
2022-03-07 15:34:59 -05:00
|
|
|
property var messagingStore: profileSectionStore.messagingStore
|
2022-01-10 11:44:54 -05:00
|
|
|
property bool hasAddedContacts: contactStore.myContactsModel.count > 0
|
|
|
|
|
2021-12-09 13:53:40 +01:00
|
|
|
// property MessageStore messageStore: MessageStore { }
|
2021-11-02 15:11:35 +01:00
|
|
|
|
2022-04-04 13:09:23 +02:00
|
|
|
property real volume: !!localAccountSensitiveSettings ? localAccountSensitiveSettings.volume * 0.01 : 0.5
|
2021-12-08 23:20:43 +02:00
|
|
|
property bool notificationSoundsEnabled: !!localAccountSensitiveSettings ? localAccountSensitiveSettings.notificationSoundsEnabled : false
|
2021-11-15 10:15:21 -05:00
|
|
|
|
2022-02-09 01:04:49 +01:00
|
|
|
property var walletSectionTransactionsInst: walletSectionTransactions
|
|
|
|
|
2022-03-18 15:47:51 +01:00
|
|
|
property var savedAddressesModel: walletSectionSavedAddresses.model
|
|
|
|
|
2022-07-01 13:24:32 +02:00
|
|
|
property var allNetworks: networksModule.all
|
|
|
|
|
|
|
|
property var disabledChainIds: []
|
|
|
|
|
|
|
|
function addRemoveDisabledChain(suggestedRoutes, chainID, isDisbaled) {
|
|
|
|
if(isDisbaled) {
|
|
|
|
disabledChainIds.push(chainID)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(var i = 0; i < disabledChainIds.length;i++) {
|
|
|
|
if(disabledChainIds[i] === chainID) {
|
|
|
|
disabledChainIds.splice(i, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkIfDisabledByUser(chainID) {
|
|
|
|
for(var i = 0; i < disabledChainIds.length;i++) {
|
|
|
|
if(disabledChainIds[i] === chainID) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-03-18 15:47:51 +01:00
|
|
|
function getEtherscanLink() {
|
|
|
|
return profileSectionModule.ensUsernamesModule.getEtherscanLink()
|
|
|
|
}
|
|
|
|
|
2022-06-09 17:59:54 +03:00
|
|
|
function createCommunity(communityName, communityDescription, checkedMembership, communityColor, communityTags,
|
|
|
|
communityImage, imageCropperModalaX, imageCropperModalaY, imageCropperModalbX, imageCropperModalbY) {
|
|
|
|
communitiesModuleInst.createCommunity(communityName, communityDescription, checkedMembership, communityColor,
|
|
|
|
communityTags, communityImage, imageCropperModalaX, imageCropperModalaY,
|
|
|
|
imageCropperModalbX, imageCropperModalbY);
|
2021-11-02 15:11:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function copyToClipboard(text) {
|
2022-01-10 11:44:54 -05:00
|
|
|
globalUtils.copyToClipboard(text)
|
2021-11-02 15:11:35 +01:00
|
|
|
}
|
2022-01-18 15:54:14 -05:00
|
|
|
|
|
|
|
function generateAlias(pk) {
|
|
|
|
return globalUtils.generateAlias(pk);
|
|
|
|
}
|
|
|
|
|
2022-02-01 10:31:57 -05:00
|
|
|
property string currentCurrency: walletSection.currentCurrency
|
2022-01-31 11:03:45 -05:00
|
|
|
property string signingPhrase: walletSection.signingPhrase
|
2022-05-19 10:53:57 +02:00
|
|
|
function estimateGas(from_addr, to, assetSymbol, value, chainId, data) {
|
|
|
|
return walletSectionTransactions.estimateGas(from_addr, to, assetSymbol, value, chainId, data)
|
2022-02-01 10:31:57 -05:00
|
|
|
}
|
|
|
|
function getFiatValue(balance, cryptoSymbo, fiatSymbol) {
|
|
|
|
return profileSectionStore.ensUsernamesStore.getFiatValue(balance, cryptoSymbo, fiatSymbol)
|
|
|
|
}
|
|
|
|
function getGasEthValue(gweiValue, gasLimit) {
|
|
|
|
return profileSectionStore.ensUsernamesStore.getGasEthValue(gweiValue, gasLimit)
|
|
|
|
}
|
2022-02-01 16:03:47 -05:00
|
|
|
|
2022-05-19 10:53:57 +02:00
|
|
|
|
|
|
|
function transfer(from, to, tokenSymbol, amount, gasLimit, gasPrice, tipLimit, overallLimit, password, chainId, uuid, eip1559Enabled) {
|
|
|
|
return walletSectionTransactions.transfer(
|
|
|
|
from, to, tokenSymbol, amount, gasLimit,
|
|
|
|
gasPrice, tipLimit, overallLimit, password, chainId, uuid,
|
|
|
|
eip1559Enabled
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function suggestedFees(chainId) {
|
|
|
|
return JSON.parse(walletSectionTransactions.suggestedFees(chainId))
|
2022-02-01 16:03:47 -05:00
|
|
|
}
|
2022-02-02 11:25:06 -05:00
|
|
|
|
2022-07-07 10:51:04 +02:00
|
|
|
function getEstimatedTime(chainId, maxFeePerGas) {
|
|
|
|
return walletSectionTransactions.getEstimatedTime(chainId, maxFeePerGas)
|
2022-06-02 19:47:42 +02:00
|
|
|
}
|
|
|
|
|
2022-05-19 10:53:57 +02:00
|
|
|
function getChainIdForChat() {
|
|
|
|
return walletSectionTransactions.getChainIdForChat()
|
2022-02-02 11:25:06 -05:00
|
|
|
}
|
2022-02-28 13:30:36 +01:00
|
|
|
|
2022-05-19 10:53:57 +02:00
|
|
|
function getChainIdForBrowser() {
|
|
|
|
return walletSectionTransactions.getChainIdForBrowser()
|
2022-02-28 13:30:36 +01:00
|
|
|
}
|
|
|
|
|
2022-07-01 13:24:32 +02:00
|
|
|
function suggestedRoutes(account, amount, token, disabledChainIds) {
|
|
|
|
return JSON.parse(walletSectionTransactions.suggestedRoutes(account, amount, token, disabledChainIds)).networks
|
2022-02-28 13:30:36 +01:00
|
|
|
}
|
2022-03-18 15:47:51 +01:00
|
|
|
|
|
|
|
function hex2Eth(value) {
|
|
|
|
return globalUtils.hex2Eth(value)
|
|
|
|
}
|
2022-07-04 12:47:29 +02:00
|
|
|
|
|
|
|
function setCurrentUserStatus(newStatus) {
|
|
|
|
if (userProfileInst && userProfileInst.currentUserStatus !== newStatus) {
|
|
|
|
mainModuleInst.setCurrentUserStatus(newStatus)
|
|
|
|
}
|
|
|
|
}
|
2021-10-01 18:58:36 +03:00
|
|
|
}
|