EC Timeout if it doesn't respond after 30 seconds (#4237)

* basic implementation

* using a decodable struct to interpret the widget message

* small code refactor/improvement
This commit is contained in:
Mauro
2025-06-20 18:21:31 +02:00
committed by GitHub
parent cbf405a67e
commit 0c8a401b4d
5 changed files with 48 additions and 1 deletions
@@ -94,3 +94,23 @@ enum CallScreenJavaScriptMessageName: String, CaseIterable {
allCases.map(\.postMessageScript).joined(separator: "\n")
}
}
struct DecodedWidgetMessage: Decodable {
private static let decoder = JSONDecoder()
private static let joinAction = "io.element.join"
private static let fromWidget = "fromWidget"
let action: String?
let api: String?
static func decode(message: String) throws -> DecodedWidgetMessage? {
guard let data = message.data(using: .utf8) else {
return nil
}
return try decoder.decode(DecodedWidgetMessage.self, from: data)
}
var hasJoined: Bool {
action == Self.joinAction && api == Self.fromWidget
}
}