浏览代码

VLCDropBoxController: sort dropbox files before presenting

(cherry picked from commit 73bd72ee5d8e4172bccc5e4a3d1646265b7dfb65)
Carola Nitz 7 年之前
父节点
当前提交
f5730272aa
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Sources/VLCDropboxController.m

+ 5 - 1
Sources/VLCDropboxController.m

@@ -198,7 +198,11 @@
     }
     [[[self client].filesRoutes listFolder:path] setResponseBlock:^(DBFILESListFolderResult * _Nullable result, DBFILESListFolderError * _Nullable routeError, DBRequestError * _Nullable networkError) {
         if (result) {
-            _currentFileList = [NSArray arrayWithArray:result.entries];
+            _currentFileList = [result.entries sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
+                NSString *first = [(DBFILESMetadata*)a name];
+                NSString *second = [(DBFILESMetadata*)b name];
+                return [first caseInsensitiveCompare:second];
+            }];
             APLog(@"found filtered metadata for %lu files", (unsigned long)_currentFileList.count);
             if ([self.delegate respondsToSelector:@selector(mediaListUpdated)])
                 [self.delegate mediaListUpdated];