Show activity indicator while loading license
This commit is contained in:
parent
d2ba821c8f
commit
534f1e2094
|
@ -136,6 +136,12 @@ extension UITextField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension UIActivityIndicatorView {
|
||||||
|
func applyAccent(_ theme: Theme) {
|
||||||
|
color = theme.palette.colorAccent1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: status bar is broken
|
// XXX: status bar is broken
|
||||||
extension MFMailComposeViewController {
|
extension MFMailComposeViewController {
|
||||||
func apply(_ theme: Theme) {
|
func apply(_ theme: Theme) {
|
||||||
|
|
|
@ -28,6 +28,8 @@ import UIKit
|
||||||
class LabelViewController: UIViewController {
|
class LabelViewController: UIViewController {
|
||||||
@IBOutlet private weak var scrollView: UIScrollView?
|
@IBOutlet private weak var scrollView: UIScrollView?
|
||||||
|
|
||||||
|
@IBOutlet private weak var activity: UIActivityIndicatorView?
|
||||||
|
|
||||||
@IBOutlet private weak var label: UILabel?
|
@IBOutlet private weak var label: UILabel?
|
||||||
|
|
||||||
var text: String?
|
var text: String?
|
||||||
|
@ -43,12 +45,18 @@ class LabelViewController: UIViewController {
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
activity?.hidesWhenStopped = true
|
||||||
|
activity?.applyAccent(Theme.current)
|
||||||
|
|
||||||
if let url = url {
|
if let url = url {
|
||||||
label?.text = nil
|
label?.text = nil
|
||||||
|
activity?.startAnimating()
|
||||||
|
|
||||||
DispatchQueue(label: LabelViewController.description(), qos: .background).async { [weak self] in
|
DispatchQueue(label: LabelViewController.description(), qos: .background).async { [weak self] in
|
||||||
let urlText = try? String(contentsOf: url)
|
let urlText = try? String(contentsOf: url)
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self?.label?.text = urlText
|
self?.label?.text = urlText
|
||||||
|
self?.activity?.stopAnimating()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -599,10 +599,15 @@
|
||||||
<constraint firstItem="Qme-Hw-Egq" firstAttribute="width" secondItem="6iI-GI-SMq" secondAttribute="width" id="urL-Uu-OBn"/>
|
<constraint firstItem="Qme-Hw-Egq" firstAttribute="width" secondItem="6iI-GI-SMq" secondAttribute="width" id="urL-Uu-OBn"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</scrollView>
|
</scrollView>
|
||||||
|
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="piQ-gx-2Zm">
|
||||||
|
<rect key="frame" x="177.5" y="323.5" width="20" height="20"/>
|
||||||
|
</activityIndicatorView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
|
<constraint firstItem="piQ-gx-2Zm" firstAttribute="centerY" secondItem="e1G-CS-7AH" secondAttribute="centerY" id="2bL-bY-Tq7"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="6iI-GI-SMq" secondAttribute="bottom" id="O7t-Z4-Wgz"/>
|
<constraint firstAttribute="bottom" secondItem="6iI-GI-SMq" secondAttribute="bottom" id="O7t-Z4-Wgz"/>
|
||||||
|
<constraint firstItem="piQ-gx-2Zm" firstAttribute="centerX" secondItem="e1G-CS-7AH" secondAttribute="centerX" id="kec-lV-4be"/>
|
||||||
<constraint firstItem="6iI-GI-SMq" firstAttribute="top" secondItem="e1G-CS-7AH" secondAttribute="top" id="moK-Ck-mjj"/>
|
<constraint firstItem="6iI-GI-SMq" firstAttribute="top" secondItem="e1G-CS-7AH" secondAttribute="top" id="moK-Ck-mjj"/>
|
||||||
<constraint firstItem="6iI-GI-SMq" firstAttribute="leading" secondItem="e1G-CS-7AH" secondAttribute="leading" id="rLL-Mv-Pet"/>
|
<constraint firstItem="6iI-GI-SMq" firstAttribute="leading" secondItem="e1G-CS-7AH" secondAttribute="leading" id="rLL-Mv-Pet"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="6iI-GI-SMq" secondAttribute="trailing" id="smW-RU-D8F"/>
|
<constraint firstAttribute="trailing" secondItem="6iI-GI-SMq" secondAttribute="trailing" id="smW-RU-D8F"/>
|
||||||
|
@ -610,6 +615,7 @@
|
||||||
<viewLayoutGuide key="safeArea" id="skL-cM-vUB"/>
|
<viewLayoutGuide key="safeArea" id="skL-cM-vUB"/>
|
||||||
</view>
|
</view>
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="activity" destination="piQ-gx-2Zm" id="4MR-Wt-LPh"/>
|
||||||
<outlet property="label" destination="KWp-cG-SuG" id="us3-ss-xAX"/>
|
<outlet property="label" destination="KWp-cG-SuG" id="us3-ss-xAX"/>
|
||||||
<outlet property="scrollView" destination="6iI-GI-SMq" id="uWc-do-1WG"/>
|
<outlet property="scrollView" destination="6iI-GI-SMq" id="uWc-do-1WG"/>
|
||||||
</connections>
|
</connections>
|
||||||
|
|
Loading…
Reference in New Issue