Even more space tweaks (#4588)

* Bring back the button to share a space on iOS 26.

* Remove the setting and disable the space tab on iOS 17.

(The tab bar is broken on iPadOS 17).
This commit is contained in:
Doug
2025-10-07 14:34:10 +01:00
committed by GitHub
parent 10a956ca8e
commit 19bf29e854
9 changed files with 36 additions and 31 deletions

View File

@@ -38,7 +38,10 @@ import SwiftUI
}
func barVisibility(in horizontalSizeClass: UserInterfaceSizeClass?) -> Visibility {
if let barVisibilityOverride {
if #unavailable(iOS 18.0) {
// There are glitches with the tab bar on iPadOS 17, so disable the tab bar until we have fixed it.
.hidden
} else if let barVisibilityOverride {
barVisibilityOverride
} else if horizontalSizeClass == .compact, navigationSplitCoordinator?.detailCoordinator != nil {
// Whilst we support pushing screens on the stack in the sidebarCoordinator, in practice

View File

@@ -61,7 +61,6 @@ final class AppSettings {
case enableKeyShareOnInvite
case knockingEnabled
case threadsEnabled
case spacesEnabled
case developerOptionsEnabled
case nextGenHTMLParserEnabled
case linkPreviewsEnabled
@@ -390,9 +389,6 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.threadsEnabled, defaultValue: false, storageType: .userDefaults(store))
var threadsEnabled
@UserPreference(key: UserDefaultsKeys.spacesEnabled, defaultValue: true, storageType: .userDefaults(store))
var spacesEnabled
@UserPreference(key: UserDefaultsKeys.nextGenHTMLParserEnabled, defaultValue: true, storageType: .userDefaults(store))
var nextGenHTMLParserEnabled

View File

@@ -84,10 +84,6 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
chatsTabDetails = .init(tag: HomeTab.chats, title: L10n.screenHomeTabChats, icon: \.chat, selectedIcon: \.chatSolid)
chatsTabDetails.navigationSplitCoordinator = chatsSplitCoordinator
if !flowParameters.appSettings.spacesEnabled {
chatsTabDetails.barVisibilityOverride = .hidden
}
let spacesSplitCoordinator = NavigationSplitCoordinator(placeholderCoordinator: PlaceholderScreenCoordinator(hideBrandChrome: flowParameters.appSettings.hideBrandChrome))
spaceExplorerFlowCoordinator = SpaceExplorerFlowCoordinator(navigationSplitCoordinator: spacesSplitCoordinator,
flowParameters: flowParameters)
@@ -289,9 +285,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
}
.store(in: &cancellables)
flowParameters.appSettings.$spacesEnabled
.combineLatest(userSession.clientProxy.spaceService.joinedSpacesPublisher)
.map { $0 && !$1.isEmpty ? nil : .hidden }
userSession.clientProxy.spaceService.joinedSpacesPublisher
.map { $0.isEmpty ? .hidden : nil }
.weakAssign(to: \.chatsTabDetails.barVisibilityOverride, on: self)
.store(in: &cancellables)
}

View File

@@ -130,7 +130,7 @@ struct StaticLocationScreen: View {
Image(systemName: "square.and.arrow.up")
}
}
@ViewBuilder
private var shareSheet: some View {
let location = context.viewState.initialMapCenter
@@ -139,8 +139,17 @@ struct StaticLocationScreen: View {
applicationActivities: ShareToMapsAppActivity.MapsAppType.allCases.map { ShareToMapsAppActivity(type: $0, location: location, locationDescription: locationDescription) })
.edgesIgnoringSafeArea(.bottom)
.presentationDetents([.medium, .large])
.presentationCompactAdaptation(shareSheetCompactPresentation)
.presentationDragIndicator(.hidden)
}
private var shareSheetCompactPresentation: PresentationAdaptation {
if #available(iOS 26.0, *) {
.none // ShareLinks use a popover presentation on iOS 26, let it match that.
} else {
.sheet
}
}
}
// MARK: - Previews

View File

@@ -41,7 +41,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
var enableOnlySignedDeviceIsolationMode: Bool { get set }
var enableKeyShareOnInvite: Bool { get set }
var spacesEnabled: Bool { get set }
var hideQuietNotificationAlerts: Bool { get set }
var hideUnreadMessagesBadge: Bool { get set }

View File

@@ -33,10 +33,6 @@ struct DeveloperOptionsScreen: View {
}
Section("General") {
Toggle(isOn: $context.spacesEnabled) {
Text("Spaces")
}
Toggle(isOn: $context.nextGenHTMLParserEnabled) {
Text("Next gen HTML parsing")
}

View File

@@ -55,20 +55,27 @@ struct SpaceScreen: View {
mediaProvider: context.mediaProvider)
}
ToolbarItemGroup(placement: .secondaryAction) {
// FIXME: The ShareLink crashes on iOS 26 due to the share sheet failing to morph out of the button 🤦
if let permalink = context.viewState.permalink, #unavailable(iOS 26.0) {
Section {
ShareLink(item: permalink) {
Label(L10n.actionShare, icon: \.shareIos)
// This should really use a ToolbarItemGroup(placement: .secondaryAction), however it
// was crashing on iOS 26.0 when tapping the ShareLink as the popover presentation
// controller attempts to anchor itself to the button that is no longer visible.
ToolbarItem(placement: .primaryAction) {
Menu {
if let permalink = context.viewState.permalink {
Section {
ShareLink(item: permalink) {
Label(L10n.actionShare, icon: \.shareIos)
}
}
}
}
Section {
Button(role: .destructive) { context.send(viewAction: .leaveSpace) } label: {
Label(L10n.actionLeaveSpace, icon: \.leave)
Section {
Button(role: .destructive) { context.send(viewAction: .leaveSpace) } label: {
Label(L10n.actionLeaveSpace, icon: \.leave)
}
}
} label: {
// Use an SF Symbol to match what ToolbarItemGroup(placement: .secondaryAction) would give us.
Image(systemSymbol: .ellipsis)
}
}
}

View File

@@ -118,11 +118,12 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
}
func setFilter(_ filter: RoomSummaryProviderFilter) {
let baseFilter: [RoomListEntriesDynamicFilterKind] = if appSettings.spacesEnabled {
let baseFilter: [RoomListEntriesDynamicFilterKind] = if #available(iOS 18.0, *) {
[.any(filters: [.all(filters: [.nonSpace, .nonLeft]),
.all(filters: [.space, .invite])]),
.deduplicateVersions]
} else {
// Don't show space invites on iOS 17 given that the tab bar is disabled due to glitches on iPad.
[.nonLeft, .nonSpace, .deduplicateVersions]
}

View File

@@ -584,7 +584,6 @@ class MockScreen: Identifiable {
appSettings.hasRunIdentityConfirmationOnboarding = true
appSettings.hasRunNotificationPermissionsOnboarding = true
appSettings.analyticsConsentState = .optedOut
appSettings.spacesEnabled = true
appSettings.hasSeenSpacesAnnouncement = true
let clientProxy = ClientProxyMock(.init(userID: "@mock:client.com",