2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
2021-08-06 15:31:42 +00:00
|
|
|
import Qt.labs.platform 1.1
|
2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-04-28 15:30:41 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
2021-12-09 12:53:40 +00:00
|
|
|
import Qt.labs.qmlmodels 1.0
|
2021-07-06 09:42:51 +00:00
|
|
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
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.popups 1.0
|
|
|
|
import shared.status 1.0
|
|
|
|
import shared.controls 1.0
|
2021-10-28 20:23:30 +00:00
|
|
|
import shared.views.chat 1.0
|
2020-05-25 20:34:26 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
import "../helpers"
|
|
|
|
import "../controls"
|
|
|
|
import "../popups"
|
|
|
|
import "../panels"
|
|
|
|
import "../../Wallet"
|
2021-07-16 15:02:47 +00:00
|
|
|
|
|
|
|
Item {
|
2021-10-21 22:39:53 +00:00
|
|
|
id: root
|
2021-07-22 14:53:19 +00:00
|
|
|
anchors.fill: parent
|
2021-12-01 16:47:57 +00:00
|
|
|
|
|
|
|
// Important: we have parent module in this context only cause qml components
|
2021-12-09 12:53:40 +00:00
|
|
|
// don't follow struct we have on the backend.
|
2021-12-01 16:47:57 +00:00
|
|
|
property var parentModule
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
property var rootStore
|
2021-05-25 19:38:18 +00:00
|
|
|
property alias pinnedMessagesPopupComponent: pinnedMessagesPopupComponent
|
2021-11-26 15:37:57 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
//property int chatGroupsListViewCount: 0
|
2020-07-09 17:47:36 +00:00
|
|
|
property bool isReply: false
|
2020-07-20 17:04:33 +00:00
|
|
|
property bool isImage: false
|
|
|
|
property bool isExtendedInput: isReply || isImage
|
2020-07-15 16:19:25 +00:00
|
|
|
property bool isConnected: false
|
2020-08-10 13:06:46 +00:00
|
|
|
property string contactToRemove: ""
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// property string activeChatId: "" //root.rootStore.chatsModelInst.channelView.activeChannel.id
|
2021-11-15 15:15:21 +00:00
|
|
|
property bool isBlocked: root.rootStore.contactsModuleInst.model.isContactBlocked(activeChatId)
|
2021-11-23 22:07:28 +00:00
|
|
|
property bool isContact: root.rootStore.isContactAdded(activeChatId)
|
2021-11-15 15:15:21 +00:00
|
|
|
// property bool contactRequestReceived: root.rootStore.contactsModuleInst.model.contactRequestReceived(activeChatId)
|
2021-05-26 17:36:24 +00:00
|
|
|
property string currentNotificationChatId
|
|
|
|
property string currentNotificationCommunityId
|
2021-07-16 15:02:47 +00:00
|
|
|
property var currentTime: 0
|
|
|
|
property var idMap: ({})
|
|
|
|
property Timer timer: Timer { }
|
2021-07-22 14:53:19 +00:00
|
|
|
property var userList
|
2021-09-21 12:26:32 +00:00
|
|
|
|
2021-11-10 08:09:31 +00:00
|
|
|
signal openAppSearch()
|
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// function hideChatInputExtendedArea () {
|
|
|
|
// if(stackLayoutChatMessages.currentIndex >= 0 && stackLayoutChatMessages.currentIndex < stackLayoutChatMessages.children.length)
|
|
|
|
// stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].chatInput.hideExtendedArea()
|
|
|
|
// }
|
2021-05-25 19:38:18 +00:00
|
|
|
|
2020-09-23 16:13:39 +00:00
|
|
|
function showReplyArea() {
|
2020-07-20 17:04:33 +00:00
|
|
|
isReply = true;
|
|
|
|
isImage = false;
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// let replyMessageIndex = root.rootStore.chatsModelInst.messageView.messageList.getMessageIndex(SelectedMessage.messageId);
|
|
|
|
// if (replyMessageIndex === -1) return;
|
|
|
|
// let userName = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "userName")
|
|
|
|
// let message = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "message")
|
|
|
|
// let identicon = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "identicon")
|
|
|
|
// let image = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "image")
|
|
|
|
// let sticker = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "sticker")
|
|
|
|
// let contentType = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "contentType")
|
2020-09-29 09:06:57 +00:00
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// if(stackLayoutChatMessages.currentIndex >= 0 && stackLayoutChatMessages.currentIndex < stackLayoutChatMessages.children.length)
|
|
|
|
// stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].chatInput.showReplyArea(userName, message, identicon, contentType, image, sticker)
|
2020-07-20 17:04:33 +00:00
|
|
|
}
|
|
|
|
|
2020-09-29 09:06:57 +00:00
|
|
|
function requestAddressForTransaction(address, amount, tokenAddress, tokenDecimals = 18) {
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// amount = root.rootStore.utilsModelInst.eth2Wei(amount.toString(), tokenDecimals)
|
|
|
|
// root.rootStore.chatsModelInst.transactions.requestAddress(activeChatId,
|
|
|
|
// address,
|
|
|
|
// amount,
|
|
|
|
// tokenAddress)
|
2020-11-03 10:29:56 +00:00
|
|
|
txModalLoader.close()
|
2020-07-20 17:04:33 +00:00
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
function requestTransaction(address, amount, tokenAddress, tokenDecimals = 18) {
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// amount = root.rootStore.utilsModelInst.eth2Wei(amount.toString(), tokenDecimals)
|
|
|
|
// root.rootStore.chatsModelInst.transactions.request(activeChatId,
|
|
|
|
// address,
|
|
|
|
// amount,
|
|
|
|
// tokenAddress)
|
2020-11-03 10:29:56 +00:00
|
|
|
txModalLoader.close()
|
2020-07-20 17:04:33 +00:00
|
|
|
}
|
2020-09-29 09:06:57 +00:00
|
|
|
|
2021-05-26 17:36:24 +00:00
|
|
|
function clickOnNotification() {
|
2021-07-09 07:49:08 +00:00
|
|
|
// So far we're just showing this app as the top most window. Once we decide about the way
|
|
|
|
// how to notify the app what channle should be displayed within the app when user clicks
|
|
|
|
// notificaiton bubble this part should be updated accordingly.
|
|
|
|
//
|
|
|
|
// I removed part of this function which caused app crash.
|
2021-05-26 17:36:24 +00:00
|
|
|
applicationWindow.show()
|
|
|
|
applicationWindow.raise()
|
|
|
|
applicationWindow.requestActivate()
|
|
|
|
}
|
|
|
|
|
2021-09-24 14:04:49 +00:00
|
|
|
function positionAtMessage(messageId, isSearch = false) {
|
2021-12-09 12:53:40 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].message.scrollToMessage(messageId, isSearch);
|
2021-05-26 17:36:24 +00:00
|
|
|
}
|
|
|
|
|
2021-04-07 18:26:03 +00:00
|
|
|
Timer {
|
2021-07-16 15:02:47 +00:00
|
|
|
interval: 60000; // 1 min
|
|
|
|
running: true
|
|
|
|
repeat: true
|
|
|
|
triggeredOnStart: true
|
|
|
|
onTriggered: {
|
2021-10-21 22:39:53 +00:00
|
|
|
root.currentTime = Date.now()
|
2021-07-16 15:02:47 +00:00
|
|
|
}
|
2021-04-07 18:26:03 +00:00
|
|
|
}
|
2021-06-10 19:20:43 +00:00
|
|
|
|
2021-10-21 00:41:54 +00:00
|
|
|
MessageContextMenuView {
|
2021-08-25 20:31:00 +00:00
|
|
|
id: contextmenu
|
2021-12-09 16:25:38 +00:00
|
|
|
chatSectionModule: root.parentModule
|
2021-10-21 22:39:53 +00:00
|
|
|
store: root.rootStore
|
|
|
|
reactionModel: root.rootStore.emojiReactionsModel
|
2021-08-25 20:31:00 +00:00
|
|
|
}
|
|
|
|
|
2021-12-01 16:47:57 +00:00
|
|
|
StatusImageModal {
|
|
|
|
id: imagePopup
|
|
|
|
onClicked: {
|
|
|
|
if (button === Qt.LeftButton) {
|
|
|
|
imagePopup.close()
|
|
|
|
}
|
|
|
|
else if(button === Qt.RightButton) {
|
|
|
|
contextmenu.imageSource = imagePopup.imageSource
|
|
|
|
contextmenu.hideEmojiPicker = true
|
|
|
|
contextmenu.isRightClickOnImage = true;
|
|
|
|
contextmenu.show()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-16 15:02:47 +00:00
|
|
|
StackLayout {
|
|
|
|
anchors.fill: parent
|
2021-12-09 12:53:40 +00:00
|
|
|
currentIndex: {
|
|
|
|
if(chatCommunitySectionModule.activeItem.id !== "")
|
|
|
|
{
|
|
|
|
for(let i = 1; i < this.children.length; i++)
|
|
|
|
{
|
|
|
|
var obj = this.children[i];
|
|
|
|
if(obj && obj.chatContentModule)
|
|
|
|
{
|
|
|
|
let myChatId = obj.chatContentModule.getMyChatId()
|
|
|
|
if(myChatId == parentModule.activeItem.id || myChatId == parentModule.activeItem.activeSubItem.id)
|
|
|
|
return i
|
2021-07-16 15:02:47 +00:00
|
|
|
}
|
2021-07-06 09:42:51 +00:00
|
|
|
}
|
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
// Should never be here, correct index must be returned from the `for` loop above
|
|
|
|
console.error("Wrong chat/channel index, active item id: ", parentModule.activeItem.id,
|
|
|
|
" active subitem id: ", parentModule.activeItem.activeSubItem.id)
|
2021-07-06 09:42:51 +00:00
|
|
|
}
|
2020-07-15 16:19:25 +00:00
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
return 0
|
|
|
|
}
|
2021-06-21 19:35:32 +00:00
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
EmptyChatPanel {
|
|
|
|
onShareChatKeyClicked: openProfilePopup(userProfile.name, userProfile.pubKey, userProfile.icon);
|
|
|
|
}
|
2021-07-16 15:02:47 +00:00
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
// This is kind of a solution for applying backend refactored changes with the minimal qml changes.
|
|
|
|
// The best would be if we made qml to follow the struct we have on the backend side.
|
|
|
|
Repeater {
|
|
|
|
model: parentModule.model
|
|
|
|
delegate: delegateChooser
|
|
|
|
|
|
|
|
DelegateChooser {
|
|
|
|
id: delegateChooser
|
|
|
|
role: "type"
|
|
|
|
DelegateChoice { // In case of category
|
|
|
|
roleValue: Constants.chatType.unknown
|
|
|
|
delegate: Repeater {
|
|
|
|
model: subItems
|
|
|
|
delegate: ChatContentView {
|
|
|
|
Component.onCompleted: {
|
|
|
|
parentModule.prepareChatContentModuleForChatId(model.itemId)
|
|
|
|
chatContentModule = parentModule.getChatContentModule()
|
2021-09-21 12:26:32 +00:00
|
|
|
}
|
2021-07-16 15:02:47 +00:00
|
|
|
}
|
2021-12-09 12:53:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DelegateChoice { // In all other cases
|
|
|
|
delegate: ChatContentView {
|
|
|
|
Component.onCompleted: {
|
|
|
|
parentModule.prepareChatContentModuleForChatId(itemId)
|
|
|
|
chatContentModule = parentModule.getChatContentModule()
|
2021-07-16 15:02:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-21 12:26:32 +00:00
|
|
|
}
|
2021-12-09 12:53:40 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-09 11:11:04 +00:00
|
|
|
|
2021-12-09 12:53:40 +00:00
|
|
|
ChatRequestMessagePanel {
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.bottomMargin: Style.current.bigPadding
|
|
|
|
isContact: root.isContact
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// visible: root.rootStore.chatsModelInst.channelView.activeChannel.chatType === Constants.chatType.oneToOne
|
|
|
|
// && (!root.isContact /*|| !contactRequestReceived*/)
|
2021-12-09 12:53:40 +00:00
|
|
|
onAddContactClicked: {
|
|
|
|
root.rootStore.addContact(activeChatId);
|
2021-07-16 15:02:47 +00:00
|
|
|
}
|
2021-12-01 16:47:57 +00:00
|
|
|
}
|
2021-05-18 17:17:04 +00:00
|
|
|
|
2021-07-16 15:02:47 +00:00
|
|
|
Loader {
|
|
|
|
id: txModalLoader
|
|
|
|
function close() {
|
|
|
|
if (!this.item) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.item.close()
|
|
|
|
this.closed()
|
2021-05-18 17:17:04 +00:00
|
|
|
}
|
2021-07-16 15:02:47 +00:00
|
|
|
function closed() {
|
|
|
|
this.sourceComponent = undefined
|
|
|
|
}
|
|
|
|
}
|
2021-05-18 17:17:04 +00:00
|
|
|
|
2021-07-16 15:02:47 +00:00
|
|
|
Component {
|
|
|
|
id: cmpSendTransactionNoEns
|
|
|
|
ChatCommandModal {
|
|
|
|
id: sendTransactionNoEns
|
2021-10-22 20:49:47 +00:00
|
|
|
store: root.rootStore
|
2021-07-16 15:02:47 +00:00
|
|
|
onClosed: {
|
|
|
|
txModalLoader.closed()
|
2021-05-18 17:17:04 +00:00
|
|
|
}
|
2021-10-21 22:39:53 +00:00
|
|
|
sendChatCommand: root.requestAddressForTransaction
|
2021-07-16 15:02:47 +00:00
|
|
|
isRequested: false
|
|
|
|
//% "Send"
|
|
|
|
commandTitle: qsTrId("command-button-send")
|
2021-10-18 10:55:07 +00:00
|
|
|
header.title: commandTitle
|
2021-07-16 15:02:47 +00:00
|
|
|
//% "Request Address"
|
|
|
|
finalButtonLabel: qsTrId("request-address")
|
|
|
|
selectRecipient.selectedRecipient: {
|
|
|
|
return {
|
|
|
|
address: Constants.zeroAddress, // Setting as zero address since we don't have the address yet
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// alias: root.rootStore.chatsModelInst.channelView.activeChannel.alias,
|
|
|
|
// identicon: root.rootStore.chatsModelInst.channelView.activeChannel.identicon,
|
|
|
|
// name: root.rootStore.chatsModelInst.channelView.activeChannel.name,
|
2021-07-16 15:02:47 +00:00
|
|
|
type: RecipientSelector.Type.Contact
|
2021-05-18 17:17:04 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-16 15:02:47 +00:00
|
|
|
selectRecipient.selectedType: RecipientSelector.Type.Contact
|
|
|
|
selectRecipient.readOnly: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: cmpReceiveTransaction
|
|
|
|
ChatCommandModal {
|
|
|
|
id: receiveTransaction
|
2021-10-22 20:49:47 +00:00
|
|
|
store: root.rootStore
|
2021-07-16 15:02:47 +00:00
|
|
|
onClosed: {
|
|
|
|
txModalLoader.closed()
|
2021-05-18 17:17:04 +00:00
|
|
|
}
|
2021-10-21 22:39:53 +00:00
|
|
|
sendChatCommand: root.requestTransaction
|
2021-07-16 15:02:47 +00:00
|
|
|
isRequested: true
|
|
|
|
//% "Request"
|
|
|
|
commandTitle: qsTrId("wallet-request")
|
2021-10-18 10:55:07 +00:00
|
|
|
header.title: commandTitle
|
2021-07-16 15:02:47 +00:00
|
|
|
//% "Request"
|
|
|
|
finalButtonLabel: qsTrId("wallet-request")
|
|
|
|
selectRecipient.selectedRecipient: {
|
|
|
|
return {
|
|
|
|
address: Constants.zeroAddress, // Setting as zero address since we don't have the address yet
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// alias: root.rootStore.chatsModelInst.channelView.activeChannel.alias,
|
|
|
|
// identicon: root.rootStore.chatsModelInst.channelView.activeChannel.identicon,
|
|
|
|
// name: root.rootStore.chatsModelInst.channelView.activeChannel.name,
|
2021-07-16 15:02:47 +00:00
|
|
|
type: RecipientSelector.Type.Contact
|
2021-05-18 17:17:04 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-16 15:02:47 +00:00
|
|
|
selectRecipient.selectedType: RecipientSelector.Type.Contact
|
|
|
|
selectRecipient.readOnly: true
|
2021-05-18 17:17:04 +00:00
|
|
|
}
|
2020-10-28 07:44:09 +00:00
|
|
|
}
|
|
|
|
|
2021-07-16 15:02:47 +00:00
|
|
|
Component {
|
|
|
|
id: cmpSendTransactionWithEns
|
|
|
|
SendModal {
|
|
|
|
id: sendTransactionWithEns
|
|
|
|
onOpened: {
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// root.rootStore.walletModelInst.gasView.getGasPrice()
|
2021-07-16 15:02:47 +00:00
|
|
|
}
|
|
|
|
onClosed: {
|
|
|
|
txModalLoader.closed()
|
|
|
|
}
|
|
|
|
selectRecipient.readOnly: true
|
|
|
|
selectRecipient.selectedRecipient: {
|
|
|
|
return {
|
|
|
|
address: "",
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// alias: root.rootStore.chatsModelInst.channelView.activeChannel.alias,
|
|
|
|
// identicon: root.rootStore.chatsModelInst.channelView.activeChannel.identicon,
|
|
|
|
// name: root.rootStore.chatsModelInst.channelView.activeChannel.name,
|
2021-07-16 15:02:47 +00:00
|
|
|
type: RecipientSelector.Type.Contact,
|
|
|
|
ensVerified: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
selectRecipient.selectedType: RecipientSelector.Type.Contact
|
2020-11-03 10:29:56 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-16 15:02:47 +00:00
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
ActivityCenterPopup {
|
2021-07-16 15:02:47 +00:00
|
|
|
id: activityCenter
|
2021-12-09 12:53:40 +00:00
|
|
|
height: root.height - 56 * 2 // TODO get screen size // Taken from old code top bar height was fixed there to 56
|
|
|
|
y: 56
|
2021-10-21 22:39:53 +00:00
|
|
|
store: root.rootStore
|
2020-11-03 10:29:56 +00:00
|
|
|
}
|
2021-07-16 15:02:47 +00:00
|
|
|
|
|
|
|
Connections {
|
2021-11-15 15:15:21 +00:00
|
|
|
target: root.rootStore.contactsModuleInst.model
|
2021-07-16 15:02:47 +00:00
|
|
|
onContactListChanged: {
|
2021-11-15 15:15:21 +00:00
|
|
|
root.isBlocked = root.rootStore.contactsModuleInst.model.isContactBlocked(activeChatId);
|
|
|
|
root.isContact = root.rootStore.contactsModuleInst.model.isAdded(activeChatId);
|
2020-11-03 10:29:56 +00:00
|
|
|
}
|
2020-10-28 07:44:09 +00:00
|
|
|
}
|
2021-07-16 15:02:47 +00:00
|
|
|
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// Connections {
|
|
|
|
// target: root.rootStore.chatsModelInst.channelView
|
|
|
|
// onActiveChannelChanged: {
|
|
|
|
// root.rootStore.chatsModelInst.messageView.hideLoadingIndicator()
|
|
|
|
// SelectedMessage.reset();
|
|
|
|
// chatColumn.isReply = false;
|
|
|
|
// }
|
|
|
|
// }
|
2021-07-16 15:02:47 +00:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: systemTray
|
|
|
|
onMessageClicked: function () {
|
|
|
|
clickOnNotification()
|
2020-10-28 07:44:09 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-06 09:42:51 +00:00
|
|
|
|
2021-07-16 15:02:47 +00:00
|
|
|
Component {
|
|
|
|
id: pinnedMessagesPopupComponent
|
|
|
|
PinnedMessagesPopup {
|
|
|
|
id: pinnedMessagesPopup
|
2021-12-09 16:25:38 +00:00
|
|
|
chatSectionModule: root.parentModule
|
2021-10-21 22:39:53 +00:00
|
|
|
rootStore: root.rootStore
|
|
|
|
messageStore: root.rootStore.messageStore
|
2021-07-16 15:02:47 +00:00
|
|
|
onClosed: destroy()
|
|
|
|
}
|
|
|
|
}
|
2021-07-14 12:35:37 +00:00
|
|
|
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// Connections {
|
|
|
|
// target: root.rootStore.chatsModelInst.messageView
|
|
|
|
|
|
|
|
// onSearchedMessageLoaded: {
|
|
|
|
// positionAtMessage(messageId, true);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// onMessageNotificationPushed: function(messageId, communityId, chatId, msg, contentType, chatType, timestamp, identicon, username, hasMention, isAddedContact, channelName) {
|
|
|
|
// if (localAccountSensitiveSettings.notificationSetting == Constants.notifyAllMessages ||
|
|
|
|
// (localAccountSensitiveSettings.notificationSetting == Constants.notifyJustMentions && hasMention)) {
|
|
|
|
// if (chatId === root.rootStore.chatsModelInst.channelView.activeChannel.id && applicationWindow.active === true) {
|
|
|
|
// // Do not show the notif if we are in the channel already and the window is active and focused
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
|
|
|
|
// root.currentNotificationChatId = chatId
|
|
|
|
// root.currentNotificationCommunityId = null
|
|
|
|
|
|
|
|
// let name;
|
|
|
|
// if (localAccountSensitiveSettings.notificationMessagePreviewSetting === Constants.notificationPreviewAnonymous) {
|
|
|
|
// name = "Status"
|
|
|
|
// } else if (chatType === Constants.chatType.publicChat) {
|
|
|
|
// name = chatId
|
|
|
|
// } else {
|
|
|
|
// name = chatType === Constants.chatType.privateGroupChat ? Utils.filterXSS(channelName) : Utils.removeStatusEns(username)
|
|
|
|
// }
|
|
|
|
|
|
|
|
// let message;
|
|
|
|
// if (localAccountSensitiveSettings.notificationMessagePreviewSetting > Constants.notificationPreviewNameOnly) {
|
|
|
|
// switch(contentType){
|
|
|
|
// //% "Image"
|
|
|
|
// case Constants.messageContentType.imageType: message = qsTrId("image"); break
|
|
|
|
// //% "Sticker"
|
|
|
|
// case Constants.messageContentType.stickerType: message = qsTrId("sticker"); break
|
|
|
|
// default: message = msg // don't parse emojis here as it emits HTML
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// //% "You have a new message"
|
|
|
|
// message = qsTrId("you-have-a-new-message")
|
|
|
|
// }
|
|
|
|
|
|
|
|
// currentlyHasANotification = true
|
|
|
|
|
|
|
|
// if (Qt.platform.os === "linux") {
|
|
|
|
// // Linux Notifications are not implemented in Nim/C++ yet
|
|
|
|
// return systemTray.showMessage(name, message, systemTray.icon.source, 4000)
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // Note:
|
|
|
|
// // Show notification 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.
|
|
|
|
// root.rootStore.chatsModelInst.showOSNotification(name,
|
|
|
|
// message,
|
|
|
|
// Constants.osNotificationType.newMessage,
|
|
|
|
// communityId,
|
|
|
|
// chatId,
|
|
|
|
// messageId,
|
|
|
|
// localAccountSensitiveSettings.useOSNotifications)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
2021-07-27 14:04:05 +00:00
|
|
|
|
2021-12-13 14:24:21 +00:00
|
|
|
// Not Refactored Yet
|
|
|
|
// Connections {
|
|
|
|
// target: root.rootStore.chatsModelInst.stickers
|
|
|
|
// onTransactionWasSent: {
|
|
|
|
// //% "Transaction pending..."
|
|
|
|
// toastMessage.title = qsTr("Transaction pending...")
|
|
|
|
// toastMessage.source = Style.svg("loading")
|
|
|
|
// toastMessage.iconColor = Style.current.primary
|
|
|
|
// toastMessage.iconRotates = true
|
|
|
|
// toastMessage.link = `${walletModel.utilsView.etherscanLink}/${txResult}`
|
|
|
|
// toastMessage.open()
|
|
|
|
// }
|
|
|
|
// onTransactionCompleted: {
|
|
|
|
// toastMessage.title = !success ?
|
|
|
|
// //% "Could not buy Stickerpack"
|
|
|
|
// qsTrId("could-not-buy-stickerpack")
|
|
|
|
// :
|
|
|
|
// //% "Stickerpack bought successfully"
|
|
|
|
// qsTrId("stickerpack-bought-successfully");
|
|
|
|
// if (success) {
|
|
|
|
// toastMessage.source = Style.svg("check-circle")
|
|
|
|
// toastMessage.iconColor = Style.current.success
|
|
|
|
// } else {
|
|
|
|
// toastMessage.source = Style.svg("block-icon")
|
|
|
|
// toastMessage.iconColor = Style.current.danger
|
|
|
|
// }
|
|
|
|
|
|
|
|
// toastMessage.link = `${walletModel.utilsView.etherscanLink}/${txHash}`
|
|
|
|
// toastMessage.open()
|
|
|
|
// }
|
|
|
|
// }
|
2020-05-25 20:34:26 +00:00
|
|
|
}
|