craft-native 0.0.168 → 0.0.170
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 +1028 -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/dist/ios/templates/CraftNativeActions.swift +15 -0
- package/package.json +1 -1
|
@@ -18,8 +18,24 @@ android {
|
|
|
18
18
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
// Release signing from the environment (the upload key Google Play
|
|
22
|
+
// expects; Play App Signing re-signs for devices). Without
|
|
23
|
+
// CRAFT_ANDROID_KEYSTORE a release build is unsigned.
|
|
24
|
+
val releaseKeystore = System.getenv("CRAFT_ANDROID_KEYSTORE")?.takeIf { it.isNotBlank() }
|
|
25
|
+
signingConfigs {
|
|
26
|
+
if (releaseKeystore != null) {
|
|
27
|
+
create("release") {
|
|
28
|
+
storeFile = file(releaseKeystore)
|
|
29
|
+
storePassword = System.getenv("CRAFT_ANDROID_KEYSTORE_PASSWORD")
|
|
30
|
+
keyAlias = System.getenv("CRAFT_ANDROID_KEY_ALIAS")
|
|
31
|
+
keyPassword = System.getenv("CRAFT_ANDROID_KEY_PASSWORD") ?: System.getenv("CRAFT_ANDROID_KEYSTORE_PASSWORD")
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
21
36
|
buildTypes {
|
|
22
37
|
release {
|
|
38
|
+
if (releaseKeystore != null) signingConfig = signingConfigs.getByName("release")
|
|
23
39
|
isMinifyEnabled = true
|
|
24
40
|
isShrinkResources = true
|
|
25
41
|
proguardFiles(
|
package/dist/cli.js
CHANGED
|
@@ -3303,7 +3303,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
|
|
|
3303
3303
|
`);
|
|
3304
3304
|
}
|
|
3305
3305
|
// package.json
|
|
3306
|
-
var version = "0.0.
|
|
3306
|
+
var version = "0.0.170";
|
|
3307
3307
|
|
|
3308
3308
|
// bin/cli.ts
|
|
3309
3309
|
var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -647,6 +647,12 @@ enum CraftNativeActions {
|
|
|
647
647
|
/// offline, fetched once (a copy already there answers at once, and two
|
|
648
648
|
/// screens asking at the same time share one download). A refused answer
|
|
649
649
|
/// (not 2xx) keeps nothing and says its status. Cancelled like fetch.
|
|
650
|
+
///
|
|
651
|
+
/// `cellular: false` keeps it off a metered connection: iOS refuses the
|
|
652
|
+
/// download on cellular, a personal hotspot and Low Data Mode, and the
|
|
653
|
+
/// answer is `{ ok: false, reason: "cellular" }` straight away, so the
|
|
654
|
+
/// screen can say it is waiting for Wi-Fi instead of failing. A copy
|
|
655
|
+
/// already kept still answers, whatever the connection.
|
|
650
656
|
private static func keepMedia(
|
|
651
657
|
requestToken: String,
|
|
652
658
|
args: [Any],
|
|
@@ -675,12 +681,21 @@ enum CraftNativeActions {
|
|
|
675
681
|
request.setValue(value, forHTTPHeaderField: name)
|
|
676
682
|
}
|
|
677
683
|
}
|
|
684
|
+
if options["cellular"] as? Bool == false {
|
|
685
|
+
request.allowsExpensiveNetworkAccess = false
|
|
686
|
+
request.allowsConstrainedNetworkAccess = false
|
|
687
|
+
}
|
|
678
688
|
if CraftNativeMedia.join(address, { complete(requestToken, $0, completion) }) { return }
|
|
679
689
|
let task = fetchSession.downloadTask(with: request) { location, response, error in
|
|
680
690
|
cancellationLock.lock()
|
|
681
691
|
fetchTasks.removeValue(forKey: requestToken)
|
|
682
692
|
cancellationLock.unlock()
|
|
683
693
|
if let error = error {
|
|
694
|
+
// Refused only because the connection is metered: not a failure, a wait.
|
|
695
|
+
if let reason = (error as? URLError)?.networkUnavailableReason, reason == .expensive || reason == .constrained {
|
|
696
|
+
CraftNativeMedia.finish(address, .success(["ok": false, "url": address, "reason": "cellular"]))
|
|
697
|
+
return
|
|
698
|
+
}
|
|
684
699
|
let code = (error as? URLError)?.code == .timedOut ? "TIMEOUT" : "NETWORK_ERROR"
|
|
685
700
|
CraftNativeMedia.finish(address, failure(code, error.localizedDescription))
|
|
686
701
|
return
|