@servicemind.tis/tis-image-and-file-upload-and-view 1.2.31 → 1.2.32

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.
@@ -905,11 +905,12 @@ class TisRemoteUploadService {
905
905
  return null;
906
906
  }
907
907
  try {
908
- const response = await this.callApiWithTimeout('socket/check-devices-online', {
908
+ const response = await this.callApiWithTimeout('tis-image-mobile-uploader/check-devices-online', {
909
909
  desktopDeviceId: this.deviceId,
910
910
  mobileDeviceId: mobileDeviceId
911
911
  }, 15000);
912
- const data = response.data || response;
912
+ // Response structure: { body: { data: { desktop: {...}, mobile: {...} } } }
913
+ const data = response?.body?.data || response?.data || response;
913
914
  const status = {
914
915
  desktop: {
915
916
  isOnline: data.desktop?.isOnline ?? false,
@@ -933,6 +934,19 @@ class TisRemoteUploadService {
933
934
  mobile: status.mobile.isOnline ? '🟢' : '🔴',
934
935
  readyForTransfer: status.isReadyForTransfer
935
936
  });
937
+ // If desktop device (this device) is offline, send immediate ping to update status
938
+ if (!status.desktop.isOnline && this.socketAdapter) {
939
+ console.log(`[${TisRemoteUploadService.COMPONENT}] Desktop detected as offline, sending immediate ping...`);
940
+ this.callApiWithTimeout('ping', { timestamp: Date.now() }, 5000)
941
+ .then(() => {
942
+ console.log(`[${TisRemoteUploadService.COMPONENT}] Immediate ping sent, rechecking status...`);
943
+ // Recheck status after a short delay
944
+ setTimeout(() => this.checkDevicesOnline(), 1000);
945
+ })
946
+ .catch((err) => {
947
+ console.warn(`[${TisRemoteUploadService.COMPONENT}] Immediate ping failed:`, err);
948
+ });
949
+ }
936
950
  return status;
937
951
  }
938
952
  catch (error) {