@craft-native/android 0.0.148 → 0.0.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craft-native/android",
3
- "version": "0.0.148",
3
+ "version": "0.0.149",
4
4
  "homepage": "https://github.com/craft-native/craft/tree/main/packages/android#readme",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1882,6 +1882,7 @@ class MainActivity : AppCompatActivity() {
1882
1882
  openScreen(route, payload.optJSONObject("params") ?: JSONObject())
1883
1883
  }
1884
1884
  "NAVIGATE_BACK" -> if (screens.lastOrNull() === screen) back()
1885
+ "NAVIGATE_POP_TO_ROOT" -> if (screens.lastOrNull() === screen) popToRoot()
1885
1886
  "API_REQUEST" -> answerAPI(screen, message, payload)
1886
1887
  "API_CANCEL" -> {
1887
1888
  val id = payload.optString("requestId")
@@ -3197,6 +3198,12 @@ class MainActivity : AppCompatActivity() {
3197
3198
  }
3198
3199
  }
3199
3200
 
3201
+ /** Back to the first screen in one move. */
3202
+ private fun popToRoot() {
3203
+ while (screens.size > 1) closeScreen(screens.removeAt(screens.lastIndex))
3204
+ show(screens.last())
3205
+ }
3206
+
3200
3207
  private fun back() {
3201
3208
  if (screens.size > 1) {
3202
3209
  closeScreen(screens.removeAt(screens.lastIndex))