mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Fix unjoinable invites on mobile as well as unclickable previews
This commit is contained in:
parent
912a8c43b2
commit
1a163f49e2
4 changed files with 27 additions and 6 deletions
|
@ -21,7 +21,7 @@ Rectangle {
|
|||
|
||||
anchors.fill: parent
|
||||
singlePageMode: communityListC.preferredWidth + roomListC.preferredWidth + timlineViewC.minimumWidth > width
|
||||
pageIndex: Rooms.currentRoom ? 2 : 1
|
||||
pageIndex: (Rooms.currentRoom || Rooms.currentRoomPreview.roomid) ? 2 : 1
|
||||
|
||||
AdaptiveLayoutElement {
|
||||
id: communityListC
|
||||
|
|
|
@ -192,6 +192,7 @@ Page {
|
|||
TapHandler {
|
||||
margin: -Nheko.paddingSmall
|
||||
onSingleTapped: {
|
||||
console.log("tapped "+roomId);
|
||||
if (!Rooms.currentRoom || Rooms.currentRoom.roomId !== roomId)
|
||||
Rooms.setCurrentRoom(roomId);
|
||||
else
|
||||
|
|
|
@ -24,7 +24,7 @@ Item {
|
|||
property bool showBackButton: false
|
||||
|
||||
Label {
|
||||
visible: !room && !TimelineManager.isInitialSync && !roomPreview
|
||||
visible: !room && !TimelineManager.isInitialSync && (!roomPreview || !roomPreview.roomid)
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("No room open")
|
||||
font.pointSize: 24
|
||||
|
@ -137,7 +137,7 @@ Item {
|
|||
ColumnLayout {
|
||||
id: preview
|
||||
|
||||
property string roomId: room ? room.roomId : (roomPreview ? roomPreview.roomId : "")
|
||||
property string roomId: room ? room.roomId : (roomPreview ? roomPreview.roomid : "")
|
||||
property string roomName: room ? room.roomName : (roomPreview ? roomPreview.roomName : "")
|
||||
property string roomTopic: room ? room.roomTopic : (roomPreview ? roomPreview.roomTopic : "")
|
||||
property string avatarUrl: room ? room.roomAvatarUrl : (roomPreview ? roomPreview.roomAvatarUrl : "")
|
||||
|
@ -163,7 +163,7 @@ Item {
|
|||
}
|
||||
|
||||
MatrixText {
|
||||
text: parent.roomName
|
||||
text: parent.roomName == "" ? qsTr("No preview available") : parent.roomName
|
||||
font.pixelSize: 24
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ Item {
|
|||
anchors.margins: Nheko.paddingMedium
|
||||
width: Nheko.avatarSize
|
||||
height: Nheko.avatarSize
|
||||
visible: room != null && room.isSpace && showBackButton
|
||||
visible: (room == null || room.isSpace) && showBackButton
|
||||
enabled: visible
|
||||
image: ":/icons/icons/ui/angle-pointing-to-left.png"
|
||||
ToolTip.visible: hovered
|
||||
|
|
|
@ -609,6 +609,12 @@ RoomlistModel::setCurrentRoom(QString roomid)
|
|||
(currentRoomPreview_ && currentRoomPreview_->roomid() == roomid))
|
||||
return;
|
||||
|
||||
if (roomid.isEmpty()) {
|
||||
currentRoom_ = nullptr;
|
||||
currentRoomPreview_ = {};
|
||||
emit currentRoomChanged();
|
||||
}
|
||||
|
||||
nhlog::ui()->debug("Trying to switch to: {}", roomid.toStdString());
|
||||
if (models.contains(roomid)) {
|
||||
currentRoom_ = models.value(roomid);
|
||||
|
@ -635,10 +641,24 @@ RoomlistModel::setCurrentRoom(QString roomid)
|
|||
p.roomTopic_ = QString::fromStdString(i->topic);
|
||||
p.roomAvatarUrl_ = QString::fromStdString(i->avatar_url);
|
||||
currentRoomPreview_ = std::move(p);
|
||||
nhlog::ui()->debug("Switched to (preview): {}",
|
||||
currentRoomPreview_->roomid_.toStdString());
|
||||
} else {
|
||||
p.roomid_ = roomid;
|
||||
currentRoomPreview_ = p;
|
||||
nhlog::ui()->debug("Switched to (empty): {}",
|
||||
currentRoomPreview_->roomid_.toStdString());
|
||||
}
|
||||
|
||||
emit currentRoomChanged();
|
||||
nhlog::ui()->debug("Switched to: {}", roomid.toStdString());
|
||||
} else {
|
||||
currentRoom_ = nullptr;
|
||||
|
||||
RoomPreview p;
|
||||
p.roomid_ = roomid;
|
||||
currentRoomPreview_ = std::move(p);
|
||||
emit currentRoomChanged();
|
||||
nhlog::ui()->debug("Switched to (empty): {}", roomid.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue