Skip to content

Commit

Permalink
Sync: Part 11 sync to upstream (#557)
Browse files Browse the repository at this point in the history
* chore: add video and discussion analytics (#93)

* fix: fixes after merge, deleted IAP parts

* chore: changed dependency version, deleted unused analytics part

* chore: regenerate mocks

* chore: In app ratings modal and profile picture picture sheet UI improvements (#94)

* chore: show subtitles for videos in full-screen mode (#97)

* fix: after merge

* fix: iOS 18 Toggle tap gesture (#98)

* fix: added priority for toggle tap gesture

* fix: fixed tap and drag actions for Toggle

---------

Co-authored-by: Anton Yarmolenko <[email protected]>

* fix: gesture for ios 18.2

* chore: quick fix with performance for subtitles view

* chore: sign-in and register screens social sign in improvements (#95)

* chore: fix after merge

* fix: fix microsoft login issue on iOS after config branch merges (#96)

* refactor: change the microsoft key name in the script (#101)

* chore: fix access modifier

* chore: re-generate nocks

* chore: hide grades when sub section dependents not available (#99)

* chore: fix after merge

* chore: hide progress points from assignment status (#100)

* chore: fix test

---------

Co-authored-by: Saeed Bashir <[email protected]>
Co-authored-by: Anton Yarmolenko <[email protected]>
Co-authored-by: Shafqat Muneer <[email protected]>
  • Loading branch information
4 people authored Jan 7, 2025
1 parent 61c6f6b commit 7e67397
Show file tree
Hide file tree
Showing 45 changed files with 648 additions and 301 deletions.
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

0 comments on commit 7e67397

Please sign in to comment.