Implement in-memory decline cache for group calls

This commit is contained in:
ismailgulek
2021-03-18 13:32:34 +03:00
parent 7d99bb8f13
commit a1a4f585ee
3 changed files with 48 additions and 7 deletions
@@ -61,6 +61,10 @@ final class JitsiService: NSObject {
private var httpClients: [String: MXHTTPClient] = [:]
/// Holds widgetIds for declined group calls. Made a map to speed up lookups.
/// Values are useless, not used with false values.
private var declinedJitsiWidgets: [String: Bool] = [:]
// MARK: - Setup
private override init() {
@@ -69,6 +73,18 @@ final class JitsiService: NSObject {
// MARK: - Public
func declineWidget(withId widgetId: String) {
declinedJitsiWidgets[widgetId] = true
}
func resetDeclineForWidget(withId widgetId: String) {
declinedJitsiWidgets.removeValue(forKey: widgetId)
}
func isWidgetDeclined(withId widgetId: String) -> Bool {
return declinedJitsiWidgets[widgetId] == true
}
// MARK: Configuration
func configureDefaultConferenceOptions(with serverURL: URL) {