Skip to content

Missing completion call in postConsent if authorize fails #22

@anttivuor

Description

@anttivuor

When token has expired, postConsent tries to fetch a new token. If that fetching fails, postConsent is not resolved/completed at all. It only handles case .success(_). This results the app waiting indefinitely for the function to resolve. This can be reproduce by disabling internet connection when using the SDK.

ios-release/Sources/MobileConsentsSDK/Networking/Manager/NetworkManager.swift (link)

func postConsent(_ consent: Consent, completion: @escaping (Error?) -> Void) {
  if let token = token, token.expiresIn > Date() {
    postConsent(consent: consent, completion: completion)
  } else {
    authorize { repsponse in
      if case .success(_) = repsponse {
        self.postConsent(consent, completion: completion)
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions