Support removing request from ExtensionBridge

This commit is contained in:
Ivan Grachev 2022-08-28 21:48:31 +03:00
parent 257e75d47c
commit 63511d3b65

View File

@ -25,7 +25,7 @@ struct ExtensionBridge {
static func hasRequest(id: Int) -> Bool {
if initiatedRequests.contains(id) {
initiatedRequests.remove(id)
removeRequest(id: id)
return true
} else {
return false
@ -36,6 +36,10 @@ struct ExtensionBridge {
defaults?.set(response.json, forKey: key(id: response.id))
}
static func removeRequest(id: Int) {
initiatedRequests.remove(id)
}
static func removeResponse(id: Int) {
let key = key(id: id)
defaults?.removeObject(forKey: key)