// // HelpVC.swift // Sirani // // Created by Anhar Solehudin on 24/03/19. // Copyright © 2019 Anhar Solehudin. All rights reserved. // import UIKit import WebKit class HelpVC: UIViewController { @IBOutlet weak var dropdown1: UIImageView! @IBOutlet weak var lineWv1: UIView! @IBOutlet weak var wv1: WKWebView! // View Lifecycles override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } override func viewDidLoad() { super.viewDidLoad() // Auto-expand and style the view self.lineWv1.isHidden = false self.wv1.isHidden = false self.dropdown1.rotates(-.pi) // Dynamic height adjustment for WKWebView for constraint in wv1.constraints { if constraint.firstAttribute == .height { constraint.constant = 1350 } } let htmlContent = """
Pusat Layanan & Bantuan
Sertifikasi Perangkat Telekomunikasi (SIRANI)
🏢 Kantor Layanan Terpadu
📍
Alamat Kantor
Gedung Menara Danareksa, Lantai UG
Jl. Medan Merdeka Selatan no. 14 Jakarta 10110, Indonesia
📍 Buka di Google Maps
📞 Saluran Kontak Layanan
🎧
Call Center
✉️
💬
WhatsApp Pelayanan (WAYAN)
⏰ Waktu Jam Layanan
🏢 Loket Pelayanan (Menara Danareksa)
📅 Senin - Kamis: 08.00 - 16.00 WIB
📅 Jumat: 08.00 - 16.30 WIB
🎧 Contact Center 159
📅 Senin - Jumat: 07.00 - 17.00 WIB
📄 Regulasi & Template Dokumen
Regulasi (UU, PP, Permen, Kepdir) → Surat Pernyataan Kesediaan Mematuhi Ketentuan → Deklarasi Kesesuaian (DoC) → Deklarasi Keamanan IMEI → Rangkuman Referensi Halaman LHU → Panduan Penggunaan (Customer & Public) →
""" wv1.navigationDelegate = self wv1.loadHTMLString(htmlContent, baseURL: nil) } @IBAction func onTitleOneTapped(_ sender: Any) { if self.wv1.isHidden { UIView.animate(withDuration: 0.25, delay: 0, options: .curveEaseOut, animations: { self.lineWv1.isHidden = false self.lineWv1.layoutIfNeeded() self.wv1.isHidden = false self.wv1.layoutIfNeeded() self.dropdown1.rotates(-.pi) }) } else { UIView.animate(withDuration: 0, delay: 0, options: .curveEaseIn, animations: { self.lineWv1.isHidden = true self.lineWv1.layoutIfNeeded() self.wv1.isHidden = true self.wv1.layoutIfNeeded() self.dropdown1.rotates(0.0) }) } } } extension UIView { func rotates(_ toValue: CGFloat, duration: CFTimeInterval = 0.3) { let animation = CABasicAnimation(keyPath: "transform.rotation") animation.toValue = toValue animation.duration = duration animation.isRemovedOnCompletion = false animation.fillMode = CAMediaTimingFillMode.forwards self.layer.add(animation, forKey: nil) } } extension HelpVC: WKNavigationDelegate { func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { if navigationAction.navigationType == .linkActivated { guard let url = navigationAction.request.url else { decisionHandler(.allow) return } let components = URLComponents(url: url, resolvingAgainstBaseURL: false) if components?.scheme == "http" || components?.scheme == "https" || components?.scheme == "mailto" || components?.scheme == "tel" { if UIApplication.shared.canOpenURL(url) { if #available(iOS 10.0, *) { UIApplication.shared.open(url) } else { UIApplication.shared.openURL(url) } decisionHandler(.cancel) } else { decisionHandler(.allow) } } else { decisionHandler(.allow) } } else { decisionHandler(.allow) } } }