craft-native 0.0.168 → 0.0.169
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/dist/android/src/index.d.ts +62 -0
- package/dist/android/src/index.js +138 -18
- package/dist/android/templates/CraftNativeBackground.kt.template +296 -0
- package/dist/android/templates/CraftNativeCapabilities.kt.template +59 -37
- package/dist/android/templates/CraftNativeHealth.kt.template +1046 -0
- package/dist/android/templates/CraftNativeHealthStub.kt.template +32 -0
- package/dist/android/templates/CraftNativeMessagingService.kt.template +75 -0
- package/dist/android/templates/CraftNativeMutation.kt.template +14 -2
- package/dist/android/templates/CraftNativeServices.kt.template +561 -0
- package/dist/android/templates/CraftNativeShell.kt.template +1013 -0
- package/dist/android/templates/LocationRecordingService.kt.template +7 -0
- package/dist/android/templates/MainActivityNative.kt.template +738 -132
- package/dist/android/templates/build.gradle.kts.app.template +16 -0
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -52,9 +52,16 @@ object CraftLocationRecordingStore {
|
|
|
52
52
|
fun isActive(context: Context) = prefs(context).getBoolean("active", false)
|
|
53
53
|
fun isPaused(context: Context) = prefs(context).getBoolean("paused", false)
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Hears each fix the recording keeps, while the app is running: a native
|
|
57
|
+
* screen shows the route growing (`craftLocationUpdate`).
|
|
58
|
+
*/
|
|
59
|
+
@Volatile var listener: ((android.location.Location) -> Unit)? = null
|
|
60
|
+
|
|
55
61
|
@Synchronized
|
|
56
62
|
fun append(context: Context, location: android.location.Location) {
|
|
57
63
|
if (!isActive(context) || isPaused(context)) return
|
|
64
|
+
listener?.invoke(location)
|
|
58
65
|
val json = JSONObject().apply {
|
|
59
66
|
put("latitude", location.latitude)
|
|
60
67
|
put("longitude", location.longitude)
|