Move mapTilerConfiguration into AccountSettings. (#6410)

* Move mapTilerConfiguration into `AccountSettings`.

* Re-order notification tone setting into the Configuration section.

* Update the Enterprise submodule.
This commit is contained in:
Doug
2026-10-26 16:37:33 +00:00
committed by GitHub
parent 6bee9ddf8d
commit d129be0cf3
12 changed files with 31 additions and 26 deletions
@@ -45,9 +45,6 @@ final nonisolated class AccountSettings: @unchecked Sendable {
@UserPreference(defaultValue: true)
var enableNotifications: Bool
/// The tone played when the user hasn't selected one, which the homeserver can configure remotely.
let defaultNotificationTone: RemotePreference<NotificationTone> = .init(.default)
/// The sound played when delivering noisy notifications. If nil, use ``defaultNotificationTone``.
@UserPreference
var selectedNotificationTone: NotificationTone?
@@ -55,9 +52,18 @@ final nonisolated class AccountSettings: @unchecked Sendable {
@UserPreference(defaultValue: true)
var sharePresence: Bool
init(userID: String, store: UserDefaultsProtocol) {
// MARK: Configuration
/// The tone played when the user hasn't selected one, which the homeserver can configure remotely.
let defaultNotificationTone: RemotePreference<NotificationTone> = .init(.default)
/// The MapTiler configuration used to build map URLs, which the homeserver can configure remotely.
let mapTilerConfiguration: RemotePreference<MapTilerConfiguration>
init(userID: String, store: UserDefaultsProtocol, bundledMapTilerConfiguration: MapTilerConfiguration) {
self.store = .init(userID: userID, store: store)
self.userID = userID
mapTilerConfiguration = .init(bundledMapTilerConfiguration)
}
func migrateAppSettingsValue(_ keyPath: KeyPath<AccountSettings, UserPreferenceKey>) {
@@ -74,7 +74,7 @@ final nonisolated class AppSettings: @unchecked Sendable {
accountProvisioningHost: String,
bugReportApplicationID: String,
analyticsTermsURL: URL?,
mapTilerConfiguration: MapTilerConfiguration) {
bundledMapTilerConfiguration: MapTilerConfiguration) {
self.accountProviders = accountProviders
self.allowOtherAccountProviders = allowOtherAccountProviders
self.hideBrandChrome = hideBrandChrome
@@ -95,7 +95,7 @@ final nonisolated class AppSettings: @unchecked Sendable {
self.accountProvisioningHost = accountProvisioningHost
self.bugReportApplicationID = bugReportApplicationID
self.analyticsTermsURL = analyticsTermsURL
self.mapTilerConfiguration = RemotePreference(mapTilerConfiguration)
self.bundledMapTilerConfiguration = bundledMapTilerConfiguration
}
// MARK: - Application
@@ -351,13 +351,10 @@ final nonisolated class AppSettings: @unchecked Sendable {
// MARK: - Maps
/// The locally-bundled MapTiler configuration.
static let bundledMapTilerConfiguration = MapTilerConfiguration(baseURL: "https://api.maptiler.com/maps",
apiKey: Secrets.mapLibreAPIKey,
lightStyleID: "9bc819c8-e627-474a-a348-ec144fe3d810",
darkStyleID: "dea61faf-292b-4774-9660-58fcef89a7f3")
/// The MapTiler configuration used to build map URLs, which defaults to the bundled one.
private(set) var mapTilerConfiguration = RemotePreference(AppSettings.bundledMapTilerConfiguration)
private(set) var bundledMapTilerConfiguration = MapTilerConfiguration(baseURL: "https://api.maptiler.com/maps",
apiKey: Secrets.mapLibreAPIKey,
lightStyleID: "9bc819c8-e627-474a-a348-ec144fe3d810",
darkStyleID: "dea61faf-292b-4774-9660-58fcef89a7f3")
// MARK: - Feature Flags
@@ -423,7 +420,9 @@ final nonisolated class AppSettings: @unchecked Sendable {
}
func userSettings(for userID: String) -> UserSettings {
UserSettings(appSettings: self, accountSettings: .init(userID: userID, store: store))
UserSettings(appSettings: self, accountSettings: .init(userID: userID,
store: store,
bundledMapTilerConfiguration: bundledMapTilerConfiguration))
}
static func volatile() -> AppSettings {
@@ -106,7 +106,7 @@ class PinnedEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
let stackCoordinator = NavigationStackCoordinator()
let params = LocationSharingScreenCoordinatorParameters(interactionMode: interactionMode,
mapURLBuilder: userSession.userSettings.app.mapTilerConfiguration.publisher.value,
mapURLBuilder: userSession.userSettings.account.mapTilerConfiguration.publisher.value,
roomProxy: roomProxy,
timelineController: timelineController,
userSession: userSession,
@@ -1171,7 +1171,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
let stackCoordinator = NavigationStackCoordinator()
let params = LocationSharingScreenCoordinatorParameters(interactionMode: interactionMode,
mapURLBuilder: userSession.userSettings.app.mapTilerConfiguration.publisher.value,
mapURLBuilder: userSession.userSettings.account.mapTilerConfiguration.publisher.value,
roomProxy: roomProxy,
timelineController: timelineController,
userSession: userSession,
@@ -433,7 +433,7 @@ extension LocationSharingScreenViewModel {
let userSession = UserSessionMock(.init())
return LocationSharingScreenViewModel(interactionMode: interactionMode,
mapURLBuilder: userSession.userSettings.app.mapTilerConfiguration.publisher.value,
mapURLBuilder: userSession.userSettings.account.mapTilerConfiguration.publisher.value,
roomProxy: roomProxy,
timelineController: TimelineControllerMock(.init()),
userSession: userSession,
@@ -80,7 +80,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
super.init(initialViewState: ComposerToolbarViewState(wysiwygViewModel: wysiwygViewModel,
isRoomEncrypted: roomProxy.infoPublisher.value.isEncrypted,
isLocationSharingEnabled: userSettings.app.mapTilerConfiguration.publisher.value.isEnabled,
isLocationSharingEnabled: userSettings.account.mapTilerConfiguration.publisher.value.isEnabled,
bindings: .init()),
mediaProvider: mediaProvider)
@@ -105,7 +105,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
pinnedEventIDs: roomProxy.infoPublisher.value.pinnedEventIDs,
emojiProvider: emojiProvider,
linkMetadataProvider: hideTimelineMedia ? nil : linkMetadataProvider,
mapTilerConfiguration: userSettings.app.mapTilerConfiguration.publisher.value,
mapTilerConfiguration: userSettings.account.mapTilerConfiguration.publisher.value,
bindings: .init(reactionsCollapsed: [:])),
mediaProvider: userSession.mediaProvider,
contentScannerService: userSession.contentScannerService)
@@ -176,7 +176,7 @@ class MockScreen: Identifiable {
accountProvisioningHost: appSettings.accountProvisioningHost,
bugReportApplicationID: appSettings.bugReportApplicationID,
analyticsTermsURL: appSettings.analyticsTermsURL,
mapTilerConfiguration: AppSettings.bundledMapTilerConfiguration)
bundledMapTilerConfiguration: appSettings.bundledMapTilerConfiguration)
}
let flowCoordinator = AuthenticationFlowCoordinator(authenticationService: AuthenticationService.mock,
+1 -1
View File
@@ -46,6 +46,6 @@ private extension AppSettings {
accountProvisioningHost: accountProvisioningHost,
bugReportApplicationID: bugReportApplicationID,
analyticsTermsURL: analyticsTermsURL,
mapTilerConfiguration: mapTilerConfiguration.publisher.value)
bundledMapTilerConfiguration: bundledMapTilerConfiguration)
}
}
@@ -355,7 +355,7 @@ final class AuthenticationStartScreenViewModelTests {
accountProvisioningHost: appSettings.accountProvisioningHost,
bugReportApplicationID: appSettings.bugReportApplicationID,
analyticsTermsURL: appSettings.analyticsTermsURL,
mapTilerConfiguration: AppSettings.bundledMapTilerConfiguration)
bundledMapTilerConfiguration: appSettings.bundledMapTilerConfiguration)
}
}
@@ -420,7 +420,7 @@ struct LocationSharingScreenViewModelTests {
let userSession = UserSessionMock(.init())
viewModel = LocationSharingScreenViewModel(interactionMode: .viewLive(sender: nil, initialLiveLocationShare: nil),
mapURLBuilder: userSession.userSettings.app.mapTilerConfiguration.publisher.value,
mapURLBuilder: userSession.userSettings.account.mapTilerConfiguration.publisher.value,
roomProxy: roomProxyMock,
timelineController: TimelineControllerMock(.init(timelineProxy: TimelineProxyMock(.init()))),
userSession: userSession,
@@ -631,7 +631,7 @@ struct LocationSharingScreenViewModelTests {
userSettings = UserSettings.mock()
timelineProxy = TimelineProxyMock(.init())
viewModel = LocationSharingScreenViewModel(interactionMode: .picker(shouldShowLiveLocationOption: true),
mapURLBuilder: userSettings.app.mapTilerConfiguration.publisher.value,
mapURLBuilder: userSettings.account.mapTilerConfiguration.publisher.value,
roomProxy: JoinedRoomProxyMock(.init(members: members)),
timelineController: TimelineControllerMock(.init(timelineProxy: timelineProxy)),
userSession: UserSessionMock(.init(userSettings: userSettings, liveLocationService: liveLocationServiceMock)),
@@ -657,7 +657,7 @@ struct LocationSharingScreenViewModelTests {
roomProxyMock.makeLiveLocationServiceReturnValue = roomLiveLocationServiceMock
viewModel = LocationSharingScreenViewModel(interactionMode: .viewLive(sender: sender, initialLiveLocationShare: initialShare),
mapURLBuilder: userSettings.app.mapTilerConfiguration.publisher.value,
mapURLBuilder: userSettings.account.mapTilerConfiguration.publisher.value,
roomProxy: roomProxyMock,
timelineController: TimelineControllerMock(.init(timelineProxy: TimelineProxyMock(.init()))),
userSession: UserSessionMock(.init(userSettings: userSettings)),