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 { 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 barVisibilityOverride
} else if horizontalSizeClass == .compact, navigationSplitCoordinator?.detailCoordinator != nil { } else if horizontalSizeClass == .compact, navigationSplitCoordinator?.detailCoordinator != nil {
// Whilst we support pushing screens on the stack in the sidebarCoordinator, in practice // 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 enableKeyShareOnInvite
case knockingEnabled case knockingEnabled
case threadsEnabled case threadsEnabled
case spacesEnabled
case developerOptionsEnabled case developerOptionsEnabled
case nextGenHTMLParserEnabled case nextGenHTMLParserEnabled
case linkPreviewsEnabled case linkPreviewsEnabled
@@ -390,9 +389,6 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.threadsEnabled, defaultValue: false, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.threadsEnabled, defaultValue: false, storageType: .userDefaults(store))
var threadsEnabled var threadsEnabled
@UserPreference(key: UserDefaultsKeys.spacesEnabled, defaultValue: true, storageType: .userDefaults(store))
var spacesEnabled
@UserPreference(key: UserDefaultsKeys.nextGenHTMLParserEnabled, defaultValue: true, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.nextGenHTMLParserEnabled, defaultValue: true, storageType: .userDefaults(store))
var nextGenHTMLParserEnabled var nextGenHTMLParserEnabled

View File

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

View File

@@ -130,7 +130,7 @@ struct StaticLocationScreen: View {
Image(systemName: "square.and.arrow.up") Image(systemName: "square.and.arrow.up")
} }
} }
@ViewBuilder @ViewBuilder
private var shareSheet: some View { private var shareSheet: some View {
let location = context.viewState.initialMapCenter let location = context.viewState.initialMapCenter
@@ -139,8 +139,17 @@ struct StaticLocationScreen: View {
applicationActivities: ShareToMapsAppActivity.MapsAppType.allCases.map { ShareToMapsAppActivity(type: $0, location: location, locationDescription: locationDescription) }) applicationActivities: ShareToMapsAppActivity.MapsAppType.allCases.map { ShareToMapsAppActivity(type: $0, location: location, locationDescription: locationDescription) })
.edgesIgnoringSafeArea(.bottom) .edgesIgnoringSafeArea(.bottom)
.presentationDetents([.medium, .large]) .presentationDetents([.medium, .large])
.presentationCompactAdaptation(shareSheetCompactPresentation)
.presentationDragIndicator(.hidden) .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 // MARK: - Previews

View File

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

View File

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

View File

@@ -55,20 +55,27 @@ struct SpaceScreen: View {
mediaProvider: context.mediaProvider) mediaProvider: context.mediaProvider)
} }
ToolbarItemGroup(placement: .secondaryAction) { // This should really use a ToolbarItemGroup(placement: .secondaryAction), however it
// FIXME: The ShareLink crashes on iOS 26 due to the share sheet failing to morph out of the button 🤦 // was crashing on iOS 26.0 when tapping the ShareLink as the popover presentation
if let permalink = context.viewState.permalink, #unavailable(iOS 26.0) { // controller attempts to anchor itself to the button that is no longer visible.
Section { ToolbarItem(placement: .primaryAction) {
ShareLink(item: permalink) { Menu {
Label(L10n.actionShare, icon: \.shareIos) if let permalink = context.viewState.permalink {
Section {
ShareLink(item: permalink) {
Label(L10n.actionShare, icon: \.shareIos)
}
} }
} }
}
Section {
Section { Button(role: .destructive) { context.send(viewAction: .leaveSpace) } label: {
Button(role: .destructive) { context.send(viewAction: .leaveSpace) } label: { Label(L10n.actionLeaveSpace, icon: \.leave)
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) { func setFilter(_ filter: RoomSummaryProviderFilter) {
let baseFilter: [RoomListEntriesDynamicFilterKind] = if appSettings.spacesEnabled { let baseFilter: [RoomListEntriesDynamicFilterKind] = if #available(iOS 18.0, *) {
[.any(filters: [.all(filters: [.nonSpace, .nonLeft]), [.any(filters: [.all(filters: [.nonSpace, .nonLeft]),
.all(filters: [.space, .invite])]), .all(filters: [.space, .invite])]),
.deduplicateVersions] .deduplicateVersions]
} else { } else {
// Don't show space invites on iOS 17 given that the tab bar is disabled due to glitches on iPad.
[.nonLeft, .nonSpace, .deduplicateVersions] [.nonLeft, .nonSpace, .deduplicateVersions]
} }

View File

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