mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 15:09:31 +02:00
MESSENGER-5892 refactoring
This commit is contained in:
@@ -772,8 +772,9 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol {
|
||||
}
|
||||
|
||||
// bwi #4478: refresh wellknown a bit more often
|
||||
self.currentMatrixSession?.refreshHomeserverWellknown(false, success: { _ in
|
||||
self.currentMatrixSession?.refreshHomeserverWellknown(false, success: { wellknown in
|
||||
// bwi: #5706 fix crash: only show matomo alert when wellknown is available
|
||||
wellknown?.updateFederationStatus()
|
||||
self.bwiCheckForMatomoPromt()
|
||||
}, failure: nil)
|
||||
}
|
||||
|
||||
@@ -239,6 +239,7 @@ class AuthenticationService: NSObject {
|
||||
// FRROT wellknown call for identity server after server selection
|
||||
if let wellKnown = try? await wellKnown(for: homeserverURL) {
|
||||
self.wellknown = wellKnown
|
||||
wellknown?.updateFederationStatus()
|
||||
|
||||
if let baseURL = URL(string: wellKnown.homeServer.baseUrl) {
|
||||
homeserverURL = baseURL
|
||||
|
||||
@@ -93,6 +93,25 @@ public extension MXWellKnown {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@objc func updateFederationStatus() {
|
||||
do {
|
||||
guard let bwiDict = self.jsonDictionary()["de.bwi"] as? [String : Any] else {
|
||||
BWIBuildSettings.shared.isWellknownFederationEnabled = false
|
||||
return
|
||||
}
|
||||
|
||||
let bwi = try WellknownBWI(dict: bwiDict)
|
||||
if let federation = bwi.federation {
|
||||
BWIBuildSettings.shared.isWellknownFederationEnabled = federation.enable ?? false
|
||||
} else {
|
||||
BWIBuildSettings.shared.isWellknownFederationEnabled = false
|
||||
}
|
||||
}
|
||||
catch {
|
||||
BWIBuildSettings.shared.isWellknownFederationEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
// returns true if there is a valid url or no url, only the case "is url" but not valid is wrong
|
||||
@objc func isValidDataPrivacyURL() -> Bool {
|
||||
|
||||
@@ -51,14 +51,4 @@ struct WellknownFederation: Decodable {
|
||||
case enable
|
||||
}
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
enable = try? container.decode(Bool.self, forKey: .enable)
|
||||
showIntroduction = try? container.decode(Bool.self, forKey: .showIntroduction)
|
||||
showAnnouncement = try? container.decode(Bool.self, forKey: .showAnnouncement)
|
||||
|
||||
// Save federation status in userDetaults
|
||||
BWIBuildSettings.shared.isWellknownFederationEnabled = enable ?? false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user