hide input field until mutual contacts and notify on contact accepted
This commit is contained in:
parent
d827433ad4
commit
7b95031ee6
|
@ -63,6 +63,8 @@ QtObject:
|
|||
)
|
||||
result.setup
|
||||
|
||||
proc contactListChanged*(self: ContactsView) {.signal.}
|
||||
|
||||
proc updateContactList*(self: ContactsView, contacts: seq[Profile]) =
|
||||
for contact in contacts:
|
||||
self.contactList.updateContact(contact)
|
||||
|
@ -72,8 +74,7 @@ QtObject:
|
|||
self.blockedContacts.updateContact(contact)
|
||||
if contact.systemTags.contains(contactRequest) and not contact.systemTags.contains(contactAdded) and not contact.systemTags.contains(contactBlocked):
|
||||
self.contactRequests.updateContact(contact)
|
||||
|
||||
proc contactListChanged*(self: ContactsView) {.signal.}
|
||||
self.contactListChanged()
|
||||
|
||||
proc getContactList(self: ContactsView): QVariant {.slot.} =
|
||||
return newQVariant(self.contactList)
|
||||
|
@ -89,7 +90,7 @@ QtObject:
|
|||
|
||||
proc notifyOnNewContactRequests*(self: ContactsView, contacts: seq[Profile]) =
|
||||
for contact in contacts:
|
||||
if contact.systemTags.contains(contactRequest) and not contact.systemTags.contains(contactAdded) and not contact.systemTags.contains(contactBlocked):
|
||||
if contact.systemTags.contains(contactRequest) and not contact.systemTags.contains(contactBlocked):
|
||||
self.contactRequestAdded(status_ens.userNameOrAlias(contact), contact.address)
|
||||
|
||||
QtProperty[QVariant] list:
|
||||
|
|
|
@ -35,6 +35,7 @@ StackLayout {
|
|||
property string activeChatId: chatsModel.activeChannel.id
|
||||
property bool isBlocked: profileModel.contacts.isContactBlocked(activeChatId)
|
||||
property bool isContact: profileModel.contacts.isAdded(activeChatId)
|
||||
property bool contactRequestReceived: profileModel.contacts.contactRequestReceived(activeChatId)
|
||||
|
||||
property string currentNotificationChatId
|
||||
property string currentNotificationCommunityId
|
||||
|
@ -343,10 +344,13 @@ StackLayout {
|
|||
StatusChatInput {
|
||||
id: chatInput
|
||||
visible: {
|
||||
const community = chatsModel.communities.activeCommunity
|
||||
if (chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat) {
|
||||
return chatsModel.activeChannel.isMember
|
||||
}
|
||||
if (chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne) {
|
||||
return isContact && contactRequestReceived
|
||||
}
|
||||
const community = chatsModel.communities.activeCommunity
|
||||
return !community.active ||
|
||||
community.access === Constants.communityChatPublicAccess ||
|
||||
community.admin ||
|
||||
|
|
|
@ -4,7 +4,7 @@ import "../../../../../shared"
|
|||
import "../../../../../shared/status"
|
||||
|
||||
Item {
|
||||
visible: chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne && !isContact
|
||||
visible: chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne && (!isContact || !contactRequestReceived)
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
|
||||
|
@ -18,7 +18,8 @@ Item {
|
|||
|
||||
StyledText {
|
||||
id: contactText1
|
||||
text: qsTr("You need to be mutual contacts with this person for them to receive your messages")
|
||||
text: !isContact ? qsTr("You need to be mutual contacts with this person for them to receive your messages") :
|
||||
qsTr("Waiting for %1 to accept your request").arg(Utils.removeStatusEns(chatsModel.activeChannel.name))
|
||||
anchors.top: waveImg.bottom
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
|
@ -29,7 +30,8 @@ Item {
|
|||
|
||||
StyledText {
|
||||
id: contactText2
|
||||
text: qsTr("Just click this button to add them as contact. They will receive a notification all once they accept you as contact as well, you'll be able to chat")
|
||||
visible: !isContact
|
||||
text: qsTr("Just click this button to add them as contact. They will receive a notification. Once they accept the request, you'll be able to chat")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.top: contactText1.bottom
|
||||
|
@ -39,6 +41,7 @@ Item {
|
|||
}
|
||||
|
||||
StatusButton {
|
||||
visible: !isContact
|
||||
text: qsTr("Add to contacts")
|
||||
anchors.top: contactText2.bottom
|
||||
anchors.topMargin: Style.current.smallPadding
|
||||
|
|
|
@ -125,7 +125,10 @@ Rectangle {
|
|||
if (!appSettings.notifyOnNewRequests) {
|
||||
return
|
||||
}
|
||||
systemTray.showMessage(qsTr("New contact request"),
|
||||
const isContact = profileModel.contacts.isAdded(address)
|
||||
systemTray.showMessage(isContact ? qsTr("Contact request accepted") :
|
||||
qsTr("New contact request"),
|
||||
isContact ? qsTr("You can now chat with %1").arg(Utils.removeStatusEns(name)) :
|
||||
qsTr("%1 requests to become contacts").arg(Utils.removeStatusEns(name)),
|
||||
SystemTrayIcon.NoIcon,
|
||||
Constants.notificationPopupTTL)
|
||||
|
|
Loading…
Reference in New Issue