Browse Source

Fix Share ext details

- typo
- make sure file names are unique
- fix upload counter, easier to read for users

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 years ago
parent
commit
4fdcab8927

+ 2 - 2
Share/NCShareCell.swift

@@ -25,7 +25,7 @@ import UIKit
 import NCCommunication
 
 protocol NCShareCellDelegate: AnyObject {
-    var uploadStated: Bool { get }
+    var uploadStarted: Bool { get }
     func removeFile(named fileName: String)
     func renameFile(named fileName: String)
 }
@@ -65,7 +65,7 @@ class NCShareCell: UITableViewCell {
     }
 
     @IBAction func buttonTapped(_ sender: Any) {
-        guard !fileName.isEmpty, delegate?.uploadStated != true else { return }
+        guard !fileName.isEmpty, delegate?.uploadStarted != true else { return }
         let alertController = UIAlertController(title: "", message: fileName, preferredStyle: .alert)
 
         alertController.addAction(UIAlertAction(title: NSLocalizedString("_rename_file_", comment: ""), style: .default) { _ in

+ 0 - 2
Share/NCShareExtension+DataSource.swift

@@ -175,8 +175,6 @@ extension NCShareExtension: UITableViewDataSource {
         let fileName = filesName[indexPath.row]
         cell.setup(fileName: fileName)
         cell.delegate = self
-        cell.moreButton?.isHidden = filesName.count < 2
-
         return cell
     }
 }

+ 1 - 1
Share/NCShareExtension+Files.swift

@@ -129,7 +129,7 @@ class NCFilesExtensionHandler {
                 default: return
                 }
 
-                if let fileName = fileName { filesName.append(fileName) }
+                if let fileName = fileName, !filesName.contains(fileName) { filesName.append(fileName) }
             }
         }
     }

+ 0 - 2
Share/NCShareExtension+NCDelegate.swift

@@ -102,8 +102,6 @@ extension NCShareExtension: NCEmptyDataSetDelegate, NCAccountRequestDelegate {
 }
 
 extension NCShareExtension: NCShareCellDelegate, NCRenameFileDelegate, NCListCellDelegate {
-    // Bug in Swift?
-    var uploadStated: Bool { uploadStarted }
 
     func removeFile(named fileName: String) {
         guard let index = self.filesName.firstIndex(of: fileName) else {

+ 1 - 1
Share/NCShareExtension.swift

@@ -190,7 +190,7 @@ class NCShareExtension: UIViewController {
 
     @objc func triggerProgressTask(_ notification: NSNotification) {
         guard let progress = notification.userInfo?["progress"] as? CGFloat else { return }
-        let status = NSLocalizedString("_upload_file_", comment: "") + " \(counterUpload) " + NSLocalizedString("_of_", comment: "") + " \(filesName.count)"
+        let status = NSLocalizedString("_upload_file_", comment: "") + " \(counterUpload + 1) " + NSLocalizedString("_of_", comment: "") + " \(filesName.count)"
         IHProgressHUD.show(progress: progress, status: status)
     }