-
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
MBL-1211: Rewire current user email in AppEnvironment/AppDelegateViewModel #1966
MBL-1211: Rewire current user email in AppEnvironment/AppDelegateViewModel #1966
Conversation
82b189b
to
6ee9775
Compare
@@ -107,6 +107,7 @@ public struct AppEnvironment: AppEnvironmentType { | |||
apiService: AppEnvironment.current.apiService.logout(), | |||
cache: type(of: AppEnvironment.current.cache).init(), | |||
currentUser: nil, | |||
currentUserEmail: nil, |
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.
Clear it on logout, too.
SwiftFormat found issues:
Generated by 🚫 Danger |
|
||
XCTAssertEqual(AppEnvironment.current.currentUserEmail, "[email protected]") | ||
|
||
AppEnvironment.logout() |
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 makes this not-really-a-unit-test but I'm OK with the weirdness.
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 should make note of this change for when we regression test the release since AppDelegate changes have a wide impact
📲 What
Fix
AppEnvironment.current.currentUserEmail
, which did not appear to be correctly saving the currently logged-in user's e-mail.🤔 Why
We need the user's e-mail on the Thanks page for post-campaign backings. I noticed that we had this
currentUserEmail
property onEnvironment
, but it wasn't working correctly. I did some digging and I figured it's because the signal is being deallocated before the value is set.An interesting question is why
currentUserEmail
isn't just part ofcurrentUser
. Apparently the V1User
object doesn't appear to have an e-mail attached to it, and the e-mail is coming from GraphQL, instead. It's a bit messy but I wanted to keep this change fairly low-profile instead of doing more refactoring.