NCShareAdvancePermissionFooter.swift 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. func dismissShareAdvanceView(shouldSave: Bool)
  11. }
  12. class NCShareAdvancePermissionFooter: UIView {
  13. @IBOutlet weak var buttonCancel: UIButton!
  14. @IBOutlet weak var buttonNext: UIButton!
  15. weak var delegate: NCShareAdvanceFotterDelegate?
  16. func setupUI(with share: TableShareable, delegate: NCShareAdvanceFotterDelegate?) {
  17. self.delegate = delegate
  18. backgroundColor = .clear
  19. addShadow(location: .top)
  20. buttonCancel.addTarget(self, action: #selector(cancelClicked), for: .touchUpInside)
  21. buttonCancel.setTitle(NSLocalizedString("_cancel_", comment: ""), for: .normal)
  22. buttonCancel.layer.cornerRadius = 10
  23. buttonCancel.layer.masksToBounds = true
  24. buttonCancel.layer.borderWidth = 1
  25. if NCManageDatabase.shared.getTableShare(account: share.account, idShare: share.idShare) == nil {
  26. buttonNext.setTitle(NSLocalizedString("_next_", comment: ""), for: .normal)
  27. } else {
  28. buttonNext.setTitle(NSLocalizedString("_apply_changes_", comment: ""), for: .normal)
  29. }
  30. buttonNext.layer.cornerRadius = 10
  31. buttonNext.layer.masksToBounds = true
  32. buttonNext.backgroundColor = NCBrandColor.shared.brand
  33. buttonNext.addTarget(self, action: #selector(nextClicked), for: .touchUpInside)
  34. }
  35. @objc func cancelClicked() {
  36. delegate?.dismissShareAdvanceView(shouldSave: false)
  37. }
  38. @objc func nextClicked() {
  39. delegate?.dismissShareAdvanceView(shouldSave: true)
  40. }
  41. }