-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[NT-995] Settings account header for Apple users #1160
Conversation
…NT-995-apple-account-header
self.vm.inputs.viewWillAppear() | ||
self.reloadDataShouldHideWarningIcon.assertValueCount(1) |
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.
This wasn't even testing the thing that the test name says it's testing 😢
self.vm.inputs.viewWillAppear() | ||
self.reloadDataShouldHideWarningIcon.assertValueCount(1) |
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.
This was also not even testing what the value of reloadDataShouldHideWarningIcon
was, which meant it could have been the opposite of what was expected and this test would have passed :\
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.
🙈
@@ -15,3 +15,14 @@ public func ksr_setCustomSpacing(_ spacing: CGFloat) -> ((UIView, UIStackView) - | |||
return stackView | |||
} | |||
} | |||
|
|||
public func ksr_setBackgroundColor(_ color: UIColor) -> ((UIStackView) -> (UIStackView)) { |
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.
✨ new ✨ so that we can set a background color on UIStackView
s
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.
Handy as this may be 😄 If we're calling this in bindStyles()
we may end up with many background views? 🤔 I would suggest this as an extension on UIStackView
with an associated object to track any existing background views perhaps and, if one exists, just update its backgroundColor
. Another fairly rudimentary way could be to use UIView
's tag
property and just set some sentinel value that you can check for.
Calling it again in the test shows that it's not idempotent:
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.
Ahh good catch!
Generated by 🚫 Danger |
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.
Looks good! had some thoughts/questions.
@@ -9,11 +9,17 @@ final class SettingsAccountDataSource: ValueCellDataSource { | |||
func configureRows( |
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.
Seems like this can rather be a single type SettingsAccountRowData
which should make it easier to modify when needed. Perhaps not as part of this PR 🤷♂️
private lazy var emailLabel = { UILabel(frame: .zero) }() | ||
private lazy var manageThisAccountLabel = { | ||
UILabel(frame: .zero) | ||
|> UILabel.lens.translatesAutoresizingMaskIntoConstraints .~ 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.
Worth noting that our constraint helper functions automatically set this and it's also redundant when a view is added to a stackview.
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.
So actually this label is not constrained using our helper functions, nor added to a stack view, which is why it needs this to be set.
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.
Ah apologies!
|> UILabel.lens.translatesAutoresizingMaskIntoConstraints .~ false | ||
}() | ||
|
||
private lazy var stackView = { |
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.
Think we've mostly standardized on rootStackView
for the top-most stack.
} | ||
""" | ||
|
||
guard let data = jsonString.data(using: .utf8) 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.
Saves a guard
statement if we use the non-failable Data
initializer:
let data = Data(jsonString.utf8)
@@ -15,3 +15,14 @@ public func ksr_setCustomSpacing(_ spacing: CGFloat) -> ((UIView, UIStackView) - | |||
return stackView | |||
} | |||
} | |||
|
|||
public func ksr_setBackgroundColor(_ color: UIColor) -> ((UIStackView) -> (UIStackView)) { |
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.
Handy as this may be 😄 If we're calling this in bindStyles()
we may end up with many background views? 🤔 I would suggest this as an extension on UIStackView
with an associated object to track any existing background views perhaps and, if one exists, just update its backgroundColor
. Another fairly rudimentary way could be to use UIView
's tag
property and just set some sentinel value that you can check for.
Calling it again in the test shows that it's not idempotent:
label | ||
|> settingsDescriptionLabelStyle | ||
|> \.text %~ { _ in localizedString( | ||
key: "manage_this_account", |
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.
Here too. Not sure if these are legacy.
@@ -2,6 +2,11 @@ import KsApi | |||
import Prelude | |||
import ReactiveSwift | |||
|
|||
public typealias SettingsAccountData = ( | |||
currency: Currency, email: 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.
Could we put each label on new line?
return true | ||
} | ||
|
||
guard let isEmailVerified = user.isEmailVerified, |
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.
For your consideration:
if [user.isEmailVerified, user.isDeliverable]
.map({ $0 ?? false })
.allSatisfy(isTrue) {
return true
}
Not sure how much it really adds for readability, just less guard let
s.
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.
Hmm yeah I'm not sure the extra mental overhead is worth it here 😅
self.vm.inputs.viewWillAppear() | ||
self.reloadDataShouldHideWarningIcon.assertValueCount(1) |
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.
🙈
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.
🚢
📲 What
Adds a header to the Settings account screen for Apple connected users, and hides the Change Password and Change Email functionality.
🤔 Why
Apple connected users will not be able to change their Kickstarter email, and they will not have a password. We want to prevent these users from accessing these features.
🛠 How
SettingsAccountHeader
that displays the user's email and some messaging about how to update their Apple accountUserCurrency.swift
toGraphUser.swift
and added testsisAppleConnected
to the User schema, and updated the account query to include theisAppleConnected
field.combineLatest
bug where thereloadData
output was firing multiple times after the first load.👀 See
Trello, screenshots, external resources?
♿️ Accessibility
✅ Acceptance criteria
Using Charles Proxy, enable breakpoints to intercept the response from the GraphQL endpoint. Modify your payload by setting
isAppleConnected
totrue
, to see the Apple-connected user treatment.isAppleConnected
to true. You should see the new Apple header displaying your email.⏰ TODO