mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Opens source’s website in-app upon tapping link in SourceHeaderView
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SafariServices
|
||||
|
||||
import AltStoreCore
|
||||
import Roxas
|
||||
@@ -91,6 +92,7 @@ class SourceDetailViewController: HeaderContentViewController<SourceHeaderView,
|
||||
{
|
||||
let sourceAboutView = SourceHeaderView(frame: CGRect(x: 0, y: 0, width: 375, height: 200))
|
||||
sourceAboutView.configure(for: self.source)
|
||||
sourceAboutView.websiteButton.addTarget(self, action: #selector(SourceDetailViewController.showWebsite), for: .primaryActionTriggered)
|
||||
return sourceAboutView
|
||||
}
|
||||
|
||||
@@ -105,4 +107,15 @@ class SourceDetailViewController: HeaderContentViewController<SourceHeaderView,
|
||||
self.navigationBarButton.isHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: Actions
|
||||
|
||||
@objc private func showWebsite()
|
||||
{
|
||||
guard let websiteURL = self.source.websiteURL else { return }
|
||||
|
||||
let safariViewController = SFSafariViewController(url: websiteURL)
|
||||
safariViewController.preferredControlTintColor = self.source.effectiveTintColor ?? .altPrimary
|
||||
self.present(safariViewController, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user