NCMoreAppSuggestionsCell.swift 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. import SafariServices
  10. class NCMoreAppSuggestionsCell: BaseNCMoreCell {
  11. @IBOutlet weak var talkView: UIStackView!
  12. @IBOutlet weak var notesView: UIStackView!
  13. @IBOutlet weak var moreAppsView: UIStackView!
  14. static let reuseIdentifier = "NCMoreAppSuggestionsCell"
  15. static func fromNib() -> UINib {
  16. return UINib(nibName: "NCMoreAppSuggestionsCell", bundle: nil)
  17. }
  18. override func awakeFromNib() {
  19. super.awakeFromNib()
  20. backgroundColor = .clear
  21. talkView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(talkTapped)))
  22. notesView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(notesTapped)))
  23. moreAppsView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(moreAppsTapped)))
  24. }
  25. @objc func talkTapped() {
  26. guard let url = URL(string: NCGlobal.shared.talkSchemeUrl) else { return }
  27. if UIApplication.shared.canOpenURL(url) {
  28. UIApplication.shared.open(url)
  29. } else {
  30. guard let url = URL(string: NCGlobal.shared.talkAppStoreUrl) else { return }
  31. UIApplication.shared.open(url)
  32. }
  33. }
  34. @objc func notesTapped() {
  35. guard let url = URL(string: NCGlobal.shared.notesSchemeUrl) else { return }
  36. if UIApplication.shared.canOpenURL(url) {
  37. UIApplication.shared.open(url)
  38. } else {
  39. guard let url = URL(string: NCGlobal.shared.notesAppStoreUrl) else { return }
  40. UIApplication.shared.open(url)
  41. }
  42. }
  43. @objc func moreAppsTapped() {
  44. guard let url = URL(string: NCGlobal.shared.moreAppsUrl) else { return }
  45. UIApplication.shared.open(url)
  46. }
  47. }