Skip to content

Commit

Permalink
Fix linting and warning. (eu-digital-green-certificates#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
yspreen authored May 31, 2021
1 parent 49f474d commit 7931506
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions DGCAWallet/Storyboards/Base.lproj/Settings.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="FgE-yf-uSb">
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="FgE-yf-uSb">
<rect key="frame" x="197" y="495.5" width="20" height="20"/>
</activityIndicatorView>
</subviews>
Expand Down Expand Up @@ -251,7 +251,7 @@
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBackgroundColor">
<color red="0.0" green="0.46000000000000002" blue="0.89000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
28 changes: 16 additions & 12 deletions DGCAWallet/ViewControllers/LicenseVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,41 @@ import WebKit
class LicenseVC: UIViewController, WKNavigationDelegate {
@IBOutlet weak var packageNameLabel: UILabel!
@IBOutlet weak var licenseWebView: WKWebView!
@IBOutlet weak var githubUrlLabel: UILabel!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!

var licenseObject: JSON = []

override func viewDidLoad() {
super.viewDidLoad()
self.packageNameLabel.text = licenseObject["name"].string
self.licenseWebView.isUserInteractionEnabled = false
self.licenseWebView.navigationDelegate = self

packageNameLabel.text = licenseObject["name"].string
licenseWebView.isUserInteractionEnabled = false
licenseWebView.navigationDelegate = self
if #available(iOS 13.0, *) {
activityIndicator.style = .medium
} else {
activityIndicator.style = .gray
}

if let licenseUrl = licenseObject["licenseUrl"].string {
loadWebView(licenseUrl)
}
}

func loadWebView(_ packageLink: String) {
DispatchQueue.main.async {
let request = URLRequest(url: URL(string: packageLink)!)
self.licenseWebView?.load(request)
DispatchQueue.main.async { [weak self] in
let request = URLRequest(url: URL(string: packageLink)!)
self?.licenseWebView?.load(request)
}

self.activityIndicator.startAnimating()
self.licenseWebView.navigationDelegate = self
activityIndicator.startAnimating()
licenseWebView.navigationDelegate = self
}

func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
self.activityIndicator.stopAnimating()
activityIndicator.stopAnimating()
}

func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
self.activityIndicator.stopAnimating()
activityIndicator.stopAnimating()
}
}

0 comments on commit 7931506

Please sign in to comment.