Sessions: remove profile info, restore list design

This commit is contained in:
nephros 2021-12-15 10:36:26 +01:00
parent f8bc0df74a
commit 3786a0cb3f

View file

@ -57,80 +57,10 @@ AccordionItem {
} }
} }
ResponsiveGrid {
bottomPadding: Theme.paddingMedium
width: parent.width
Loader {
id: userInformationLoader
active: tdLibWrapper.authorizationState === TelegramAPI.AuthorizationReady
width: parent.columnWidth
sourceComponent: Component {
Column {
anchors.topMargin: Theme.paddingMedium
spacing: Theme.paddingMedium
Text {
x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin )
horizontalAlignment: Text.AlignHCenter
text: qsTr("Logged in as %1").arg(Emoji.emojify(activeSessionsItem.userInformation.first_name + " " + activeSessionsItem.userInformation.last_name, Theme.fontSizeSmall))
font.pixelSize: Theme.fontSizeSmall
wrapMode: Text.Wrap
color: Theme.primaryColor
textFormat: Text.StyledText
anchors {
horizontalCenter: parent.horizontalCenter
}
}
ProfileThumbnail {
photoData: ((typeof activeSessionsItem.userInformation.profile_photo !== "undefined") ? activeSessionsItem.userInformation.profile_photo.small : {})
width: Theme.itemSizeExtraLarge
height: Theme.itemSizeExtraLarge
replacementStringHint: activeSessionsItem.userInformation.first_name + " " + activeSessionsItem.userInformation.last_name
anchors {
horizontalCenter: parent.horizontalCenter
}
}
Label {
x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin )
horizontalAlignment: Text.AlignHCenter
text: qsTr("Phone number: +%1").arg(activeSessionsItem.userInformation.phone_number)
font.pixelSize: Theme.fontSizeSmall
wrapMode: Text.Wrap
anchors {
horizontalCenter: parent.horizontalCenter
}
}
BackgroundItem {
id: logOutItem
width: parent.width
function showRemorseItem() {
remorse.execute(logOutItem, qsTr("Logged out"), function() {
tdLibWrapper.logout();
pageStack.pop();
});
}
RemorseItem { id: remorse }
Button {
id: logOutButton
text: qsTr("Log Out")
anchors.horizontalCenter: parent.horizontalCenter
onClicked: logOutItem.showRemorseItem()
}
}
}
}
}
Loader { Loader {
id: sessionInformationLoader id: sessionInformationLoader
active: tdLibWrapper.authorizationState === TelegramAPI.AuthorizationReady active: tdLibWrapper.authorizationState === TelegramAPI.AuthorizationReady
width: parent.columnWidth width: parent.width
sourceComponent: Component { sourceComponent: Component {
SilicaListView { SilicaListView {
id: activeSessionsListView id: activeSessionsListView
@ -163,14 +93,6 @@ AccordionItem {
} }
} }
Rectangle {
height: parent.height - Theme.paddingSmall
width: parent.width
anchors.centerIn: parent
visible: modelData.is_current
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.opacityFaint)
}
Column { Column {
id: activeSessionColumn id: activeSessionColumn
width: parent.width - ( 2 * Theme.horizontalPageMargin ) width: parent.width - ( 2 * Theme.horizontalPageMargin )
@ -180,9 +102,20 @@ AccordionItem {
Label { Label {
width: parent.width width: parent.width
property string hltext: modelData.is_current ? " (" + qsTr("this app") + ")" : "" text: qsTr("This app")
text: Theme.highlightText( modelData.application_name + " " + modelData.application_version + hltext, hltext, Theme.highlightColor) font.pixelSize: Theme.fontSizeMedium
font.pixelSize: modelData.is_current ? Theme.fontSizeMedium : Theme.fontSizeSmall font.bold: true
visible: modelData.is_current
color: Theme.highlightColor
anchors {
horizontalCenter: parent.horizontalCenter
}
}
Label {
width: parent.width
text: modelData.application_name + " " + modelData.application_version
font.pixelSize: Theme.fontSizeMedium
font.bold: true font.bold: true
color: Theme.primaryColor color: Theme.primaryColor
maximumLineCount: 1 maximumLineCount: 1
@ -248,5 +181,4 @@ AccordionItem {
} }
} }
} }
}
} }