Browse Source

add LaunchScreen

pull/1/head
InKwon James Kim 5 years ago
parent
commit
044be6b885
  1. 4
      GME Remit.xcodeproj/project.pbxproj
  2. BIN
      GMERemittance/Assets.xcassets/gme-logo.imageset/gme-logo.png
  3. 18
      GMERemittance/Base.lproj/LaunchScreen.storyboard
  4. 63
      GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift

4
GME Remit.xcodeproj/project.pbxproj

@ -13975,7 +13975,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
@ -14027,7 +14027,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 4.0;
VALIDATE_PRODUCT = YES;
};
name = Release;

BIN
GMERemittance/Assets.xcassets/gme-logo.imageset/gme-logo.png

After

Width: 692  |  Height: 197  |  Size: 14 KiB

18
GMERemittance/Base.lproj/LaunchScreen.storyboard

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@ -17,7 +17,16 @@
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_gme_logo" translatesAutoresizingMaskIntoConstraints="NO" id="N3b-w5-Ftf">
<rect key="frame" x="167.5" y="323.5" width="40" height="40"/>
</imageView>
</subviews>
<color key="backgroundColor" red="0.92941176470588238" green="0.10588235294117647" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="N3b-w5-Ftf" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="0fk-eE-qb1"/>
<constraint firstItem="N3b-w5-Ftf" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="OKi-EB-LSk"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
@ -26,4 +35,7 @@
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="ic_gme_logo" width="40" height="40"/>
</resources>
</document>

63
GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift

@ -18,82 +18,50 @@ class WkWebViewController: UIViewController {
var activityIndicator: UIActivityIndicatorView?
let userContentController = WKUserContentController()
override func viewDidLoad() {
super.viewDidLoad()
let preference = WKPreferences()
preference.javaScriptEnabled = true
let webConfiguration = WKWebViewConfiguration()
// test 1
userContentController.add(self, name: "test")
// test 2
webConfiguration.userContentController = userContentController
webConfiguration.preferences = preference
let webView = WKWebView.init(frame: self.view.frame, configuration: webConfiguration)
let webView = WKWebView.init(frame: view.frame, configuration: webConfiguration)
webView.uiDelegate = self
webView.navigationDelegate = self
self.view = webView
self.webView = webView
// other setup
addCloseButton()
self.activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray)
self.webView.addSubview(activityIndicator!)
self.webView.isUserInteractionEnabled = true
self.activityIndicator?.startAnimating()
self.activityIndicator?.isHidden = false
self.activityIndicator?.hidesWhenStopped = true
self.webView.bringSubview(toFront: activityIndicator!)
view = webView
self.webView = webView
let _url = (self.url ?? "")
print(_url)
activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.gray)
webView.addSubview(activityIndicator!)
webView.isUserInteractionEnabled = true
activityIndicator?.startAnimating()
activityIndicator?.isHidden = false
activityIndicator?.hidesWhenStopped = true
webView.bringSubview(toFront: activityIndicator!)
if let myURL = URL(string: _url) {
var myRequest = URLRequest(url: myURL)
//
// headers.forEach({
// myRequest.setValue($0.key ?? "", forHTTPHeaderField: $0.value ?? "")
//
// })
//
// print(myRequest.allHTTPHeaderFields)
if let myURL = URL(string: url ?? "") {
let myRequest = URLRequest(url: myURL)
webView.load(myRequest)
}
}
private func addCloseButton() {
let button = UIBarButtonItem.init(title: "Close", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self._dismiss))
self.navigationItem.rightBarButtonItem = button
}
@objc private func _dismiss() {
self.dismiss(animated: true, completion: nil)
}
}
extension WkWebViewController: WKUIDelegate, WKNavigationDelegate {
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
print("start")
activityIndicator?.center = self.view.center
// activityIndicator?.isHidden = false
activityIndicator?.startAnimating()
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
// activityIndicator?.isHidden = true
activityIndicator?.stopAnimating()
self.navigationItem.title = webView.title
}
@ -108,13 +76,9 @@ extension WkWebViewController: WKUIDelegate, WKNavigationDelegate {
self.present(alertController, animated: true, completion: {});
}
}
extension WkWebViewController: WKScriptMessageHandler {
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
print(message.name)
if let body = message.body as? String {
@ -122,9 +86,6 @@ extension WkWebViewController: WKScriptMessageHandler {
self.dismiss(animated: true, completion: nil)
}
}
}
}
Loading…
Cancel
Save