Skip to content
Snippets Groups Projects
Commit fc0e038d authored by jakobsbode's avatar jakobsbode
Browse files

add second text, presented, if the input is unequal to the shown secret

parent 6431ccf7
Branches
Tags
No related merge requests found
......@@ -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
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment