2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-02-18 19:14:31 +00:00
|
|
|
import QtMultimedia 5.13
|
2020-05-11 21:24:08 +00:00
|
|
|
import "../imports"
|
2021-02-18 19:14:31 +00:00
|
|
|
import "../sounds"
|
2020-06-23 18:59:16 +00:00
|
|
|
import "../shared"
|
2020-10-27 12:46:19 +00:00
|
|
|
import "../shared/status"
|
2020-05-13 17:27:06 +00:00
|
|
|
import "./AppLayouts"
|
2020-12-17 10:40:37 +00:00
|
|
|
import "./AppLayouts/Timeline"
|
2020-10-15 18:57:43 +00:00
|
|
|
import "./AppLayouts/Wallet"
|
2020-12-29 20:33:54 +00:00
|
|
|
import "./AppLayouts/Chat/components"
|
2021-02-17 16:31:59 +00:00
|
|
|
import "./AppLayouts/Chat/CommunityComponents"
|
2021-06-30 14:17:05 +00:00
|
|
|
import Qt.labs.platform 1.1
|
2021-02-18 19:14:31 +00:00
|
|
|
import Qt.labs.settings 1.0
|
2020-05-11 21:24:08 +00:00
|
|
|
|
2021-06-11 12:17:23 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Layout 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
StatusAppLayout {
|
2020-09-15 19:47:13 +00:00
|
|
|
id: appMain
|
2021-06-11 12:17:23 +00:00
|
|
|
anchors.fill: parent
|
2020-05-11 21:24:08 +00:00
|
|
|
|
2021-02-18 19:14:31 +00:00
|
|
|
property alias appSettings: appSettings
|
2021-06-11 12:17:23 +00:00
|
|
|
signal settingsLoaded()
|
2021-02-18 19:14:31 +00:00
|
|
|
|
2021-06-11 12:17:23 +00:00
|
|
|
function changeAppSection(section) {
|
|
|
|
chatsModel.communities.activeCommunity.active = false
|
|
|
|
appView.currentIndex = Utils.getAppSectionIndex(section)
|
|
|
|
}
|
2021-02-18 19:14:31 +00:00
|
|
|
|
2020-12-21 12:08:44 +00:00
|
|
|
function getProfileImage(pubkey, isCurrentUser, useLargeImage) {
|
|
|
|
if (isCurrentUser || (isCurrentUser === undefined && pubkey === profileModel.profile.pubKey)) {
|
|
|
|
return profileModel.profile.thumbnailImage
|
|
|
|
}
|
|
|
|
|
|
|
|
const index = profileModel.contacts.list.getContactIndexByPubkey(pubkey)
|
|
|
|
if (index === -1) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-01-15 15:37:23 +00:00
|
|
|
if (appSettings.onlyShowContactsProfilePics) {
|
|
|
|
const isContact = profileModel.contacts.list.rowData(index, "isContact")
|
|
|
|
if (isContact === "false") {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-21 12:08:44 +00:00
|
|
|
return profileModel.contacts.list.rowData(index, useLargeImage ? "largeImage" : "thumbnailImage")
|
|
|
|
}
|
|
|
|
|
2020-12-29 20:33:54 +00:00
|
|
|
function openPopup(popupComponent, params = {}) {
|
|
|
|
const popup = popupComponent.createObject(appMain, params);
|
|
|
|
popup.open()
|
|
|
|
return popup
|
|
|
|
}
|
|
|
|
|
2021-03-29 19:31:18 +00:00
|
|
|
function getContactListObject(dataModel) {
|
|
|
|
const nbContacts = profileModel.contacts.list.rowCount()
|
|
|
|
const contacts = []
|
|
|
|
let contact
|
|
|
|
for (let i = 0; i < nbContacts; i++) {
|
|
|
|
contact = {
|
|
|
|
name: profileModel.contacts.list.rowData(i, "name"),
|
|
|
|
localNickname: profileModel.contacts.list.rowData(i, "localNickname"),
|
|
|
|
pubKey: profileModel.contacts.list.rowData(i, "pubKey"),
|
|
|
|
address: profileModel.contacts.list.rowData(i, "address"),
|
|
|
|
identicon: profileModel.contacts.list.rowData(i, "identicon"),
|
|
|
|
thumbnailImage: profileModel.contacts.list.rowData(i, "thumbnailImage"),
|
|
|
|
isUser: false,
|
|
|
|
isContact: profileModel.contacts.list.rowData(i, "isContact") !== "false"
|
|
|
|
}
|
|
|
|
|
|
|
|
contacts.push(contact)
|
|
|
|
if (dataModel) {
|
|
|
|
dataModel.append(contact);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return contacts
|
|
|
|
}
|
|
|
|
|
2021-01-14 16:03:00 +00:00
|
|
|
function getUserNickname(pubKey) {
|
|
|
|
// Get contact nickname
|
|
|
|
const contactList = profileModel.contacts.list
|
|
|
|
const contactCount = contactList.rowCount()
|
|
|
|
for (let i = 0; i < contactCount; i++) {
|
|
|
|
if (contactList.rowData(i, 'pubKey') === pubKey) {
|
|
|
|
return contactList.rowData(i, 'localNickname')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2020-12-29 20:33:54 +00:00
|
|
|
function openLink(link) {
|
|
|
|
if (appSettings.showBrowserSelector) {
|
|
|
|
appMain.openPopup(chooseBrowserPopupComponent, {link: link})
|
|
|
|
} else {
|
|
|
|
if (appSettings.openLinksInStatus) {
|
|
|
|
appMain.changeAppSection(Constants.browser)
|
|
|
|
browserLayoutContainer.item.openUrlInNewTab(link)
|
|
|
|
} else {
|
|
|
|
Qt.openUrlExternally(link)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-11 12:17:23 +00:00
|
|
|
|
|
|
|
appNavBar: StatusAppNavBar {
|
|
|
|
height: appMain.height
|
|
|
|
|
|
|
|
navBarChatButton: StatusNavBarTabButton {
|
|
|
|
icon.name: "chat"
|
|
|
|
checked: !chatsModel.communities.activeCommunity.active && appView.currentIndex === Utils.getAppSectionIndex(Constants.chat)
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Chat"
|
|
|
|
tooltip.text: qsTrId("chat")
|
2021-07-12 11:13:44 +00:00
|
|
|
badge.value: chatsModel.messageView.unreadDirectMessagesAndMentionsCount + profileModel.contacts.contactRequests.count
|
|
|
|
badge.visible: badge.value > 0 || (chatsModel.messageView.unreadMessagesCount > 0 && !checked)
|
|
|
|
badge.anchors.rightMargin: badge.value > 0 ? 0 : 4
|
|
|
|
badge.anchors.topMargin: badge.value > 0 ? 4 : 5
|
|
|
|
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusAppNavBar.backgroundColor
|
|
|
|
badge.border.width: 2
|
2021-06-11 12:17:23 +00:00
|
|
|
onClicked: {
|
|
|
|
if (chatsModel.communities.activeCommunity.active) {
|
|
|
|
chatLayoutContainer.chatColumn.input.hideExtendedArea();
|
|
|
|
chatsModel.communities.activeCommunity.active = false
|
|
|
|
}
|
|
|
|
appMain.changeAppSection(Constants.chat)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
navBarCommunityTabButtons.model: chatsModel.communities.joinedCommunities
|
|
|
|
navBarCommunityTabButtons.delegate: StatusNavBarTabButton {
|
|
|
|
onClicked: {
|
|
|
|
appMain.changeAppSection(Constants.chat)
|
|
|
|
chatsModel.communities.setActiveCommunity(model.id)
|
|
|
|
}
|
|
|
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
checked: chatsModel.communities.activeCommunity.active && chatsModel.communities.activeCommunity.id === model.id
|
|
|
|
name: model.name
|
|
|
|
tooltip.text: model.name
|
|
|
|
icon.color: model.communityColor
|
|
|
|
icon.source: model.thumbnailImage
|
|
|
|
|
2021-07-12 11:13:44 +00:00
|
|
|
badge.visible: !checked && model.unviewedMessagesCount > 0
|
2021-06-11 12:17:23 +00:00
|
|
|
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusBadge.borderColor
|
|
|
|
badge.border.width: 2
|
2021-07-12 11:13:44 +00:00
|
|
|
badge.anchors.rightMargin: 4
|
|
|
|
badge.anchors.topMargin: 5
|
2021-06-11 12:17:23 +00:00
|
|
|
|
|
|
|
popupMenu: StatusPopupMenu {
|
|
|
|
id: communityContextMenu
|
|
|
|
|
|
|
|
openHandler: function () {
|
|
|
|
chatsModel.communities.setObservedCommunity(model.id)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Invite People"
|
|
|
|
text: qsTrId("invite-people")
|
2021-06-11 12:17:23 +00:00
|
|
|
icon.name: "share-ios"
|
|
|
|
enabled: chatsModel.communities.observedCommunity.canManageUsers
|
2021-07-21 09:49:03 +00:00
|
|
|
onTriggered: openPopup(inviteFriendsToCommunityPopup, {
|
|
|
|
community: chatsModel.communities.observedCommunity
|
|
|
|
})
|
2021-06-11 12:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "View Community"
|
|
|
|
text: qsTrId("view-community")
|
2021-06-11 12:17:23 +00:00
|
|
|
icon.name: "group-chat"
|
2021-07-16 12:36:27 +00:00
|
|
|
onTriggered: openPopup(communityProfilePopup, {
|
|
|
|
community: chatsModel.communities.observedCommunity
|
|
|
|
})
|
2021-06-11 12:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2021-07-16 10:11:03 +00:00
|
|
|
enabled: chatsModel.communities.observedCommunity.admin
|
|
|
|
text: qsTr("Edit Community")
|
2021-06-11 12:17:23 +00:00
|
|
|
icon.name: "edit"
|
|
|
|
onTriggered: openPopup(editCommunityPopup, {community: chatsModel.communities.observedCommunity})
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Leave Community"
|
|
|
|
text: qsTrId("leave-community")
|
2021-06-11 12:17:23 +00:00
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.width: 14
|
|
|
|
iconRotation: 180
|
|
|
|
type: StatusMenuItem.Type.Danger
|
|
|
|
onTriggered: chatsModel.communities.leaveCommunity(model.id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
navBarTabButtons: [
|
|
|
|
StatusNavBarTabButton {
|
|
|
|
icon.name: "wallet"
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Wallet"
|
|
|
|
tooltip.text: qsTrId("wallet")
|
2021-06-11 12:17:23 +00:00
|
|
|
visible: enabled
|
|
|
|
enabled: isExperimental === "1" || appSettings.isWalletEnabled
|
|
|
|
checked: appView.currentIndex == Utils.getAppSectionIndex(Constants.wallet)
|
|
|
|
onClicked: appMain.changeAppSection(Constants.wallet)
|
|
|
|
},
|
|
|
|
|
|
|
|
StatusNavBarTabButton {
|
|
|
|
enabled: isExperimental === "1" || appSettings.isBrowserEnabled
|
|
|
|
visible: enabled
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Browser"
|
|
|
|
tooltip.text: qsTrId("browser")
|
2021-06-11 12:17:23 +00:00
|
|
|
icon.name: "browser"
|
|
|
|
checked: appView.currentIndex == Utils.getAppSectionIndex(Constants.browser)
|
|
|
|
onClicked: appMain.changeAppSection(Constants.browser)
|
|
|
|
},
|
|
|
|
|
|
|
|
StatusNavBarTabButton {
|
|
|
|
enabled: isExperimental === "1" || appSettings.timelineEnabled
|
|
|
|
visible: enabled
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Timeline"
|
|
|
|
tooltip.text: qsTrId("timeline")
|
2021-06-11 12:17:23 +00:00
|
|
|
icon.name: "status-update"
|
|
|
|
checked: appView.currentIndex == Utils.getAppSectionIndex(Constants.timeline)
|
|
|
|
onClicked: appMain.changeAppSection(Constants.timeline)
|
|
|
|
},
|
|
|
|
|
|
|
|
StatusNavBarTabButton {
|
|
|
|
id: profileBtn
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Profile"
|
|
|
|
tooltip.text: qsTrId("profile")
|
2021-06-11 12:17:23 +00:00
|
|
|
icon.name: "profile"
|
|
|
|
checked: appView.currentIndex == Utils.getAppSectionIndex(Constants.profile)
|
|
|
|
onClicked: appMain.changeAppSection(Constants.profile)
|
|
|
|
|
2021-07-12 11:13:44 +00:00
|
|
|
badge.visible: !profileModel.mnemonic.isBackedUp && !checked
|
2021-06-11 12:17:23 +00:00
|
|
|
badge.anchors.rightMargin: 4
|
|
|
|
badge.anchors.topMargin: 5
|
|
|
|
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusAppNavBar.backgroundColor
|
|
|
|
badge.border.width: 2
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
appView: StackLayout {
|
|
|
|
id: appView
|
|
|
|
anchors.fill: parent
|
|
|
|
currentIndex: 0
|
|
|
|
onCurrentIndexChanged: {
|
|
|
|
if (typeof this.children[currentIndex].onActivated === "function") {
|
|
|
|
this.children[currentIndex].onActivated()
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.children[currentIndex] === browserLayoutContainer && browserLayoutContainer.active == false){
|
|
|
|
browserLayoutContainer.active = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
timelineLayoutContainer.active = this.children[currentIndex] === timelineLayoutContainer
|
|
|
|
|
|
|
|
if(this.children[currentIndex] === walletLayoutContainer){
|
|
|
|
walletLayoutContainer.showSigningPhrasePopup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ChatLayout {
|
|
|
|
id: chatLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
2021-07-20 15:22:09 +00:00
|
|
|
onProfileButtonClicked: {
|
|
|
|
appMain.changeAppSection(Constants.profile);
|
|
|
|
}
|
2021-06-11 12:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WalletLayout {
|
|
|
|
id: walletLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: browserLayoutComponent
|
|
|
|
BrowserLayout { }
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: browserLayoutContainer
|
|
|
|
sourceComponent: browserLayoutComponent
|
|
|
|
active: false
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
// Loaders do not have access to the context, so props need to be set
|
|
|
|
// Adding a "_" to avoid a binding loop
|
|
|
|
property var _chatsModel: chatsModel.messageView
|
|
|
|
property var _walletModel: walletModel
|
|
|
|
property var _utilsModel: utilsModel
|
|
|
|
property var _web3Provider: web3Provider
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: timelineLayoutContainer
|
|
|
|
sourceComponent: Component {
|
|
|
|
TimelineLayout {}
|
|
|
|
}
|
|
|
|
onLoaded: timelineLayoutContainer.item.onActivated()
|
|
|
|
active: false
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
|
|
|
|
ProfileLayout {
|
|
|
|
id: profileLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
|
|
|
|
NodeLayout {
|
|
|
|
id: nodeLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
|
|
|
|
UIComponents {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
}
|
2021-02-18 19:14:31 +00:00
|
|
|
|
|
|
|
Settings {
|
|
|
|
id: appSettings
|
2021-06-22 15:38:45 +00:00
|
|
|
fileName: profileModel.settings.settingsFile
|
2021-02-18 19:14:31 +00:00
|
|
|
property var chatSplitView
|
|
|
|
property var walletSplitView
|
|
|
|
property var profileSplitView
|
|
|
|
property bool communitiesEnabled: false
|
2021-04-23 11:43:18 +00:00
|
|
|
property bool isWalletEnabled: false
|
2021-02-18 19:14:31 +00:00
|
|
|
property bool nodeManagementEnabled: false
|
2021-04-23 11:43:18 +00:00
|
|
|
property bool isBrowserEnabled: false
|
2021-06-14 16:39:49 +00:00
|
|
|
property bool isActivityCenterEnabled: false
|
2021-06-30 18:46:26 +00:00
|
|
|
property bool showOnlineUsers: false
|
2021-07-21 08:26:31 +00:00
|
|
|
property bool isGifWidgetEnabled: false
|
2021-02-18 19:14:31 +00:00
|
|
|
property bool displayChatImages: false
|
2021-03-17 12:20:25 +00:00
|
|
|
property bool useCompactMode: true
|
2021-02-18 19:14:31 +00:00
|
|
|
property bool timelineEnabled: true
|
|
|
|
property var recentEmojis: []
|
2021-03-11 12:49:29 +00:00
|
|
|
property var hiddenCommunityWelcomeBanners: []
|
2021-04-29 14:48:16 +00:00
|
|
|
property var hiddenCommunityBackUpBanners: []
|
2021-02-18 19:14:31 +00:00
|
|
|
property real volume: 0.2
|
|
|
|
property int notificationSetting: Constants.notifyAllMessages
|
|
|
|
property bool notificationSoundsEnabled: true
|
|
|
|
property bool useOSNotifications: true
|
|
|
|
property int notificationMessagePreviewSetting: Constants.notificationPreviewNameAndMessage
|
2021-05-17 20:15:34 +00:00
|
|
|
property bool notifyOnNewRequests: true
|
2021-02-18 19:14:31 +00:00
|
|
|
property var whitelistedUnfurlingSites: ({})
|
|
|
|
property bool neverAskAboutUnfurlingAgain: false
|
|
|
|
property bool hideChannelSuggestions: false
|
|
|
|
property int fontSize: Constants.fontSizeM
|
|
|
|
property bool hideSignPhraseModal: false
|
|
|
|
property bool onlyShowContactsProfilePics: true
|
2021-02-23 20:14:29 +00:00
|
|
|
property bool quitOnClose: false
|
2021-07-07 09:32:03 +00:00
|
|
|
property string skinColor: ""
|
2021-02-18 19:14:31 +00:00
|
|
|
|
|
|
|
// Browser settings
|
|
|
|
property bool showBrowserSelector: true
|
|
|
|
property bool openLinksInStatus: true
|
2021-03-16 16:13:25 +00:00
|
|
|
property bool shouldShowFavoritesBar: true
|
2021-02-18 19:14:31 +00:00
|
|
|
property string browserHomepage: ""
|
2021-03-16 16:24:35 +00:00
|
|
|
property int shouldShowBrowserSearchEngine: Constants.browserSearchEngineDuckDuckGo
|
|
|
|
property int useBrowserEthereumExplorer: Constants.browserEthereumExplorerEtherscan
|
2021-02-18 19:14:31 +00:00
|
|
|
property bool autoLoadImages: true
|
|
|
|
property bool javaScriptEnabled: true
|
|
|
|
property bool errorPageEnabled: true
|
|
|
|
property bool pluginsEnabled: true
|
|
|
|
property bool autoLoadIconsForPage: true
|
|
|
|
property bool touchIconsEnabled: true
|
|
|
|
property bool webRTCPublicInterfacesOnly: false
|
|
|
|
property bool devToolsEnabled: false
|
|
|
|
property bool pdfViewerEnabled: true
|
|
|
|
property bool compatibilityMode: true
|
|
|
|
}
|
|
|
|
|
2021-03-17 17:00:11 +00:00
|
|
|
ErrorSound {
|
|
|
|
id: errorSound
|
|
|
|
}
|
|
|
|
|
2021-02-18 19:14:31 +00:00
|
|
|
Audio {
|
|
|
|
id: sendMessageSound
|
|
|
|
audioRole: Audio.NotificationRole
|
|
|
|
source: "../../../../sounds/send_message.wav"
|
|
|
|
volume: appSettings.volume
|
|
|
|
muted: !appSettings.notificationSoundsEnabled
|
|
|
|
}
|
|
|
|
|
|
|
|
Audio {
|
|
|
|
id: notificationSound
|
|
|
|
audioRole: Audio.NotificationRole
|
|
|
|
source: "../../../../sounds/notification.wav"
|
|
|
|
volume: appSettings.volume
|
|
|
|
muted: !appSettings.notificationSoundsEnabled
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
2021-06-22 15:38:45 +00:00
|
|
|
target: profileModel.settings
|
|
|
|
onSettingsFileChanged: {
|
2021-04-15 11:41:14 +00:00
|
|
|
profileModel.changeLocale(globalSettings.locale)
|
|
|
|
|
2021-03-17 12:20:25 +00:00
|
|
|
// Since https://github.com/status-im/status-desktop/commit/93668ff75
|
|
|
|
// we're hiding the setting to change appearance for compact normal mode
|
|
|
|
// of the UI. For now, compact mode is the new default.
|
|
|
|
//
|
|
|
|
// Prior to this change, most likely many users are still using the
|
|
|
|
// normal mode configuration, so we have to enforce compact mode for
|
|
|
|
// those.
|
2021-03-17 19:11:42 +00:00
|
|
|
if (!appSettings.useCompactMode) {
|
|
|
|
appSettings.useCompactMode = true
|
2021-03-17 12:20:25 +00:00
|
|
|
}
|
|
|
|
|
2021-02-18 19:14:31 +00:00
|
|
|
const whitelist = profileModel.getLinkPreviewWhitelist()
|
|
|
|
try {
|
|
|
|
const whiteListedSites = JSON.parse(whitelist)
|
|
|
|
let settingsUpdated = false
|
2021-03-05 18:45:39 +00:00
|
|
|
|
|
|
|
// Add Status links to whitelist
|
|
|
|
whiteListedSites.push({title: "Status", address: Constants.deepLinkPrefix, imageSite: false})
|
|
|
|
whiteListedSites.push({title: "Status", address: Constants.joinStatusLink, imageSite: false})
|
|
|
|
|
2021-02-18 19:14:31 +00:00
|
|
|
const settings = appSettings.whitelistedUnfurlingSites
|
2021-03-05 18:45:39 +00:00
|
|
|
|
|
|
|
// Set Status links as true. We intercept thoseURLs so it is privacy-safe
|
|
|
|
if (!settings[Constants.deepLinkPrefix] || !settings[Constants.joinStatusLink]) {
|
|
|
|
settings[Constants.deepLinkPrefix] = true
|
|
|
|
settings[Constants.joinStatusLink] = true
|
|
|
|
settingsUpdated = true
|
|
|
|
}
|
|
|
|
|
2021-02-18 19:14:31 +00:00
|
|
|
const whitelistedHostnames = []
|
|
|
|
|
|
|
|
// Add whitelisted sites in to app settings that are not already there
|
|
|
|
whiteListedSites.forEach(site => {
|
2021-03-05 18:45:39 +00:00
|
|
|
if (!settings.hasOwnProperty(site.address)) {
|
|
|
|
settings[site.address] = false
|
|
|
|
settingsUpdated = true
|
|
|
|
}
|
|
|
|
whitelistedHostnames.push(site.address)
|
|
|
|
})
|
2021-02-18 19:14:31 +00:00
|
|
|
// Remove any whitelisted sites from app settings that don't exist in the
|
|
|
|
// whitelist from status-go
|
|
|
|
Object.keys(settings).forEach(settingsHostname => {
|
|
|
|
if (!whitelistedHostnames.includes(settingsHostname)) {
|
|
|
|
delete settings[settingsHostname]
|
|
|
|
settingsUpdated = true
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (settingsUpdated) {
|
|
|
|
appSettings.whitelistedUnfurlingSites = settings
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
console.error('Could not parse the whitelist for sites', e)
|
|
|
|
}
|
|
|
|
appMain.settingsLoaded()
|
|
|
|
}
|
|
|
|
}
|
2021-06-11 12:17:23 +00:00
|
|
|
|
2021-02-18 19:14:31 +00:00
|
|
|
Connections {
|
|
|
|
target: profileModel
|
|
|
|
ignoreUnknownSignals: true
|
|
|
|
enabled: removeMnemonicAfterLogin
|
|
|
|
onInitialized: {
|
|
|
|
profileModel.mnemonic.remove()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-30 14:17:05 +00:00
|
|
|
Connections {
|
|
|
|
target: profileModel.contacts
|
|
|
|
onContactRequestAdded: {
|
|
|
|
if (!appSettings.notifyOnNewRequests) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
const isContact = profileModel.contacts.isAdded(address)
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Contact request accepted"
|
|
|
|
systemTray.showMessage(isContact ? qsTrId("contact-request-accepted") :
|
|
|
|
//% "New contact request"
|
|
|
|
qsTrId("new-contact-request"),
|
|
|
|
//% "You can now chat with %1"
|
|
|
|
isContact ? qsTrId("you-can-now-chat-with--1").arg(Utils.removeStatusEns(name)) :
|
|
|
|
//% "%1 requests to become contacts"
|
|
|
|
qsTrId("-1-requests-to-become-contacts").arg(Utils.removeStatusEns(name)),
|
2021-06-30 14:17:05 +00:00
|
|
|
SystemTrayIcon.NoIcon,
|
|
|
|
Constants.notificationPopupTTL)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-29 20:33:54 +00:00
|
|
|
Component {
|
|
|
|
id: chooseBrowserPopupComponent
|
|
|
|
ChooseBrowserPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-12-21 12:08:44 +00:00
|
|
|
|
2021-03-29 19:31:18 +00:00
|
|
|
Component {
|
|
|
|
id: inviteFriendsToCommunityPopup
|
|
|
|
InviteFriendsToCommunityPopup {
|
2021-07-15 11:15:56 +00:00
|
|
|
anchors.centerIn: parent
|
2021-03-29 19:31:18 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
2021-07-16 12:36:27 +00:00
|
|
|
id: communityProfilePopup
|
|
|
|
|
|
|
|
CommunityProfilePopup {
|
|
|
|
id: communityProfilePopup
|
2021-07-15 11:15:56 +00:00
|
|
|
anchors.centerIn: parent
|
2021-07-16 12:36:27 +00:00
|
|
|
|
2021-03-29 19:31:18 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: editCommunityPopup
|
|
|
|
CreateCommunityPopup {
|
2021-07-15 11:15:56 +00:00
|
|
|
anchors.centerIn: parent
|
2021-03-29 19:31:18 +00:00
|
|
|
isEdit: true
|
2021-05-24 03:09:49 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-03-29 19:31:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-28 02:55:50 +00:00
|
|
|
Component {
|
|
|
|
id: editChannelPopup
|
|
|
|
CreateChannelPopup {
|
2021-07-15 11:05:17 +00:00
|
|
|
anchors.centerIn: parent
|
2021-05-28 02:55:50 +00:00
|
|
|
isEdit: true
|
2021-06-02 19:43:33 +00:00
|
|
|
pinnedMessagesPopupComponent: chatLayoutContainer.chatColumn.pinnedMessagesPopupComponent
|
2021-05-28 02:55:50 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-11 17:31:13 +00:00
|
|
|
ToastMessage {
|
|
|
|
id: toastMessage
|
|
|
|
}
|
2021-04-13 17:49:24 +00:00
|
|
|
// Add SendModal here as it is used by the Wallet as well as the Browser
|
2020-11-03 10:29:56 +00:00
|
|
|
Loader {
|
2020-10-15 18:57:43 +00:00
|
|
|
id: sendModal
|
2021-05-25 14:58:53 +00:00
|
|
|
active: false
|
2020-11-03 10:29:56 +00:00
|
|
|
|
|
|
|
function open() {
|
|
|
|
this.active = true
|
|
|
|
this.item.open()
|
|
|
|
}
|
|
|
|
function closed() {
|
|
|
|
// this.sourceComponent = undefined // kill an opened instance
|
|
|
|
this.active = false
|
|
|
|
}
|
|
|
|
sourceComponent: SendModal {
|
|
|
|
onOpened: {
|
2021-06-08 12:48:31 +00:00
|
|
|
walletModel.gasView.getGasPricePredictions()
|
2020-11-03 10:29:56 +00:00
|
|
|
}
|
|
|
|
onClosed: {
|
|
|
|
sendModal.closed()
|
|
|
|
}
|
2020-10-15 18:57:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-17 03:07:01 +00:00
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+1"
|
|
|
|
onTriggered: changeAppSection(Constants.chat)
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+2"
|
|
|
|
onTriggered: changeAppSection(Constants.browser)
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+3"
|
|
|
|
onTriggered: changeAppSection(Constants.wallet)
|
|
|
|
}
|
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+4, Ctrl+,"
|
|
|
|
onTriggered: changeAppSection(Constants.profile)
|
|
|
|
}
|
2020-12-28 20:03:57 +00:00
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+K"
|
|
|
|
onTriggered: {
|
|
|
|
if (channelPicker.opened) {
|
|
|
|
channelPicker.close()
|
|
|
|
} else {
|
|
|
|
channelPicker.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-11 12:17:23 +00:00
|
|
|
|
2020-12-28 20:03:57 +00:00
|
|
|
Component {
|
|
|
|
id: statusIdenticonComponent
|
|
|
|
StatusIdenticon {}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusInputListPopup {
|
|
|
|
id: channelPicker
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Where do you want to go?"
|
|
|
|
title: qsTrId("where-do-you-want-to-go-")
|
2020-12-28 20:03:57 +00:00
|
|
|
showSearchBox: true
|
|
|
|
width: 350
|
|
|
|
x: parent.width / 2 - width / 2
|
|
|
|
y: parent.height / 2 - height / 2
|
2021-06-17 22:09:00 +00:00
|
|
|
modelList: chatsModel.channelView.chats
|
2020-12-28 20:03:57 +00:00
|
|
|
getText: function (modelData) {
|
|
|
|
return modelData.name
|
|
|
|
}
|
|
|
|
getImageComponent: function (parent, modelData) {
|
|
|
|
return statusIdenticonComponent.createObject(parent, {
|
|
|
|
width: channelPicker.imageWidth,
|
|
|
|
height: channelPicker.imageHeight,
|
|
|
|
chatName: modelData.name,
|
|
|
|
chatType: modelData.chatType,
|
|
|
|
identicon: modelData.identicon
|
|
|
|
});
|
|
|
|
}
|
|
|
|
onClicked: function (index) {
|
2021-06-17 22:09:00 +00:00
|
|
|
chatsModel.channelView.setActiveChannelByIndex(index)
|
2020-12-28 20:03:57 +00:00
|
|
|
appMain.changeAppSection(Constants.chat)
|
|
|
|
channelPicker.close()
|
|
|
|
}
|
|
|
|
}
|
2020-05-11 21:24:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
2021-02-17 16:31:59 +00:00
|
|
|
D{i:0;formeditorZoom:1.75;height:770;width:1232}
|
2020-05-11 21:24:08 +00:00
|
|
|
}
|
|
|
|
##^##*/
|