mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Properly use the new hideBrandChrome in the AuthenticationStartLogo
This commit is contained in:
committed by
Stefan Ceriu
parent
8236893290
commit
39a757d037
@@ -111,7 +111,8 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
|||||||
let appLockService = AppLockService(keychainController: keychainController, appSettings: appSettings)
|
let appLockService = AppLockService(keychainController: keychainController, appSettings: appSettings)
|
||||||
let appLockNavigationCoordinator = NavigationRootCoordinator()
|
let appLockNavigationCoordinator = NavigationRootCoordinator()
|
||||||
appLockFlowCoordinator = AppLockFlowCoordinator(appLockService: appLockService,
|
appLockFlowCoordinator = AppLockFlowCoordinator(appLockService: appLockService,
|
||||||
navigationCoordinator: appLockNavigationCoordinator)
|
navigationCoordinator: appLockNavigationCoordinator,
|
||||||
|
appSettings: appSettings)
|
||||||
|
|
||||||
notificationManager = NotificationManager(notificationCenter: UNUserNotificationCenter.current(),
|
notificationManager = NotificationManager(notificationCenter: UNUserNotificationCenter.current(),
|
||||||
appSettings: appSettings)
|
appSettings: appSettings)
|
||||||
@@ -911,7 +912,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
|||||||
|
|
||||||
showLoadingIndicator()
|
showLoadingIndicator()
|
||||||
|
|
||||||
navigationRootCoordinator.setRootCoordinator(PlaceholderScreenCoordinator())
|
navigationRootCoordinator.setRootCoordinator(PlaceholderScreenCoordinator(hideBrandChrome: appSettings.hideBrandChrome))
|
||||||
|
|
||||||
stopSync(isBackgroundTask: false)
|
stopSync(isBackgroundTask: false)
|
||||||
userSessionFlowCoordinator?.stop()
|
userSessionFlowCoordinator?.stop()
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ enum AppLockFlowCoordinatorAction: Equatable {
|
|||||||
class AppLockFlowCoordinator: CoordinatorProtocol {
|
class AppLockFlowCoordinator: CoordinatorProtocol {
|
||||||
let appLockService: AppLockServiceProtocol
|
let appLockService: AppLockServiceProtocol
|
||||||
let navigationCoordinator: NavigationRootCoordinator
|
let navigationCoordinator: NavigationRootCoordinator
|
||||||
|
let appSettings: AppSettings
|
||||||
|
|
||||||
/// States the flow can find itself in
|
/// States the flow can find itself in
|
||||||
enum State: StateType {
|
enum State: StateType {
|
||||||
@@ -89,9 +90,11 @@ class AppLockFlowCoordinator: CoordinatorProtocol {
|
|||||||
init(initialState: State = .initial,
|
init(initialState: State = .initial,
|
||||||
appLockService: AppLockServiceProtocol,
|
appLockService: AppLockServiceProtocol,
|
||||||
navigationCoordinator: NavigationRootCoordinator,
|
navigationCoordinator: NavigationRootCoordinator,
|
||||||
notificationCenter: NotificationCenter = .default) {
|
notificationCenter: NotificationCenter = .default,
|
||||||
|
appSettings: AppSettings) {
|
||||||
self.appLockService = appLockService
|
self.appLockService = appLockService
|
||||||
self.navigationCoordinator = navigationCoordinator
|
self.navigationCoordinator = navigationCoordinator
|
||||||
|
self.appSettings = appSettings
|
||||||
|
|
||||||
// Set the initial state and start with the placeholder screen as the root view.
|
// Set the initial state and start with the placeholder screen as the root view.
|
||||||
stateMachine = .init(state: initialState)
|
stateMachine = .init(state: initialState)
|
||||||
@@ -218,7 +221,7 @@ class AppLockFlowCoordinator: CoordinatorProtocol {
|
|||||||
|
|
||||||
/// Displays the unlock flow with the app's placeholder view to hide obscure the view hierarchy in the app switcher.
|
/// Displays the unlock flow with the app's placeholder view to hide obscure the view hierarchy in the app switcher.
|
||||||
private func showPlaceholder() {
|
private func showPlaceholder() {
|
||||||
navigationCoordinator.setRootCoordinator(PlaceholderScreenCoordinator(hideBrandChrome: false), animated: false)
|
navigationCoordinator.setRootCoordinator(PlaceholderScreenCoordinator(hideBrandChrome: appSettings.hideBrandChrome), animated: false)
|
||||||
actionsSubject.send(.lockApp)
|
actionsSubject.send(.lockApp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
navigationTabCoordinator = NavigationTabCoordinator()
|
navigationTabCoordinator = NavigationTabCoordinator()
|
||||||
navigationRootCoordinator.setRootCoordinator(navigationTabCoordinator)
|
navigationRootCoordinator.setRootCoordinator(navigationTabCoordinator)
|
||||||
|
|
||||||
let chatsSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator())
|
let chatsSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator(hideBrandChrome: flowParameters.appSettings.hideBrandChrome))
|
||||||
chatsFlowCoordinator = ChatsFlowCoordinator(isNewLogin: isNewLogin,
|
chatsFlowCoordinator = ChatsFlowCoordinator(isNewLogin: isNewLogin,
|
||||||
navigationSplitCoordinator: chatsSplitCoordinator,
|
navigationSplitCoordinator: chatsSplitCoordinator,
|
||||||
flowParameters: flowParameters)
|
flowParameters: flowParameters)
|
||||||
@@ -88,7 +88,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
chatsTabDetails.barVisibilityOverride = .hidden
|
chatsTabDetails.barVisibilityOverride = .hidden
|
||||||
}
|
}
|
||||||
|
|
||||||
let spacesSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator())
|
let spacesSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator(hideBrandChrome: flowParameters.appSettings.hideBrandChrome))
|
||||||
spaceExplorerFlowCoordinator = SpaceExplorerFlowCoordinator(navigationSplitCoordinator: spacesSplitCoordinator,
|
spaceExplorerFlowCoordinator = SpaceExplorerFlowCoordinator(navigationSplitCoordinator: spacesSplitCoordinator,
|
||||||
flowParameters: flowParameters)
|
flowParameters: flowParameters)
|
||||||
spacesTabDetails = .init(tag: HomeTab.spaces, title: L10n.screenHomeTabSpaces, icon: \.space, selectedIcon: \.spaceSolid)
|
spacesTabDetails = .init(tag: HomeTab.spaces, title: L10n.screenHomeTabSpaces, icon: \.space, selectedIcon: \.spaceSolid)
|
||||||
|
|||||||
+13
-5
@@ -12,7 +12,7 @@ struct AuthenticationStartLogo: View {
|
|||||||
@Environment(\.colorScheme) private var colorScheme
|
@Environment(\.colorScheme) private var colorScheme
|
||||||
|
|
||||||
/// Set to `true` when using on top of `Asset.Images.launchBackground`
|
/// Set to `true` when using on top of `Asset.Images.launchBackground`
|
||||||
let isOnGradient: Bool
|
let hideBrandChrome: Bool
|
||||||
|
|
||||||
/// Extra padding needed to avoid cropping the shadows.
|
/// Extra padding needed to avoid cropping the shadows.
|
||||||
private let extra: CGFloat = 64
|
private let extra: CGFloat = 64
|
||||||
@@ -22,11 +22,19 @@ struct AuthenticationStartLogo: View {
|
|||||||
private var isLight: Bool { colorScheme == .light }
|
private var isLight: Bool { colorScheme == .light }
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
if hideBrandChrome {
|
||||||
|
Image(asset: Asset.Images.appLogo)
|
||||||
|
} else {
|
||||||
|
brandLogo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var brandLogo: some View {
|
||||||
Image(asset: Asset.Images.appLogo)
|
Image(asset: Asset.Images.appLogo)
|
||||||
.background {
|
.background {
|
||||||
Circle()
|
Circle()
|
||||||
.inset(by: 1)
|
.inset(by: 1)
|
||||||
.shadow(color: .black.opacity(!isLight && isOnGradient ? 0.3 : 0.4),
|
.shadow(color: .black.opacity(!isLight ? 0.3 : 0.4),
|
||||||
radius: 12.57143,
|
radius: 12.57143,
|
||||||
y: 6.28571)
|
y: 6.28571)
|
||||||
|
|
||||||
@@ -40,19 +48,19 @@ struct AuthenticationStartLogo: View {
|
|||||||
.padding(24)
|
.padding(24)
|
||||||
.background {
|
.background {
|
||||||
Color.white
|
Color.white
|
||||||
.opacity(isLight ? 0.23 : isOnGradient ? 0.05 : 0.13)
|
.opacity(isLight ? 0.23 : 0.05)
|
||||||
}
|
}
|
||||||
.clipShape(outerShape)
|
.clipShape(outerShape)
|
||||||
.overlay {
|
.overlay {
|
||||||
outerShape
|
outerShape
|
||||||
.inset(by: 0.25)
|
.inset(by: 0.25)
|
||||||
.stroke(.white.opacity(isLight ? 1 : isOnGradient ? 0.9 : 0.25), lineWidth: 0.5)
|
.stroke(.white.opacity(isLight ? 1 : 0.9), lineWidth: 0.5)
|
||||||
.blendMode(isLight ? .normal : .overlay)
|
.blendMode(isLight ? .normal : .overlay)
|
||||||
}
|
}
|
||||||
.padding(extra)
|
.padding(extra)
|
||||||
.background {
|
.background {
|
||||||
ZStack {
|
ZStack {
|
||||||
if !isLight, isOnGradient {
|
if !isLight {
|
||||||
outerShape
|
outerShape
|
||||||
.inset(by: 1)
|
.inset(by: 1)
|
||||||
.padding(extra)
|
.padding(extra)
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ struct AuthenticationStartScreen: View {
|
|||||||
if verticalSizeClass == .regular {
|
if verticalSizeClass == .regular {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
AuthenticationStartLogo(isOnGradient: !context.viewState.hideBrandChrome)
|
AuthenticationStartLogo(hideBrandChrome: context.viewState.hideBrandChrome)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import SwiftUI
|
|||||||
class PlaceholderScreenCoordinator: CoordinatorProtocol {
|
class PlaceholderScreenCoordinator: CoordinatorProtocol {
|
||||||
private let hideBrandChrome: Bool
|
private let hideBrandChrome: Bool
|
||||||
|
|
||||||
init(hideBrandChrome: Bool = true) {
|
init(hideBrandChrome: Bool) {
|
||||||
self.hideBrandChrome = hideBrandChrome
|
self.hideBrandChrome = hideBrandChrome
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ struct PlaceholderScreen: View {
|
|||||||
let hideBrandChrome: Bool
|
let hideBrandChrome: Bool
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
AuthenticationStartLogo(isOnGradient: !hideBrandChrome)
|
AuthenticationStartLogo(hideBrandChrome: hideBrandChrome)
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.background {
|
.background {
|
||||||
if !hideBrandChrome {
|
if !hideBrandChrome {
|
||||||
@@ -40,11 +40,11 @@ struct PlaceholderScreen: View {
|
|||||||
|
|
||||||
struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
|
struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
PlaceholderScreen(hideBrandChrome: true)
|
|
||||||
.previewDisplayName("Screen")
|
|
||||||
|
|
||||||
PlaceholderScreen(hideBrandChrome: false)
|
PlaceholderScreen(hideBrandChrome: false)
|
||||||
.previewDisplayName("With background")
|
.previewDisplayName("With chrome")
|
||||||
|
|
||||||
|
PlaceholderScreen(hideBrandChrome: true)
|
||||||
|
.previewDisplayName("Without chrome")
|
||||||
|
|
||||||
NavigationSplitView {
|
NavigationSplitView {
|
||||||
List {
|
List {
|
||||||
@@ -53,7 +53,7 @@ struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} detail: {
|
} detail: {
|
||||||
PlaceholderScreen(hideBrandChrome: true)
|
PlaceholderScreen(hideBrandChrome: false)
|
||||||
}
|
}
|
||||||
.previewDisplayName("Split View")
|
.previewDisplayName("Split View")
|
||||||
.previewInterfaceOrientation(.landscapeLeft)
|
.previewInterfaceOrientation(.landscapeLeft)
|
||||||
|
|||||||
@@ -198,7 +198,8 @@ class MockScreen: Identifiable {
|
|||||||
let flowCoordinator = AppLockFlowCoordinator(initialState: .unlocked,
|
let flowCoordinator = AppLockFlowCoordinator(initialState: .unlocked,
|
||||||
appLockService: appLockService,
|
appLockService: appLockService,
|
||||||
navigationCoordinator: navigationCoordinator,
|
navigationCoordinator: navigationCoordinator,
|
||||||
notificationCenter: notificationCenter)
|
notificationCenter: notificationCenter,
|
||||||
|
appSettings: ServiceLocator.shared.settings)
|
||||||
|
|
||||||
flowCoordinator.actions
|
flowCoordinator.actions
|
||||||
.sink { [weak self] action in
|
.sink { [weak self] action in
|
||||||
@@ -751,7 +752,7 @@ class MockScreen: Identifiable {
|
|||||||
appSettings.hasRunIdentityConfirmationOnboarding = true
|
appSettings.hasRunIdentityConfirmationOnboarding = true
|
||||||
appSettings.hasRunNotificationPermissionsOnboarding = true
|
appSettings.hasRunNotificationPermissionsOnboarding = true
|
||||||
appSettings.analyticsConsentState = .optedOut
|
appSettings.analyticsConsentState = .optedOut
|
||||||
let navigationSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator())
|
let navigationSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator(hideBrandChrome: false))
|
||||||
navigationRootCoordinator.setRootCoordinator(navigationSplitCoordinator)
|
navigationRootCoordinator.setRootCoordinator(navigationSplitCoordinator)
|
||||||
|
|
||||||
let clientProxy = ClientProxyMock(.init(userID: "@mock:client.com", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))
|
let clientProxy = ClientProxyMock(.init(userID: "@mock:client.com", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))
|
||||||
|
|||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:c6466a4dabc841afdb8e8fa1075d2a522df2001afd3b0ea38920757693d1a257
|
|
||||||
size 131689
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:c6466a4dabc841afdb8e8fa1075d2a522df2001afd3b0ea38920757693d1a257
|
|
||||||
size 131689
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:61f6e4e2777ed816cee39e9a833ecd4e8591f04056bf06da055f402db5048bd2
|
|
||||||
size 192719
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:61f6e4e2777ed816cee39e9a833ecd4e8591f04056bf06da055f402db5048bd2
|
|
||||||
size 192719
|
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:4380953ce3d71548e00c2a13e887c072e9be87683649b01e1229650450fb43ef
|
||||||
|
size 111030
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:4380953ce3d71548e00c2a13e887c072e9be87683649b01e1229650450fb43ef
|
||||||
|
size 111030
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8917e9fd0ba16e0986b2ce7fdb5b1d6c14606161da7cd8f2f1a632d596553d3b
|
||||||
|
size 69542
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8917e9fd0ba16e0986b2ce7fdb5b1d6c14606161da7cd8f2f1a632d596553d3b
|
||||||
|
size 69542
|
||||||
@@ -29,7 +29,7 @@ class ChatsFlowCoordinatorTests: XCTestCase {
|
|||||||
clientProxy = ClientProxyMock(.init(userID: "hi@bob", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))
|
clientProxy = ClientProxyMock(.init(userID: "hi@bob", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))
|
||||||
timelineControllerFactory = TimelineControllerFactoryMock(.init())
|
timelineControllerFactory = TimelineControllerFactoryMock(.init())
|
||||||
|
|
||||||
splitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator())
|
splitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator(hideBrandChrome: false))
|
||||||
|
|
||||||
notificationManager = NotificationManagerMock()
|
notificationManager = NotificationManagerMock()
|
||||||
|
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ class RoomFlowCoordinatorTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let navigationSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator())
|
let navigationSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator(hideBrandChrome: false))
|
||||||
navigationStackCoordinator = NavigationStackCoordinator()
|
navigationStackCoordinator = NavigationStackCoordinator()
|
||||||
navigationSplitCoordinator.setDetailCoordinator(navigationStackCoordinator)
|
navigationSplitCoordinator.setDetailCoordinator(navigationStackCoordinator)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user