feat: add migration part 1 banner (MESSENGER-7564)

This commit is contained in:
Jan Niklas Grabowski
2025-09-15 17:39:24 +02:00
parent b819783abf
commit 00d9048124
10 changed files with 148 additions and 67 deletions

View File

@@ -94,6 +94,24 @@ public extension MXWellKnown {
}
}
@objc func migrationInfoLevel() -> Int {
do {
guard let bwiDict = self.jsonDictionary()["de.bwi"] as? [String : Any] else {
return 0
}
let bwi = try WellknownBWI(dict: bwiDict)
if let migration = bwi.migrationBuMX {
return migration.level ?? 0
} else {
return 0
}
}
catch {
return 0
}
}
@objc func updateFederationStatus() {
do {
guard let bwiDict = self.jsonDictionary()["de.bwi"] as? [String : Any] else {

View File

@@ -21,6 +21,7 @@ struct WellknownBWI: Decodable {
let dataPrivacyURL: String?
let imprintURL: String?
let federation: WellknownFederation?
let migrationBuMX: WellknownMigrationBuMX?
init(dict: [String: Any]) throws {
let jsonData = try JSONSerialization.data(withJSONObject: dict, options: [])
@@ -32,6 +33,7 @@ struct WellknownBWI: Decodable {
case dataPrivacyURL = "data_privacy_url"
case imprintURL = "imprint_url"
case federation
case migrationBuMX = "migration_bumx"
}
}
@@ -52,3 +54,11 @@ struct WellknownFederation: Decodable {
}
}
struct WellknownMigrationBuMX: Decodable {
let level: Int?
enum CodingKeys: String, CodingKey {
case level
}
}