Skip to content

Commit

Permalink
[expo-updates][android] restrict property visibility on state machine…
Browse files Browse the repository at this point in the history
… objects (expo#23063)
  • Loading branch information
wschurman authored Jun 26, 2023
1 parent 3fa54f5 commit 2c04f0a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/expo-updates/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- [iOS] Use weak delegate for state machine. ([#23060](https://github.com/expo/expo/pull/23060) by [@wschurman](https://github.com/wschurman))
- [Android] Convert LoaderTask.RemoteCheckResult to sealed class. ([#23061](https://github.com/expo/expo/pull/23061) by [@wschurman](https://github.com/wschurman))
- [Android] Restrict property visibility on state machine objects. ([#23063](https://github.com/expo/expo/pull/23063) by [@wschurman](https://github.com/wschurman))

### 💡 Others

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import org.json.JSONObject
The state machine context, with information intended to be consumed by application JS code.
*/
data class UpdatesStateContext(
val isUpdateAvailable: Boolean = false,
val isUpdatePending: Boolean = false,
val isRollback: Boolean = false,
val isChecking: Boolean = false,
val isDownloading: Boolean = false,
val isRestarting: Boolean = false,
val latestManifest: JSONObject? = null,
val downloadedManifest: JSONObject? = null,
val checkError: UpdatesStateError? = null,
val downloadError: UpdatesStateError? = null
private val isUpdateAvailable: Boolean = false,
private val isUpdatePending: Boolean = false,
private val isRollback: Boolean = false,
private val isChecking: Boolean = false,
private val isDownloading: Boolean = false,
private val isRestarting: Boolean = false,
private val latestManifest: JSONObject? = null,
private val downloadedManifest: JSONObject? = null,
private val checkError: UpdatesStateError? = null,
private val downloadError: UpdatesStateError? = null
) {

val json: Map<String, Any>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package expo.modules.updates.statemachine
* For now, we just have the "message" property.
*/
data class UpdatesStateError(
val message: String
private val message: String
) {
val json: Map<String, String>
get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ class UpdatesStateMachine(
* The current state
*/
var state: UpdatesStateValue = UpdatesStateValue.Idle
private set

/**
* The context
*/
var context: UpdatesStateContext = UpdatesStateContext()
private set

/**
Called after the app restarts (reloadAsync()) to reset the machine to its
Expand Down

0 comments on commit 2c04f0a

Please sign in to comment.