generated from element-hq/.github
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a banner that offers the user to transition to native sliding sync (
#3252) * Fixes #2508 - Offer user to transition to SSS * Rename `HomeScreenBannerMode.shown` to `HomeScreenBannerMode.show` * Generate and use preview tests for the migration banner * Bump the RustSDK to v1.0.46 * Address PR review comment
- Loading branch information
1 parent
f264c25
commit bef8924
Showing
16 changed files
with
186 additions
and
26 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
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
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
68 changes: 68 additions & 0 deletions
68
ElementX/Sources/Screens/HomeScreen/View/HomeScreenSlidingSyncMigrationBanner.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,68 @@ | ||
// | ||
// Copyright 2024 New Vector Ltd. | ||
// | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
// Please see LICENSE in the repository root for full details. | ||
// | ||
|
||
import Combine | ||
import SwiftUI | ||
|
||
struct HomeScreenSlidingSyncMigrationBanner: View { | ||
var context: HomeScreenViewModel.Context | ||
|
||
var body: some View { | ||
VStack(alignment: .leading, spacing: 16) { | ||
VStack(alignment: .leading, spacing: 4) { | ||
HStack(spacing: 16) { | ||
Text(L10n.bannerMigrateToNativeSlidingSyncTitle) | ||
.font(.compound.bodyLGSemibold) | ||
.foregroundColor(.compound.textPrimary) | ||
|
||
Spacer() | ||
|
||
Button { | ||
context.send(viewAction: .skipSlidingSyncUpgrade) | ||
} label: { | ||
Image(systemName: "xmark") | ||
.foregroundColor(.compound.iconSecondary) | ||
.frame(width: 12, height: 12) | ||
} | ||
} | ||
Text(L10n.bannerMigrateToNativeSlidingSyncDescription) | ||
.font(.compound.bodyMD) | ||
.foregroundColor(.compound.textSecondary) | ||
} | ||
|
||
Button(L10n.bannerMigrateToNativeSlidingSyncAction) { | ||
context.send(viewAction: .confirmSlidingSyncUpgrade) | ||
} | ||
.frame(maxWidth: .infinity) | ||
.buttonStyle(.compound(.primary, size: .medium)) | ||
} | ||
.padding(16) | ||
.background(Color.compound.bgSubtleSecondary) | ||
.cornerRadius(14) | ||
.padding(.horizontal, 16) | ||
} | ||
} | ||
|
||
struct HomeScreenSlidingSyncMigrationBanner_Previews: PreviewProvider, TestablePreview { | ||
static let viewModel = buildViewModel() | ||
|
||
static var previews: some View { | ||
HomeScreenSlidingSyncMigrationBanner(context: viewModel.context) | ||
} | ||
|
||
static func buildViewModel() -> HomeScreenViewModel { | ||
let clientProxy = ClientProxyMock(.init()) | ||
|
||
let userSession = UserSessionMock(.init(clientProxy: clientProxy)) | ||
|
||
return HomeScreenViewModel(userSession: userSession, | ||
analyticsService: ServiceLocator.shared.analytics, | ||
appSettings: ServiceLocator.shared.settings, | ||
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(), | ||
userIndicatorController: ServiceLocator.shared.userIndicatorController) | ||
} | ||
} |
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
3 changes: 3 additions & 0 deletions
3
...shots__/PreviewTests/test_homeScreenSlidingSyncMigrationBanner-iPad-en-GB.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...hots__/PreviewTests/test_homeScreenSlidingSyncMigrationBanner-iPad-pseudo.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...__/PreviewTests/test_homeScreenSlidingSyncMigrationBanner-iPhone-15-en-GB.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.