Skip to content
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

Fix: Social auth banner #558

Merged
merged 3 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class SignInViewModel: ObservableObject {
let user = try await interactor.login(username: username, password: password)
analytics.identify(id: "\(user.id)", username: user.username, email: user.email)
analytics.userLogin(method: .password)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, authMethod: nil)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: nil)
NotificationCenter.default.post(name: .userAuthorized, object: nil)
} catch let error {
failure(error)
Expand All @@ -101,7 +101,7 @@ public class SignInViewModel: ObservableObject {
let user = try await interactor.login(ssoToken: "")
analytics.identify(id: "\(user.id)", username: user.username, email: user.email)
analytics.userLogin(method: .password)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, authMethod: nil)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: nil)
} catch let error {
failure(error)
}
Expand Down Expand Up @@ -132,14 +132,11 @@ public class SignInViewModel: ObservableObject {
let user = try await interactor.login(externalToken: externalToken, backend: backend)
analytics.identify(id: "\(user.id)", username: user.username, email: user.email)
analytics.userLogin(method: authMethod)
var socialAuthMethod: String?
if case AuthMethod.socailAuth(let method) = authMethod {
socialAuthMethod = method.rawValue
var postLoginData: PostLoginData?
if case .socailAuth(let socialMethod) = authMethod {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

socailAuth typo
socialAuth?

postLoginData = PostLoginData(authMethod: socialMethod.rawValue, showSocialRegisterBanner: false)
}
router.showMainOrWhatsNewScreen(
sourceScreen: sourceScreen,
authMethod: socialAuthMethod
)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: postLoginData)
NotificationCenter.default.post(name: .userAuthorized, object: nil)
} catch let error {
failure(error, authMethod: authMethod)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,11 @@ public final class SignUpViewModel: ObservableObject {
analytics.identify(id: "\(user.id)", username: user.username, email: user.email)
analytics.registrationSuccess(method: authMetod.analyticsValue)
isShowProgress = false
var socialAuthMethod: String?
if case AuthMethod.socailAuth(let method) = authMethod {
socialAuthMethod = method.rawValue
var postLoginData: PostLoginData?
if case .socailAuth(let socialMethod) = authMethod {
postLoginData = PostLoginData(authMethod: socialMethod.rawValue, showSocialRegisterBanner: false)
}
router.showMainOrWhatsNewScreen(
sourceScreen: sourceScreen,
authMethod: socialAuthMethod
)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: postLoginData)
NotificationCenter.default.post(name: .userAuthorized, object: nil)
} catch let error {
isShowProgress = false
Expand Down Expand Up @@ -204,21 +201,12 @@ public final class SignUpViewModel: ObservableObject {
analytics.identify(id: "\(user.id)", username: user.username, email: user.email)
analytics.userLogin(method: authMethod)
isShowProgress = false
var socialAuthMethod: String?
if case AuthMethod.socailAuth(let method) = authMethod {
socialAuthMethod = method.rawValue
var postLoginData: PostLoginData?
if case .socailAuth(let socialMethod) = authMethod {
postLoginData = PostLoginData(authMethod: socialMethod.rawValue, showSocialRegisterBanner: true)
}
router.showMainOrWhatsNewScreen(
sourceScreen: sourceScreen,
authMethod: socialAuthMethod
)
NotificationCenter.default.post(
name: .userAuthorized,
object: [
"authMethod": authMethod,
"showSocialRegisterBanner": true
]
)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: postLoginData)
NotificationCenter.default.post(name: .userAuthorized, object: nil)
} catch {
update(fullName: response.name, email: response.email)
self.externalToken = response.token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class SSOWebViewModel: ObservableObject {
let user = try await interactor.login(ssoToken: "\(payload).\(signature)")
analytics.identify(id: "\(user.id)", username: user.username, email: user.email)
analytics.userLogin(method: .SSO)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, authMethod: nil)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: nil)
} catch let error {
failure(error, authMethod: .SSO)
}
Expand Down
Loading
Loading