-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into saeed/app_theme_configurable_option2
- Loading branch information
Showing
30 changed files
with
733 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
Authorization/Authorization/Presentation/Startup/LogistrationBottomView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// LogistrationBottomView.swift | ||
// Authorization | ||
// | ||
// Created by SaeedBashir on 10/26/23. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
import Core | ||
|
||
public struct LogistrationBottomView: View { | ||
@ObservedObject | ||
private var viewModel: StartupViewModel | ||
|
||
@Environment(\.isHorizontal) private var isHorizontal | ||
|
||
public init(viewModel: StartupViewModel) { | ||
self.viewModel = viewModel | ||
} | ||
|
||
public var body: some View { | ||
VStack(alignment: .leading) { | ||
HStack(spacing: 24) { | ||
StyledButton(AuthLocalization.SignIn.registerBtn) { | ||
viewModel.router.showRegisterScreen() | ||
viewModel.tracksignUpClicked() | ||
} | ||
.frame(maxWidth: .infinity) | ||
|
||
StyledButton( | ||
AuthLocalization.SignIn.logInTitle, | ||
action: { viewModel.router.showLoginScreen() }, | ||
color: .white, | ||
textColor: Theme.Colors.accentColor, | ||
borderColor: Theme.Colors.textInputStroke | ||
) | ||
.frame(width: 100) | ||
} | ||
.padding(.horizontal, isHorizontal ? 0 : 0) | ||
} | ||
.padding(.horizontal, isHorizontal ? 10 : 24) | ||
} | ||
} | ||
|
||
struct LogistrationBottomView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
let vm = StartupViewModel( | ||
interactor: AuthInteractor.mock, | ||
router: AuthorizationRouterMock(), | ||
analytics: AuthorizationAnalyticsMock() | ||
) | ||
LogistrationBottomView(viewModel: vm) | ||
.preferredColorScheme(.light) | ||
.previewDisplayName("StartupView Light") | ||
.loadFonts() | ||
|
||
LogistrationBottomView(viewModel: vm) | ||
.preferredColorScheme(.dark) | ||
.previewDisplayName("StartupView Dark") | ||
.loadFonts() | ||
} | ||
} |
124 changes: 124 additions & 0 deletions
124
Authorization/Authorization/Presentation/Startup/StartupView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
// | ||
// StartupView.swift | ||
// Authorization | ||
// | ||
// Created by SaeedBashir on 10/23/23. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
import Core | ||
|
||
public struct StartupView: View { | ||
|
||
@State private var searchQuery: String = "" | ||
|
||
@Environment(\.isHorizontal) private var isHorizontal | ||
|
||
@ObservedObject | ||
private var viewModel: StartupViewModel | ||
|
||
public init(viewModel: StartupViewModel) { | ||
self.viewModel = viewModel | ||
} | ||
|
||
public var body: some View { | ||
ZStack(alignment: .top) { | ||
VStack(alignment: .leading) { | ||
CoreAssets.appLogo.swiftUIImage | ||
.resizable() | ||
.frame(maxWidth: 189, maxHeight: 54) | ||
.padding(.top, isHorizontal ? 20 : 40) | ||
.padding(.bottom, isHorizontal ? 0 : 20) | ||
.padding(.horizontal, isHorizontal ? 10 : 24) | ||
.colorMultiply(Theme.Colors.accentColor) | ||
|
||
VStack { | ||
VStack(alignment: .leading) { | ||
Text(AuthLocalization.Startup.infoMessage) | ||
.font(Theme.Fonts.titleLarge) | ||
.foregroundColor(Theme.Colors.textPrimary) | ||
.padding(.bottom, isHorizontal ? 10 : 20 ) | ||
|
||
Text(AuthLocalization.Startup.searchTitle) | ||
.font(Theme.Fonts.bodyLarge) | ||
.bold() | ||
.foregroundColor(Theme.Colors.textPrimary) | ||
.padding(.top, isHorizontal ? 0 : 24) | ||
|
||
HStack(spacing: 11) { | ||
Image(systemName: "magnifyingglass") | ||
.padding(.leading, 16) | ||
.padding(.top, 1) | ||
TextField(AuthLocalization.Startup.searchPlaceholder, text: $searchQuery, onCommit: { | ||
if searchQuery.isEmpty { return } | ||
viewModel.router.showDiscoveryScreen(searchQuery: searchQuery, fromStartupScreen: true) | ||
}) | ||
.autocapitalization(.none) | ||
.autocorrectionDisabled() | ||
.frame(minHeight: 50) | ||
.submitLabel(.search) | ||
|
||
}.overlay( | ||
Theme.Shapes.textInputShape | ||
.stroke(lineWidth: 1) | ||
.fill(Theme.Colors.textInputStroke) | ||
) | ||
.background( | ||
Theme.Shapes.textInputShape | ||
.fill(Theme.Colors.textInputBackground) | ||
) | ||
|
||
Button { | ||
viewModel.router.showDiscoveryScreen(searchQuery: searchQuery, fromStartupScreen: true) | ||
} label: { | ||
Text(AuthLocalization.Startup.exploreAllCourses) | ||
.underline() | ||
.foregroundColor(Theme.Colors.accentColor) | ||
.font(Theme.Fonts.bodyLarge) | ||
} | ||
.padding(.top, isHorizontal ? 0 : 5) | ||
Spacer() | ||
} | ||
.padding(.horizontal, isHorizontal ? 10 : 24) | ||
|
||
LogistrationBottomView(viewModel: viewModel) | ||
} | ||
.padding(.top, 10) | ||
.padding(.bottom, 2) | ||
} | ||
.onDisappear { | ||
searchQuery = "" | ||
} | ||
} | ||
.hideNavigationBar() | ||
.padding(.all, isHorizontal ? 1 : 0) | ||
.background(Theme.Colors.background.ignoresSafeArea(.all)) | ||
.ignoresSafeArea(.keyboard, edges: .bottom) | ||
.onTapGesture { | ||
UIApplication.shared.endEditing() | ||
} | ||
} | ||
} | ||
|
||
#if DEBUG | ||
struct StartupView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
let vm = StartupViewModel( | ||
interactor: AuthInteractor.mock, | ||
router: AuthorizationRouterMock(), | ||
analytics: AuthorizationAnalyticsMock() | ||
) | ||
|
||
StartupView(viewModel: vm) | ||
.preferredColorScheme(.light) | ||
.previewDisplayName("StartupView Light") | ||
.loadFonts() | ||
|
||
StartupView(viewModel: vm) | ||
.preferredColorScheme(.dark) | ||
.previewDisplayName("StartupView Dark") | ||
.loadFonts() | ||
} | ||
} | ||
#endif |
30 changes: 30 additions & 0 deletions
30
Authorization/Authorization/Presentation/Startup/StartupViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// StartupViewModel.swift | ||
// Authorization | ||
// | ||
// Created by SaeedBashir on 10/23/23. | ||
// | ||
|
||
import Foundation | ||
import Core | ||
|
||
public class StartupViewModel: ObservableObject { | ||
let router: AuthorizationRouter | ||
private let interactor: AuthInteractorProtocol | ||
private let analytics: AuthorizationAnalytics | ||
@Published var searchQuery: String? | ||
|
||
public init( | ||
interactor: AuthInteractorProtocol, | ||
router: AuthorizationRouter, | ||
analytics: AuthorizationAnalytics | ||
) { | ||
self.interactor = interactor | ||
self.router = router | ||
self.analytics = analytics | ||
} | ||
|
||
func tracksignUpClicked() { | ||
analytics.signUpClicked() | ||
} | ||
} |
Oops, something went wrong.