Browse Source

Merge pull request #540 from deltachat/fix-help

fix help
bjoern 5 years ago
parent
commit
648ad2a989

+ 1 - 1
deltachat-ios/Assets/Help/de/help.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html><head><meta charset="UTF-8" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
+<html><head><meta charset="UTF-8" /><meta name="viewport" content="initial-scale=1.0" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
   <li><a href="#was-ist-delta-chat">Was ist Delta Chat?</a>
     <ul>
       <li><a href="#wie-finde-ich-leute-mit-denen-ich-chatten-kann">Wie finde ich Leute, mit denen ich chatten kann?</a></li>

+ 1 - 1
deltachat-ios/Assets/Help/en/help.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html><head><meta charset="UTF-8" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
+<html><head><meta charset="UTF-8" /><meta name="viewport" content="initial-scale=1.0" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
   <li><a href="#what-is-delta-chat">What is Delta Chat?</a>
     <ul>
       <li><a href="#how-can-i-find-people-to-chat-with">How can I find people to chat with?</a></li>

+ 1 - 1
deltachat-ios/Assets/Help/es/help.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html><head><meta charset="UTF-8" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
+<html><head><meta charset="UTF-8" /><meta name="viewport" content="initial-scale=1.0" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
   <li><a href="#qué-es-delta-chat">¿Qué es Delta Chat?</a>
     <ul>
       <li><a href="#cómo-puedo-encontrar-personas-con-las-que-chatear">¿Cómo puedo encontrar personas con las que chatear?</a></li>

+ 8 - 7
deltachat-ios/Assets/Help/help.css

@@ -1,7 +1,8 @@
 body {
-    font-family: sans-serif;
-    font-size: 300%;
-	padding: 2rem;
+    font-size: 13pt;
+    font-family: -apple-system, sans-serif;
+	padding: 0 .5rem .5rem .5rem;
+    -webkit-text-size-adjust: none;
 }
 
 a {
@@ -23,14 +24,14 @@ ul#top > li {
 }
 
 ul#top li {
-  margin-top: 1.7rem;
-  margin-bottom: 1.7rem;
+  margin-top: 0.7rem;
+  margin-bottom: 0.7rem;
   font-weight: normal;
 }
 
 p.back {
-  font-size: 3rem;
-  padding: 0 1rem 0 0;
+  font-size: 1.5rem;
+  padding: 0 2rem 0 0;
 }
 
 

+ 1 - 1
deltachat-ios/Assets/Help/it/help.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html><head><meta charset="UTF-8" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
+<html><head><meta charset="UTF-8" /><meta name="viewport" content="initial-scale=1.0" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
   <li><a href="#cosè-delta-chat">Cos’è Delta Chat?</a>
     <ul>
       <li><a href="#come-posso-trovare-persone-con-cui-messaggiare">Come posso trovare persone con cui messaggiare?</a></li>

+ 1 - 1
deltachat-ios/Assets/Help/nl/help.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html><head><meta charset="UTF-8" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
+<html><head><meta charset="UTF-8" /><meta name="viewport" content="initial-scale=1.0" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
   <li><a href="#wat-is-delta-chat">Wat is Delta Chat?</a>
     <ul>
       <li><a href="#hoe-kan-ik-gesprekspartners-vinden">Hoe kan ik gesprekspartners vinden?</a></li>

+ 1 - 1
deltachat-ios/Assets/Help/sq/help.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html><head><meta charset="UTF-8" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
+<html><head><meta charset="UTF-8" /><meta name="viewport" content="initial-scale=1.0" /><link rel="stylesheet" href="../help.css" /></head><body><ul id="top">
   <li><a href="#çështë-delta-chat-i">Ç’është Delta Chat-i?</a>
     <ul>
       <li><a href="#si-mund-të-gjej-persona-për-të-biseduar-me-ta">Si mund të gjej persona për të biseduar me ta?</a></li>

+ 16 - 2
deltachat-ios/Controller/HelpViewController.swift

@@ -1,10 +1,11 @@
 import UIKit
 import WebKit
 
-class HelpViewController: UIViewController {
+class HelpViewController: UIViewController, WKNavigationDelegate {
 
     private lazy var webView: WKWebView = {
         let view = WKWebView()
+        view.navigationDelegate = self
         return view
     }()
 
@@ -17,6 +18,19 @@ class HelpViewController: UIViewController {
         fatalError("init(coder:) has not been implemented")
     }
 
+    func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
+        if navigationAction.navigationType == .linkActivated {
+            if let url = navigationAction.request.url,
+                url.host != nil,
+                UIApplication.shared.canOpenURL(url) {
+                UIApplication.shared.open(url)
+                decisionHandler(.cancel)
+                return
+            }
+        }
+        decisionHandler(.allow)
+    }
+
     // MARK: - lifecycle
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -62,7 +76,7 @@ class HelpViewController: UIViewController {
             var fileURL: URL?
 
             fileURL = Bundle.main.url(forResource: "help", withExtension: "html", subdirectory: "Assets/Help/\(lang)") ??
-                Bundle.main.url(forResource: "en_help", withExtension: "html", subdirectory: "Assets/Help/en")
+                Bundle.main.url(forResource: "help", withExtension: "html", subdirectory: "Assets/Help/en")
 
             guard let url = fileURL else {
                 safe_fatalError("could not find help asset")