Add QR code next to DM link

This commit is contained in:
10G Meow 2023-06-23 11:48:29 +03:00
parent 7a775a6ca5
commit 0daa3358ae
2 changed files with 81 additions and 80 deletions

View file

@ -78,16 +78,7 @@
{{ $t("room_info.created_by", { user: creator }) }}
</div>
</div>
<copy-link :locationLink="publicRoomLink" i18nCopyLinkKey="copy_invite_link">
<template slot="qrCode">
<canvas
@click.stop="showFullScreenQR = true"
ref="roomQr"
class="qr"
id="room-qr"
></canvas>
</template>
</copy-link>
<copy-link :locationLink="publicRoomLink" i18nCopyLinkKey="copy_invite_link" />
<v-card class="account ma-3" flat>
<v-card-title class="h2">{{ $t("room_info.permissions") }}</v-card-title>
@ -258,8 +249,6 @@
@close="showPurgeConfirmation = false"
/>
<QRCodePopup :show="showFullScreenQR" :message="publicRoomLink" @close="showFullScreenQR = false" />
<RoomExport :room="room" v-if="exporting" v-on:close="exporting = false" />
</div>
</template>
@ -271,9 +260,7 @@ import DeviceList from "../components/DeviceList";
import RoomExport from "../components/RoomExport";
import RoomAvatarPicker from "../components/RoomAvatarPicker";
import CopyLink from "../components/CopyLink.vue"
import QRCode from "qrcode";
import roomInfoMixin from "./roomInfoMixin";
import QRCodePopup from './QRCodePopup.vue';
import util from "../plugins/utils";
export default {
@ -284,7 +271,6 @@ export default {
PurgeRoomDialog,
DeviceList,
RoomExport,
QRCodePopup,
RoomAvatarPicker,
CopyLink
},
@ -296,7 +282,6 @@ export default {
showAllMembers: false,
showLeaveConfirmation: false,
showPurgeConfirmation: false,
showFullScreenQR: false,
expandedMembers: [],
buildVersion: "",
updatingJoinRule: false, // Flag if we are processing update curerntly
@ -322,9 +307,6 @@ export default {
this.user = this.$matrix.matrixClient.getUser(this.$matrix.currentUserId);
this.displayName = this.user.displayName;
// Set QR code
this.updateQRCode();
// Display build version
const version = require("!!raw-loader!../assets/version.txt").default;
console.log("Version", version);
@ -383,13 +365,9 @@ export default {
watch: {
room: {
handler(ignoredNewVal, ignoredOldVal) {
handler() {
console.log("RoomInfo: Current room changed");
this.updateMembers();
this.$nextTick(() => {
// Wait a tick, we want to be sure that the QR canvas ref is already created!
this.updateQRCode();
});
},
},
},
@ -432,26 +410,6 @@ export default {
}
},
updateQRCode() {
var fullUrl = this.publicRoomLink;
var canvas = this.$refs.roomQr;
if (fullUrl && canvas) {
QRCode.toCanvas(
canvas,
fullUrl,
{
type: "image/png",
margin: 1,
width: 60,
},
function (error) {
if (error) console.error(error);
else console.log("success!");
}
);
}
},
memberAvatar(member) {
if (member) {
return member.getAvatarUrl(
@ -520,7 +478,6 @@ export default {
})
.finally(() => {
this.updatingJoinRule = false;
this.updateQRCode();
});
},
startPrivateChat(userId) {