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
|
2021-11-01 20:10:50 +00:00
|
|
|
import Qt.labs.qmlmodels 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
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.status 1.0
|
2020-05-13 17:27:06 +00:00
|
|
|
import "./AppLayouts"
|
2021-10-19 10:27:41 +00:00
|
|
|
import "./AppLayouts/Timeline"
|
2020-10-15 18:57:43 +00:00
|
|
|
import "./AppLayouts/Wallet"
|
2021-08-13 20:04:04 +00:00
|
|
|
import "./AppLayouts/WalletV2"
|
2021-10-01 15:58:36 +00:00
|
|
|
import "./AppLayouts/Chat/popups"
|
|
|
|
import "./AppLayouts/Chat/popups/community"
|
|
|
|
import "./AppLayouts/Profile/Sections"
|
|
|
|
import "./AppLayouts/stores"
|
2021-06-17 18:41:11 +00:00
|
|
|
|
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
|
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
|
2021-10-21 23:34:35 +00:00
|
|
|
import StatusQ.Core 0.1
|
2021-06-11 12:17:23 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Item {
|
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-09-15 11:40:07 +00:00
|
|
|
property alias appLayout: appLayout
|
2021-06-17 18:41:11 +00:00
|
|
|
property var newVersionJSON: JSON.parse(utilsModel.newVersion)
|
2021-08-05 18:06:19 +00:00
|
|
|
property bool profilePopupOpened: false
|
2021-10-20 09:50:50 +00:00
|
|
|
property bool networkGuarded: profileModel.network.current === Constants.networkMainnet || (profileModel.network.current === Constants.networkRopsten && localAccountSensitiveSettings.stickersEnsRopsten)
|
2021-10-01 15:58:36 +00:00
|
|
|
property RootStore rootStore: RootStore { }
|
2021-10-20 09:50:50 +00:00
|
|
|
|
2021-06-11 12:17:23 +00:00
|
|
|
signal settingsLoaded()
|
2021-08-18 14:43:59 +00:00
|
|
|
signal openContactsPopup()
|
2021-02-18 19:14:31 +00:00
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
function changeAppSectionBySectionType(sectionType) {
|
|
|
|
mainModule.setActiveSectionBySectionType(sectionType)
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeAppSectionBySectionId(sectionId) {
|
|
|
|
mainModule.setActiveSectionById(sectionId)
|
2021-06-11 12:17:23 +00:00
|
|
|
}
|
2021-02-18 19:14:31 +00:00
|
|
|
|
2020-12-21 12:08:44 +00:00
|
|
|
function getProfileImage(pubkey, isCurrentUser, useLargeImage) {
|
2021-10-29 18:06:18 +00:00
|
|
|
if (isCurrentUser || (isCurrentUser === undefined && pubkey === userProfile.pubKey)) {
|
2021-12-01 12:46:21 +00:00
|
|
|
return userProfile.icon
|
2020-12-21 12:08:44 +00:00
|
|
|
}
|
|
|
|
|
2021-11-15 15:15:21 +00:00
|
|
|
const index = appMain.rootStore.contactsModuleInst.model.list.getContactIndexByPubkey(pubkey)
|
2020-12-21 12:08:44 +00:00
|
|
|
if (index === -1) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-10-20 09:50:50 +00:00
|
|
|
if (localAccountSensitiveSettings.onlyShowContactsProfilePics) {
|
2021-11-15 15:15:21 +00:00
|
|
|
const isContact = appMain.rootStore.contactsModuleInst.model.list.rowData(index, "isContact")
|
2021-10-19 10:27:41 +00:00
|
|
|
if (isContact === "false") {
|
2021-01-15 15:37:23 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
return appMain.rootStore.contactsModuleInst.model.list.rowData(index, useLargeImage ? "largeImage" : "thumbnailImage")
|
2020-12-21 12:08:44 +00:00
|
|
|
}
|
|
|
|
|
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) {
|
2021-11-15 15:15:21 +00:00
|
|
|
const nbContacts = appMain.rootStore.contactsModuleInst.model.list.rowCount()
|
2021-03-29 19:31:18 +00:00
|
|
|
const contacts = []
|
|
|
|
let contact
|
|
|
|
for (let i = 0; i < nbContacts; i++) {
|
2021-11-15 15:15:21 +00:00
|
|
|
if (appMain.rootStore.contactsModuleInst.model.list.rowData(i, "isBlocked") === "true") {
|
2021-08-09 11:11:04 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2021-03-29 19:31:18 +00:00
|
|
|
contact = {
|
2021-11-15 15:15:21 +00:00
|
|
|
name: appMain.rootStore.contactsModuleInst.model.list.rowData(i, "name"),
|
|
|
|
localNickname: appMain.rootStore.contactsModuleInst.model.list.rowData(i, "localNickname"),
|
|
|
|
pubKey: appMain.rootStore.contactsModuleInst.model.list.rowData(i, "pubKey"),
|
|
|
|
address: appMain.rootStore.contactsModuleInst.model.list.rowData(i, "address"),
|
|
|
|
identicon: appMain.rootStore.contactsModuleInst.model.list.rowData(i, "identicon"),
|
|
|
|
thumbnailImage: appMain.rootStore.contactsModuleInst.model.list.rowData(i, "thumbnailImage"),
|
2021-03-29 19:31:18 +00:00
|
|
|
isUser: false,
|
2021-11-15 15:15:21 +00:00
|
|
|
isContact: appMain.rootStore.contactsModuleInst.model.list.rowData(i, "isContact") !== "false"
|
2021-03-29 19:31:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
contacts.push(contact)
|
|
|
|
if (dataModel) {
|
|
|
|
dataModel.append(contact);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return contacts
|
|
|
|
}
|
|
|
|
|
2021-01-14 16:03:00 +00:00
|
|
|
function getUserNickname(pubKey) {
|
|
|
|
// Get contact nickname
|
2021-11-15 15:15:21 +00:00
|
|
|
const contactList = appMain.rootStore.contactsModuleInst.model.list
|
2021-01-14 16:03:00 +00:00
|
|
|
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) {
|
2021-10-20 09:50:50 +00:00
|
|
|
if (localAccountSensitiveSettings.showBrowserSelector) {
|
2020-12-29 20:33:54 +00:00
|
|
|
appMain.openPopup(chooseBrowserPopupComponent, {link: link})
|
|
|
|
} else {
|
2021-10-20 09:50:50 +00:00
|
|
|
if (localAccountSensitiveSettings.openLinksInStatus) {
|
2021-10-19 10:27:41 +00:00
|
|
|
appMain.changeAppSectionBySectionType(Constants.appSection.browser)
|
2020-12-29 20:33:54 +00:00
|
|
|
browserLayoutContainer.item.openUrlInNewTab(link)
|
|
|
|
} else {
|
|
|
|
Qt.openUrlExternally(link)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-05 18:06:19 +00:00
|
|
|
function openProfilePopup(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, parentPopup){
|
|
|
|
var popup = profilePopupComponent.createObject(appMain);
|
|
|
|
if(parentPopup){
|
|
|
|
popup.parentPopup = parentPopup;
|
|
|
|
}
|
2021-10-29 18:06:18 +00:00
|
|
|
popup.openPopup(userProfile.pubKey !== fromAuthorParam, userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam);
|
2021-08-05 18:06:19 +00:00
|
|
|
profilePopupOpened = true
|
|
|
|
}
|
|
|
|
|
|
|
|
property Component profilePopupComponent: ProfilePopup {
|
|
|
|
id: profilePopup
|
2021-11-15 15:15:21 +00:00
|
|
|
store: rootStore
|
2021-08-05 18:06:19 +00:00
|
|
|
onClosed: {
|
|
|
|
if(profilePopup.parentPopup){
|
|
|
|
profilePopup.parentPopup.close();
|
|
|
|
}
|
|
|
|
profilePopupOpened = false
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: downloadModalComponent
|
|
|
|
DownloadModal {
|
|
|
|
onClosed: {
|
|
|
|
destroy();
|
2021-06-11 12:17:23 +00:00
|
|
|
}
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|
2021-06-11 12:17:23 +00:00
|
|
|
}
|
2021-02-18 19:14:31 +00:00
|
|
|
|
2021-10-11 12:41:42 +00:00
|
|
|
Audio {
|
2021-03-17 17:00:11 +00:00
|
|
|
id: errorSound
|
2021-10-11 12:41:42 +00:00
|
|
|
track: "error.mp3"
|
2021-03-17 17:00:11 +00:00
|
|
|
}
|
|
|
|
|
2021-02-18 19:14:31 +00:00
|
|
|
Audio {
|
|
|
|
id: sendMessageSound
|
2021-10-11 12:41:42 +00:00
|
|
|
track: "send_message.wav"
|
2021-02-18 19:14:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Audio {
|
|
|
|
id: notificationSound
|
2021-10-11 12:41:42 +00:00
|
|
|
track: "notification.wav"
|
2021-02-18 19:14:31 +00:00
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
ModuleWarning {
|
|
|
|
id: versionWarning
|
|
|
|
width: parent.width
|
|
|
|
visible: newVersionJSON.available
|
|
|
|
color: Style.current.green
|
|
|
|
btnWidth: 100
|
|
|
|
text: qsTr("A new version of Status (%1) is available").arg(newVersionJSON.version)
|
|
|
|
btnText: qsTr("Download")
|
|
|
|
onClick: function(){
|
|
|
|
openPopup(downloadModalComponent, {newVersionAvailable: newVersionJSON.available, downloadURL: newVersionJSON.url})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-10 08:09:31 +00:00
|
|
|
AppSearch{
|
|
|
|
id: appSearch
|
|
|
|
store: mainModule.appSearchModule
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
StatusAppLayout {
|
2021-09-15 11:40:07 +00:00
|
|
|
id: appLayout
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
width: parent.width
|
|
|
|
anchors.top: parent.top
|
2021-09-20 12:06:14 +00:00
|
|
|
anchors.topMargin: versionWarning.visible ? 32 : 0
|
2021-06-17 18:41:11 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
|
|
|
appNavBar: StatusAppNavBar {
|
|
|
|
height: appMain.height
|
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
communityTypeRole: "sectionType"
|
|
|
|
communityTypeValue: Constants.appSection.community
|
|
|
|
sectionModel: mainModule.sectionsModel
|
|
|
|
|
|
|
|
property bool communityAdded: false
|
|
|
|
|
|
|
|
onAboutToUpdateFilteredRegularModel: {
|
|
|
|
communityAdded = false
|
|
|
|
}
|
|
|
|
|
|
|
|
filterRegularItem: function(item) {
|
|
|
|
if(!item.enabled)
|
|
|
|
return false
|
|
|
|
|
|
|
|
if(item.sectionType === Constants.appSection.community)
|
|
|
|
if(communityAdded)
|
|
|
|
return false
|
|
|
|
else
|
|
|
|
communityAdded = true
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
filterCommunityItem: function(item) {
|
|
|
|
return item.sectionType === Constants.appSection.community
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
regularNavBarButton: StatusNavBarTabButton {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
name: model.icon.length > 0? "" : model.name
|
|
|
|
icon.name: model.icon
|
|
|
|
icon.source: model.image
|
|
|
|
tooltip.text: model.name
|
|
|
|
checked: model.active
|
|
|
|
badge.value: model.notificationsCount
|
|
|
|
badge.visible: model.hasNotification
|
|
|
|
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusBadge.borderColor
|
|
|
|
badge.border.width: 2
|
2021-06-17 18:41:11 +00:00
|
|
|
onClicked: {
|
2021-10-19 10:27:41 +00:00
|
|
|
changeAppSectionBySectionId(model.id)
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
communityNavBarButton: StatusNavBarTabButton {
|
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
|
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
|
2021-10-19 10:27:41 +00:00
|
|
|
onClicked: {
|
|
|
|
changeAppSectionBySectionId(model.id)
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
|
|
|
popupMenu: StatusPopupMenu {
|
|
|
|
id: communityContextMenu
|
|
|
|
|
|
|
|
openHandler: function () {
|
|
|
|
chatsModel.communities.setObservedCommunity(model.id)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
//% "Invite People"
|
|
|
|
text: qsTrId("invite-people")
|
|
|
|
icon.name: "share-ios"
|
|
|
|
enabled: chatsModel.communities.observedCommunity.canManageUsers
|
|
|
|
onTriggered: openPopup(inviteFriendsToCommunityPopup, {
|
2021-10-19 10:27:41 +00:00
|
|
|
community: chatsModel.communities.observedCommunity
|
|
|
|
})
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
//% "View Community"
|
|
|
|
text: qsTrId("view-community")
|
|
|
|
icon.name: "group-chat"
|
|
|
|
onTriggered: openPopup(communityProfilePopup, {
|
2021-11-02 14:11:35 +00:00
|
|
|
store: appMain.rootStore,
|
2021-06-17 18:41:11 +00:00
|
|
|
community: chatsModel.communities.observedCommunity
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
enabled: chatsModel.communities.observedCommunity.admin
|
|
|
|
//% "Edit Community"
|
|
|
|
text: qsTrId("edit-community")
|
|
|
|
icon.name: "edit"
|
2021-11-02 14:11:35 +00:00
|
|
|
onTriggered: openPopup(editCommunityPopup, {store: appMain.rootStore, community: chatsModel.communities.observedCommunity})
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
//% "Leave Community"
|
|
|
|
text: qsTrId("leave-community")
|
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.width: 14
|
|
|
|
iconRotation: 180
|
|
|
|
type: StatusMenuItem.Type.Danger
|
|
|
|
onTriggered: chatsModel.communities.leaveCommunity(model.id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
navBarProfileButton: StatusNavBarTabButton {
|
|
|
|
id: profileButton
|
2021-09-27 10:31:17 +00:00
|
|
|
property bool opened: false
|
2021-10-19 10:27:41 +00:00
|
|
|
|
2021-12-01 12:46:21 +00:00
|
|
|
icon.source: appMain.rootStore.userProfileInst.icon
|
2021-06-17 18:41:11 +00:00
|
|
|
badge.visible: true
|
|
|
|
badge.anchors.rightMargin: 4
|
|
|
|
badge.anchors.topMargin: 25
|
|
|
|
badge.implicitHeight: 15
|
|
|
|
badge.implicitWidth: 15
|
|
|
|
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusAppNavBar.backgroundColor
|
2021-11-30 14:49:45 +00:00
|
|
|
/*
|
|
|
|
//This is still not in use. Read a comment for `currentUserStatus` in UserProfile on the nim side.
|
|
|
|
// Use this code once support for custom user status is added
|
|
|
|
switch(userProfile.currentUserStatus){
|
|
|
|
case Constants.userStatus.online:
|
|
|
|
return Style.current.green;
|
|
|
|
case Constants.userStatus.doNotDisturb:
|
|
|
|
return Style.current.red;
|
|
|
|
default:
|
|
|
|
return Style.current.midGrey;
|
|
|
|
}*/
|
|
|
|
badge.color: appMain.rootStore.userProfileInst.userStatus ? Style.current.green : Style.current.midGrey
|
2021-06-17 18:41:11 +00:00
|
|
|
badge.border.width: 3
|
2021-09-27 10:31:17 +00:00
|
|
|
onClicked: {
|
|
|
|
userStatusContextMenu.opened ?
|
|
|
|
userStatusContextMenu.close() :
|
|
|
|
userStatusContextMenu.open()
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
|
|
|
UserStatusContextMenu {
|
|
|
|
id: userStatusContextMenu
|
|
|
|
y: profileButton.y - userStatusContextMenu.height
|
2021-11-04 23:38:57 +00:00
|
|
|
store: appMain.rootStore
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-28 12:50:48 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
|
|
|
|
appView: StackLayout {
|
|
|
|
id: appView
|
|
|
|
anchors.fill: parent
|
2021-10-19 10:27:41 +00:00
|
|
|
currentIndex: {
|
|
|
|
if(mainModule.activeSection.sectionType === Constants.appSection.chat) {
|
2021-11-10 12:48:22 +00:00
|
|
|
return Constants.appViewStackIndex.chat
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.community) {
|
|
|
|
|
2021-11-01 20:10:50 +00:00
|
|
|
for(let i = this.children.length - 1; i >=0; i--)
|
|
|
|
{
|
|
|
|
var obj = this.children[i];
|
2021-11-26 15:37:57 +00:00
|
|
|
if(obj && obj.sectionId && obj.sectionId == mainModule.activeSection.id)
|
2021-11-01 20:10:50 +00:00
|
|
|
{
|
|
|
|
return i
|
|
|
|
}
|
|
|
|
}
|
2021-10-19 10:27:41 +00:00
|
|
|
|
2021-11-10 12:48:22 +00:00
|
|
|
// Should never be here, correct index must be returned from the for loop above
|
|
|
|
console.error("Wrong section type: ", mainModule.activeSection.sectionType,
|
|
|
|
" or section id: ", mainModule.activeSection.id)
|
|
|
|
return Constants.appViewStackIndex.community
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.wallet) {
|
2021-11-10 12:48:22 +00:00
|
|
|
return Constants.appViewStackIndex.wallet
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.walletv2) {
|
2021-11-10 12:48:22 +00:00
|
|
|
return Constants.appViewStackIndex.walletv2
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.browser) {
|
2021-11-10 12:48:22 +00:00
|
|
|
return Constants.appViewStackIndex.browser
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.timeline) {
|
2021-11-10 12:48:22 +00:00
|
|
|
return Constants.appViewStackIndex.timeline
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.profile) {
|
2021-11-10 12:48:22 +00:00
|
|
|
return Constants.appViewStackIndex.profile
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
|
|
|
else if(mainModule.activeSection.sectionType === Constants.appSection.node) {
|
2021-11-10 12:48:22 +00:00
|
|
|
return Constants.appViewStackIndex.node
|
2021-10-19 10:27:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// We should never end up here
|
|
|
|
console.error("Unknown section type")
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
onCurrentIndexChanged: {
|
2021-08-18 14:43:59 +00:00
|
|
|
var obj = this.children[currentIndex];
|
|
|
|
if(!obj)
|
|
|
|
return
|
|
|
|
|
|
|
|
if (obj.onActivated && typeof obj.onActivated === "function") {
|
2021-06-17 18:41:11 +00:00
|
|
|
this.children[currentIndex].onActivated()
|
2021-03-05 18:45:39 +00:00
|
|
|
}
|
|
|
|
|
2021-08-18 14:43:59 +00:00
|
|
|
if(obj === browserLayoutContainer && browserLayoutContainer.active == false){
|
2021-06-17 18:41:11 +00:00
|
|
|
browserLayoutContainer.active = true;
|
|
|
|
}
|
|
|
|
|
2021-11-26 15:37:57 +00:00
|
|
|
if(obj === timelineLayoutContainer){
|
|
|
|
timelineLayoutContainer.active = true
|
|
|
|
}
|
2021-10-19 10:27:41 +00:00
|
|
|
|
2021-08-18 14:43:59 +00:00
|
|
|
if(obj === walletLayoutContainer){
|
2021-06-17 18:41:11 +00:00
|
|
|
walletLayoutContainer.showSigningPhrasePopup();
|
|
|
|
}
|
|
|
|
|
2021-08-18 14:43:59 +00:00
|
|
|
if(obj === walletV2LayoutContainer){
|
2021-06-17 18:41:11 +00:00
|
|
|
walletV2LayoutContainer.showSigningPhrasePopup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-10 12:48:22 +00:00
|
|
|
// NOTE:
|
|
|
|
// If we ever change stack layout component order we need to updade
|
|
|
|
// Constants.appViewStackIndex accordingly
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
ChatLayout {
|
|
|
|
id: chatLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
onProfileButtonClicked: {
|
2021-10-19 10:27:41 +00:00
|
|
|
appMain.changeAppSectionBySectionType(Constants.appSection.profile);
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
2021-11-01 20:10:50 +00:00
|
|
|
|
2021-11-10 08:09:31 +00:00
|
|
|
onOpenAppSearch: {
|
|
|
|
appSearch.openSearchPopup()
|
|
|
|
}
|
|
|
|
|
2021-11-01 20:10:50 +00:00
|
|
|
Component.onCompleted: {
|
2021-11-26 15:37:57 +00:00
|
|
|
chatCommunitySectionModule = mainModule.getChatSectionModule()
|
2021-11-01 20:10:50 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WalletLayout {
|
|
|
|
id: walletLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: browserLayoutComponent
|
2021-10-22 20:49:47 +00:00
|
|
|
BrowserLayout {
|
|
|
|
globalStore: appMain.rootStore
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2021-10-19 10:27:41 +00:00
|
|
|
Loader {
|
|
|
|
id: timelineLayoutContainer
|
|
|
|
sourceComponent: Component {
|
|
|
|
TimelineLayout {
|
|
|
|
messageStore: appMain.rootStore.messageStore
|
|
|
|
rootStore: appMain.rootStore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onLoaded: timelineLayoutContainer.item.onActivated()
|
|
|
|
active: false
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
ProfileLayout {
|
|
|
|
id: profileLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
2021-10-01 15:58:36 +00:00
|
|
|
globalStore: appMain.rootStore
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NodeLayout {
|
|
|
|
id: nodeLayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
|
|
|
|
WalletV2Layout {
|
|
|
|
id: walletV2LayoutContainer
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2021-11-01 20:10:50 +00:00
|
|
|
|
|
|
|
Repeater{
|
|
|
|
model: mainModule.sectionsModel
|
|
|
|
|
|
|
|
delegate: DelegateChooser {
|
|
|
|
id: delegateChooser
|
|
|
|
role: "sectionType"
|
|
|
|
DelegateChoice {
|
|
|
|
roleValue: Constants.appSection.community
|
|
|
|
delegate: ChatLayout {
|
|
|
|
property string sectionId: model.id
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
onProfileButtonClicked: {
|
|
|
|
appMain.changeAppSectionBySectionType(Constants.appSection.profile);
|
|
|
|
}
|
|
|
|
|
2021-11-10 08:09:31 +00:00
|
|
|
onOpenAppSearch: {
|
|
|
|
appSearch.openSearchPopup()
|
|
|
|
}
|
|
|
|
|
2021-11-01 20:10:50 +00:00
|
|
|
Component.onCompleted: {
|
2021-11-03 10:55:51 +00:00
|
|
|
// we cannot return QVariant if we pass another parameter in a function call
|
|
|
|
// that's why we're using it this way
|
|
|
|
mainModule.prepareCommunitySectionModuleForCommunityId(model.id)
|
2021-11-26 15:37:57 +00:00
|
|
|
chatCommunitySectionModule = mainModule.getCommunitySectionModule()
|
2021-11-01 20:10:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
2021-11-26 15:37:57 +00:00
|
|
|
// This doesn't exists, not sure how this part ended up here?!?!
|
|
|
|
// We need to figure out what happened and fix this.
|
|
|
|
// So far just want to discard this, but leave it in order to check it later.
|
|
|
|
// Connections {
|
|
|
|
// target: profileModel
|
|
|
|
|
|
|
|
// onSettingsFileChanged: {
|
|
|
|
// // 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.
|
|
|
|
// if (!localAccountSensitiveSettings.useCompactMode) {
|
|
|
|
// localAccountSensitiveSettings.useCompactMode = true
|
|
|
|
// }
|
|
|
|
|
|
|
|
// const whitelist = profileModel.getLinkPreviewWhitelist()
|
|
|
|
// try {
|
|
|
|
// const whiteListedSites = JSON.parse(whitelist)
|
|
|
|
// let settingsUpdated = false
|
|
|
|
|
|
|
|
// // Add Status links to whitelist
|
|
|
|
// whiteListedSites.push({title: "Status", address: Constants.deepLinkPrefix, imageSite: false})
|
|
|
|
// whiteListedSites.push({title: "Status", address: Constants.joinStatusLink, imageSite: false})
|
|
|
|
// let settings = localAccountSensitiveSettings.whitelistedUnfurlingSites
|
|
|
|
|
|
|
|
// if (!settings) {
|
|
|
|
// settings = {}
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // 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
|
|
|
|
// }
|
|
|
|
|
|
|
|
// const whitelistedHostnames = []
|
|
|
|
|
|
|
|
// // Add whitelisted sites in to app settings that are not already there
|
|
|
|
// whiteListedSites.forEach(site => {
|
|
|
|
// if (!settings.hasOwnProperty(site.address)) {
|
|
|
|
// settings[site.address] = false
|
|
|
|
// settingsUpdated = true
|
|
|
|
// }
|
|
|
|
// whitelistedHostnames.push(site.address)
|
|
|
|
// })
|
|
|
|
// // 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) {
|
|
|
|
// localAccountSensitiveSettings.whitelistedUnfurlingSites = settings
|
|
|
|
// }
|
|
|
|
// } catch (e) {
|
|
|
|
// console.error('Could not parse the whitelist for sites', e)
|
|
|
|
// }
|
|
|
|
// appMain.settingsLoaded()
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
2021-08-18 14:43:59 +00:00
|
|
|
Connections {
|
|
|
|
target: chatsModel
|
|
|
|
onNotificationClicked: {
|
|
|
|
applicationWindow.makeStatusAppActive()
|
|
|
|
|
2021-10-28 14:08:18 +00:00
|
|
|
switch(notificationType){
|
|
|
|
case Constants.osNotificationType.newContactRequest:
|
2021-11-10 12:48:22 +00:00
|
|
|
appView.currentIndex = Constants.appViewStackIndex.chat
|
2021-10-28 14:08:18 +00:00
|
|
|
appMain.openContactsPopup()
|
|
|
|
break
|
|
|
|
case Constants.osNotificationType.acceptedContactRequest:
|
2021-11-10 12:48:22 +00:00
|
|
|
appView.currentIndex = Constants.appViewStackIndex.chat
|
2021-10-28 14:08:18 +00:00
|
|
|
break
|
|
|
|
case Constants.osNotificationType.joinCommunityRequest:
|
|
|
|
case Constants.osNotificationType.acceptedIntoCommunity:
|
|
|
|
case Constants.osNotificationType.rejectedByCommunity:
|
2021-11-10 12:48:22 +00:00
|
|
|
// Not Refactored - Need to check what community exactly we need to switch to.
|
|
|
|
// appView.currentIndex = Utils.getAppSectionIndex(Constants.community)
|
2021-10-28 14:08:18 +00:00
|
|
|
break
|
|
|
|
case Constants.osNotificationType.newMessage:
|
2021-11-10 12:48:22 +00:00
|
|
|
appView.currentIndex = Constants.appViewStackIndex.chat
|
2021-10-28 14:08:18 +00:00
|
|
|
break
|
|
|
|
}
|
2021-08-18 14:43:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Connections {
|
2021-11-15 15:15:21 +00:00
|
|
|
target: profileModel
|
|
|
|
ignoreUnknownSignals: true
|
|
|
|
enabled: removeMnemonicAfterLogin
|
|
|
|
onInitialized: {
|
|
|
|
mnemonicModule.remove()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: appMain.rootStore.contactsModuleInst.model
|
2021-06-17 18:41:11 +00:00
|
|
|
onContactRequestAdded: {
|
2021-10-20 09:50:50 +00:00
|
|
|
if (!localAccountSensitiveSettings.notifyOnNewRequests) {
|
2021-06-17 18:41:11 +00:00
|
|
|
return
|
|
|
|
}
|
2021-08-18 14:43:59 +00:00
|
|
|
|
2021-11-15 15:15:21 +00:00
|
|
|
const isContact = appMain.rootStore.contactsModuleInst.model.isAdded(address)
|
2021-08-18 14:43:59 +00:00
|
|
|
|
|
|
|
// Note:
|
|
|
|
// Whole this Connection object should be moved to the nim side.
|
|
|
|
// Left here only cause we don't have a way to deal with translations on the nim side.
|
|
|
|
|
2021-11-30 17:52:34 +00:00
|
|
|
const title = isContact ? qsTrId("contact-request-accepted") :
|
|
|
|
//% "New contact request"
|
|
|
|
qsTrId("new-contact-request")
|
|
|
|
|
|
|
|
const message = //% "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))
|
|
|
|
|
|
|
|
if (Qt.platform.os === "linux") {
|
|
|
|
// Linux Notifications are not implemented in Nim/C++ yet
|
|
|
|
return systemTray.showMessage(title, message, systemTray.icon.source, 4000)
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
//% "Contact request accepted"
|
2021-11-30 17:52:34 +00:00
|
|
|
profileModel.showOSNotification(title,
|
|
|
|
message,
|
2021-08-18 14:43:59 +00:00
|
|
|
isContact? Constants.osNotificationType.acceptedContactRequest :
|
|
|
|
Constants.osNotificationType.newContactRequest,
|
2021-10-20 09:50:50 +00:00
|
|
|
localAccountSensitiveSettings.useOSNotifications)
|
2021-06-30 14:17:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: chooseBrowserPopupComponent
|
|
|
|
ChooseBrowserPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2020-12-29 20:33:54 +00:00
|
|
|
}
|
|
|
|
}
|
2020-12-21 12:08:44 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: inviteFriendsToCommunityPopup
|
|
|
|
InviteFriendsToCommunityPopup {
|
|
|
|
anchors.centerIn: parent
|
2021-11-15 15:15:21 +00:00
|
|
|
hasAddedContacts: appMain.rootStore.allContacts.hasAddedContacts()
|
2021-06-17 18:41:11 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-03-29 19:31:18 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-16 12:36:27 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
2021-07-16 12:36:27 +00:00
|
|
|
id: communityProfilePopup
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
CommunityProfilePopup {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-03-29 19:31:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: editCommunityPopup
|
|
|
|
CreateCommunityPopup {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
isEdit: true
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-05-24 03:09:49 +00:00
|
|
|
}
|
2021-03-29 19:31:18 +00:00
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: editChannelPopup
|
|
|
|
CreateChannelPopup {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
isEdit: true
|
2021-11-10 12:48:22 +00:00
|
|
|
// Not Refactored
|
|
|
|
// pinnedMessagesPopupComponent: chatLayoutContainer.chatColumn.pinnedMessagesPopupComponent
|
2021-06-17 18:41:11 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-05-28 02:55:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Component {
|
|
|
|
id: genericConfirmationDialog
|
|
|
|
ConfirmationDialog {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-07-26 18:44:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
ToastMessage {
|
|
|
|
id: toastMessage
|
2020-11-03 10:29:56 +00:00
|
|
|
}
|
2021-07-05 12:34:56 +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
|
2021-07-05 12:34:56 +00:00
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
function open() {
|
|
|
|
this.active = true
|
|
|
|
this.item.open()
|
2020-11-03 10:29:56 +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
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
sourceComponent: SendModal {
|
2021-11-04 18:55:21 +00:00
|
|
|
store: appMain.rootStore
|
2021-06-17 18:41:11 +00:00
|
|
|
onOpened: {
|
2021-07-05 12:34:56 +00:00
|
|
|
walletModel.gasView.getGasPrice()
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
onClosed: {
|
|
|
|
sendModal.closed()
|
|
|
|
}
|
2020-12-28 20:03:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-17 18:41:11 +00:00
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+1"
|
2021-10-19 10:27:41 +00:00
|
|
|
onTriggered: changeAppSectionBySectionType(Constants.appSection.chat)
|
2020-12-28 20:03:57 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+2"
|
2021-10-19 10:27:41 +00:00
|
|
|
onTriggered: changeAppSectionBySectionType(Constants.appSection.browser)
|
2020-12-28 20:03:57 +00:00
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+3"
|
2021-10-19 10:27:41 +00:00
|
|
|
onTriggered: changeAppSectionBySectionType(Constants.appSection.wallet)
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+4, Ctrl+,"
|
2021-10-19 10:27:41 +00:00
|
|
|
onTriggered: changeAppSectionBySectionType(Constants.appSection.profile)
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
Action {
|
|
|
|
shortcut: "Ctrl+K"
|
|
|
|
onTriggered: {
|
|
|
|
if (channelPicker.opened) {
|
|
|
|
channelPicker.close()
|
|
|
|
} else {
|
|
|
|
channelPicker.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
2021-10-21 23:34:35 +00:00
|
|
|
id: statusSmartIdenticonComponent
|
|
|
|
StatusSmartIdenticon {
|
|
|
|
property string imageSource: ""
|
|
|
|
image: StatusImageSettings {
|
|
|
|
width: channelPicker.imageWidth
|
|
|
|
height: channelPicker.imageHeight
|
|
|
|
source: imageSource
|
|
|
|
isIdenticon: true
|
|
|
|
}
|
|
|
|
icon: StatusIconSettings {
|
|
|
|
width: channelPicker.imageWidth
|
|
|
|
height: channelPicker.imageHeight
|
|
|
|
letterSize: 15
|
|
|
|
color: Theme.palette.miscColor5
|
|
|
|
}
|
|
|
|
}
|
2021-06-17 18:41:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusInputListPopup {
|
|
|
|
id: channelPicker
|
|
|
|
//% "Where do you want to go?"
|
|
|
|
title: qsTrId("where-do-you-want-to-go-")
|
|
|
|
showSearchBox: true
|
|
|
|
width: 350
|
|
|
|
x: parent.width / 2 - width / 2
|
|
|
|
y: parent.height / 2 - height / 2
|
|
|
|
modelList: chatsModel.channelView.chats
|
|
|
|
getText: function (modelData) {
|
|
|
|
return modelData.name
|
|
|
|
}
|
|
|
|
getImageComponent: function (parent, modelData) {
|
2021-10-21 23:34:35 +00:00
|
|
|
return statusSmartIdenticonComponent.createObject(parent, {
|
|
|
|
imageSource: modelData.identicon,
|
|
|
|
name: modelData.name
|
2021-06-17 18:41:11 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
onClicked: function (index) {
|
2021-10-19 10:27:41 +00:00
|
|
|
appMain.changeAppSectionBySectionType(Constants.appSection.chat)
|
2021-06-17 18:41:11 +00:00
|
|
|
chatsModel.channelView.setActiveChannelByIndex(index)
|
|
|
|
channelPicker.close()
|
|
|
|
}
|
2020-12-28 20:03:57 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-23 11:59:29 +00:00
|
|
|
|
|
|
|
Component.onCompleted: {
|
2021-11-18 19:34:03 +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.
|
|
|
|
if (!localAccountSensitiveSettings.useCompactMode) {
|
|
|
|
localAccountSensitiveSettings.useCompactMode = true
|
|
|
|
}
|
|
|
|
|
|
|
|
const whitelist = profileModel.getLinkPreviewWhitelist()
|
|
|
|
try {
|
|
|
|
const whiteListedSites = JSON.parse(whitelist)
|
|
|
|
let settingsUpdated = false
|
|
|
|
|
|
|
|
// Add Status links to whitelist
|
|
|
|
whiteListedSites.push({title: "Status", address: Constants.deepLinkPrefix, imageSite: false})
|
|
|
|
whiteListedSites.push({title: "Status", address: Constants.joinStatusLink, imageSite: false})
|
|
|
|
let settings = localAccountSensitiveSettings.whitelistedUnfurlingSites
|
|
|
|
|
|
|
|
if (!settings) {
|
|
|
|
settings = {}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
|
|
|
const whitelistedHostnames = []
|
|
|
|
|
|
|
|
// Add whitelisted sites in to app settings that are not already there
|
|
|
|
whiteListedSites.forEach(site => {
|
|
|
|
if (!settings.hasOwnProperty(site.address)) {
|
|
|
|
settings[site.address] = false
|
|
|
|
settingsUpdated = true
|
|
|
|
}
|
|
|
|
whitelistedHostnames.push(site.address)
|
|
|
|
})
|
|
|
|
// 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) {
|
|
|
|
localAccountSensitiveSettings.whitelistedUnfurlingSites = settings
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
console.error('Could not parse the whitelist for sites', e)
|
|
|
|
}
|
|
|
|
appMain.settingsLoaded()
|
2021-09-23 11:59:29 +00:00
|
|
|
}
|
2020-05-11 21:24:08 +00:00
|
|
|
}
|