mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
#40: Add UserSessionStoreProtocol.
Only log out of the specific account. Add tests for the keychain controller. Expand test coverage. PR comments
This commit is contained in:
@@ -19,7 +19,7 @@ protocol AuthenticationCoordinatorDelegate: AnyObject {
|
||||
func authenticationCoordinatorDidStartLoading(_ authenticationCoordinator: AuthenticationCoordinator)
|
||||
|
||||
func authenticationCoordinator(_ authenticationCoordinator: AuthenticationCoordinator,
|
||||
didLoginWithSession userSession: UserSession)
|
||||
didLoginWithSession userSession: UserSessionProtocol)
|
||||
|
||||
func authenticationCoordinator(_ authenticationCoordinator: AuthenticationCoordinator,
|
||||
didFailWithError error: AuthenticationCoordinatorError)
|
||||
@@ -27,7 +27,7 @@ protocol AuthenticationCoordinatorDelegate: AnyObject {
|
||||
|
||||
class AuthenticationCoordinator: Coordinator {
|
||||
|
||||
private let userSessionStore: UserSessionStore
|
||||
private let userSessionStore: UserSessionStoreProtocol
|
||||
private let navigationRouter: NavigationRouter
|
||||
|
||||
private(set) var clientProxy: ClientProxyProtocol?
|
||||
@@ -35,7 +35,7 @@ class AuthenticationCoordinator: Coordinator {
|
||||
|
||||
weak var delegate: AuthenticationCoordinatorDelegate?
|
||||
|
||||
init(userSessionStore: UserSessionStore,
|
||||
init(userSessionStore: UserSessionStoreProtocol,
|
||||
navigationRouter: NavigationRouter) {
|
||||
self.userSessionStore = userSessionStore
|
||||
self.navigationRouter = navigationRouter
|
||||
|
||||
+2
-4
@@ -16,13 +16,11 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// Metrics used across the entire onboarding flow.
|
||||
struct AuthenticationMetrics {
|
||||
/// Standard constants used across the app's UI.
|
||||
struct UIConstants {
|
||||
static let maxContentWidth: CGFloat = 600
|
||||
static let maxContentHeight: CGFloat = 750
|
||||
|
||||
/// The padding used between the top of the main content and the navigation bar.
|
||||
static let topPaddingToNavigationBar: CGFloat = 16
|
||||
/// The width/height used for the main icon shown in most of the screens.
|
||||
static let iconSize: CGFloat = 90
|
||||
}
|
||||
@@ -16,11 +16,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
protocol SplashScreenCoordinatorProtocol: Coordinator, Presentable {
|
||||
var callback: ((SplashScreenCoordinatorAction) -> Void)? { get set }
|
||||
}
|
||||
|
||||
final class SplashScreenCoordinator: SplashScreenCoordinatorProtocol {
|
||||
final class SplashScreenCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ enum SplashScreenViewModelAction {
|
||||
|
||||
// MARK: View
|
||||
|
||||
struct SplashScreenViewState: BindableState, CustomDebugStringConvertible {
|
||||
struct SplashScreenViewState: BindableState {
|
||||
private enum Constants {
|
||||
static let gradientColors = [
|
||||
Color(red: 0.95, green: 0.98, blue: 0.96),
|
||||
@@ -55,11 +55,6 @@ struct SplashScreenViewState: BindableState, CustomDebugStringConvertible {
|
||||
let content: [SplashScreenPageContent]
|
||||
var bindings: SplashScreenBindings
|
||||
|
||||
/// Custom debug description to reduce noise in the logs.
|
||||
var debugDescription: String {
|
||||
"SplashScreenViewState at page \(bindings.pageIndex)."
|
||||
}
|
||||
|
||||
init() {
|
||||
// The pun doesn't translate, so we only use it for English.
|
||||
let locale = Locale.current
|
||||
|
||||
@@ -51,6 +51,7 @@ struct SplashScreen: View {
|
||||
overlayHeight: overlayFrame.height + geometry.safeAreaInsets.bottom)
|
||||
.frame(width: geometry.size.width)
|
||||
.tag(-1)
|
||||
.accessibilityIdentifier("hiddenPage")
|
||||
|
||||
ForEach(0..<pageCount, id: \.self) { index in
|
||||
SplashScreenPage(content: viewModel.viewState.content[index],
|
||||
@@ -90,7 +91,7 @@ struct SplashScreen: View {
|
||||
|
||||
buttons
|
||||
.padding(.horizontal, 16)
|
||||
.frame(maxWidth: AuthenticationMetrics.maxContentWidth)
|
||||
.frame(maxWidth: UIConstants.maxContentWidth)
|
||||
Spacer()
|
||||
}
|
||||
.background(ViewFrameReader(frame: $overlayFrame))
|
||||
|
||||
@@ -68,8 +68,8 @@ struct SplashScreenPage: View {
|
||||
Spacer().frame(maxHeight: overlayHeight)
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.frame(maxWidth: AuthenticationMetrics.maxContentWidth,
|
||||
maxHeight: AuthenticationMetrics.maxContentHeight)
|
||||
.frame(maxWidth: UIConstants.maxContentWidth,
|
||||
maxHeight: UIConstants.maxContentHeight)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(backgroundGradient.ignoresSafeArea())
|
||||
|
||||
Reference in New Issue
Block a user