Summary: Renaming methods in UserFlow to match other APIs

Reviewed By: swillard13

Differential Revision: D24078270

fbshipit-source-id: c3a65d440e389d7b3c76de7706372265584353c8
This commit is contained in:
Dmytro Voronkevych 2020-10-02 08:06:17 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 2c6d010a50
Коммит 923b77aef9
1 изменённых файлов: 22 добавлений и 20 удалений

Просмотреть файл

@ -21,10 +21,15 @@ type FlowId = {
* API for tracking reliability of your user interactions * API for tracking reliability of your user interactions
* *
* Example: * Example:
* var flowId = UserFlow.newFlowId(QuickLogItentifiersExample.EXAMPLE_EVENT); * const flowId = UserFlow.newFlowId(QuickLogItentifiersExample.EXAMPLE_EVENT);
* ...
* UserFlow.start(flowId, "user_click"); * UserFlow.start(flowId, "user_click");
* ... * ...
* UserFlow.completeWithSuccess(flowId); * UserFlow.addAnnotation(flowId, "cached", "true");
* ...
* UserFlow.addPoint(flowId, "reload");
* ...
* UserFlow.endSuccess(flowId);
*/ */
const UserFlow = { const UserFlow = {
/** /**
@ -59,13 +64,13 @@ const UserFlow = {
} }
}, },
annotate( addAnnotation(
flowId: FlowId, flowId: FlowId,
annotationName: string, annotationName: string,
annotationValue: string, annotationValue: string,
): void { ): void {
if (global.nativeUserFlowAnnotate) { if (global.nativeUserFlowAddAnnotation) {
global.nativeUserFlowAnnotate( global.nativeUserFlowAddAnnotation(
flowId.markerId, flowId.markerId,
flowId.instanceKey, flowId.instanceKey,
annotationName, annotationName,
@ -74,9 +79,9 @@ const UserFlow = {
} }
}, },
markPoint(flowId: FlowId, pointName: string): void { addPoint(flowId: FlowId, pointName: string): void {
if (global.nativeUserFlowMarkPoint) { if (global.nativeUserFlowAddPoint) {
global.nativeUserFlowMarkPoint( global.nativeUserFlowAddPoint(
flowId.markerId, flowId.markerId,
flowId.instanceKey, flowId.instanceKey,
pointName, pointName,
@ -84,22 +89,19 @@ const UserFlow = {
} }
}, },
completeWithSuccess(flowId: FlowId): void { endSuccess(flowId: FlowId): void {
if (global.nativeUserFlowCompleteWithSuccess) { if (global.nativeUserFlowEndSuccess) {
global.nativeUserFlowCompleteWithSuccess( global.nativeUserFlowEndSuccess(flowId.markerId, flowId.instanceKey);
flowId.markerId,
flowId.instanceKey,
);
} }
}, },
completeWithFail( endFailure(
flowId: FlowId, flowId: FlowId,
errorName: string, errorName: string,
debugInfo: ?string = null, debugInfo: ?string = null,
): void { ): void {
if (global.nativeUserFlowCompleteWithFail) { if (global.nativeUserFlowEndFail) {
global.nativeUserFlowCompleteWithFail( global.nativeUserFlowEndFail(
flowId.markerId, flowId.markerId,
flowId.instanceKey, flowId.instanceKey,
errorName, errorName,
@ -108,9 +110,9 @@ const UserFlow = {
} }
}, },
cancel(flowId: FlowId, cancelReason: string): void { endCancel(flowId: FlowId, cancelReason: string): void {
if (global.nativeUserFlowCancel) { if (global.nativeUserFlowEndCancel) {
global.nativeUserFlowCancel( global.nativeUserFlowEndCancel(
flowId.markerId, flowId.markerId,
flowId.instanceKey, flowId.instanceKey,
cancelReason, cancelReason,