+
@@ -207,6 +256,8 @@ import util from "../plugins/utils";
import profileInfoMixin from "./profileInfoMixin";
import LogoutRoomDialog from './LogoutRoomDialog.vue';
import CopyLink from "./CopyLink.vue"
+import { requestNotificationPermission, windowNotificationPermission } from "../plugins/notificationAndServiceWorker.js"
+import { mapState } from 'vuex'
export default {
name: "Profile",
@@ -234,7 +285,8 @@ export default {
passwordErrorMessage: null,
isAvatarLoaded: true,
loadValue: 0,
- newPasswordHasError: false
+ newPasswordHasError: false,
+ notificationDialog: false
};
},
@@ -252,7 +304,13 @@ export default {
this.newPassword2 &&
this.newPassword1 == this.newPassword2
);
- }
+ },
+ notificationIcon() {
+ return this.globalNotification ? 'notifications_active' : 'notifications_off';
+ },
+ ...mapState([
+ 'globalNotification'
+ ])
},
methods: {
@@ -306,7 +364,53 @@ export default {
console.log("Progress: " + JSON.stringify(progress));
});
},
+ updateGlobalNotificationStore(flag) {
+ this.$store.commit('setGlobalNotification', flag);
+ },
+ windowNotificationPermission,
+ onUpdateGlobalNotification(showAlertOrDialog = true) {
+ const permission = this.windowNotificationPermission();
+
+ switch (permission) {
+ case 'denied':
+ this.updateGlobalNotificationStore(false);
+ if (showAlertOrDialog) {
+ alert(this.$t("notification.blocked_message"));
+ }
+ break;
+ case 'granted':
+ this.updateGlobalNotificationStore(!this.globalNotification);
+ break;
+ case 'default':
+ if (showAlertOrDialog) {
+ this.notificationDialog = true;
+ }
+ this.updateGlobalNotificationStore(!this.globalNotification);
+ break;
+ default:
+ alert(this.$t("notification.not_supported"));
+ }
+ },
+ async onNotifyDialog() {
+ const permission = await requestNotificationPermission()
+ if(permission === 'denied') {
+ this.updateGlobalNotificationStore(false);
+ alert(this.$t("notification.blocked_message"));
+ } else {
+ this.updateGlobalNotificationStore(true);
+ }
+ this.notificationDialog = false;
+ },
+ onNotifyDialogClosed() {
+ this.updateGlobalNotificationStore(false);
+ this.notificationDialog = false;
+ }
},
+ mounted() {
+ if(this.globalNotification && this.windowNotificationPermission() !== 'granted') {
+ this.onUpdateGlobalNotification(false);
+ }
+ }
};
diff --git a/src/components/RoomExport.vue b/src/components/RoomExport.vue
index 769af2a..6038c77 100644
--- a/src/components/RoomExport.vue
+++ b/src/components/RoomExport.vue
@@ -84,11 +84,10 @@ import RoomEncrypted from "./messages/RoomEncrypted.vue";
import RoomDeletionNotice from "./messages/RoomDeletionNotice.vue";
import DebugEvent from "./messages/DebugEvent.vue";
import MessageOperations from "./messages/MessageOperations.vue";
-import AvatarOperations from "./messages/AvatarOperations.vue";
import ChatHeader from "./ChatHeader.vue";
import VoiceRecorder from "./VoiceRecorder.vue";
import RoomInfoBottomSheet from "./RoomInfoBottomSheet.vue";
-import CreatedRoomWelcomeHeader from "./CreatedRoomWelcomeHeader.vue";
+import WelcomeHeaderRoom from "./welcome_headers/WelcomeHeaderRoom.vue";
import MessageOperationsBottomSheet from "./MessageOperationsBottomSheet.vue";
import StickerPickerBottomSheet from "./StickerPickerBottomSheet.vue";
import BottomSheet from "./BottomSheet.vue";
@@ -137,11 +136,10 @@ export default {
MessageOperations,
VoiceRecorder,
RoomInfoBottomSheet,
- CreatedRoomWelcomeHeader,
+ WelcomeHeaderRoom,
MessageOperationsBottomSheet,
StickerPickerBottomSheet,
BottomSheet,
- AvatarOperations,
CreatePollDialog,
},
props: {
@@ -264,7 +262,7 @@ export default {
if (parentEvent) {
Vue.set(parentEvent, "isMxThread", true);
Vue.set(event, "parentThread", parentEvent);
- }
+ }
});
this.events.filter(event => (event.replyEventId && !event.replyEvent)).forEach(event => {
const parentEvent = this.timelineSet.findEventById(event.replyEventId) || this.room.findEventById(event.replyEventId);
@@ -287,6 +285,7 @@ export default {
var imageFolder = zip.folder("images");
var audioFolder = zip.folder("audio");
var videoFolder = zip.folder("video");
+ var filesFolder = zip.folder("files");
var downloadPromises = [];
let components = this.$refs.exportedEvent;
@@ -321,7 +320,8 @@ export default {
for (let imageIndex = 0; imageIndex < images.length; imageIndex++) {
const img = images[imageIndex];
img.onerror = undefined;
- img.src = './avatars/' + fileName;
+ img.removeAttribute("src");
+ img.setAttribute("data-exported-src", './avatars/' + fileName);
}
}
}
@@ -421,13 +421,15 @@ export default {
var extension = ".mp3";
let fileName = comp.event.getId() + extension;
audioFolder.file(fileName, blob); // TODO calc bytes
+ //this.$nextTick(() => {
let elements = comp.$el.getElementsByTagName("audio");
let element = elements && elements[0];
if (element) {
- element.src = "./audio/" + fileName;
+ element.setAttribute("data-exported-src", "./audio/" + fileName);
}
this.processedEvents += 1;
resolve(true);
+ //});
});
}
})
@@ -449,13 +451,36 @@ export default {
var extension = ".mp4";
let fileName = comp.event.getId() + extension;
videoFolder.file(fileName, blob); // TODO calc bytes
+// comp.src = "./video/" + fileName;
let elements = comp.$el.getElementsByTagName("video");
let element = elements && elements[0];
if (element) {
- element.src = "./video/" + fileName;
+ element.setAttribute("data-exported-src", "./video/" + fileName);
}
this.processedEvents += 1;
-
+ resolve(true);
+ });
+ }
+ })
+ .catch((ignoredErr) => {
+ this.processedEvents += 1;
+ })
+ );
+ break;
+ case "MessageIncomingFileExport":
+ case "MessageOutgoingFileExport":
+ downloadPromises.push(
+ util
+ .getAttachment(this.$matrix.matrixClient, comp.event, null, true)
+ .then((blob) => {
+ if (currentMediaSize + blob.size <= maxMediaSize) {
+ currentMediaSize += blob.size;
+ return new Promise((resolve, ignoredReject) => {
+ var extension = util.getFileExtension(comp.event);
+ let fileName = comp.event.getId() + extension;
+ filesFolder.file(fileName, blob);
+ comp.href="./files/" + fileName;
+ this.processedEvents += 1;
resolve(true);
});
}
@@ -504,7 +529,8 @@ export default {
getCssRules(root);
this.$nextTick(() => {
- doc += this.$refs.exportRoot.outerHTML;
+ const contentHtml = this.$refs.exportRoot.outerHTML;
+ doc += contentHtml.replaceAll("data-exported-src=", "src=");
doc += "