Skip to content

Commit

Permalink
Only open ws connection when syncing sdcard, instead of device connected
Browse files Browse the repository at this point in the history
  • Loading branch information
beastoin committed Oct 18, 2024
1 parent 5d3703a commit 984e4b6
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions app/lib/providers/capture_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -570,17 +570,6 @@ class CaptureProvider extends ChangeNotifier
debugPrint(
'previousStorageBytes in initiateStorageBytesStreaming: ${SharedPreferencesUtil().previousStorageBytes}');
btConnectedTime = DateTime.now().toUtc().toString();
sdCardSocket.setupSdCardWebSocket(
//replace
onMessageReceived: () {
debugPrint('onMessageReceived');
memoryProvider?.getMemoriesFromServer();
notifyListeners();
_notifySdCardComplete();
return;
},
btConnectedTime: btConnectedTime,
);

if (totalStorageFileBytes > 100) {
sdCardReady = true;
Expand All @@ -595,6 +584,17 @@ class CaptureProvider extends ChangeNotifier
if (totalStorageFileBytes == 0) {
return;
}
await sdCardSocket.setupSdCardWebSocket(
//replace
onMessageReceived: () {
debugPrint('onMessageReceived');
memoryProvider?.getMemoriesFromServer();
notifyListeners();
_notifySdCardComplete();
return;
},
btConnectedTime: btConnectedTime,
);
if (sdCardSocket.sdCardConnectionState != WebsocketConnectionStatus.connected) {
sdCardSocket.sdCardChannel?.sink.close();
await sdCardSocket.setupSdCardWebSocket(
Expand Down

0 comments on commit 984e4b6

Please sign in to comment.