The PR fixes that and also add safety in case some platform or other error occurs: the reject method is also called then.
iOS Freezing
Because the SessionManager used to be "global", e.g. shared, concurrent executions broke each other: FlutterResult were overriden every time the call is made.
Now we create a SessionManager for every request and nothing interrupts nothing.
Another thing is that flutter result was executed twice: the actual result of fingerprints check and every time the request was cancelled. A minor thing, still fixed.
Organization
I split the code a bit and provided a library class, so users can use all the classes by importing a single file instead of a bunch of them.
Dart Side
Because
onRequest
in the Dio intercepter is an unawaited future, the exception here: https://github.com/diefferson/http_certificate_pinning/blob/b5f2cbddcc19af745a9f33cf7f525b52cd6c67ab/lib/certificate_pinning_interceptor.dart#L24Is never handled by the try-catch blocks. The solution is to "throw" it this way:
The PR fixes that and also add safety in case some platform or other error occurs: the
reject
method is also called then.iOS Freezing
Because the SessionManager used to be "global", e.g. shared, concurrent executions broke each other:
FlutterResult
were overriden every time the call is made.Now we create a
SessionManager
for every request and nothing interrupts nothing.Another thing is that flutter result was executed twice: the actual result of fingerprints check and every time the request was cancelled. A minor thing, still fixed.