ReviewOS

also looking at this

craft-native/craft

feat(android): getNetworkStatus — the action iOS cannot serve

#146
Merged glennmichael123 wants to merge feat/android-network-status into main
7 files +407 -3
packages/android/templates/CraftNative.kt.templatemodified+11-0
Changes to packages/android/templates/CraftNative.kt.template
@@ -63,6 +63,7 @@ object CraftNative {
6363 private external fun nativeClipboardWrite(activity: Activity, text: String): Boolean
6464 private external fun nativeOpenUrl(activity: Activity, url: String): Boolean
6565 private external fun nativeShare(activity: Activity, text: String, title: String): Boolean
66 private external fun nativeGetNetworkStatus(activity: Activity): String?
6667
6768 /**
6869 * `getDeviceInfo`, or null to use the Kotlin implementation.
@@ -165,4 +166,14 @@ object CraftNative {
165166 false
166167 }
167168 }
169
170 /** The active network as JSON, or null to use the Kotlin implementation. */
171 fun getNetworkStatus(activity: Activity): String? {
172 if (!isAvailable) return null
173 return try {
174 nativeGetNetworkStatus(activity)
175 } catch (e: UnsatisfiedLinkError) {
176 null
177 }
178 }
168179}