-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Login Screen Work #2
base: master
Are you sure you want to change the base?
Conversation
…ded at this time. Make the core project scheme shared.
} | ||
|
||
if(notification.name == LoginViewController.userNameNotification) { | ||
self.userName = notification.userInfo!["userName"] as! String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this map returns null when you ask for a String key, then I'd suggest combining these notifications into a single notification and checking all of the possible keys any time something changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Kotlin, we can do a thing like:
(notification.userInfo!["userName"] as? String)?.let { userName = it }
This basically:
- queries the map for the specified key, then attempts to convert that to a string
- if the end result of that is not null, then enter the block, setting an implicit variable
it
to the converted string - the block sets the local userName variable
self.twitterName = notification.userInfo!["twitterName"] as! String | ||
} | ||
|
||
// Remove when comfortable with functionality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Remove when comfortable with functionality | |
// FIXME Remove when comfortable with functionality |
This makes finding debug-only code more searchable.
|
||
if(notification.name == LoginViewController.userNameNotification) { | ||
self.userName = notification.userInfo!["userName"] as! String | ||
if (self.userName != "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (self.userName != "") { | |
signInButton.isEnabled = self.userName != "" |
if(notification.name == LoginViewController.userNameNotification) { | ||
self.userName = notification.userInfo!["userName"] as! String | ||
if (self.userName != "") { | ||
signInButton.isEnabled = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signInButton.isEnabled = true |
self.userName = notification.userInfo!["userName"] as! String | ||
if (self.userName != "") { | ||
signInButton.isEnabled = true | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { |
if (self.userName != "") { | ||
signInButton.isEnabled = true | ||
} else { | ||
signInButton.isEnabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signInButton.isEnabled = false |
signInButton.isEnabled = true | ||
} else { | ||
signInButton.isEnabled = false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} |
God this feature sucks.
@@ -11,16 +11,66 @@ | |||
import UIKit | |||
|
|||
class LoginViewController: UIViewController { | |||
|
|||
static let userNameNotification = Notification.Name("userNameNotification") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really just need one of these. Call it loginInfoNotification
This PR is to make the login screen more interactable.
Still need to save player info state, but keeping this small to get this screen moving.