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

Sync: Part 11 sync to upstream #557

Merged
merged 21 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
be873f3
chore: add video and discussion analytics (#93)
saeedbashir Nov 13, 2024
cfc5b1b
fix: fixes after merge, deleted IAP parts
rnr Dec 19, 2024
f73c10f
chore: changed dependency version, deleted unused analytics part
rnr Dec 20, 2024
41870ac
chore: regenerate mocks
rnr Dec 20, 2024
009c490
chore: In app ratings modal and profile picture picture sheet UI impr…
saeedbashir Nov 15, 2024
9cbe962
chore: show subtitles for videos in full-screen mode (#97)
shafqat-muneer Nov 22, 2024
1ffadfd
fix: after merge
rnr Dec 23, 2024
7f8f347
fix: iOS 18 Toggle tap gesture (#98)
rnr Nov 21, 2024
61ea590
fix: gesture for ios 18.2
rnr Dec 23, 2024
af2e2df
chore: quick fix with performance for subtitles view
rnr Dec 26, 2024
56e4cf6
chore: sign-in and register screens social sign in improvements (#95)
saeedbashir Nov 25, 2024
0d8cd35
chore: fix after merge
rnr Dec 27, 2024
3eac3ab
fix: fix microsoft login issue on iOS after config branch merges (#96)
saeedbashir Nov 25, 2024
c429fed
refactor: change the microsoft key name in the script (#101)
saeedbashir Dec 2, 2024
fbda27a
chore: fix access modifier
rnr Dec 27, 2024
4ad6479
chore: re-generate nocks
rnr Dec 27, 2024
7369873
chore: hide grades when sub section dependents not available (#99)
saeedbashir Nov 29, 2024
0a83d59
chore: fix after merge
rnr Dec 27, 2024
db043ae
chore: hide progress points from assignment status (#100)
saeedbashir Dec 2, 2024
da94c65
Merge branch 'develop' into sync/part-11-sync-to-upstream
rnr Dec 30, 2024
a32c3db
chore: fix test
rnr Dec 30, 2024
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
22 changes: 13 additions & 9 deletions Authorization/Authorization/Presentation/Login/SignInView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ public struct SignInView: View {
.foregroundColor(Theme.Colors.textPrimary)
.padding(.bottom, 20)
.accessibilityIdentifier("welcome_back_text")
if viewModel.socialAuthEnabled {
SocialAuthView(
viewModel: .init(
config: viewModel.config,
lastUsedOption: viewModel.storage.lastUsedSocialAuth
) { result in
Task { await viewModel.login(with: result) }
}
)
.padding(.top, 22)
.padding(.bottom, 16)
}
Text(AuthLocalization.SignIn.emailOrUsername)
.font(Theme.Fonts.labelLarge)
.foregroundColor(Theme.Colors.textPrimary)
Expand Down Expand Up @@ -231,15 +243,6 @@ public struct SignInView: View {
}
}
}
if viewModel.socialAuthEnabled {
SocialAuthView(
viewModel: .init(
config: viewModel.config
) { result in
Task { await viewModel.login(with: result) }
}
)
}
agreements
Spacer()
}
Expand Down Expand Up @@ -329,6 +332,7 @@ struct SignInView_Previews: PreviewProvider {
config: ConfigMock(),
analytics: AuthorizationAnalyticsMock(),
validator: Validator(),
storage: CoreStorageMock(),
sourceScreen: .default
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,23 @@ public class SignInViewModel: ObservableObject {
private let interactor: AuthInteractorProtocol
private let analytics: AuthorizationAnalytics
private let validator: Validator
let storage: CoreStorage

public init(
interactor: AuthInteractorProtocol,
router: AuthorizationRouter,
config: ConfigProtocol,
analytics: AuthorizationAnalytics,
validator: Validator,
storage: CoreStorage,
sourceScreen: LogistrationSourceScreen
) {
self.interactor = interactor
self.router = router
self.config = config
self.analytics = analytics
self.validator = validator
self.storage = storage
self.sourceScreen = sourceScreen
}

Expand All @@ -83,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)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, authMethod: nil)
NotificationCenter.default.post(name: .userAuthorized, object: nil)
} catch let error {
failure(error)
Expand All @@ -98,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)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, authMethod: nil)
} catch let error {
failure(error)
}
Expand Down Expand Up @@ -129,7 +132,14 @@ 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)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen)
var socialAuthMethod: String?
if case AuthMethod.socailAuth(let method) = authMethod {
socialAuthMethod = method.rawValue
}
router.showMainOrWhatsNewScreen(
sourceScreen: sourceScreen,
authMethod: socialAuthMethod
)
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 @@ -90,6 +90,21 @@ public struct SignUpView: View {

let requiredFields = viewModel.requiredFields
let optionalFields = viewModel.optionalFields

if viewModel.socialAuthEnabled,
!requiredFields.isEmpty {
SocialAuthView(
authType: .register,
viewModel: .init(
config: viewModel.config,
lastUsedOption: viewModel.storage.lastUsedSocialAuth
) { result in
Task { await viewModel.register(with: result) }
}
)
.padding(.top, 22)
.padding(.bottom, -2)
}

FieldsView(
fields: requiredFields,
Expand Down Expand Up @@ -149,18 +164,6 @@ public struct SignUpView: View {
.frame(maxWidth: .infinity)
.accessibilityLabel("signup_button")
}
if viewModel.socialAuthEnabled,
!requiredFields.isEmpty {
SocialAuthView(
authType: .register,
viewModel: .init(
config: viewModel.config
) { result in
Task { await viewModel.register(with: result) }
}
)
.padding(.bottom, 30)
}
Spacer()
}
.padding(.horizontal, 24)
Expand Down Expand Up @@ -214,6 +217,7 @@ struct SignUpView_Previews: PreviewProvider {
config: ConfigMock(),
cssInjector: CSSInjectorMock(),
validator: Validator(),
storage: CoreStorageMock(),
sourceScreen: .default
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public final class SignUpViewModel: ObservableObject {
private let analytics: AuthorizationAnalytics
private let validator: Validator
var authMethod: AuthMethod = .password
let storage: CoreStorage

public init(
interactor: AuthInteractorProtocol,
Expand All @@ -65,6 +66,7 @@ public final class SignUpViewModel: ObservableObject {
config: ConfigProtocol,
cssInjector: CSSInjector,
validator: Validator,
storage: CoreStorage,
sourceScreen: LogistrationSourceScreen
) {
self.interactor = interactor
Expand All @@ -73,6 +75,7 @@ public final class SignUpViewModel: ObservableObject {
self.config = config
self.cssInjector = cssInjector
self.validator = validator
self.storage = storage
self.sourceScreen = sourceScreen
}

Expand Down Expand Up @@ -137,7 +140,14 @@ public final class SignUpViewModel: ObservableObject {
analytics.identify(id: "\(user.id)", username: user.username, email: user.email)
analytics.registrationSuccess(method: authMetod.analyticsValue)
isShowProgress = false
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen)
var socialAuthMethod: String?
if case AuthMethod.socailAuth(let method) = authMethod {
socialAuthMethod = method.rawValue
}
router.showMainOrWhatsNewScreen(
sourceScreen: sourceScreen,
authMethod: socialAuthMethod
)
NotificationCenter.default.post(name: .userAuthorized, object: nil)
} catch let error {
isShowProgress = false
Expand Down Expand Up @@ -194,7 +204,14 @@ public final class SignUpViewModel: ObservableObject {
analytics.identify(id: "\(user.id)", username: user.username, email: user.email)
analytics.userLogin(method: authMethod)
isShowProgress = false
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen)
var socialAuthMethod: String?
if case AuthMethod.socailAuth(let method) = authMethod {
socialAuthMethod = method.rawValue
}
router.showMainOrWhatsNewScreen(
sourceScreen: sourceScreen,
authMethod: socialAuthMethod
)
NotificationCenter.default.post(
name: .userAuthorized,
object: [
Expand All @@ -212,7 +229,7 @@ public final class SignUpViewModel: ObservableObject {
await registerUser(authMetod: authMethod)
}
}

private func update(fullName: String?, email: String?) {
fields.first(where: { $0.field.type == .email })?.text = email ?? ""
fields.first(where: { $0.field.name == "name" })?.text = fullName ?? ""
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)
router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, authMethod: nil)
} catch let error {
failure(error, authMethod: .SSO)
}
Expand Down
Loading
Loading