NCMoreAppSuggestionsCell.swift 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // NCMoreAppSuggestionsCell.swift
  3. // Nextcloud
  4. //
  5. // Created by Milen on 14.06.23.
  6. // Copyright © 2023 Marino Faggiana. All rights reserved.
  7. //
  8. import Foundation
  9. class NCMoreAppSuggestionsCell: BaseNCMoreCell {
  10. @IBOutlet weak var talkView: UIStackView!
  11. @IBOutlet weak var notesView: UIStackView!
  12. @IBOutlet weak var moreAppsView: UIStackView!
  13. static let reuseIdentifier = "NCMoreAppSuggestionsCell"
  14. static func fromNib() -> UINib {
  15. return UINib(nibName: "NCMoreAppSuggestionsCell", bundle: nil)
  16. }
  17. override func awakeFromNib() {
  18. super.awakeFromNib()
  19. backgroundColor = .clear
  20. talkView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(talkTapped)))
  21. notesView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(notesTapped)))
  22. moreAppsView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(moreAppsTapped)))
  23. }
  24. @objc func talkTapped() {
  25. guard let url = URL(string: NCGlobal.shared.talkSchemeUrl) else { return }
  26. if UIApplication.shared.canOpenURL(url) {
  27. UIApplication.shared.open(url)
  28. } else {
  29. guard let url = URL(string: NCGlobal.shared.talkAppStoreUrl) else { return }
  30. UIApplication.shared.open(url)
  31. }
  32. }
  33. @objc func notesTapped() {
  34. guard let url = URL(string: NCGlobal.shared.notesSchemeUrl) else { return }
  35. if UIApplication.shared.canOpenURL(url) {
  36. UIApplication.shared.open(url)
  37. } else {
  38. guard let url = URL(string: NCGlobal.shared.notesAppStoreUrl) else { return }
  39. UIApplication.shared.open(url)
  40. }
  41. }
  42. @objc func moreAppsTapped() {
  43. guard let url = URL(string: NCGlobal.shared.moreAppsUrl) else { return }
  44. UIApplication.shared.open(url)
  45. }
  46. }