-
Notifications
You must be signed in to change notification settings - Fork 263
fix: detect when Identity verification becomes turned off #1674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d15ddba
d1b065b
a8eb5db
3789979
7699bbd
552890b
5316329
1de9ff2
d4d113e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -391,13 +391,35 @@ extension OSCustomEventsExecutor: OSUserJwtConfigListener { | |
| // If auth changed from false or unknown to true, drop invalid items | ||
| if to == .on { | ||
| removeInvalidDeltasAndRequests() | ||
| } else if to == .off { | ||
| // Identity Verification was turned off: release requests parked awaiting a JWT. | ||
| reQueueAllPendingRequests() | ||
| } | ||
| } | ||
|
|
||
| func onJwtUpdated(externalId: String, token: String?) { | ||
| reQueuePendingRequestsForExternalId(externalId: externalId) | ||
| } | ||
|
|
||
| /// Identity Verification was turned off: move every auth-pended request, across all | ||
| /// external IDs, back into the request queue and flush. | ||
| private func reQueueAllPendingRequests() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so even though the calls originated with JWT and now JWT is off, we want to reQueue the requests?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, we could decide to drop but this would come from something like:
|
||
| self.dispatchQueue.async { | ||
| guard !self.pendingAuthRequests.isEmpty else { | ||
| return | ||
| } | ||
| for (_, requests) in self.pendingAuthRequests { | ||
| for request in requests { | ||
| self.requestQueue.append(request) | ||
| } | ||
| } | ||
| self.pendingAuthRequests = [:] | ||
| OneSignalUserDefaults.initShared().saveCodeableData(forKey: OS_CUSTOM_EVENTS_EXECUTOR_REQUEST_QUEUE_KEY, withValue: self.requestQueue) | ||
| OneSignalUserDefaults.initShared().saveCodeableData(forKey: OS_CUSTOM_EVENTS_EXECUTOR_PENDING_QUEUE_KEY, withValue: self.pendingAuthRequests) | ||
| self.processRequestQueue(inBackground: false) | ||
| } | ||
| } | ||
|
|
||
| private func reQueuePendingRequestsForExternalId(externalId: String) { | ||
| self.dispatchQueue.async { | ||
| guard let requests = self.pendingAuthRequests[externalId] else { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.