Repository navigation
Expand file tree
/
Copy pathFlowBridge.java
More file actions
56 lines (46 loc) Β· 2.3 KB
/
Copy pathFlowBridge.java
File metadata and controls
56 lines (46 loc) Β· 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package cn.reactnative.modules.update;
/**
* JNI bindings to the shared update-flow decision layer
* (cpp/update_flow_core). String-in/string-out JSON on purpose β it matches
* the decision layer's own boundary and keeps this surface trivially stable.
* A null return means the input did not parse; callers skip the check round.
*/
final class FlowBridge {
private FlowBridge() {
}
// The cold-start round (cpp/update_flow_core/native_round.h), shared with
// iOS and Harmony. envJson describes this launch (see native_round.h).
/** {"body": request text, "query": first query state}; null when not runnable. */
static native String prepareRound(String configJson, String envJson, double randomSample);
/**
* The next endpoint-query state: "url" (+ "post") to request next,
* "found" when the text passed in is the response, neither when the
* query is over. responseText is null for a failed (or no) request.
*/
static native String nextQueryStep(String stateJson, String responseText);
/**
* One step of the round driver (cpp/update_flow_core/round_engine.h):
* {"state", "commands"} for the previous state (null to start) and the
* event. Null only when the core threw.
*/
static native String stepRound(String stateJson, String eventJson);
/** The decision with planned attempts, hashInfo and the response-cache text. */
static native String handleResponse(
String responseText, String configJson, String envJson, String requestBody,
long responseAtSeconds);
// Persisted-config layer (cpp/update_flow_core/native_config.h), shared
// with iOS and Harmony.
/** Contract C1: same config in another serialization. Null is never equivalent. */
static native boolean configsEquivalent(String a, String b);
/**
* The run gate: {"appKey": trimmed} when the config may run a round,
* otherwise {"status", "reason"}. Null config text = not configured.
*/
static native String runnableConfig(String configJson);
/**
* Validates host configure() options (a JSON object) into the config to
* persist. Throws IllegalArgumentException("Invalid native configuration:
* ...") for options the host must fix.
*/
static native String normalizeConfiguration(String optionsJson);
}