feat: add profile popup for the empty chat view

This commit is contained in:
Jonathan Rainville 2020-07-09 13:12:28 -04:00 committed by Iuri Matias
parent b3b7047fe1
commit 3d19e9ed74
4 changed files with 18 additions and 3 deletions

View File

@ -239,7 +239,11 @@ QtObject:
proc isEnsVerified*(self: ChatsView, id: string): bool {.slot.} =
if id == "": return false
self.status.contacts.getContactByID(id).ensVerified
let contact = self.status.contacts.getContactByID(id)
if contact == nil:
return false
result = contact.ensVerified
proc formatENSUsername*(self: ChatsView, username: string): string {.slot.} =
result = status_ens.addDomain(username)

View File

@ -18,7 +18,7 @@ proc getContactByID*(self: ContactModel, id: string): Profile =
let response = status_contacts.getContactByID(id)
# TODO: change to options
let responseResult = parseJSON($response)["result"]
if responseResult.kind == JNull:
if responseResult == nil or responseResult.kind == JNull:
result = nil
else:
result = toProfileModel(parseJSON($response)["result"])

View File

@ -32,7 +32,9 @@ Item {
color: Style.current.darkGrey
onLinkActivated: function (linkClicked) {
switch (linkClicked) {
case "shareKey": console.log('Go to share key'); break;
case "shareKey":
profilePopup.openPopup(profileModel.profile.username, profileModel.profile.pubKey, profileModel.profile.identicon);
break;
case "invite": inviteFriendsPopup.open(); break;
default: //no idea what was clicked
}
@ -42,6 +44,12 @@ Item {
InviteFriendsPopup {
id: inviteFriendsPopup
}
ProfilePopup {
id: profilePopup
height: 330
noFooter: true
}
}
/*##^##
Designer {

View File

@ -12,6 +12,7 @@ ModalPopup {
property var fromAuthor: ""
property bool showQR: false
property bool isEnsVerified: false
property bool noFooter: false
function openPopup(userNameParam, fromAuthorParam, identiconParam) {
this.showQR = false
@ -234,6 +235,8 @@ ModalPopup {
}
footer: Item {
id: footerContainer
visible: !noFooter
width: parent.width
height: children[0].height