@@ -184,6 +184,7 @@ import axios from '@nextcloud/axios'
184184import { showError } from ' @nextcloud/dialogs'
185185import { emit , subscribe , unsubscribe } from ' @nextcloud/event-bus'
186186import { registerFileAction , FileAction , Permission , DefaultType } from ' @nextcloud/files'
187+ import getSortingConfig from ' ../services/FileSortingConfig.ts'
187188
188189import isFullscreen from ' @nextcloud/vue/dist/Mixins/isFullscreen.js'
189190import isMobile from ' @nextcloud/vue/dist/Mixins/isMobile.js'
@@ -259,6 +260,7 @@ export default {
259260 comparisonFile: null ,
260261 nextFile: {},
261262 fileList: [],
263+ sortingConfig: null ,
262264
263265 // States
264266 isLoaded: false ,
@@ -570,13 +572,14 @@ export default {
570572 },
571573
572574 methods: {
573- beforeOpen () {
575+ async beforeOpen () {
574576 // initial loading start
575577 this .initiated = true
576578
577579 if (OCA ? .Files ? .Sidebar ? .setFullScreenMode ) {
578580 OCA .Files .Sidebar .setFullScreenMode (true )
579581 }
582+ this .sortingConfig = await getSortingConfig ()
580583 },
581584
582585 /**
@@ -586,7 +589,7 @@ export default {
586589 * @param {string|null} overrideHandlerId the ID of the handler with which to view the files, if any
587590 */
588591 async openFile (path , overrideHandlerId = null ) {
589- this .beforeOpen ()
592+ await this .beforeOpen ()
590593
591594 // cancel any previous request
592595 this .cancelRequestFile ()
@@ -699,7 +702,7 @@ export default {
699702 // sort like the files list
700703 // TODO: implement global sorting API
701704 // https://github.com/nextcloud/server/blob/a83b79c5f8ab20ed9b4d751167417a65fa3c42b8/apps/files/lib/Controller/ApiController.php#L247
702- this .fileList = filteredFiles .sort ((a , b ) => sortCompare (a, b, ' basename ' ))
705+ this .fileList = filteredFiles .sort ((a , b ) => sortCompare (a, b, this . sortingConfig . key , this . sortingConfig . asc ))
703706
704707 // store current position
705708 this .currentIndex = this .fileList .findIndex (file => file .basename === fileInfo .basename )
0 commit comments