-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy pathNativeUpdateResult.java
More file actions
51 lines (42 loc) 路 1.54 KB
/
Copy pathNativeUpdateResult.java
File metadata and controls
51 lines (42 loc) 路 1.54 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
package cn.reactnative.modules.update;
/**
* Snapshot of a native check-and-update round. A downloaded result does not
* mean that the running React Native instance has been reloaded.
*/
public final class NativeUpdateResult {
public static final String SKIPPED = "skipped";
public static final String NO_UPDATE = "noUpdate";
public static final String DOWNLOADED = "downloaded";
public static final String FAILED = "failed";
public static final String CANCELLED = "cancelled";
private final String status;
private final String reason;
private final String hash;
private final boolean activated;
private NativeUpdateResult(String status, String reason, String hash, boolean activated) {
this.status = status;
this.reason = reason;
this.hash = hash;
this.activated = activated;
}
static NativeUpdateResult of(String status, String reason) {
return new NativeUpdateResult(status, reason, "", false);
}
static NativeUpdateResult downloaded(String hash, boolean activated) {
return new NativeUpdateResult(DOWNLOADED, "", hash, activated);
}
public String getStatus() {
return status;
}
public String getReason() {
return reason;
}
/** Installed update hash, or an empty string when this round installed nothing. */
public String getHash() {
return hash;
}
/** Whether this round selected the downloaded version for the next launch. */
public boolean isActivated() {
return activated;
}
}