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

changed some textfields in onboarding

parent 3c5dd573
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -45,7 +45,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func credentialsFailed(){ func credentialsFailed(){
Onboarding.credentialFails += 1 Onboarding.credentialFails += 1
if Onboarding.credentialFails >= 3 { if Onboarding.credentialFails >= 1/*3*/ {
self.window?.rootViewController = Onboarding.detailOnboarding(self.credentialCheck) self.window?.rootViewController = Onboarding.detailOnboarding(self.credentialCheck)
} }
else { else {
......
...@@ -21,6 +21,7 @@ class Onboarding: NSObject { ...@@ -21,6 +21,7 @@ class Onboarding: NSObject {
static var mailaddress = UITextField.init() static var mailaddress = UITextField.init()
static var username = UITextField.init() static var username = UITextField.init()
static var password = UITextField.init() static var password = UITextField.init()
static var credentials: UIView? = nil
static var imapServer = UITextField.init() static var imapServer = UITextField.init()
static var smtpServer = UITextField.init() static var smtpServer = UITextField.init()
static var imapPort = UITextField.init() static var imapPort = UITextField.init()
...@@ -107,6 +108,8 @@ class Onboarding: NSObject { ...@@ -107,6 +108,8 @@ class Onboarding: NSObject {
let page1 = OnboardingContentViewController.content(withTitle: NSLocalizedString("Hello", comment: "Welcome"), body: NSLocalizedString("InterestedInSecureMail", comment: "commendation to user for using secure mail"), image: nil, buttonText: nil, action: nil) let page1 = OnboardingContentViewController.content(withTitle: NSLocalizedString("Hello", comment: "Welcome"), body: NSLocalizedString("InterestedInSecureMail", comment: "commendation to user for using secure mail"), image: nil, buttonText: nil, action: nil)
if let tmpCredentials = credentials {}
else {
mailaddress = UITextField.init() mailaddress = UITextField.init()
mailaddress.textColor = textColor mailaddress.textColor = textColor
mailaddress.attributedPlaceholder = NSAttributedString.init(string: NSLocalizedString("Address", comment: ""), attributes: [NSForegroundColorAttributeName: textColor]) mailaddress.attributedPlaceholder = NSAttributedString.init(string: NSLocalizedString("Address", comment: ""), attributes: [NSForegroundColorAttributeName: textColor])
...@@ -147,11 +150,12 @@ class Onboarding: NSObject { ...@@ -147,11 +150,12 @@ class Onboarding: NSObject {
mailaddress.inputAccessoryView = keyboardToolbar mailaddress.inputAccessoryView = keyboardToolbar
password.inputAccessoryView = keyboardToolbar password.inputAccessoryView = keyboardToolbar
let credentials = UIView.init(frame: CGRect.init(x: 0, y: 0, width: 50, height: mailaddress.frame.height + mailaddressUnderline.frame.height + padding + password.frame.height + passwordUnderline.frame.height)) credentials = UIView.init(frame: CGRect.init(x: 0, y: 0, width: 50, height: mailaddress.frame.height + mailaddressUnderline.frame.height + padding + password.frame.height + passwordUnderline.frame.height))
credentials.addSubview(mailaddress) credentials?.addSubview(mailaddress)
credentials.addSubview(mailaddressUnderline) credentials?.addSubview(mailaddressUnderline)
credentials.addSubview(password) credentials?.addSubview(password)
credentials.addSubview(passwordUnderline) credentials?.addSubview(passwordUnderline)
}
var bodyText = NSLocalizedString("InsertMailAddressAndPassword", comment: "") var bodyText = NSLocalizedString("InsertMailAddressAndPassword", comment: "")
if self.credentialFails > 0 { if self.credentialFails > 0 {
...@@ -257,21 +261,29 @@ class Onboarding: NSObject { ...@@ -257,21 +261,29 @@ class Onboarding: NSObject {
let start = OnboardingContentViewController.content(withTitle: NSLocalizedString("WhatAShame", comment: ""), body: NSLocalizedString("CouldNotConnect", comment: ""), videoURL: nil, inputView: nil, buttonText: nil, actionBlock: nil) let start = OnboardingContentViewController.content(withTitle: NSLocalizedString("WhatAShame", comment: ""), body: NSLocalizedString("CouldNotConnect", comment: ""), videoURL: nil, inputView: nil, buttonText: nil, actionBlock: nil)
let email = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertMailAddress", comment: ""), videoURL: nil, inputView: mailaddress, buttonText: nil, actionBlock: nil) let email = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertMailAddressAndPassword", comment: ""), videoURL: nil, inputView: credentials, buttonText: nil, actionBlock: callback)//OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertMailAddress", comment: ""), videoURL: nil, inputView: mailaddress, buttonText: nil, actionBlock: nil)
username = UITextField.init() username = UITextField.init()
//text.textColor = UIColor.whiteColor() //text.textColor = UIColor.whiteColor()
//text.tintColor = UIColor.whiteColor() //text.tintColor = UIColor.whiteColor()
username.borderStyle = UITextBorderStyle.roundedRect username.borderStyle = UITextBorderStyle.none
username.keyboardType = UIKeyboardType.emailAddress username.keyboardType = UIKeyboardType.emailAddress
username.autocorrectionType = UITextAutocorrectionType.no username.autocorrectionType = UITextAutocorrectionType.no
username.frame = CGRect.init(x: 0, y: 0, width: 50, height: 30) username.frame = CGRect.init(x: 0, y: 0, width: 50, height: 30)
username.placeholder = NSLocalizedString("Username", comment: "") username.placeholder = NSLocalizedString("Username", comment: "")
username.text = UserManager.loadUserValue(Attribute.userName) as? String username.text = UserManager.loadUserValue(Attribute.userName) as? String
username.textColor = textColor
let usernameUnderline = UIView.init(frame: CGRect.init(x: 0, y: username.frame.maxY, width: username.frame.width, height: 0.5))
usernameUnderline.backgroundColor = textColor
let user = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertUsername", comment: ""), videoURL: nil, inputView: username, buttonText: nil, actionBlock: nil) let userView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: 50, height: username.frame.height + usernameUnderline.frame.height))
userView.addSubview(username)
userView.addSubview(usernameUnderline)
let passwd = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertPassword", comment: ""), videoURL: nil, inputView: password, buttonText: nil, actionBlock: nil) let user = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertUsername", comment: ""), videoURL: nil, inputView: userView, buttonText: nil, actionBlock: nil)
//let passwd = OnboardingContentViewController.content(withTitle: nil, body: NSLocalizedString("InsertPassword", comment: ""), videoURL: nil, inputView: password, buttonText: nil, actionBlock: nil)
imapServer.borderStyle = UITextBorderStyle.roundedRect imapServer.borderStyle = UITextBorderStyle.roundedRect
imapServer.frame = CGRect.init(x: 0, y: 0, width: 50, height: 30) imapServer.frame = CGRect.init(x: 0, y: 0, width: 50, height: 30)
...@@ -424,7 +436,7 @@ class Onboarding: NSObject { ...@@ -424,7 +436,7 @@ class Onboarding: NSObject {
let last = OnboardingContentViewController.content(withTitle: NSLocalizedString("EverythingCorrect", comment: ""), body: nil, videoURL: nil, inputView: nil, buttonText: NSLocalizedString("next", comment: ""), actionBlock: callback) let last = OnboardingContentViewController.content(withTitle: NSLocalizedString("EverythingCorrect", comment: ""), body: nil, videoURL: nil, inputView: nil, buttonText: NSLocalizedString("next", comment: ""), actionBlock: callback)
let vc = Onboard.OnboardingViewController(backgroundImage: background, contents: [start, email, user, passwd, imap1, imap2, smtp1, smtp2, last]) let vc = Onboard.OnboardingViewController(backgroundImage: background, contents: [start, email, user, /*passwd,*/ imap1, imap2, smtp1, smtp2, last])
vc?.view.backgroundColor = defaultColor vc?.view.backgroundColor = defaultColor
return vc! return vc!
} }
...@@ -450,7 +462,9 @@ class Onboarding: NSObject { ...@@ -450,7 +462,9 @@ class Onboarding: NSObject {
static func checkConfig(_ fail: @escaping () -> (), work: @escaping () -> ()) -> Bool { static func checkConfig(_ fail: @escaping () -> (), work: @escaping () -> ()) -> Bool {
smtpCheckDone = false smtpCheckDone = false
imapCheckDone = false imapCheckDone = false
if credentialFails > 2 {
manualSet = true manualSet = true
}
self.work = work self.work = work
self.fail = fail self.fail = fail
//AppDelegate.getAppDelegate().mailHandler.checkSMTP(smtpCompletion) //AppDelegate.getAppDelegate().mailHandler.checkSMTP(smtpCompletion)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment