StatusChatInput: remove unmaintained integration with ChatCommandsPopup
The functionality for sending/receiving funds directly from chat is currently not supported, both code and designs are outdated. This commit removes integration part but leaves ChatCommandsPopup component for potential future use. Closes: #12118
This commit is contained in:
parent
3548cee149
commit
f8347af7b7
|
@ -5,18 +5,14 @@ QtObject {
|
|||
|
||||
property string createChatInitMessage: ""
|
||||
property var createChatFileUrls: []
|
||||
property bool createChatStartSendTransactionProcess: false
|
||||
property bool createChatStartReceiveTransactionProcess: false
|
||||
property string createChatStickerHashId: ""
|
||||
property string createChatStickerPackId: ""
|
||||
property string createChatStickerUrl: ""
|
||||
|
||||
function resetProperties() {
|
||||
root.createChatInitMessage = "";
|
||||
root.createChatFileUrls = [];
|
||||
root.createChatStartSendTransactionProcess = false;
|
||||
root.createChatStartReceiveTransactionProcess = false;
|
||||
root.createChatStickerHashId = "";
|
||||
root.createChatStickerPackId = "";
|
||||
root.createChatInitMessage = ""
|
||||
root.createChatFileUrls = []
|
||||
root.createChatStickerHashId = ""
|
||||
root.createChatStickerPackId = ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -624,10 +624,6 @@ QtObject {
|
|||
return globalUtilsInst.wei2Eth(wei,18)
|
||||
}
|
||||
|
||||
function getEth2Wei(eth) {
|
||||
return globalUtilsInst.eth2Wei(eth, 18)
|
||||
}
|
||||
|
||||
function getEtherscanLink() {
|
||||
return profileSectionModule.ensUsernamesModule.getEtherscanLink()
|
||||
}
|
||||
|
|
|
@ -53,56 +53,23 @@ Item {
|
|||
|
||||
signal openStickerPackPopup(string stickerPackId)
|
||||
|
||||
function requestAddressForTransaction(address, amount, tokenAddress, tokenDecimals = 18) {
|
||||
amount = globalUtils.eth2Wei(amount.toString(), tokenDecimals)
|
||||
|
||||
parentModule.prepareChatContentModuleForChatId(activeChatId)
|
||||
let chatContentModule = parentModule.getChatContentModule()
|
||||
chatContentModule.inputAreaModule.requestAddress(address,
|
||||
amount,
|
||||
tokenAddress)
|
||||
}
|
||||
function requestTransaction(address, amount, tokenAddress, tokenDecimals = 18) {
|
||||
amount = globalUtils.eth2Wei(amount.toString(), tokenDecimals)
|
||||
|
||||
|
||||
parentModule.prepareChatContentModuleForChatId(activeChatId)
|
||||
let chatContentModule = parentModule.getChatContentModule()
|
||||
chatContentModule.inputAreaModule.request(address,
|
||||
amount,
|
||||
tokenAddress)
|
||||
}
|
||||
|
||||
// This function is called once `1:1` or `group` chat is created.
|
||||
function checkForCreateChatOptions(chatId) {
|
||||
if(root.createChatPropertiesStore.createChatStartSendTransactionProcess) {
|
||||
if (root.contactDetails.ensVerified) {
|
||||
Global.openPopup(cmpSendTransactionWithEns);
|
||||
} else {
|
||||
Global.openPopup(cmpSendTransactionNoEns);
|
||||
}
|
||||
}
|
||||
else if (root.createChatPropertiesStore.createChatStartSendTransactionProcess) {
|
||||
Global.openPopup(cmpReceiveTransaction);
|
||||
}
|
||||
else if (root.createChatPropertiesStore.createChatStickerHashId !== "" &&
|
||||
root.createChatPropertiesStore.createChatStickerPackId !== "" &&
|
||||
root.createChatPropertiesStore.createChatStickerUrl !== "") {
|
||||
root.rootStore.sendSticker(chatId,
|
||||
root.createChatPropertiesStore.createChatStickerHashId,
|
||||
"",
|
||||
root.createChatPropertiesStore.createChatStickerPackId,
|
||||
root.createChatPropertiesStore.createChatStickerUrl);
|
||||
}
|
||||
else if (root.createChatPropertiesStore.createChatInitMessage !== "" ||
|
||||
root.createChatPropertiesStore.createChatFileUrls.length > 0) {
|
||||
|
||||
root.rootStore.sendMessage(chatId,
|
||||
Qt.Key_Enter,
|
||||
root.createChatPropertiesStore.createChatInitMessage,
|
||||
"",
|
||||
root.createChatPropertiesStore.createChatFileUrls
|
||||
);
|
||||
if (root.createChatPropertiesStore.createChatStickerHashId !== ""
|
||||
&& root.createChatPropertiesStore.createChatStickerPackId !== ""
|
||||
&& root.createChatPropertiesStore.createChatStickerUrl !== "") {
|
||||
root.rootStore.sendSticker(
|
||||
chatId,
|
||||
root.createChatPropertiesStore.createChatStickerHashId,
|
||||
"",
|
||||
root.createChatPropertiesStore.createChatStickerPackId,
|
||||
root.createChatPropertiesStore.createChatStickerUrl)
|
||||
} else if (root.createChatPropertiesStore.createChatInitMessage !== ""
|
||||
|| root.createChatPropertiesStore.createChatFileUrls.length > 0) {
|
||||
root.rootStore.sendMessage(
|
||||
chatId, Qt.Key_Enter,
|
||||
root.createChatPropertiesStore.createChatInitMessage,
|
||||
"", root.createChatPropertiesStore.createChatFileUrls)
|
||||
}
|
||||
|
||||
root.createChatPropertiesStore.resetProperties()
|
||||
|
@ -337,23 +304,6 @@ Item {
|
|||
d.activeChatContentModule.inputAreaModule.preservedProperties.fileUrlsAndSourcesJson = JSON.stringify(chatInput.fileUrlsAndSources)
|
||||
}
|
||||
|
||||
onSendTransactionCommandButtonClicked: {
|
||||
if (!d.activeChatContentModule) {
|
||||
console.warn("error on sending transaction command - chat content module is not set")
|
||||
return
|
||||
}
|
||||
|
||||
if (Utils.isEnsVerified(d.activeChatContentModule.getMyChatId())) {
|
||||
Global.openPopup(cmpSendTransactionWithEns)
|
||||
} else {
|
||||
Global.openPopup(cmpSendTransactionNoEns)
|
||||
}
|
||||
}
|
||||
|
||||
onReceiveTransactionCommandButtonClicked: {
|
||||
Global.openPopup(cmpReceiveTransaction)
|
||||
}
|
||||
|
||||
onStickerSelected: {
|
||||
root.rootStore.sendSticker(d.activeChatContentModule.getMyChatId(),
|
||||
hashId,
|
||||
|
@ -416,87 +366,4 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: cmpSendTransactionNoEns
|
||||
ChatCommandModal {
|
||||
store: root.rootStore
|
||||
contactsStore: root.contactsStore
|
||||
onClosed: {
|
||||
destroy()
|
||||
}
|
||||
sendChatCommand: root.requestAddressForTransaction
|
||||
isRequested: false
|
||||
commandTitle: qsTr("Send")
|
||||
headerSettings.title: commandTitle
|
||||
finalButtonLabel: qsTr("Request Address")
|
||||
selectRecipient.selectedRecipient: {
|
||||
parentModule.prepareChatContentModuleForChatId(activeChatId)
|
||||
let chatContentModule = parentModule.getChatContentModule()
|
||||
return {
|
||||
address: Constants.zeroAddress, // Setting as zero address since we don't have the address yet
|
||||
alias: chatContentModule.chatDetails.name, // Do we need the alias for real or name works?
|
||||
pubKey: chatContentModule.chatDetails.id,
|
||||
icon: chatContentModule.chatDetails.icon,
|
||||
name: chatContentModule.chatDetails.name,
|
||||
type: RecipientSelector.Type.Contact,
|
||||
ensVerified: true
|
||||
}
|
||||
}
|
||||
selectRecipient.selectedType: RecipientSelector.Type.Contact
|
||||
selectRecipient.readOnly: true
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: cmpReceiveTransaction
|
||||
ChatCommandModal {
|
||||
store: root.rootStore
|
||||
contactsStore: root.contactsStore
|
||||
onClosed: {
|
||||
destroy()
|
||||
}
|
||||
sendChatCommand: root.requestTransaction
|
||||
isRequested: true
|
||||
commandTitle: qsTr("Request")
|
||||
headerSettings.title: commandTitle
|
||||
finalButtonLabel: qsTr("Request")
|
||||
selectRecipient.selectedRecipient: {
|
||||
parentModule.prepareChatContentModuleForChatId(activeChatId)
|
||||
let chatContentModule = parentModule.getChatContentModule()
|
||||
return {
|
||||
address: Constants.zeroAddress, // Setting as zero address since we don't have the address yet
|
||||
alias: chatContentModule.chatDetails.name, // Do we need the alias for real or name works?
|
||||
pubKey: chatContentModule.chatDetails.id,
|
||||
icon: chatContentModule.chatDetails.icon,
|
||||
name: chatContentModule.chatDetails.name,
|
||||
type: RecipientSelector.Type.Contact
|
||||
}
|
||||
}
|
||||
selectRecipient.selectedType: RecipientSelector.Type.Contact
|
||||
selectRecipient.readOnly: true
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: cmpSendTransactionWithEns
|
||||
SendModal {
|
||||
onClosed: {
|
||||
destroy()
|
||||
}
|
||||
preSelectedRecipient: {
|
||||
parentModule.prepareChatContentModuleForChatId(activeChatId)
|
||||
let chatContentModule = parentModule.getChatContentModule()
|
||||
|
||||
return {
|
||||
address: "",
|
||||
alias: chatContentModule.chatDetails.name, // Do we need the alias for real or name works?
|
||||
identicon: chatContentModule.chatDetails.icon,
|
||||
name: chatContentModule.chatDetails.name,
|
||||
type: RecipientSelector.Type.Contact,
|
||||
ensVerified: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,14 +161,6 @@ Page {
|
|||
usersStore: ({
|
||||
usersModel: membersSelector.model
|
||||
})
|
||||
onSendTransactionCommandButtonClicked: {
|
||||
root.createChatPropertiesStore.createChatStartSendTransactionProcess = true;
|
||||
membersSelector.createChat();
|
||||
}
|
||||
onReceiveTransactionCommandButtonClicked: {
|
||||
root.createChatPropertiesStore.createChatStartReceiveTransactionProcess = true;
|
||||
membersSelector.createChat();
|
||||
}
|
||||
onStickerSelected: {
|
||||
root.createChatPropertiesStore.createChatStickerHashId = hashId;
|
||||
root.createChatPropertiesStore.createChatStickerPackId = packId;
|
||||
|
|
|
@ -24,8 +24,6 @@ Rectangle {
|
|||
id: control
|
||||
objectName: "statusChatInput"
|
||||
|
||||
signal sendTransactionCommandButtonClicked()
|
||||
signal receiveTransactionCommandButtonClicked()
|
||||
signal stickerSelected(string hashId, string packId, string url)
|
||||
signal sendMessage(var event)
|
||||
signal keyUpPress()
|
||||
|
@ -172,7 +170,6 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
property bool chatCommandsPopupOpen: false
|
||||
property Menu textFormatMenu: null
|
||||
|
||||
function copyMentions(start, end) {
|
||||
|
@ -1020,35 +1017,6 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: chatCommandsPopupComponent
|
||||
|
||||
ChatCommandsPopup {
|
||||
id: chatCommandsPopup
|
||||
x: 8
|
||||
y: -height
|
||||
onSendTransactionCommandButtonClicked: {
|
||||
control.sendTransactionCommandButtonClicked()
|
||||
close()
|
||||
}
|
||||
onReceiveTransactionCommandButtonClicked: {
|
||||
control.receiveTransactionCommandButtonClicked()
|
||||
close()
|
||||
}
|
||||
onClosed: {
|
||||
chatCommandsBtn.highlighted = false
|
||||
destroy()
|
||||
}
|
||||
onOpened: {
|
||||
chatCommandsBtn.highlighted = true
|
||||
}
|
||||
Component.onDestruction: {
|
||||
if (d.chatCommandsPopupOpen)
|
||||
d.chatCommandsPopupOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: gifPopupComponent
|
||||
|
||||
|
@ -1081,26 +1049,6 @@ Rectangle {
|
|||
anchors.fill: parent
|
||||
spacing: 4
|
||||
|
||||
// TODO remove that Loader when the Chat Commands are re-implemented and fixed
|
||||
Loader {
|
||||
id: chatCommandsBtnLoader
|
||||
active: false
|
||||
sourceComponent: StatusQ.StatusFlatRoundButton {
|
||||
id: chatCommandsBtn
|
||||
Layout.preferredWidth: 32
|
||||
Layout.preferredHeight: 32
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
Layout.bottomMargin: 4
|
||||
icon.name: "chat-commands"
|
||||
type: StatusQ.StatusFlatRoundButton.Type.Tertiary
|
||||
onClicked: {
|
||||
d.chatCommandsPopupOpen ? Global.closePopup() : Global.openPopup(chatCommandsPopup);
|
||||
d.chatCommandsPopupOpen = !d.chatCommandsPopupOpen;
|
||||
}
|
||||
visible: RootStore.isWalletEnabled && !isEdit && control.chatType === Constants.chatType.oneToOne
|
||||
}
|
||||
}
|
||||
|
||||
StatusQ.StatusFlatRoundButton {
|
||||
id: imageBtn
|
||||
Layout.preferredWidth: 32
|
||||
|
@ -1534,6 +1482,5 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue