Skip to content

Commit

Permalink
Adding support for cancelOnBackground for UserFlow
Browse files Browse the repository at this point in the history
Summary:
UserFlow API now takes configuration parameter, which is required. It contains of 2 arguments:
* triggerSource
* cancelOnBackround

Reviewed By: swillard13

Differential Revision: D25094721

fbshipit-source-id: 64a468c2168265ade9f8d4cea4beb911637544fa
  • Loading branch information
dmitry-voronkevich authored and facebook-github-bot committed Dec 7, 2020
1 parent defdb6d commit 0d49859
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Libraries/Reliability/UserFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type PointData = $Shape<{
* Example:
* const flowId = UserFlow.newFlowId(QuickLogItentifiersExample.EXAMPLE_EVENT);
* ...
* UserFlow.start(flowId, "user_click");
* UserFlow.start(flowId, {triggerSource: "user_click", cancelOnBackground: true});
* ...
* UserFlow.addAnnotation(flowId, "cached", "true");
* ...
Expand Down Expand Up @@ -65,12 +65,27 @@ const UserFlow = {
};
},

start(flowId: FlowId, triggerSource: string): void {
/**
* Starts new flow.
* Example:
* UserFlow.start(flowId, {triggerSource: 'user_click', cancelOnBackground: true})
*
* Specify triggerSource as a place where your flow has started.
* Specify if flow should be automatically cancelled if applicaton goes to background.
* It is recommended to use true for cancelOnBackground - this reduces amount of lost flows due to instrumentation mistakes.
* Only if you know that your flow should survive app backgrounding - use false. This includes cases of tracking cross application interactions.
*
*/
start(
flowId: FlowId,
options: {triggerSource: string, cancelOnBackground: boolean},
): void {
if (global.nativeUserFlowStart) {
global.nativeUserFlowStart(
flowId.markerId,
flowId.instanceKey,
triggerSource,
options.triggerSource,
options.cancelOnBackground,
);
}
},
Expand Down

0 comments on commit 0d49859

Please sign in to comment.