HelpVC.swift 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. //
  2. // HelpVC.swift
  3. // Sirani
  4. //
  5. // Created by Anhar Solehudin on 24/03/19.
  6. // Copyright © 2019 Anhar Solehudin. All rights reserved.
  7. //
  8. import UIKit
  9. import WebKit
  10. class HelpVC: UIViewController {
  11. @IBOutlet weak var dropdown1: UIImageView!
  12. @IBOutlet weak var lineWv1: UIView!
  13. @IBOutlet weak var wv1: WKWebView!
  14. // View Lifecycles
  15. override var preferredStatusBarStyle: UIStatusBarStyle {
  16. return .lightContent
  17. }
  18. override func viewDidLoad() {
  19. super.viewDidLoad()
  20. // Auto-expand and style the view
  21. self.lineWv1.isHidden = false
  22. self.wv1.isHidden = false
  23. self.dropdown1.rotates(-.pi)
  24. // Dynamic height adjustment for WKWebView
  25. for constraint in wv1.constraints {
  26. if constraint.firstAttribute == .height {
  27. constraint.constant = 1350
  28. }
  29. }
  30. let htmlContent = """
  31. <!DOCTYPE html>
  32. <html>
  33. <head>
  34. <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'>
  35. <style>
  36. * { box-sizing: border-box; margin: 0; padding: 0; }
  37. body {
  38. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  39. background-color: #F8FAFD;
  40. color: #1A1D26;
  41. padding: 16px;
  42. line-height: 1.5;
  43. }
  44. .hero-banner {
  45. background: linear-gradient(135deg, #1B4389 0%, #003399 100%);
  46. color: white;
  47. padding: 20px;
  48. border-radius: 16px;
  49. margin-bottom: 16px;
  50. box-shadow: 0 4px 12px rgba(27, 67, 137, 0.2);
  51. }
  52. .hero-title { font-size: 18px; font-weight: bold; margin-bottom: 4px; }
  53. .hero-subtitle { font-size: 13px; opacity: 0.9; }
  54. .card {
  55. background: white;
  56. border-radius: 16px;
  57. padding: 18px;
  58. margin-bottom: 14px;
  59. border: 1px solid #EAEFF7;
  60. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  61. }
  62. .card-title {
  63. font-size: 15px;
  64. font-weight: bold;
  65. color: #1B4389;
  66. margin-bottom: 12px;
  67. display: flex;
  68. align-items: center;
  69. gap: 8px;
  70. }
  71. .contact-row {
  72. display: flex;
  73. align-items: flex-start;
  74. padding: 10px 0;
  75. border-bottom: 1px solid #F1F4F9;
  76. }
  77. .contact-row:last-child { border-bottom: none; }
  78. .contact-icon {
  79. font-size: 18px;
  80. width: 32px;
  81. flex-shrink: 0;
  82. }
  83. .contact-info { flex: 1; }
  84. .contact-label { font-size: 11px; font-weight: bold; color: #78879B; text-transform: uppercase; margin-bottom: 2px; }
  85. .contact-val { font-size: 14px; font-weight: 600; color: #1A1D26; word-break: break-word; }
  86. .contact-val a { color: #1B4389; text-decoration: none; }
  87. .btn-map {
  88. display: inline-block;
  89. margin-top: 10px;
  90. background-color: #EBF2FC;
  91. color: #1B4389;
  92. font-size: 13px;
  93. font-weight: bold;
  94. padding: 8px 14px;
  95. border-radius: 20px;
  96. text-decoration: none;
  97. }
  98. .time-grid {
  99. display: grid;
  100. grid-template-columns: 1fr;
  101. gap: 10px;
  102. margin-top: 6px;
  103. }
  104. .time-box {
  105. background: #F8FAFD;
  106. border: 1px solid #EAEFF7;
  107. border-radius: 12px;
  108. padding: 12px;
  109. }
  110. .time-box-title { font-size: 12px; font-weight: bold; color: #1B4389; margin-bottom: 4px; }
  111. .time-item { font-size: 13px; color: #4B5563; margin-top: 3px; }
  112. .link-pill {
  113. display: flex;
  114. align-items: center;
  115. justify-content: space-between;
  116. background: #F8FAFD;
  117. border: 1px solid #EAEFF7;
  118. border-radius: 12px;
  119. padding: 12px 14px;
  120. margin-bottom: 8px;
  121. text-decoration: none;
  122. color: #1A1D26;
  123. font-size: 13px;
  124. font-weight: 600;
  125. }
  126. .link-pill span { color: #1B4389; font-weight: bold; }
  127. .footer-section {
  128. background: #4B6375;
  129. color: white;
  130. border-radius: 16px;
  131. padding: 20px;
  132. margin-top: 16px;
  133. margin-bottom: 30px;
  134. text-align: center;
  135. }
  136. .footer-brand { font-size: 15px; font-weight: bold; margin-bottom: 4px; }
  137. .footer-dept { font-size: 12px; opacity: 0.9; margin-bottom: 2px; }
  138. .footer-kemen { font-size: 12px; font-weight: 600; opacity: 0.95; }
  139. .footer-ver {
  140. display: inline-block;
  141. background: rgba(255, 255, 255, 0.15);
  142. padding: 4px 12px;
  143. border-radius: 12px;
  144. font-size: 11px;
  145. margin-top: 10px;
  146. }
  147. .footer-addr { font-size: 11px; opacity: 0.8; margin-top: 10px; line-height: 1.4; }
  148. </style>
  149. </head>
  150. <body>
  151. <!-- Hero Banner -->
  152. <div class="hero-banner">
  153. <div class="hero-title">Pusat Layanan & Bantuan</div>
  154. <div class="hero-subtitle">Sertifikasi Perangkat Telekomunikasi (SIRANI)</div>
  155. </div>
  156. <!-- Kantor Layanan Card -->
  157. <div class="card">
  158. <div class="card-title">🏢 Kantor Layanan Terpadu</div>
  159. <div class="contact-row">
  160. <div class="contact-icon">📍</div>
  161. <div class="contact-info">
  162. <div class="contact-label">Alamat Kantor</div>
  163. <div class="contact-val">
  164. Gedung Menara Danareksa, Lantai UG<br>
  165. Jl. Medan Merdeka Selatan no. 14 Jakarta 10110, Indonesia
  166. </div>
  167. <a href="https://maps.google.com/?q=-6.180472,106.826722" class="btn-map" target="_blank">📍 Buka di Google Maps</a>
  168. </div>
  169. </div>
  170. </div>
  171. <!-- Saluran Kontak Card -->
  172. <div class="card">
  173. <div class="card-title">📞 Saluran Kontak Layanan</div>
  174. <div class="contact-row">
  175. <div class="contact-icon">🎧</div>
  176. <div class="contact-info">
  177. <div class="contact-label">Call Center</div>
  178. <div class="contact-val"><a href="tel:159">159</a></div>
  179. </div>
  180. </div>
  181. <div class="contact-row">
  182. <div class="contact-icon">✉️</div>
  183. <div class="contact-info">
  184. <div class="contact-label">Email Pelayanan</div>
  185. <div class="contact-val"><a href="mailto:callcenter_djid@komdigi.go.id">callcenter_djid@komdigi.go.id</a></div>
  186. </div>
  187. </div>
  188. <div class="contact-row">
  189. <div class="contact-icon">💬</div>
  190. <div class="contact-info">
  191. <div class="contact-label">WhatsApp Pelayanan (WAYAN)</div>
  192. <div class="contact-val"><a href="https://wa.me/628111100159">08111100159</a></div>
  193. </div>
  194. </div>
  195. </div>
  196. <!-- Waktu Layanan Card -->
  197. <div class="card">
  198. <div class="card-title">⏰ Waktu Jam Layanan</div>
  199. <div class="time-grid">
  200. <div class="time-box">
  201. <div class="time-box-title">🏢 Loket Pelayanan (Menara Danareksa)</div>
  202. <div class="time-item">📅 <b>Senin - Kamis:</b> 08.00 - 16.00 WIB</div>
  203. <div class="time-item">📅 <b>Jumat:</b> 08.00 - 16.30 WIB</div>
  204. </div>
  205. <div class="time-box">
  206. <div class="time-box-title">🎧 Contact Center 159</div>
  207. <div class="time-item">📅 <b>Senin - Jumat:</b> 07.00 - 17.00 WIB</div>
  208. </div>
  209. </div>
  210. </div>
  211. <!-- Regulasi & Dokumen Card -->
  212. <div class="card">
  213. <div class="card-title">📄 Regulasi & Template Dokumen</div>
  214. <a href="https://sertifikasi.postel.go.id/regulasi" class="link-pill" target="_blank">
  215. <span>Regulasi (UU, PP, Permen, Kepdir)</span> &rarr;
  216. </a>
  217. <a href="https://sertifikasi.postel.go.id/template" class="link-pill" target="_blank">
  218. <span>Surat Pernyataan Kesediaan Mematuhi Ketentuan</span> &rarr;
  219. </a>
  220. <a href="https://sertifikasi.postel.go.id/template" class="link-pill" target="_blank">
  221. <span>Deklarasi Kesesuaian (DoC)</span> &rarr;
  222. </a>
  223. <a href="https://sertifikasi.postel.go.id/template" class="link-pill" target="_blank">
  224. <span>Deklarasi Keamanan IMEI</span> &rarr;
  225. </a>
  226. <a href="https://sertifikasi.postel.go.id/template" class="link-pill" target="_blank">
  227. <span>Rangkuman Referensi Halaman LHU</span> &rarr;
  228. </a>
  229. <a href="https://sertifikasi.postel.go.id/panduan" class="link-pill" target="_blank">
  230. <span>Panduan Penggunaan (Customer & Public)</span> &rarr;
  231. </a>
  232. </div>
  233. <!-- Footer Hak Cipta -->
  234. <div class="footer-section">
  235. <div class="footer-brand">Hak Cipta © 2026</div>
  236. <div class="footer-dept">Direktorat Layanan Infrastruktur Digital</div>
  237. <div class="footer-dept">Direktorat Jenderal Infrastruktur Digital</div>
  238. <div class="footer-kemen">Kementerian Komunikasi dan Digital</div>
  239. <div class="footer-ver">v202607282017 (Build: 2026.08.29)</div>
  240. <div class="footer-addr">
  241. Gedung Menara Danareksa, Lantai UG<br>
  242. Jl. Medan Merdeka Selatan No. 14, Jakarta Pusat 10110, Indonesia
  243. </div>
  244. </div>
  245. </body>
  246. </html>
  247. """
  248. wv1.navigationDelegate = self
  249. wv1.loadHTMLString(htmlContent, baseURL: nil)
  250. }
  251. @IBAction func onTitleOneTapped(_ sender: Any) {
  252. if self.wv1.isHidden {
  253. UIView.animate(withDuration: 0.25, delay: 0, options: .curveEaseOut, animations: {
  254. self.lineWv1.isHidden = false
  255. self.lineWv1.layoutIfNeeded()
  256. self.wv1.isHidden = false
  257. self.wv1.layoutIfNeeded()
  258. self.dropdown1.rotates(-.pi)
  259. })
  260. } else {
  261. UIView.animate(withDuration: 0, delay: 0, options: .curveEaseIn, animations: {
  262. self.lineWv1.isHidden = true
  263. self.lineWv1.layoutIfNeeded()
  264. self.wv1.isHidden = true
  265. self.wv1.layoutIfNeeded()
  266. self.dropdown1.rotates(0.0)
  267. })
  268. }
  269. }
  270. }
  271. extension UIView {
  272. func rotates(_ toValue: CGFloat, duration: CFTimeInterval = 0.3) {
  273. let animation = CABasicAnimation(keyPath: "transform.rotation")
  274. animation.toValue = toValue
  275. animation.duration = duration
  276. animation.isRemovedOnCompletion = false
  277. animation.fillMode = CAMediaTimingFillMode.forwards
  278. self.layer.add(animation, forKey: nil)
  279. }
  280. }
  281. extension HelpVC: WKNavigationDelegate {
  282. func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
  283. if navigationAction.navigationType == .linkActivated {
  284. guard let url = navigationAction.request.url else {
  285. decisionHandler(.allow)
  286. return
  287. }
  288. let components = URLComponents(url: url, resolvingAgainstBaseURL: false)
  289. if components?.scheme == "http" || components?.scheme == "https" || components?.scheme == "mailto" || components?.scheme == "tel"
  290. {
  291. if UIApplication.shared.canOpenURL(url) {
  292. if #available(iOS 10.0, *) {
  293. UIApplication.shared.open(url)
  294. } else {
  295. UIApplication.shared.openURL(url)
  296. }
  297. decisionHandler(.cancel)
  298. } else {
  299. decisionHandler(.allow)
  300. }
  301. } else {
  302. decisionHandler(.allow)
  303. }
  304. } else {
  305. decisionHandler(.allow)
  306. }
  307. }
  308. }