@tokamakdev/platform-android-arm64 0.1.1-beta.89 → 0.1.1-beta.91

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.
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/android-arm64/lib/TokamakRuntime/libtokamak.a
3
- size: 34943892 bytes
4
- sha256: 7b9a432c222a974f34900d4051fa8e802483cc30cdc042cd3d65ff6207652ede
3
+ size: 34954436 bytes
4
+ sha256: d583aef1bbeaf939dee2de9348a72ef17015b5fd339820ce8fb38dbb685c29f4
@@ -111,6 +111,12 @@ class TokamakApplication : Application(), TokamakPlugins {
111
111
 
112
112
  override fun emit(name: String, event: String, timeoutMillis: Long): String =
113
113
  emitEvent("$id.$name", event, timeoutMillis)
114
+
115
+ override fun fetch(path: String, timeoutMillis: Long): ByteArray {
116
+ val deadline = SystemClock.elapsedRealtime() + timeoutMillis
117
+ val started = runtime
118
+ return started.fetch(path, deadline - SystemClock.elapsedRealtime())
119
+ }
114
120
  }
115
121
 
116
122
  /** The activity to show UI in; throws `NeedsUIError` while the app is in the background. */
@@ -30,6 +30,9 @@ internal class TokamakRuntime private constructor(private val handle: Long) {
30
30
  fun emit(name: String, event: String, timeoutMillis: Long): String =
31
31
  nativeEmit(handle, name, event, timeoutMillis)
32
32
 
33
+ /** What the app serves at [path], blocking until it arrives or [timeoutMillis] passes. */
34
+ fun fetch(path: String, timeoutMillis: Long): ByteArray = nativeFetch(handle, path, timeoutMillis)
35
+
33
36
  /**
34
37
  * Records whether the app is in the foreground, which the Worker's `getLifecycleStage()`
35
38
  * reports from then on, and returns whether that changed.
@@ -136,6 +139,9 @@ internal class TokamakRuntime private constructor(private val handle: Long) {
136
139
  timeoutMillis: Long,
137
140
  ): String
138
141
 
142
+ @JvmStatic
143
+ private external fun nativeFetch(handle: Long, path: String, timeoutMillis: Long): ByteArray
144
+
139
145
  @JvmStatic
140
146
  private external fun nativeServerAuthority(handle: Long, host: String): ByteArray?
141
147
 
@@ -86,6 +86,13 @@ interface TokamakHost {
86
86
  * throws unless the listeners return within [timeoutMillis], which includes runtime startup.
87
87
  */
88
88
  fun emit(name: String, event: String, timeoutMillis: Long): String
89
+
90
+ /**
91
+ * What the app serves at [path], as its WebView would load it: a file the app ships or the
92
+ * Worker's response. Starts the runtime when it is not running. Blocks, so call it off the main
93
+ * thread; throws unless it arrives within [timeoutMillis].
94
+ */
95
+ fun fetch(path: String, timeoutMillis: Long): ByteArray
89
96
  }
90
97
 
91
98
  /** The app's plugins. The app's [android.app.Application] is one. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokamakdev/platform-android-arm64",
3
- "version": "0.1.1-beta.89",
3
+ "version": "0.1.1-beta.91",
4
4
  "description": "The tokamak platform pack for android-arm64",
5
5
  "repository": {
6
6
  "type": "git",