COVIDSafe code from version 1.13 (#25)

This commit is contained in:
COVIDSafe Support 2020-10-16 15:45:07 +11:00 committed by GitHub
parent a2b6a8bfb5
commit 3ea83834f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 970 additions and 576 deletions

View file

@ -0,0 +1,47 @@
//
// CSAlertViewController.swift
// CovidSafe
//
// Copyright © 2020 Australian Government. All rights reserved.
//
import UIKit
import SafariServices
class CSAlertViewController: UIViewController {
@IBOutlet weak var messageLabel: UITextView!
@IBOutlet weak var mainButton: UIButton!
private var message: NSAttributedString?
private var buttonLabel: String?
override func viewDidLoad() {
super.viewDidLoad()
messageLabel.delegate = self
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
messageLabel.attributedText = message
mainButton.setTitle(buttonLabel, for: .normal)
}
func set(message: NSAttributedString, buttonLabel: String) {
self.message = message
self.buttonLabel = buttonLabel
}
@IBAction func onMainActionTapped(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
}
extension CSAlertViewController: UITextViewDelegate {
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
self.dismiss(animated: true, completion: nil)
})
return true
}
}