File tree Expand file tree Collapse file tree 8 files changed +42
-80
lines changed
Expand file tree Collapse file tree 8 files changed +42
-80
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ import NcTextField from '@nextcloud/vue/components/NcTextField'
140140import UploadProgress from ' ../UploadProgress.vue'
141141
142142import { FILE_STATUS , ENVELOPE_NAME_MIN_LENGTH , ENVELOPE_NAME_MAX_LENGTH } from ' ../../constants.js'
143+ import { openDocument } from ' ../../utils/viewer.js'
143144import { useFilesStore } from ' ../../store/files.js'
144145
145146export default {
@@ -357,20 +358,11 @@ export default {
357358 },
358359 openFile (file ) {
359360 const fileUrl = generateUrl (' /apps/libresign/p/pdf/{uuid}' , { uuid: file .uuid })
360- if (OCA ? .Viewer !== undefined ) {
361- const fileInfo = {
362- source: fileUrl,
363- basename: file .name ,
364- mime: ' application/pdf' ,
365- fileid: file .id ,
366- }
367- OCA .Viewer .open ({
368- fileInfo,
369- list: [fileInfo],
370- })
371- } else {
372- window .open (` ${ fileUrl} ?_t=${ Date .now ()} ` )
373- }
361+ openDocument ({
362+ fileUrl,
363+ filename: file .name ,
364+ nodeId: file .id ,
365+ })
374366 },
375367 isSelected (fileId ) {
376368 return this .selectedFiles .includes (fileId)
Original file line number Diff line number Diff line change @@ -305,6 +305,7 @@ import VisibleElements from '../Request/VisibleElements.vue'
305305import svgSignal from ' ../../../img/logo-signal-app.svg?raw'
306306import svgTelegram from ' ../../../img/logo-telegram-app.svg?raw'
307307import { FILE_STATUS } from ' ../../constants.js'
308+ import { openDocument } from ' ../../utils/viewer.js'
308309import router from ' ../../router/router.js'
309310import { useFilesStore } from ' ../../store/files.js'
310311import { useSidebarStore } from ' ../../store/sidebar.js'
@@ -1033,20 +1034,11 @@ export default {
10331034 return
10341035 }
10351036
1036- if (OCA ? .Viewer !== undefined ) {
1037- const fileInfo = {
1038- source: fileUrl,
1039- basename: file .name ,
1040- mime: ' application/pdf' ,
1041- fileid: file .nodeId ,
1042- }
1043- OCA .Viewer .open ({
1044- fileInfo,
1045- list: [fileInfo],
1046- })
1047- } else {
1048- window .open (` ${ fileUrl} ?_t=${ Date .now ()} ` )
1049- }
1037+ openDocument ({
1038+ fileUrl,
1039+ filename: file .name ,
1040+ nodeId: file .nodeId ,
1041+ })
10501042 },
10511043 startSigningProgressPolling () {
10521044 const file = this .filesStore .getFile ()
Original file line number Diff line number Diff line change @@ -97,9 +97,9 @@ export default {
9797 },
9898 },
9999 methods: {
100- viewDocument () {
100+ async viewDocument () {
101101 const fileUrl = generateUrl (' /apps/libresign/p/pdf/{uuid}' , { uuid: this .document .uuid })
102- openDocument ({
102+ await openDocument ({
103103 fileUrl,
104104 filename: this .document .name ,
105105 nodeId: this .document .nodeId ,
Original file line number Diff line number Diff line change @@ -177,6 +177,7 @@ import {
177177} from ' @mdi/js'
178178import Moment from ' @nextcloud/moment'
179179import { getStatusLabel } from ' ../../utils/fileStatus.js'
180+ import { openDocument } from ' ../../utils/viewer.js'
180181import SignerDetails from ' ./SignerDetails.vue'
181182import DocumentValidationDetails from ' ./DocumentValidationDetails.vue'
182183
@@ -243,20 +244,11 @@ export default {
243244 },
244245 viewFile (file ) {
245246 const fileUrl = generateUrl (' /apps/libresign/p/pdf/{uuid}' , { uuid: file .uuid })
246- if (OCA ? .Viewer !== undefined ) {
247- const fileInfo = {
248- source: fileUrl,
249- basename: file .name ,
250- mime: ' application/pdf' ,
251- fileid: file .nodeId ,
252- }
253- OCA .Viewer .open ({
254- fileInfo,
255- list: [fileInfo],
256- })
257- } else {
258- window .open (` ${ fileUrl} ?_t=${ Date .now ()} ` )
259- }
247+ openDocument ({
248+ fileUrl,
249+ filename: file .name ,
250+ nodeId: file .nodeId ,
251+ })
260252 },
261253 },
262254}
Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ import axios from '@nextcloud/axios'
165165import { showError } from ' @nextcloud/dialogs'
166166import { generateOcsUrl } from ' @nextcloud/router'
167167
168+ import { openDocument } from ' ../../utils/viewer.js'
168169import { useUserConfigStore } from ' ../../store/userconfig.js'
169170
170171import NcActions from ' @nextcloud/vue/dist/Components/NcActions.js'
@@ -352,20 +353,11 @@ export default {
352353 return
353354 }
354355
355- if (OCA ? .Viewer !== undefined ) {
356- const fileInfo = {
357- source: fileUrl,
358- basename: doc .file .name ,
359- mime: ' application/pdf' ,
360- fileid: doc .nodeId ,
361- }
362- OCA .Viewer .open ({
363- fileInfo,
364- list: [fileInfo],
365- })
366- } else {
367- window .open (` ${ fileUrl} ?_t=${ Date .now ()} ` )
368- }
356+ openDocument ({
357+ fileUrl,
358+ filename: doc .file .name ,
359+ nodeId: doc .nodeId ,
360+ })
369361 },
370362
371363 openValidationURL (doc ) {
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ import svgTextBoxCheck from '@mdi/svg/svg/text-box-check.svg?raw'
6868import { loadState } from ' @nextcloud/initial-state'
6969import { generateUrl } from ' @nextcloud/router'
7070
71+ import { openDocument } from ' ../../../utils/viewer.js'
7172import NcActionButton from ' @nextcloud/vue/components/NcActionButton'
7273import NcActions from ' @nextcloud/vue/components/NcActions'
7374import NcButton from ' @nextcloud/vue/components/NcButton'
@@ -248,20 +249,11 @@ export default {
248249 const fileUrl = this .source .file
249250 || generateUrl (' /apps/libresign/p/pdf/{uuid}' , { uuid: this .source .uuid })
250251
251- if (OCA ? .Viewer !== undefined ) {
252- const fileInfo = {
253- source: fileUrl,
254- basename: this .source .name ,
255- mime: ' application/pdf' ,
256- fileid: this .source .nodeId ,
257- }
258- OCA .Viewer .open ({
259- fileInfo,
260- list: [fileInfo],
261- })
262- } else {
263- window .open (` ${ fileUrl} ?_t=${ Date .now ()} ` )
264- }
252+ openDocument ({
253+ fileUrl,
254+ filename: this .source .name ,
255+ nodeId: this .source .nodeId ,
256+ })
265257 },
266258 doRename (newName ) {
267259 return this .filesStore .rename (this .source .uuid , newName)
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ import axios from '@nextcloud/axios'
6969import { loadState } from ' @nextcloud/initial-state'
7070import { generateOcsUrl } from ' @nextcloud/router'
7171
72+ import { openDocument } from ' ../../utils/viewer.js'
7273import NcButton from ' @nextcloud/vue/components/NcButton'
7374import NcLoadingIcon from ' @nextcloud/vue/components/NcLoadingIcon'
7475import NcNoteCard from ' @nextcloud/vue/components/NcNoteCard'
@@ -112,11 +113,11 @@ export default {
112113 },
113114 methods: {
114115 view () {
115- if ( OCA ? . Viewer !== undefined ) {
116- OCA . Viewer . open ({ path : this .CPS })
117- } else {
118- window . open ( ` ${ this . CPS } ?_t= ${ Date . now () } ` )
119- }
116+ openDocument ( {
117+ fileUrl : this .CPS ,
118+ filename : ' Certificate Policy ' ,
119+ nodeId : null ,
120+ })
120121 },
121122 activateLocalFilePicker () {
122123 // Set to null so that selecting the same file will trigger the change event
Original file line number Diff line number Diff line change @@ -406,9 +406,10 @@ export default {
406406 }
407407 return mdiAlertCircle
408408 },
409- viewDocument () {
410- openDocument ({
411- fileUrl: file .file ,
409+ async viewDocument () {
410+ const fileUrl = generateUrl (' /apps/libresign/p/pdf/{uuid}' , { uuid: this .document .uuid })
411+ await openDocument ({
412+ fileUrl,
412413 filename: this .document .name ,
413414 nodeId: this .document .nodeId ,
414415 })
You can’t perform that action at this time.
0 commit comments