Remove the Spaces Announcement sheet. (#5376)

This commit is contained in:
Doug
2026-04-10 17:49:28 +01:00
committed by GitHub
parent 8b2d83f068
commit 9590443aac
15 changed files with 19 additions and 193 deletions
@@ -39,7 +39,6 @@ final class AppSettings {
private enum UserDefaultsKeys: String {
case lastVersionLaunched
case seenInvites
case hasSeenSpacesAnnouncement
case hasSeenNewSoundBanner
case appLockNumberOfPINAttempts
case appLockNumberOfBiometricAttempts
@@ -185,9 +184,6 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.seenInvites, defaultValue: [], storageType: .userDefaults(store))
var seenInvites: Set<String>
@UserPreference(key: UserDefaultsKeys.hasSeenSpacesAnnouncement, defaultValue: false, storageType: .userDefaults(store))
var hasSeenSpacesAnnouncement
/// Defaults to `true` for new users, and we use a migration to set it to `false` for existing users.
@UserPreference(key: UserDefaultsKeys.hasSeenNewSoundBanner, defaultValue: true, storageType: .userDefaults(store))
var hasSeenNewSoundBanner
@@ -182,7 +182,6 @@ enum TestablePreviewsDictionary {
"SpaceRoomCell_Previews" : SpaceRoomCell_Previews.self,
"SpaceScreen_Previews" : SpaceScreen_Previews.self,
"SpaceSettingsScreen_Previews" : SpaceSettingsScreen_Previews.self,
"SpacesAnnouncementSheetView_Previews" : SpacesAnnouncementSheetView_Previews.self,
"SpacesScreen_Previews" : SpacesScreen_Previews.self,
"SplashScreen_Previews" : SplashScreen_Previews.self,
"StackedAvatarsView_Previews" : StackedAvatarsView_Previews.self,
@@ -21,18 +21,10 @@ struct SpacesScreenViewState: BindableState {
var topLevelSpaces: [SpaceServiceRoom]
var selectedSpaceID: String?
var bindings: SpacesScreenViewStateBindings
}
struct SpacesScreenViewStateBindings {
var isPresentingFeatureAnnouncement = false
}
enum SpacesScreenViewAction {
case spaceAction(SpaceRoomCell.Action)
case showSettings
case screenAppeared
case featureAnnouncementAppeared
case createSpace
}
@@ -30,8 +30,7 @@ class SpacesScreenViewModel: SpacesScreenViewModelType, SpacesScreenViewModelPro
self.userIndicatorController = userIndicatorController
super.init(initialViewState: SpacesScreenViewState(userID: userSession.clientProxy.userID,
topLevelSpaces: spaceServiceProxy.topLevelSpacesPublisher.value,
bindings: .init()),
topLevelSpaces: spaceServiceProxy.topLevelSpacesPublisher.value),
mediaProvider: userSession.mediaProvider)
spaceServiceProxy.topLevelSpacesPublisher
@@ -66,13 +65,6 @@ class SpacesScreenViewModel: SpacesScreenViewModelType, SpacesScreenViewModelPro
fatalError("There shouldn't be any unjoined spaces in the joined spaces list.")
case .showSettings:
actionsSubject.send(.showSettings)
case .screenAppeared:
if !appSettings.hasSeenSpacesAnnouncement {
// Use a task otherwise the presentation isn't animated.
Task { state.bindings.isPresentingFeatureAnnouncement = true }
}
case .featureAnnouncementAppeared:
appSettings.hasSeenSpacesAnnouncement = true
case .createSpace:
actionsSubject.send(.showCreateSpace)
}
@@ -1,116 +0,0 @@
//
// Copyright 2025 Element Creations Ltd.
// Copyright 2022-2025 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
// Please see LICENSE files in the repository root for full details.
//
import Compound
import SwiftUI
struct SpacesAnnouncementSheetView: View {
@Environment(\.dismiss) private var dismiss
let context: SpacesScreenViewModel.Context
var body: some View {
FullscreenDialog(topPadding: 44, horizontalPadding: 24) {
content
} bottomContent: {
buttons
}
.background()
.backgroundStyle(.compound.bgCanvasDefault)
.padding(.top, 14) // For the drag indicator
.presentationDragIndicator(.visible)
.onAppear { context.send(viewAction: .featureAnnouncementAppeared) }
}
var content: some View {
VStack(spacing: 16) {
BigIcon(icon: \.spaceSolid, style: .defaultSolid)
VStack(spacing: 8) {
HStack(spacing: 6) {
Text(L10n.screenSpaceAnnouncementTitle)
.font(.compound.headingMDBold)
.foregroundStyle(.compound.textPrimary)
.multilineTextAlignment(.center)
Text(L10n.commonBeta)
.font(.compound.bodyXSSemibold)
.foregroundStyle(.compound.textInfoPrimary)
.textCase(.uppercase)
.padding(.horizontal, 10)
.padding(.vertical, 5)
.background {
RoundedRectangle(cornerRadius: 6)
.fill(.compound.bgInfoSubtle)
RoundedRectangle(cornerRadius: 6)
.stroke(.compound.borderInfoSubtle)
}
}
Text(L10n.screenSpaceAnnouncementSubtitle)
.font(.compound.bodyMD)
.foregroundStyle(.compound.textSecondary)
.multilineTextAlignment(.center)
}
visualListItems
Text(L10n.screenSpaceAnnouncementNotice)
.font(.compound.bodyMD)
.foregroundStyle(.compound.textSecondary)
.multilineTextAlignment(.center)
}
}
var visualListItems: some View {
VStack(spacing: 4) {
VisualListItem(title: L10n.screenSpaceAnnouncementItem1, position: .top) {
CompoundIcon(\.visibilityOn)
.foregroundStyle(.compound.iconSecondary)
.alignmentGuide(.top) { _ in 2 }
}
VisualListItem(title: L10n.screenSpaceAnnouncementItem2, position: .middle) {
CompoundIcon(\.email)
.foregroundStyle(.compound.iconSecondary)
.alignmentGuide(.top) { _ in 2 }
}
VisualListItem(title: L10n.screenSpaceAnnouncementItem3, position: .middle) {
CompoundIcon(\.search)
.foregroundStyle(.compound.iconSecondary)
.alignmentGuide(.top) { _ in 2 }
}
// This isn't possible until we enabled the room directory.
// VisualListItem(title: L10n.screenSpaceAnnouncementItem4, position: .middle) {
// CompoundIcon(\.explore)
// .foregroundStyle(.compound.iconSecondary)
// .alignmentGuide(.top) { _ in 2 }
// }
VisualListItem(title: L10n.screenSpaceAnnouncementItem5, position: .bottom) {
CompoundIcon(\.leave)
.foregroundStyle(.compound.iconSecondary)
.alignmentGuide(.top) { _ in 2 }
}
}
}
var buttons: some View {
Button(L10n.actionContinue, action: dismiss.callAsFunction)
.buttonStyle(.compound(.primary))
}
}
// MARK: - Previews
struct SpacesAnnouncementSheetView_Previews: PreviewProvider, TestablePreview {
static let viewModel = SpacesScreenViewModel(userSession: UserSessionMock(.init()),
selectedSpacePublisher: .init(nil),
appSettings: ServiceLocator.shared.settings,
userIndicatorController: UserIndicatorControllerMock())
static var previews: some View {
SpacesAnnouncementSheetView(context: viewModel.context)
}
}
@@ -19,10 +19,6 @@ struct SpacesScreen: View {
.toolbar { toolbar }
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
.toolbarBloom(hasSearchBar: false)
.onAppear { context.send(viewAction: .screenAppeared) }
.sheet(isPresented: $context.isPresentingFeatureAnnouncement) {
SpacesAnnouncementSheetView(context: context)
}
}
@ViewBuilder
@@ -150,7 +146,6 @@ struct SpacesScreen_Previews: PreviewProvider, TestablePreview {
static func makeViewModel(isEmpty: Bool = false) -> SpacesScreenViewModel {
AppSettings.resetAllSettings()
let appSettings = AppSettings()
appSettings.hasSeenSpacesAnnouncement = true
let clientProxy = ClientProxyMock(.init())
clientProxy.spaceService = SpaceServiceProxyMock(.init(topLevelSpaces: isEmpty ? [] : .mockJoinedSpaces))
@@ -591,7 +591,6 @@ class MockScreen: Identifiable {
appSettings.hasRunIdentityConfirmationOnboarding = true
appSettings.hasRunNotificationPermissionsOnboarding = true
appSettings.analyticsConsentState = .optedOut
appSettings.hasSeenSpacesAnnouncement = true
let roomSummaries: [RoomSummary] = if id == .userSessionSpacesFlow {
[[RoomSummary].mockSpaceInvites[0]] + .mockRooms