Add dispatch_async
to [STPRedirectContext handleWillForegroundNotification]
#962
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add
dispatch_async
to[STPRedirectContext handleWillForegroundNotification]
to allow[STPRedirectContext handleURLCallback]
to be prioritizedWe considered some other approaches and landed on this one:
Option 1:
Delete
STPURLCallback
completelyThe downside to this approach is the host app will still get
[AppDelegate application:openURL:options:]
calls. IfSTPURLCallback
was gone, the host app won't know whether or not that[AppDelegate application:openURL:options:]
call should be ignored by their own app's routing logic.Option 2:
Don't unschedule
STPURLCallback
and let theSTPRedirectContext
stay in theSTPRedirectContextStateCompleted
stateThe downside to this approach is the
STPRedirectContext
ends up holding a non-negligible amount of memory in order to just store theSTPRedirectContextStateCompleted
state.Option 3:
Similarly to the last one, we can avoid unscheduling the
STPURLCallback
for a second or so.This is very similar to the approach we landed on but would require more significant code changes. Also the reasoning behind how much delay to have is unclear.