mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 10:02:46 +02:00
vector-im/element-ios/issues/5298 - Add .well-known configuration support for tile server and map styles.
This commit is contained in:
committed by
Stefan Ceriu
parent
6839da94d8
commit
40bc43b0f6
@@ -16,19 +16,20 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents the homeserver configuration (usually based on HS Well-Known or hardoced values in the project)
|
||||
/// Represents the homeserver configuration (usually based on HS Well-Known or hardcoded values in the project)
|
||||
@objcMembers
|
||||
final class HomeserverConfiguration: NSObject {
|
||||
|
||||
// Note: Use an object per configuration subject when there is multiple properties related
|
||||
let jitsi: HomeserverJitsiConfiguration
|
||||
let isE2EEByDefaultEnabled: Bool
|
||||
let tileServer: HomeserverTileServerConfiguration
|
||||
|
||||
init(jitsi: HomeserverJitsiConfiguration,
|
||||
isE2EEByDefaultEnabled: Bool) {
|
||||
isE2EEByDefaultEnabled: Bool,
|
||||
tileServer: HomeserverTileServerConfiguration) {
|
||||
self.jitsi = jitsi
|
||||
self.isE2EEByDefaultEnabled = isE2EEByDefaultEnabled
|
||||
|
||||
super.init()
|
||||
self.tileServer = tileServer
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,12 +59,26 @@ final class HomeserverConfigurationBuilder: NSObject {
|
||||
jitsiServerURL = hardcodedJitsiServerURL
|
||||
}
|
||||
|
||||
// Tile server configuration
|
||||
|
||||
let tileServerMapStyleURL: URL
|
||||
if let mapStyleURLString = wellKnown?.tileServer?.mapStyleURLString,
|
||||
let mapStyleURL = URL(string: mapStyleURLString) {
|
||||
tileServerMapStyleURL = mapStyleURL
|
||||
} else {
|
||||
tileServerMapStyleURL = BuildSettings.tileServerMapStyleURL
|
||||
}
|
||||
|
||||
let tileServerConfiguration = HomeserverTileServerConfiguration(mapStyleURL: tileServerMapStyleURL)
|
||||
|
||||
// Create HomeserverConfiguration
|
||||
|
||||
let jitsiConfiguration = HomeserverJitsiConfiguration(serverDomain: jitsiPreferredDomain,
|
||||
serverURL: jitsiServerURL)
|
||||
|
||||
return HomeserverConfiguration(jitsi: jitsiConfiguration, isE2EEByDefaultEnabled: isE2EEByDefaultEnabled)
|
||||
return HomeserverConfiguration(jitsi: jitsiConfiguration,
|
||||
isE2EEByDefaultEnabled: isE2EEByDefaultEnabled,
|
||||
tileServer: tileServerConfiguration)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// `HomeserverTileServerConfiguration` defines tile server configuration to be used by the mapping library
|
||||
@objcMembers
|
||||
final class HomeserverTileServerConfiguration: NSObject {
|
||||
let mapStyleURL: URL
|
||||
|
||||
init(mapStyleURL: URL) {
|
||||
self.mapStyleURL = mapStyleURL
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user