From fc0e038d009fb4492322092f6ca0ef325d17a12b Mon Sep 17 00:00:00 2001
From: jakob <jakob.bode@fu-berlin.de>
Date: Sun, 20 Jan 2019 00:33:05 +0100
Subject: [PATCH] add second text, presented, if the input is unequal to the
 shown secret

---
 enzevalos_iphone/IntroSecretViewController.swift | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/enzevalos_iphone/IntroSecretViewController.swift b/enzevalos_iphone/IntroSecretViewController.swift
index e7769793..fbcc0a37 100644
--- a/enzevalos_iphone/IntroSecretViewController.swift
+++ b/enzevalos_iphone/IntroSecretViewController.swift
@@ -16,6 +16,7 @@ class IntroSecretViewController: UIViewController, IntroInfoButton {
     
     
     var descriptionText: String = ""
+    var alternateText: String?
     var secretText = ""
     var useTextView = false
     var doneText = NSLocalizedString("Done", comment: "finish action")
@@ -29,7 +30,7 @@ class IntroSecretViewController: UIViewController, IntroInfoButton {
     
     static let storyboardID = "secretViewController"
     
-    static func storyboardInstance(description: String, secret: String, doneAction: ((_ sender: Any) -> ())? = nil, doneText: String = NSLocalizedString("Done", comment: "finish action"), titleText: String = "", titleDecription: String = "", titleAction: ((_ sender: Any) -> ())? = nil, url: String? = TravelHandler.website, titleImage: UIImage? = TravelHandler.planeIcon) -> IntroSecretViewController? {
+    static func storyboardInstance(description: String, secret: String, doneAction: ((_ sender: Any) -> ())? = nil, doneText: String = NSLocalizedString("Done", comment: "finish action"), titleText: String = "", titleDecription: String = "", titleAction: ((_ sender: Any) -> ())? = nil, url: String? = TravelHandler.website, titleImage: UIImage? = TravelHandler.planeIcon, alternateText: String? = nil) -> IntroSecretViewController? {
         let storyboard = UIStoryboard(name:
             "Intro", bundle: nil)
         if let controller = storyboard.instantiateViewController(withIdentifier: storyboardID) as? IntroSecretViewController {
@@ -46,6 +47,7 @@ class IntroSecretViewController: UIViewController, IntroInfoButton {
             }
             controller.url = url
             controller.titleImage = titleImage
+            controller.alternateText = alternateText
             return controller
         }
         return nil
@@ -88,6 +90,10 @@ class IntroSecretViewController: UIViewController, IntroInfoButton {
             //getting the input values from user
             if let textFields = alertController.textFields, let writtenSecret = textFields[0].text, writtenSecret == self.secretText {
                 equalAction()
+            } else {
+                if !self.useTextView {
+                    self.descriptionLabel.text = self.alternateText
+                }
             }
             
             
-- 
GitLab