Skip to content

Commit

Permalink
Merge pull request #2630 from nextcloud/2628-more-apps-launches-apple…
Browse files Browse the repository at this point in the history
…-store-not-app-store

Fix: "More apps" launches apple store, not app store
  • Loading branch information
marinofaggiana authored Oct 6, 2023
2 parents 32cd6b1 + 21b670b commit b34d694
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 8 additions & 2 deletions iOSClient/More/Cells/NCMoreAppSuggestionsCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import SafariServices

class NCMoreAppSuggestionsCell: BaseNCMoreCell {
@IBOutlet weak var talkView: UIStackView!
Expand All @@ -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)
}
Expand Down Expand Up @@ -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()
}
13 changes: 13 additions & 0 deletions iOSClient/More/NCMore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import UIKit
import NextcloudKit
import SafariServices

class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {

Expand Down Expand Up @@ -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() }
Expand Down Expand Up @@ -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)
}
}

0 comments on commit b34d694

Please sign in to comment.