NCCreateFormUploadConflict.swift 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // NCCreateFormUploadConflict.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 29/03/2020.
  6. // Copyright © 2020 Marino Faggiana. All rights reserved.
  7. //
  8. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. import Foundation
  24. @objc class NCCreateFormUploadConflict: UIViewController {
  25. @IBOutlet weak var labelTitle: UILabel!
  26. @IBOutlet weak var labelSubTitle: UILabel!
  27. @IBOutlet weak var switchNewFiles: UISwitch!
  28. @IBOutlet weak var switchAlreadyExistingFiles: UISwitch!
  29. @IBOutlet weak var labelNewFiles: UILabel!
  30. @IBOutlet weak var labelAlreadyExistingFiles: UILabel!
  31. @IBOutlet weak var tableView: UITableView!
  32. @IBOutlet weak var buttonCancel: UIButton!
  33. @IBOutlet weak var buttonContinue: UIButton!
  34. private let appDelegate = UIApplication.shared.delegate as! AppDelegate
  35. @objc var metadatas: [tableMetadata]
  36. @objc required init?(coder aDecoder: NSCoder) {
  37. self.metadatas = [tableMetadata]()
  38. super.init(coder: aDecoder)
  39. }
  40. override func viewDidLoad() {
  41. super.viewDidLoad()
  42. tableView.dataSource = self
  43. tableView.delegate = self
  44. tableView.register(UINib.init(nibName: "NCCreateFormUploadConflictCell", bundle: nil), forCellReuseIdentifier: "Cell")
  45. }
  46. }
  47. // MARK: - UITableViewDelegate
  48. extension NCCreateFormUploadConflict: UITableViewDelegate {
  49. func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  50. return 100
  51. }
  52. }
  53. // MARK: - UITableViewDataSource
  54. extension NCCreateFormUploadConflict: UITableViewDataSource {
  55. func numberOfSections(in tableView: UITableView) -> Int {
  56. return 1
  57. }
  58. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  59. return metadatas.count
  60. }
  61. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  62. if let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as? NCCreateFormUploadConflictCell {
  63. let metadata = metadatas[indexPath.row]
  64. cell.labelFileName.text = metadata.fileNameView
  65. return cell
  66. }
  67. return UITableViewCell()
  68. }
  69. }