From 21b670bdd5c59003e067b94821c807f85935399c Mon Sep 17 00:00:00 2001 From: Milen Pivchev Date: Fri, 6 Oct 2023 12:06:19 +0200 Subject: [PATCH] Fix Signed-off-by: Milen Pivchev --- iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift | 10 ++++++++-- iOSClient/More/NCMore.swift | 13 +++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift index cdbe9ee993..c5078d70d2 100644 --- a/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift +++ b/iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift @@ -7,6 +7,7 @@ // import Foundation +import SafariServices class NCMoreAppSuggestionsCell: BaseNCMoreCell { @IBOutlet weak var talkView: UIStackView! @@ -15,6 +16,8 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell { static let reuseIdentifier = "NCMoreAppSuggestionsCell" + weak var delegate: NCMoreAppSuggestionsCellDelegate? + static func fromNib() -> UINib { return UINib(nibName: "NCMoreAppSuggestionsCell", bundle: nil) } @@ -51,7 +54,10 @@ class NCMoreAppSuggestionsCell: BaseNCMoreCell { } @objc func moreAppsTapped() { - guard let url = URL(string: NCGlobal.shared.moreAppsUrl) else { return } - UIApplication.shared.open(url) + delegate?.moreAppsTapped() } } + +protocol NCMoreAppSuggestionsCellDelegate: AnyObject { + func moreAppsTapped() +} diff --git a/iOSClient/More/NCMore.swift b/iOSClient/More/NCMore.swift index e8f9f1e1cb..b88d10407f 100644 --- a/iOSClient/More/NCMore.swift +++ b/iOSClient/More/NCMore.swift @@ -23,6 +23,7 @@ import UIKit import NextcloudKit +import SafariServices class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { @@ -359,6 +360,9 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { } else if section.type == .moreApps { guard let cell = tableView.dequeueReusableCell(withIdentifier: NCMoreAppSuggestionsCell.reuseIdentifier, for: indexPath) as? NCMoreAppSuggestionsCell else { return UITableViewCell() } + + cell.delegate = self + return cell } else { guard let cell = tableView.dequeueReusableCell(withIdentifier: CCCellMore.reuseIdentifier, for: indexPath) as? CCCellMore else { return UITableViewCell() } @@ -445,3 +449,12 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { } } } + +extension NCMore: NCMoreAppSuggestionsCellDelegate { + func moreAppsTapped() { + guard let url = URL(string: NCGlobal.shared.moreAppsUrl) else { return } + let safariViewController = SFSafariViewController(url: url) + + present(safariViewController, animated: true, completion: nil) + } +}