@thelacanians/vue-native-runtime 0.6.3 → 0.6.5
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/index.cjs +55 -21
- package/dist/index.js +55 -21
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -408,6 +408,17 @@ var _NativeBridgeImpl = class _NativeBridgeImpl {
|
|
|
408
408
|
// ad hoc based on the module contract rather than a shared generated type.
|
|
409
409
|
invokeNativeModule(moduleName, methodName, args = [], timeoutMs = 3e4) {
|
|
410
410
|
return new Promise((resolve, reject) => {
|
|
411
|
+
if (this.pendingCallbacks.has(this.nextCallbackId)) {
|
|
412
|
+
const orphaned = this.pendingCallbacks.get(this.nextCallbackId);
|
|
413
|
+
if (orphaned) {
|
|
414
|
+
clearTimeout(orphaned.timeoutId);
|
|
415
|
+
orphaned.reject(
|
|
416
|
+
new Error(
|
|
417
|
+
"[VueNative] Native bridge callback ID overflow \u2014 orphaned callback was rejected"
|
|
418
|
+
)
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
411
422
|
const callbackId = this.nextCallbackId;
|
|
412
423
|
if (this.nextCallbackId >= _NativeBridgeImpl.MAX_CALLBACK_ID) {
|
|
413
424
|
this.nextCallbackId = 1;
|
|
@@ -3301,7 +3312,8 @@ function useNetwork() {
|
|
|
3301
3312
|
isConnected.value = status.isConnected;
|
|
3302
3313
|
connectionType.value = status.connectionType;
|
|
3303
3314
|
}
|
|
3304
|
-
}).catch(() => {
|
|
3315
|
+
}).catch((err) => {
|
|
3316
|
+
if (__DEV__) console.warn("[vue-native] Network.getStatus failed:", err);
|
|
3305
3317
|
});
|
|
3306
3318
|
(0, import_runtime_core39.onUnmounted)(unsubscribe);
|
|
3307
3319
|
return { isConnected, connectionType };
|
|
@@ -3313,7 +3325,8 @@ function useAppState() {
|
|
|
3313
3325
|
const state = (0, import_runtime_core40.ref)("active");
|
|
3314
3326
|
NativeBridge.invokeNativeModule("AppState", "getState").then((s) => {
|
|
3315
3327
|
state.value = s;
|
|
3316
|
-
}).catch(() => {
|
|
3328
|
+
}).catch((err) => {
|
|
3329
|
+
if (__DEV__) console.warn("[vue-native] AppState.getState failed:", err);
|
|
3317
3330
|
});
|
|
3318
3331
|
const unsubscribe = NativeBridge.onGlobalEvent("appState:change", (payload) => {
|
|
3319
3332
|
state.value = payload.state;
|
|
@@ -3425,7 +3438,8 @@ function useCamera() {
|
|
|
3425
3438
|
return unsubscribe;
|
|
3426
3439
|
}
|
|
3427
3440
|
(0, import_runtime_core42.onUnmounted)(() => {
|
|
3428
|
-
NativeBridge.invokeNativeModule("Camera", "stopQRScan").catch(() => {
|
|
3441
|
+
NativeBridge.invokeNativeModule("Camera", "stopQRScan").catch((err) => {
|
|
3442
|
+
if (__DEV__) console.warn("[vue-native] Camera.stopQRScan failed:", err);
|
|
3429
3443
|
});
|
|
3430
3444
|
qrCleanups.forEach((fn) => fn());
|
|
3431
3445
|
qrCleanups.length = 0;
|
|
@@ -3651,7 +3665,8 @@ function useBackHandler(handler) {
|
|
|
3651
3665
|
unsubscribe = NativeBridge.onGlobalEvent("hardware:backPress", () => {
|
|
3652
3666
|
const handled = handler();
|
|
3653
3667
|
if (!handled) {
|
|
3654
|
-
NativeBridge.invokeNativeModule("BackHandler", "exitApp", []).catch(() => {
|
|
3668
|
+
NativeBridge.invokeNativeModule("BackHandler", "exitApp", []).catch((err) => {
|
|
3669
|
+
if (__DEV__) console.warn("[vue-native] BackHandler.exitApp failed:", err);
|
|
3655
3670
|
});
|
|
3656
3671
|
}
|
|
3657
3672
|
});
|
|
@@ -3823,7 +3838,8 @@ function useWebSocket(url, options = {}) {
|
|
|
3823
3838
|
}
|
|
3824
3839
|
if (status.value === "OPEN" || status.value === "CONNECTING") {
|
|
3825
3840
|
reconnectAttempts = maxReconnectAttempts;
|
|
3826
|
-
NativeBridge.invokeNativeModule("WebSocket", "close", [connectionId, 1e3, ""]).catch(() => {
|
|
3841
|
+
NativeBridge.invokeNativeModule("WebSocket", "close", [connectionId, 1e3, ""]).catch((err) => {
|
|
3842
|
+
if (__DEV__) console.warn("[vue-native] WebSocket.close failed:", err);
|
|
3827
3843
|
});
|
|
3828
3844
|
}
|
|
3829
3845
|
unsubscribers.forEach((unsub) => unsub());
|
|
@@ -3896,7 +3912,9 @@ function useAccelerometer(options = {}) {
|
|
|
3896
3912
|
let unsubscribe = null;
|
|
3897
3913
|
NativeBridge.invokeNativeModule("Sensors", "isAvailable", ["accelerometer"]).then((result) => {
|
|
3898
3914
|
isAvailable.value = result.available;
|
|
3899
|
-
}).catch(() => {
|
|
3915
|
+
}).catch((err) => {
|
|
3916
|
+
if (__DEV__) console.warn("[vue-native] Sensors.isAvailable(accelerometer) failed:", err);
|
|
3917
|
+
isAvailable.value = false;
|
|
3900
3918
|
});
|
|
3901
3919
|
function start() {
|
|
3902
3920
|
if (running) return;
|
|
@@ -3908,7 +3926,8 @@ function useAccelerometer(options = {}) {
|
|
|
3908
3926
|
});
|
|
3909
3927
|
NativeBridge.invokeNativeModule("Sensors", "startAccelerometer", [
|
|
3910
3928
|
options.interval ?? 100
|
|
3911
|
-
]).catch(() => {
|
|
3929
|
+
]).catch((err) => {
|
|
3930
|
+
if (__DEV__) console.warn("[vue-native] Sensors.startAccelerometer failed:", err);
|
|
3912
3931
|
});
|
|
3913
3932
|
}
|
|
3914
3933
|
function stop() {
|
|
@@ -3916,7 +3935,8 @@ function useAccelerometer(options = {}) {
|
|
|
3916
3935
|
running = false;
|
|
3917
3936
|
unsubscribe?.();
|
|
3918
3937
|
unsubscribe = null;
|
|
3919
|
-
NativeBridge.invokeNativeModule("Sensors", "stopAccelerometer").catch(() => {
|
|
3938
|
+
NativeBridge.invokeNativeModule("Sensors", "stopAccelerometer").catch((err) => {
|
|
3939
|
+
if (__DEV__) console.warn("[vue-native] Sensors.stopAccelerometer failed:", err);
|
|
3920
3940
|
});
|
|
3921
3941
|
}
|
|
3922
3942
|
(0, import_runtime_core50.onUnmounted)(() => {
|
|
@@ -3933,7 +3953,9 @@ function useGyroscope(options = {}) {
|
|
|
3933
3953
|
let unsubscribe = null;
|
|
3934
3954
|
NativeBridge.invokeNativeModule("Sensors", "isAvailable", ["gyroscope"]).then((result) => {
|
|
3935
3955
|
isAvailable.value = result.available;
|
|
3936
|
-
}).catch(() => {
|
|
3956
|
+
}).catch((err) => {
|
|
3957
|
+
if (__DEV__) console.warn("[vue-native] Sensors.isAvailable(gyroscope) failed:", err);
|
|
3958
|
+
isAvailable.value = false;
|
|
3937
3959
|
});
|
|
3938
3960
|
function start() {
|
|
3939
3961
|
if (running) return;
|
|
@@ -3945,7 +3967,8 @@ function useGyroscope(options = {}) {
|
|
|
3945
3967
|
});
|
|
3946
3968
|
NativeBridge.invokeNativeModule("Sensors", "startGyroscope", [
|
|
3947
3969
|
options.interval ?? 100
|
|
3948
|
-
]).catch(() => {
|
|
3970
|
+
]).catch((err) => {
|
|
3971
|
+
if (__DEV__) console.warn("[vue-native] Sensors.startGyroscope failed:", err);
|
|
3949
3972
|
});
|
|
3950
3973
|
}
|
|
3951
3974
|
function stop() {
|
|
@@ -3953,7 +3976,8 @@ function useGyroscope(options = {}) {
|
|
|
3953
3976
|
running = false;
|
|
3954
3977
|
unsubscribe?.();
|
|
3955
3978
|
unsubscribe = null;
|
|
3956
|
-
NativeBridge.invokeNativeModule("Sensors", "stopGyroscope").catch(() => {
|
|
3979
|
+
NativeBridge.invokeNativeModule("Sensors", "stopGyroscope").catch((err) => {
|
|
3980
|
+
if (__DEV__) console.warn("[vue-native] Sensors.stopGyroscope failed:", err);
|
|
3957
3981
|
});
|
|
3958
3982
|
}
|
|
3959
3983
|
(0, import_runtime_core50.onUnmounted)(() => {
|
|
@@ -3997,10 +4021,12 @@ function useAudio() {
|
|
|
3997
4021
|
unsubProgress();
|
|
3998
4022
|
unsubComplete();
|
|
3999
4023
|
unsubError();
|
|
4000
|
-
NativeBridge.invokeNativeModule("Audio", "stop", []).catch(() => {
|
|
4024
|
+
NativeBridge.invokeNativeModule("Audio", "stop", []).catch((err) => {
|
|
4025
|
+
if (__DEV__) console.warn("[vue-native] Audio.stop failed:", err);
|
|
4001
4026
|
});
|
|
4002
4027
|
if (isRecording.value) {
|
|
4003
|
-
NativeBridge.invokeNativeModule("Audio", "stopRecording", []).catch(() => {
|
|
4028
|
+
NativeBridge.invokeNativeModule("Audio", "stopRecording", []).catch((err) => {
|
|
4029
|
+
if (__DEV__) console.warn("[vue-native] Audio.stopRecording failed:", err);
|
|
4004
4030
|
});
|
|
4005
4031
|
}
|
|
4006
4032
|
});
|
|
@@ -4109,7 +4135,8 @@ function useDatabase(name = "default") {
|
|
|
4109
4135
|
await callback(ctx);
|
|
4110
4136
|
await NativeBridge.invokeNativeModule("Database", "execute", [name, "COMMIT", []]);
|
|
4111
4137
|
} catch (err) {
|
|
4112
|
-
await NativeBridge.invokeNativeModule("Database", "execute", [name, "ROLLBACK", []]).catch(() => {
|
|
4138
|
+
await NativeBridge.invokeNativeModule("Database", "execute", [name, "ROLLBACK", []]).catch((err2) => {
|
|
4139
|
+
if (__DEV__) console.warn("[vue-native] Database ROLLBACK failed:", err2);
|
|
4113
4140
|
});
|
|
4114
4141
|
throw err;
|
|
4115
4142
|
}
|
|
@@ -4122,7 +4149,8 @@ function useDatabase(name = "default") {
|
|
|
4122
4149
|
}
|
|
4123
4150
|
(0, import_runtime_core52.onUnmounted)(() => {
|
|
4124
4151
|
if (opened) {
|
|
4125
|
-
NativeBridge.invokeNativeModule("Database", "close", [name]).catch(() => {
|
|
4152
|
+
NativeBridge.invokeNativeModule("Database", "close", [name]).catch((err) => {
|
|
4153
|
+
if (__DEV__) console.warn("[vue-native] Database.close failed:", err);
|
|
4126
4154
|
});
|
|
4127
4155
|
opened = false;
|
|
4128
4156
|
isOpen.value = false;
|
|
@@ -4164,7 +4192,8 @@ function usePerformance() {
|
|
|
4164
4192
|
}
|
|
4165
4193
|
(0, import_runtime_core53.onUnmounted)(() => {
|
|
4166
4194
|
if (isProfiling.value) {
|
|
4167
|
-
NativeBridge.invokeNativeModule("Performance", "stopProfiling", []).catch(() => {
|
|
4195
|
+
NativeBridge.invokeNativeModule("Performance", "stopProfiling", []).catch((err) => {
|
|
4196
|
+
if (__DEV__) console.warn("[vue-native] Performance.stopProfiling failed:", err);
|
|
4168
4197
|
});
|
|
4169
4198
|
isProfiling.value = false;
|
|
4170
4199
|
}
|
|
@@ -4345,7 +4374,8 @@ function useAppleSignIn() {
|
|
|
4345
4374
|
user.value = currentUser;
|
|
4346
4375
|
isAuthenticated.value = true;
|
|
4347
4376
|
}
|
|
4348
|
-
}).catch(() => {
|
|
4377
|
+
}).catch((err) => {
|
|
4378
|
+
if (__DEV__) console.warn("[vue-native] SocialAuth.getCurrentUser failed:", err);
|
|
4349
4379
|
});
|
|
4350
4380
|
async function signIn() {
|
|
4351
4381
|
error.value = null;
|
|
@@ -4415,7 +4445,8 @@ function useGoogleSignIn(clientId) {
|
|
|
4415
4445
|
user.value = currentUser;
|
|
4416
4446
|
isAuthenticated.value = true;
|
|
4417
4447
|
}
|
|
4418
|
-
}).catch(() => {
|
|
4448
|
+
}).catch((err) => {
|
|
4449
|
+
if (__DEV__) console.warn("[vue-native] SocialAuth.getCurrentUser failed:", err);
|
|
4419
4450
|
});
|
|
4420
4451
|
async function signIn() {
|
|
4421
4452
|
error.value = null;
|
|
@@ -4525,7 +4556,8 @@ function useOTAUpdate(serverUrl) {
|
|
|
4525
4556
|
(0, import_runtime_core59.onUnmounted)(unsubscribe);
|
|
4526
4557
|
NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []).then((info) => {
|
|
4527
4558
|
currentVersion.value = info.version;
|
|
4528
|
-
}).catch(() => {
|
|
4559
|
+
}).catch((err) => {
|
|
4560
|
+
if (__DEV__) console.warn("[vue-native] OTA.getCurrentVersion failed:", err);
|
|
4529
4561
|
});
|
|
4530
4562
|
async function checkForUpdate() {
|
|
4531
4563
|
isChecking.value = true;
|
|
@@ -4566,7 +4598,8 @@ function useOTAUpdate(serverUrl) {
|
|
|
4566
4598
|
await NativeBridge.invokeNativeModule("OTA", "downloadUpdate", [downloadUrl, expectedHash || ""]);
|
|
4567
4599
|
status.value = "ready";
|
|
4568
4600
|
} catch (err) {
|
|
4569
|
-
await NativeBridge.invokeNativeModule("OTA", "cleanupPartialDownload", []).catch(() => {
|
|
4601
|
+
await NativeBridge.invokeNativeModule("OTA", "cleanupPartialDownload", []).catch((err2) => {
|
|
4602
|
+
if (__DEV__) console.warn("[vue-native] OTA.cleanupPartialDownload failed:", err2);
|
|
4570
4603
|
});
|
|
4571
4604
|
error.value = getErrorMessage4(err);
|
|
4572
4605
|
status.value = "error";
|
|
@@ -4729,7 +4762,8 @@ function useBluetooth() {
|
|
|
4729
4762
|
}
|
|
4730
4763
|
(0, import_runtime_core60.onUnmounted)(() => {
|
|
4731
4764
|
if (isScanning.value) {
|
|
4732
|
-
NativeBridge.invokeNativeModule("Bluetooth", "stopScan").catch(() => {
|
|
4765
|
+
NativeBridge.invokeNativeModule("Bluetooth", "stopScan").catch((err) => {
|
|
4766
|
+
if (__DEV__) console.warn("[vue-native] Bluetooth.stopScan failed:", err);
|
|
4733
4767
|
});
|
|
4734
4768
|
}
|
|
4735
4769
|
cleanups.forEach((fn) => fn());
|
package/dist/index.js
CHANGED
|
@@ -288,6 +288,17 @@ var _NativeBridgeImpl = class _NativeBridgeImpl {
|
|
|
288
288
|
// ad hoc based on the module contract rather than a shared generated type.
|
|
289
289
|
invokeNativeModule(moduleName, methodName, args = [], timeoutMs = 3e4) {
|
|
290
290
|
return new Promise((resolve, reject) => {
|
|
291
|
+
if (this.pendingCallbacks.has(this.nextCallbackId)) {
|
|
292
|
+
const orphaned = this.pendingCallbacks.get(this.nextCallbackId);
|
|
293
|
+
if (orphaned) {
|
|
294
|
+
clearTimeout(orphaned.timeoutId);
|
|
295
|
+
orphaned.reject(
|
|
296
|
+
new Error(
|
|
297
|
+
"[VueNative] Native bridge callback ID overflow \u2014 orphaned callback was rejected"
|
|
298
|
+
)
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
291
302
|
const callbackId = this.nextCallbackId;
|
|
292
303
|
if (this.nextCallbackId >= _NativeBridgeImpl.MAX_CALLBACK_ID) {
|
|
293
304
|
this.nextCallbackId = 1;
|
|
@@ -3194,7 +3205,8 @@ function useNetwork() {
|
|
|
3194
3205
|
isConnected.value = status.isConnected;
|
|
3195
3206
|
connectionType.value = status.connectionType;
|
|
3196
3207
|
}
|
|
3197
|
-
}).catch(() => {
|
|
3208
|
+
}).catch((err) => {
|
|
3209
|
+
if (__DEV__) console.warn("[vue-native] Network.getStatus failed:", err);
|
|
3198
3210
|
});
|
|
3199
3211
|
onUnmounted4(unsubscribe);
|
|
3200
3212
|
return { isConnected, connectionType };
|
|
@@ -3206,7 +3218,8 @@ function useAppState() {
|
|
|
3206
3218
|
const state = ref15("active");
|
|
3207
3219
|
NativeBridge.invokeNativeModule("AppState", "getState").then((s) => {
|
|
3208
3220
|
state.value = s;
|
|
3209
|
-
}).catch(() => {
|
|
3221
|
+
}).catch((err) => {
|
|
3222
|
+
if (__DEV__) console.warn("[vue-native] AppState.getState failed:", err);
|
|
3210
3223
|
});
|
|
3211
3224
|
const unsubscribe = NativeBridge.onGlobalEvent("appState:change", (payload) => {
|
|
3212
3225
|
state.value = payload.state;
|
|
@@ -3318,7 +3331,8 @@ function useCamera() {
|
|
|
3318
3331
|
return unsubscribe;
|
|
3319
3332
|
}
|
|
3320
3333
|
onUnmounted7(() => {
|
|
3321
|
-
NativeBridge.invokeNativeModule("Camera", "stopQRScan").catch(() => {
|
|
3334
|
+
NativeBridge.invokeNativeModule("Camera", "stopQRScan").catch((err) => {
|
|
3335
|
+
if (__DEV__) console.warn("[vue-native] Camera.stopQRScan failed:", err);
|
|
3322
3336
|
});
|
|
3323
3337
|
qrCleanups.forEach((fn) => fn());
|
|
3324
3338
|
qrCleanups.length = 0;
|
|
@@ -3544,7 +3558,8 @@ function useBackHandler(handler) {
|
|
|
3544
3558
|
unsubscribe = NativeBridge.onGlobalEvent("hardware:backPress", () => {
|
|
3545
3559
|
const handled = handler();
|
|
3546
3560
|
if (!handled) {
|
|
3547
|
-
NativeBridge.invokeNativeModule("BackHandler", "exitApp", []).catch(() => {
|
|
3561
|
+
NativeBridge.invokeNativeModule("BackHandler", "exitApp", []).catch((err) => {
|
|
3562
|
+
if (__DEV__) console.warn("[vue-native] BackHandler.exitApp failed:", err);
|
|
3548
3563
|
});
|
|
3549
3564
|
}
|
|
3550
3565
|
});
|
|
@@ -3716,7 +3731,8 @@ function useWebSocket(url, options = {}) {
|
|
|
3716
3731
|
}
|
|
3717
3732
|
if (status.value === "OPEN" || status.value === "CONNECTING") {
|
|
3718
3733
|
reconnectAttempts = maxReconnectAttempts;
|
|
3719
|
-
NativeBridge.invokeNativeModule("WebSocket", "close", [connectionId, 1e3, ""]).catch(() => {
|
|
3734
|
+
NativeBridge.invokeNativeModule("WebSocket", "close", [connectionId, 1e3, ""]).catch((err) => {
|
|
3735
|
+
if (__DEV__) console.warn("[vue-native] WebSocket.close failed:", err);
|
|
3720
3736
|
});
|
|
3721
3737
|
}
|
|
3722
3738
|
unsubscribers.forEach((unsub) => unsub());
|
|
@@ -3789,7 +3805,9 @@ function useAccelerometer(options = {}) {
|
|
|
3789
3805
|
let unsubscribe = null;
|
|
3790
3806
|
NativeBridge.invokeNativeModule("Sensors", "isAvailable", ["accelerometer"]).then((result) => {
|
|
3791
3807
|
isAvailable.value = result.available;
|
|
3792
|
-
}).catch(() => {
|
|
3808
|
+
}).catch((err) => {
|
|
3809
|
+
if (__DEV__) console.warn("[vue-native] Sensors.isAvailable(accelerometer) failed:", err);
|
|
3810
|
+
isAvailable.value = false;
|
|
3793
3811
|
});
|
|
3794
3812
|
function start() {
|
|
3795
3813
|
if (running) return;
|
|
@@ -3801,7 +3819,8 @@ function useAccelerometer(options = {}) {
|
|
|
3801
3819
|
});
|
|
3802
3820
|
NativeBridge.invokeNativeModule("Sensors", "startAccelerometer", [
|
|
3803
3821
|
options.interval ?? 100
|
|
3804
|
-
]).catch(() => {
|
|
3822
|
+
]).catch((err) => {
|
|
3823
|
+
if (__DEV__) console.warn("[vue-native] Sensors.startAccelerometer failed:", err);
|
|
3805
3824
|
});
|
|
3806
3825
|
}
|
|
3807
3826
|
function stop() {
|
|
@@ -3809,7 +3828,8 @@ function useAccelerometer(options = {}) {
|
|
|
3809
3828
|
running = false;
|
|
3810
3829
|
unsubscribe?.();
|
|
3811
3830
|
unsubscribe = null;
|
|
3812
|
-
NativeBridge.invokeNativeModule("Sensors", "stopAccelerometer").catch(() => {
|
|
3831
|
+
NativeBridge.invokeNativeModule("Sensors", "stopAccelerometer").catch((err) => {
|
|
3832
|
+
if (__DEV__) console.warn("[vue-native] Sensors.stopAccelerometer failed:", err);
|
|
3813
3833
|
});
|
|
3814
3834
|
}
|
|
3815
3835
|
onUnmounted14(() => {
|
|
@@ -3826,7 +3846,9 @@ function useGyroscope(options = {}) {
|
|
|
3826
3846
|
let unsubscribe = null;
|
|
3827
3847
|
NativeBridge.invokeNativeModule("Sensors", "isAvailable", ["gyroscope"]).then((result) => {
|
|
3828
3848
|
isAvailable.value = result.available;
|
|
3829
|
-
}).catch(() => {
|
|
3849
|
+
}).catch((err) => {
|
|
3850
|
+
if (__DEV__) console.warn("[vue-native] Sensors.isAvailable(gyroscope) failed:", err);
|
|
3851
|
+
isAvailable.value = false;
|
|
3830
3852
|
});
|
|
3831
3853
|
function start() {
|
|
3832
3854
|
if (running) return;
|
|
@@ -3838,7 +3860,8 @@ function useGyroscope(options = {}) {
|
|
|
3838
3860
|
});
|
|
3839
3861
|
NativeBridge.invokeNativeModule("Sensors", "startGyroscope", [
|
|
3840
3862
|
options.interval ?? 100
|
|
3841
|
-
]).catch(() => {
|
|
3863
|
+
]).catch((err) => {
|
|
3864
|
+
if (__DEV__) console.warn("[vue-native] Sensors.startGyroscope failed:", err);
|
|
3842
3865
|
});
|
|
3843
3866
|
}
|
|
3844
3867
|
function stop() {
|
|
@@ -3846,7 +3869,8 @@ function useGyroscope(options = {}) {
|
|
|
3846
3869
|
running = false;
|
|
3847
3870
|
unsubscribe?.();
|
|
3848
3871
|
unsubscribe = null;
|
|
3849
|
-
NativeBridge.invokeNativeModule("Sensors", "stopGyroscope").catch(() => {
|
|
3872
|
+
NativeBridge.invokeNativeModule("Sensors", "stopGyroscope").catch((err) => {
|
|
3873
|
+
if (__DEV__) console.warn("[vue-native] Sensors.stopGyroscope failed:", err);
|
|
3850
3874
|
});
|
|
3851
3875
|
}
|
|
3852
3876
|
onUnmounted14(() => {
|
|
@@ -3890,10 +3914,12 @@ function useAudio() {
|
|
|
3890
3914
|
unsubProgress();
|
|
3891
3915
|
unsubComplete();
|
|
3892
3916
|
unsubError();
|
|
3893
|
-
NativeBridge.invokeNativeModule("Audio", "stop", []).catch(() => {
|
|
3917
|
+
NativeBridge.invokeNativeModule("Audio", "stop", []).catch((err) => {
|
|
3918
|
+
if (__DEV__) console.warn("[vue-native] Audio.stop failed:", err);
|
|
3894
3919
|
});
|
|
3895
3920
|
if (isRecording.value) {
|
|
3896
|
-
NativeBridge.invokeNativeModule("Audio", "stopRecording", []).catch(() => {
|
|
3921
|
+
NativeBridge.invokeNativeModule("Audio", "stopRecording", []).catch((err) => {
|
|
3922
|
+
if (__DEV__) console.warn("[vue-native] Audio.stopRecording failed:", err);
|
|
3897
3923
|
});
|
|
3898
3924
|
}
|
|
3899
3925
|
});
|
|
@@ -4002,7 +4028,8 @@ function useDatabase(name = "default") {
|
|
|
4002
4028
|
await callback(ctx);
|
|
4003
4029
|
await NativeBridge.invokeNativeModule("Database", "execute", [name, "COMMIT", []]);
|
|
4004
4030
|
} catch (err) {
|
|
4005
|
-
await NativeBridge.invokeNativeModule("Database", "execute", [name, "ROLLBACK", []]).catch(() => {
|
|
4031
|
+
await NativeBridge.invokeNativeModule("Database", "execute", [name, "ROLLBACK", []]).catch((err2) => {
|
|
4032
|
+
if (__DEV__) console.warn("[vue-native] Database ROLLBACK failed:", err2);
|
|
4006
4033
|
});
|
|
4007
4034
|
throw err;
|
|
4008
4035
|
}
|
|
@@ -4015,7 +4042,8 @@ function useDatabase(name = "default") {
|
|
|
4015
4042
|
}
|
|
4016
4043
|
onUnmounted16(() => {
|
|
4017
4044
|
if (opened) {
|
|
4018
|
-
NativeBridge.invokeNativeModule("Database", "close", [name]).catch(() => {
|
|
4045
|
+
NativeBridge.invokeNativeModule("Database", "close", [name]).catch((err) => {
|
|
4046
|
+
if (__DEV__) console.warn("[vue-native] Database.close failed:", err);
|
|
4019
4047
|
});
|
|
4020
4048
|
opened = false;
|
|
4021
4049
|
isOpen.value = false;
|
|
@@ -4057,7 +4085,8 @@ function usePerformance() {
|
|
|
4057
4085
|
}
|
|
4058
4086
|
onUnmounted17(() => {
|
|
4059
4087
|
if (isProfiling.value) {
|
|
4060
|
-
NativeBridge.invokeNativeModule("Performance", "stopProfiling", []).catch(() => {
|
|
4088
|
+
NativeBridge.invokeNativeModule("Performance", "stopProfiling", []).catch((err) => {
|
|
4089
|
+
if (__DEV__) console.warn("[vue-native] Performance.stopProfiling failed:", err);
|
|
4061
4090
|
});
|
|
4062
4091
|
isProfiling.value = false;
|
|
4063
4092
|
}
|
|
@@ -4238,7 +4267,8 @@ function useAppleSignIn() {
|
|
|
4238
4267
|
user.value = currentUser;
|
|
4239
4268
|
isAuthenticated.value = true;
|
|
4240
4269
|
}
|
|
4241
|
-
}).catch(() => {
|
|
4270
|
+
}).catch((err) => {
|
|
4271
|
+
if (__DEV__) console.warn("[vue-native] SocialAuth.getCurrentUser failed:", err);
|
|
4242
4272
|
});
|
|
4243
4273
|
async function signIn() {
|
|
4244
4274
|
error.value = null;
|
|
@@ -4308,7 +4338,8 @@ function useGoogleSignIn(clientId) {
|
|
|
4308
4338
|
user.value = currentUser;
|
|
4309
4339
|
isAuthenticated.value = true;
|
|
4310
4340
|
}
|
|
4311
|
-
}).catch(() => {
|
|
4341
|
+
}).catch((err) => {
|
|
4342
|
+
if (__DEV__) console.warn("[vue-native] SocialAuth.getCurrentUser failed:", err);
|
|
4312
4343
|
});
|
|
4313
4344
|
async function signIn() {
|
|
4314
4345
|
error.value = null;
|
|
@@ -4418,7 +4449,8 @@ function useOTAUpdate(serverUrl) {
|
|
|
4418
4449
|
onUnmounted23(unsubscribe);
|
|
4419
4450
|
NativeBridge.invokeNativeModule("OTA", "getCurrentVersion", []).then((info) => {
|
|
4420
4451
|
currentVersion.value = info.version;
|
|
4421
|
-
}).catch(() => {
|
|
4452
|
+
}).catch((err) => {
|
|
4453
|
+
if (__DEV__) console.warn("[vue-native] OTA.getCurrentVersion failed:", err);
|
|
4422
4454
|
});
|
|
4423
4455
|
async function checkForUpdate() {
|
|
4424
4456
|
isChecking.value = true;
|
|
@@ -4459,7 +4491,8 @@ function useOTAUpdate(serverUrl) {
|
|
|
4459
4491
|
await NativeBridge.invokeNativeModule("OTA", "downloadUpdate", [downloadUrl, expectedHash || ""]);
|
|
4460
4492
|
status.value = "ready";
|
|
4461
4493
|
} catch (err) {
|
|
4462
|
-
await NativeBridge.invokeNativeModule("OTA", "cleanupPartialDownload", []).catch(() => {
|
|
4494
|
+
await NativeBridge.invokeNativeModule("OTA", "cleanupPartialDownload", []).catch((err2) => {
|
|
4495
|
+
if (__DEV__) console.warn("[vue-native] OTA.cleanupPartialDownload failed:", err2);
|
|
4463
4496
|
});
|
|
4464
4497
|
error.value = getErrorMessage4(err);
|
|
4465
4498
|
status.value = "error";
|
|
@@ -4622,7 +4655,8 @@ function useBluetooth() {
|
|
|
4622
4655
|
}
|
|
4623
4656
|
onUnmounted24(() => {
|
|
4624
4657
|
if (isScanning.value) {
|
|
4625
|
-
NativeBridge.invokeNativeModule("Bluetooth", "stopScan").catch(() => {
|
|
4658
|
+
NativeBridge.invokeNativeModule("Bluetooth", "stopScan").catch((err) => {
|
|
4659
|
+
if (__DEV__) console.warn("[vue-native] Bluetooth.stopScan failed:", err);
|
|
4626
4660
|
});
|
|
4627
4661
|
}
|
|
4628
4662
|
cleanups.forEach((fn) => fn());
|