浏览代码

coding

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 年之前
父节点
当前提交
6aeb0096e0
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      iOSClient/Main/Create cloud/NCUploadAssets.swift

+ 4 - 1
iOSClient/Main/Create cloud/NCUploadAssets.swift

@@ -155,6 +155,7 @@ struct UploadAssetsView: View {
     @State private var isPresentedAlert = false
     @State private var fileNamePath = NSTemporaryDirectory() + "Photo.jpg"
     @State private var renameFileName: String = ""
+    @State private var renameIndex: Int = 0
     @State private var metadata: tableMetadata?
     @State private var index: Int = 0
 
@@ -357,6 +358,8 @@ struct UploadAssetsView: View {
                                     if #available(iOS 16, *) {
                                         Menu {
                                             Button(action: {
+                                                renameFileName = uploadAssets.previewStore[index].fileName ?? ""
+                                                renameIndex = index
                                                 isPresentedAlert = true
                                             }) {
                                                 Label(NSLocalizedString("_rename_", comment: ""), systemImage: "pencil")
@@ -378,7 +381,7 @@ struct UploadAssetsView: View {
                                             .alert(NSLocalizedString("_rename_file_", comment: ""), isPresented: $isPresentedAlert) {
                                                 TextField("Filename", text: $renameFileName)
                                                 Button(NSLocalizedString("_rename_", comment: ""), action: {
-                                                    uploadAssets.previewStore[index].fileName = renameFileName
+                                                    uploadAssets.previewStore[renameIndex].fileName = renameFileName
                                                 })
                                                 Button(NSLocalizedString("_cancel_", comment: ""), role: .cancel, action: {})
                                             }