NCShareAdvancePermissionFooter.swift 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // NCShareAdvancePermissionFooter.swift
  3. // Nextcloud
  4. //
  5. // Created by T-systems on 10/08/21.
  6. // Copyright © 2021 Marino Faggiana. All rights reserved.
  7. //
  8. import UIKit
  9. protocol NCShareAdvanceFotterDelegate: AnyObject {
  10. var isNewShare: Bool { get }
  11. func dismissShareAdvanceView(shouldSave: Bool)
  12. }
  13. class NCShareAdvancePermissionFooter: UIView {
  14. @IBOutlet weak var buttonCancel: UIButton!
  15. @IBOutlet weak var buttonNext: UIButton!
  16. weak var delegate: NCShareAdvanceFotterDelegate?
  17. func setupUI(delegate: NCShareAdvanceFotterDelegate?) {
  18. self.delegate = delegate
  19. backgroundColor = .clear
  20. addShadow(location: .top)
  21. buttonCancel.addTarget(self, action: #selector(cancelClicked), for: .touchUpInside)
  22. buttonCancel.setTitle(NSLocalizedString("_cancel_", comment: ""), for: .normal)
  23. buttonCancel.layer.cornerRadius = 10
  24. buttonCancel.layer.masksToBounds = true
  25. buttonNext.setTitle(NSLocalizedString(delegate?.isNewShare == true ? "_share_" : "_save_", comment: ""), for: .normal)
  26. buttonNext.layer.cornerRadius = 10
  27. buttonNext.layer.masksToBounds = true
  28. buttonNext.backgroundColor = NCBrandColor.shared.brand
  29. buttonNext.addTarget(self, action: #selector(nextClicked), for: .touchUpInside)
  30. }
  31. @objc func cancelClicked() {
  32. delegate?.dismissShareAdvanceView(shouldSave: false)
  33. }
  34. @objc func nextClicked() {
  35. delegate?.dismissShareAdvanceView(shouldSave: true)
  36. }
  37. }