Skip to content

Commit

Permalink
Merge pull request #551 from Iterable/tapash/mob-4127-jwt-retry
Browse files Browse the repository at this point in the history
[MOB-4127] - Retry Jwt failure Requests for Online processor
  • Loading branch information
tapashmajumder authored May 2, 2022
2 parents 5f061a9 + 4aeecc6 commit 6bfea1a
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 121 deletions.
4 changes: 1 addition & 3 deletions swift-sdk/Internal/AuthManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ class AuthManager: IterableAuthManagerProtocol {

queueAuthTokenExpirationRefresh(authToken)

if authToken != nil {
onSuccess?(authToken)
}
onSuccess?(authToken)
}

private func queueAuthTokenExpirationRefresh(_ authToken: String?) {
Expand Down
6 changes: 4 additions & 2 deletions swift-sdk/Internal/InternalIterableAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,10 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
}

private func requestNewAuthToken() {
authManager.requestNewAuthToken(hasFailedPriorAuth: false, onSuccess: { [weak self] _ in
self?.completeUserLogin()
authManager.requestNewAuthToken(hasFailedPriorAuth: false, onSuccess: { [weak self] token in
if token != nil {
self?.completeUserLogin()
}
})
}

Expand Down
4 changes: 3 additions & 1 deletion swift-sdk/Internal/NetworkHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ struct NetworkHelper {
switch result {
case let .success(value):
#if NETWORK_DEBUG
print("request with requestId: \(requestId) successfully sent")
print("request with id: \(requestId) successfully sent, response:")
print(value)
#endif
fulfill.resolve(with: value)
case let .failure(error):
#if NETWORK_DEBUG
print("request with id: \(requestId) errored")
print(error)
#endif
fulfill.reject(with: error)
}
Expand Down
Loading

0 comments on commit 6bfea1a

Please sign in to comment.