craft-native 0.0.175 → 0.0.177
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 +19 -0
- package/dist/android/src/index.js +19 -2
- package/dist/android/templates/AndroidManifest.xml.template +1 -0
- package/dist/android/templates/CraftBridge.kt.template +51 -0
- package/dist/android/templates/CraftCrashReporter.kt.template +544 -0
- package/dist/android/templates/CraftNative.kt.template +17 -0
- package/dist/android/templates/CraftNativeFlatList.kt.template +20 -9
- package/dist/android/templates/CraftNativeMutation.kt.template +4 -1
- package/dist/android/templates/CraftNativeServices.kt.template +31 -1
- package/dist/android/templates/MainActivityNative.kt.template +986 -304
- package/dist/android/templates/build.gradle.kts.app.template +4 -2
- package/dist/api/mobile.d.ts +31 -0
- package/dist/cli.js +1 -1
- package/dist/components/index.d.ts +203 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ios/src/index.d.ts +19 -0
- package/dist/ios/src/index.js +7 -1
- package/dist/ios/src/testing.d.ts +5 -0
- package/dist/ios/templates/CraftApp.swift +51 -1
- package/dist/ios/templates/CraftCrashReporter.swift +1010 -0
- package/dist/ios/templates/CraftHybrid.swift +10 -0
- package/dist/ios/templates/CraftNativeActions.swift +49 -1
- package/dist/ios/templates/CraftNativeFlatList.swift +30 -28
- package/dist/ios/templates/CraftNativeMutation.swift +1 -1
- package/dist/ios/templates/CraftNativeScreen.swift +559 -86
- package/dist/ios/templates/project.yml.template +1 -0
- package/dist/ios/templates/testing/DriverTests.swift.template +8 -0
- package/dist/macos/templates/CraftNativeMutation.swift +1 -1
- package/dist/macos/templates/native_layout.zig +389 -17
- package/dist/mobile.js +66 -0
- package/package.json +1 -1
|
@@ -84,11 +84,13 @@ internal class CraftNativeServices(
|
|
|
84
84
|
if (config.optBoolean("enableKeepAwake")) add("keepAwake")
|
|
85
85
|
if (config.optBoolean("enableGeolocation") || config.optBoolean("enableBackgroundLocation")) add("geolocation")
|
|
86
86
|
if (config.optJSONObject("backgroundRefresh")?.optBoolean("enabled") == true || config.optBoolean("enablePushNotifications")) add("background")
|
|
87
|
+
// craft.crashReporter: the app's crash and error reporter (bughq).
|
|
88
|
+
if (CraftCrashReporter.enabled) add("crashReporter")
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
fun handles(module: String): Boolean = module in setOf(
|
|
90
92
|
"Dialog", "Browser", "Linking", "Share", "Push", "Health", "KeepAwake", "Brightness", "StatusBar", "Speech", "Background",
|
|
91
|
-
"Location", "Media",
|
|
93
|
+
"Location", "Media", "CrashReporter",
|
|
92
94
|
)
|
|
93
95
|
|
|
94
96
|
fun perform(module: String, method: String, args: JSONArray, completion: (CraftNativeCapabilityResult) -> Unit) {
|
|
@@ -122,6 +124,7 @@ internal class CraftNativeServices(
|
|
|
122
124
|
onBackgroundComplete?.invoke(args.optBoolean(0, true), args.opt(1) as? String)
|
|
123
125
|
done(success(true))
|
|
124
126
|
}
|
|
127
|
+
"CrashReporter" -> crashReporter(method, args, done)
|
|
125
128
|
else -> done(failure("UNKNOWN_ACTION", "Unsupported native API"))
|
|
126
129
|
}
|
|
127
130
|
} catch (error: Exception) {
|
|
@@ -436,6 +439,33 @@ internal class CraftNativeServices(
|
|
|
436
439
|
}
|
|
437
440
|
}
|
|
438
441
|
|
|
442
|
+
// MARK: Crash reporting (CraftCrashReporter.kt)
|
|
443
|
+
|
|
444
|
+
private fun crashReporter(method: String, args: JSONArray, done: (CraftNativeCapabilityResult) -> Unit) {
|
|
445
|
+
if (!CraftCrashReporter.enabled && method != "context") return done(failure("CAPABILITY_DISABLED", "Crash reporting is not configured"))
|
|
446
|
+
when (method) {
|
|
447
|
+
"capture" -> {
|
|
448
|
+
val event = args.optJSONObject(0) ?: return done(failure("INVALID_ARGUMENT", "capture needs an event"))
|
|
449
|
+
done(success(CraftCrashReporter.capture(event)))
|
|
450
|
+
}
|
|
451
|
+
"setUser" -> {
|
|
452
|
+
CraftCrashReporter.setUser(if (args.isNull(0)) null else args.optString(0))
|
|
453
|
+
done(success(true))
|
|
454
|
+
}
|
|
455
|
+
"addBreadcrumb" -> {
|
|
456
|
+
val crumb = args.optJSONObject(0) ?: return done(failure("INVALID_ARGUMENT", "addBreadcrumb needs a breadcrumb"))
|
|
457
|
+
CraftCrashReporter.addBreadcrumb(crumb)
|
|
458
|
+
done(success(true))
|
|
459
|
+
}
|
|
460
|
+
"flush" -> {
|
|
461
|
+
CraftCrashReporter.requestFlush()
|
|
462
|
+
done(success(true))
|
|
463
|
+
}
|
|
464
|
+
"context" -> done(success(if (CraftCrashReporter.enabled) CraftCrashReporter.context() else JSONObject().put("enabled", false)))
|
|
465
|
+
else -> done(failure("UNKNOWN_ACTION", "Unsupported CrashReporter method"))
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
439
469
|
// MARK: Health Connect
|
|
440
470
|
|
|
441
471
|
fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Boolean =
|