Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding device verification to user profile #203

Closed
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2e0afde
First design iteration of device verification dialogs
deepbluev7 Mar 8, 2020
b6997db
Add DeviceVerificationFlow dummy and verification test button
deepbluev7 Mar 13, 2020
01a7e0c
Set proper emoji font for device verification
deepbluev7 Mar 14, 2020
b3495bd
Make emojis a bit smaller
deepbluev7 Mar 20, 2020
42a7ac2
Use label in device verification dialogs (for proper theming)
deepbluev7 Mar 30, 2020
689894f
Add DeviceVerificationFlow dummy and verification test button
deepbluev7 Mar 13, 2020
07823f8
Rewrite UserProfile in qml
Chethan2k1 May 17, 2020
2d23353
Adding DeviceList for userprofile
Chethan2k1 May 22, 2020
a4d9cc4
Add C++ Model for DeviceList
Chethan2k1 May 27, 2020
24f59ae
Tweak UI for device verification and Add more slots
Chethan2k1 Jun 4, 2020
0035cc6
Add SAS Method choice and Add send_to_device API call
Chethan2k1 Jun 7, 2020
bbaf15b
Handle Device Verification related to_device messages
Chethan2k1 Jun 9, 2020
8da77bc
Add DeviceVerificationList to keep track of all flows and Popup on
Chethan2k1 Jun 17, 2020
30aaf8c
Shared secret with decimal and emoji works!
Chethan2k1 Jun 20, 2020
33c13ee
Add some more slots and mac
Chethan2k1 Jun 22, 2020
0d8bbfe
Some Improvements
Chethan2k1 Jun 23, 2020
7cc2df9
Some more changes
Chethan2k1 Jun 24, 2020
ff1176e
Fix presence indicator
deepbluev7 Jun 24, 2020
26874eb
Some more fixes
Chethan2k1 Jun 25, 2020
303ceb9
Fix the Weird auto-confirmation and cancellation
Chethan2k1 Jun 25, 2020
2edbf57
Add some Userprofile buttons
Chethan2k1 Jun 25, 2020
2f1d026
Error Handling and some fixes
Chethan2k1 Jun 26, 2020
362ab16
[WIP] Add Caching for users
Chethan2k1 Jun 28, 2020
9e3f900
Some issue with UserProfile
Chethan2k1 Jul 1, 2020
c7e1600
Refactor UserProfile
deepbluev7 Jul 4, 2020
fcbff88
Adding icons to UserProfile
Chethan2k1 Jul 5, 2020
eb80360
Updating keys of outdated encrypted users
Chethan2k1 Jul 6, 2020
ce2acbd
Adding Room Key Verification Stuff
Chethan2k1 Jul 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ set(SRC_FILES
src/ui/ToggleButton.cpp
src/ui/Theme.cpp
src/ui/ThemeManager.cpp
src/ui/UserProfile.cpp
src/ui/UserProfileModel.cpp

src/AvatarProvider.cpp
src/BlurhashProvider.cpp
Expand All @@ -285,6 +287,7 @@ set(SRC_FILES
src/ColorImageProvider.cpp
src/CommunitiesList.cpp
src/CommunitiesListItem.cpp
src/DeviceVerificationFlow.cpp
src/EventAccessors.cpp
src/InviteeItem.cpp
src/Logging.cpp
Expand Down Expand Up @@ -479,6 +482,8 @@ qt5_wrap_cpp(MOC_HEADERS
src/ui/ToggleButton.h
src/ui/Theme.h
src/ui/ThemeManager.h
src/ui/UserProfile.h
src/ui/UserProfileModel.h

src/notifications/Manager.h

Expand All @@ -488,6 +493,7 @@ qt5_wrap_cpp(MOC_HEADERS
src/ChatPage.h
src/CommunitiesList.h
src/CommunitiesListItem.h
src/DeviceVerificationFlow.h
src/InviteeItem.h
src/LoginPage.h
src/MainWindow.h
Expand Down
12 changes: 6 additions & 6 deletions resources/qml/Avatar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ Rectangle {
height: avatar.height / 6
width: height
radius: settings.avatarCircles ? height / 2 : height / 4
color: switch (timelineManager.userPresence(userid)) {
case "online": return "#00cc66"
case "unavailable": return "#ff9933"
case "offline": return "#a82353"
default: "transparent"
}
// color: switch (timelineManager.userPresence(userid)) {
Chethan2k1 marked this conversation as resolved.
Show resolved Hide resolved
// case "online": return "#00cc66"
// case "unavailable": return "#ff9933"
// case "offline": return "#a82353"
// default: "transparent"
// }
}

color: colors.base
Expand Down
46 changes: 35 additions & 11 deletions resources/qml/TimelineView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import im.nheko.EmojiModel 1.0

import "./delegates"
import "./emoji"
import "./device-verification"

Page {
property var colors: currentActivePalette
Expand Down Expand Up @@ -93,6 +94,24 @@ Page {
anchors.fill: parent
color: colors.window

Component {
id: deviceVerificationDialog
DeviceVerification {}
}
Connections {
target: timelineManager
onNewDeviceVerificationRequest: {
flow.userId = userId;
flow.sender = false;
flow.deviceId = deviceId;
flow.tranId = transactionId;
deviceVerificationList.add(flow.tranId);
var dialog = deviceVerificationDialog.createObject(timelineRoot,
{flow: flow,sender: false});
Chethan2k1 marked this conversation as resolved.
Show resolved Hide resolved
dialog.show();
}
}

Label {
visible: !timelineManager.timeline && !timelineManager.isInitialSync
anchors.centerIn: parent
Expand Down Expand Up @@ -248,6 +267,9 @@ Page {
color: colors.base
}
}

property variant userProfile

Row {
height: userName.height
spacing: 8
Expand All @@ -261,7 +283,12 @@ Page {

MouseArea {
anchors.fill: parent
onClicked: chat.model.openUserProfile(modelData.userId)
onClicked: {
if(userProfile) userProfile.destroy()
var component = Qt.createComponent("UserProfile.qml");
userProfile = component.createObject(timelineRoot,{user_data : modelData});
Chethan2k1 marked this conversation as resolved.
Show resolved Hide resolved
userProfile.show();
}
cursorShape: Qt.PointingHandCursor
propagateComposedEvents: true
}
Expand All @@ -275,20 +302,17 @@ Page {

MouseArea {
anchors.fill: parent
onClicked: chat.model.openUserProfile(section.split(" ")[0])
Layout.alignment: Qt.AlignHCenter
onClicked: {
if(userProfile) userProfile.destroy()
var component = Qt.createComponent("UserProfile.qml")
userProfile = component.createObject(timelineRoot,{user_data : modelData})
userProfile.show()
}
cursorShape: Qt.PointingHandCursor
propagateComposedEvents: true
}
}

Label {
color: colors.buttonText
text: timelineManager.userStatus(modelData.userId)
textFormat: Text.PlainText
elide: Text.ElideRight
width: chat.delegateMaxWidth - parent.spacing*2 - userName.implicitWidth - avatarSize
font.italic: true
}
}
}
}
Expand Down
155 changes: 155 additions & 0 deletions resources/qml/UserProfile.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.3

import im.nheko 1.0

import "./device-verification"

ApplicationWindow{
property var user_data
property var colors: currentActivePalette

id:userProfileDialog
height: 500
width: 500
modality:Qt.WindowModal
Layout.alignment: Qt.AlignHCenter
palette: colors

UserProfileList{
id: userProfileList
userId: user_data.userId
onUserIdChanged : {
userProfileList.updateDeviceList()
}
onDeviceListUpdated : {
modelDeviceList.deviceList = userProfileList
}
}

Component {
id: deviceVerificationDialog
DeviceVerification {}
}
Component{
id: deviceVerificationFlow
DeviceVerificationFlow {}
}

background: Item{
id: userProfileItem
width: userProfileDialog.width
height: userProfileDialog.height
anchors.margins: {
top:20
}

ColumnLayout{
anchors.fill: userProfileItem
width: userProfileDialog.width
spacing: 10

Avatar{
id: userProfileAvatar
url:chat.model.avatarUrl(user_data.userId).replace("mxc://", "image://MxcImage/")
height: 130
width: 130
displayName: modelData.userName
Layout.alignment: Qt.AlignHCenter
}

Label{
id: userProfileName
Chethan2k1 marked this conversation as resolved.
Show resolved Hide resolved
text: user_data.userName
fontSizeMode: Text.HorizontalFit
Layout.alignment: Qt.AlignHCenter
}

Label{
id: matrixUserID
text: user_data.userId
fontSizeMode: Text.HorizontalFit
Layout.alignment: Qt.AlignHCenter
}
Chethan2k1 marked this conversation as resolved.
Show resolved Hide resolved

ScrollView {
implicitHeight: userProfileDialog.height/2+20
implicitWidth: userProfileDialog.width-20
clip: true
Layout.alignment: Qt.AlignHCenter
ScrollBar.horizontal.policy: ScrollBar.AlwaysOn
ScrollBar.vertical.policy: ScrollBar.AlwaysOn

ListView{
id: deviceList
anchors.fill: parent
clip: true
spacing: 10

model: UserProfileModel{
id: modelDeviceList
}

delegate: RowLayout{
width: parent.width
ColumnLayout{
Text{
Layout.fillWidth: true
color: colors.text
Layout.alignment: Qt.AlignRight
text: deviceID
}
Text{
Layout.fillWidth: true
color:colors.text
Layout.alignment: Qt.AlignRight
text: displayName
}
}
Button{
id: verifyButton
text:"Verify"
onClicked: {
var newFlow = deviceVerificationFlow.createObject(userProfileDialog,
{userId : user_data.userId,sender: true,deviceId : model.deviceID});
deviceVerificationList.add(newFlow.tranId);
var dialog = deviceVerificationDialog.createObject(userProfileDialog,
{flow: newFlow,sender: true});
dialog.show();
}
contentItem: Text {
text: verifyButton.text
color: colors.background
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}
}

Button{
id: okbutton
text:"OK"
onClicked: userProfileDialog.close()
anchors.margins: {
right:10
bottom:10
}

contentItem: Text {
text: okbutton.text
color: colors.background
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}

Layout.alignment: Qt.AlignRight | Qt.AlignBottom
}
}

Item { Layout.fillHeight: true }
}
}
Loading