Skip to content

Commit

Permalink
Merge pull request #618 from Peergos/fix/open-app-check
Browse files Browse the repository at this point in the history
bugfix - multiple app launches
  • Loading branch information
ianopolous committed Sep 19, 2024
2 parents bc2c561 + 4b6f68a commit 49a4296
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
1 change: 1 addition & 0 deletions src/components/viewers/Markup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ module.exports = {
this.showSpinner = false;
},
close: function () {
window.removeEventListener('message', this.messageHandler);
this.$emit("hide-markup-viewer");
},
hasValidFileExtension: function(path, validExtensions, showErrorMessage) {
Expand Down
63 changes: 34 additions & 29 deletions src/views/Drive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ module.exports = {
progressBarUpdateFrequency: 50,
zipAndDownloadFoldersCount: 0,
htmlAnchor: "",
previouslyOpenedApp: {path: '', filename: '', app: ''},
};
},
mixins:[downloaderMixins, router, zipMixin, launcherMixin, i18n, sandboxMixin],
Expand Down Expand Up @@ -1196,10 +1197,12 @@ module.exports = {
},
back() {
this.previouslyOpenedApp = {path: '', filename: '', app: ''};
history.back();
},
showDrive() {
this.previouslyOpenedApp = {path: '', filename: '', app: ''};
this.updateHistory("Drive", this.getPath, {filename:""});
},
Expand Down Expand Up @@ -1260,38 +1263,40 @@ module.exports = {
},
openInApp(args, app) {
if (app == null || app == "" || app == "Drive") {
this.previouslyOpenedApp = {path: '', filename: '', app: ''};
this.closeApps();
return
return;
}
if (this.previouslyOpenedApp.path == this.getPath && this.previouslyOpenedApp.filename == args.filename && this.previouslyOpenedApp.app == app) {
return;
}
this.appArgs = args;
this.selectedFiles = this.files.filter(f => f.getName() == args.filename);
this.openApp(app);
},
openApp(app) {
let that = this;
this.closeApps();
if (app == "Gallery")
that.showGallery = true;
else if (app == "pdf")
that.showPdfViewer = true;
else if (app == "editor")
that.showCodeEditor = true;
else if (app == "identity-proof")
that.showIdentityProof = true;
else if (app == "hex")
that.showHexViewer = true;
else if (app == "markdown" || app == "markup")
that.showMarkupViewer = true;
else if (app == "htmlviewer") {
that.sandboxAppName = "htmlviewer";
that.currentFile= that.selectedFiles[0];
that.currentPath= that.getPath;
that.showAppSandbox = true;
} else if (app == "search") {
that.showSearch = true;
} else {
that.appOpen(app);
}
this.selectedFiles = this.files.filter(f => f.getName() == args.filename);
let that = this;
this.closeApps();
if (app == "Gallery")
that.showGallery = true;
else if (app == "pdf")
that.showPdfViewer = true;
else if (app == "editor")
that.showCodeEditor = true;
else if (app == "identity-proof")
that.showIdentityProof = true;
else if (app == "hex")
that.showHexViewer = true;
else if (app == "markdown" || app == "markup")
that.showMarkupViewer = true;
else if (app == "htmlviewer") {
that.sandboxAppName = "htmlviewer";
that.currentFile= that.selectedFiles[0];
that.currentPath= that.getPath;
that.showAppSandbox = true;
} else if (app == "search") {
that.showSearch = true;
} else {
that.appOpen(app);
}
this.previouslyOpenedApp = {path: this.getPath, filename: args.filename, app: app};
},
openSearch(fromRoot) {
var path = fromRoot ? "/" + this.context.username : this.getPath;
Expand Down

0 comments on commit 49a4296

Please sign in to comment.