diff --git a/Passepartout-iOS/Scenes/Organizer/CreditsViewController.swift b/Passepartout-iOS/Scenes/Organizer/CreditsViewController.swift index 608ad6ea..4abab9d5 100644 --- a/Passepartout-iOS/Scenes/Organizer/CreditsViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/CreditsViewController.swift @@ -58,10 +58,17 @@ class CreditsViewController: UITableViewController, TableModelHost { guard let vc = segue.destination as? LabelViewController else { return } - guard let cell = sender as? SettingTableViewCell else { + guard let cell = sender as? SettingTableViewCell, let indexPath = tableView.indexPath(for: cell) else { return } vc.title = cell.leftText + switch model.row(at: indexPath) { + case .license: + vc.url = licenses[indexPath.row].url + + case .notice: + vc.text = notices[indexPath.row].statement + } } } diff --git a/Passepartout-iOS/Scenes/Organizer/LabelViewController.swift b/Passepartout-iOS/Scenes/Organizer/LabelViewController.swift index 3a2a0f4c..078bb475 100644 --- a/Passepartout-iOS/Scenes/Organizer/LabelViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/LabelViewController.swift @@ -32,6 +32,8 @@ class LabelViewController: UIViewController { var text: String? + var url: URL? + override func awakeFromNib() { super.awakeFromNib() @@ -41,7 +43,17 @@ class LabelViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - label?.text = text + if let url = url { + label?.text = nil + DispatchQueue(label: LabelViewController.description(), qos: .background).async { [weak self] in + let urlText = try? String(contentsOf: url) + DispatchQueue.main.async { + self?.label?.text = urlText + } + } + } else { + label?.text = text + } scrollView?.applyPrimaryBackground(Theme.current) label?.applyLight(Theme.current)