From 311a03e9a7ebda67127a3c868569620f2f5a0935 Mon Sep 17 00:00:00 2001 From: Erdem Yerebasmaz <4012752+erdemyerebasmaz@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:45:35 +0300 Subject: [PATCH] Revert "Disconnect Breez SDK on shutdown" This reverts commit fe5a96ba63259b3ef6a741e0ecee7a6ca6d4b549. There's a race condition where if the App is opened through clicking the notification, disconnect happens while the app is still opening the app crashes. --- .../java/com/cBreez/client/BreezForegroundService.kt | 2 -- .../main/java/com/cBreez/client/BreezSdkConnector.kt | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/android/app/src/main/java/com/cBreez/client/BreezForegroundService.kt b/android/app/src/main/java/com/cBreez/client/BreezForegroundService.kt index c0bb2d35b..dc4df5288 100644 --- a/android/app/src/main/java/com/cBreez/client/BreezForegroundService.kt +++ b/android/app/src/main/java/com/cBreez/client/BreezForegroundService.kt @@ -14,7 +14,6 @@ import com.cBreez.client.BreezNotificationHelper.Companion.notifyForegroundServi import com.cBreez.client.BreezNotificationHelper.Companion.notifyPaymentReceived import com.cBreez.client.BreezNotificationHelper.Companion.registerNotificationChannels import com.cBreez.client.BreezSdkConnector.Companion.connectSDK -import com.cBreez.client.BreezSdkConnector.Companion.disconnectSDK import com.cBreez.client.Constants.EXTRA_REMOTE_MESSAGE import com.cBreez.client.Constants.NOTIFICATION_ID_FOREGROUND_SERVICE import com.google.firebase.messaging.RemoteMessage @@ -97,7 +96,6 @@ class BreezForegroundService : Service() { private fun shutdown() { Logger.tag(TAG).debug { "Shutting down Breez foreground service" } stopForeground(STOP_FOREGROUND_REMOVE) - disconnectSDK() stopSelf() } diff --git a/android/app/src/main/java/com/cBreez/client/BreezSdkConnector.kt b/android/app/src/main/java/com/cBreez/client/BreezSdkConnector.kt index bbfffea9a..4a7e70804 100644 --- a/android/app/src/main/java/com/cBreez/client/BreezSdkConnector.kt +++ b/android/app/src/main/java/com/cBreez/client/BreezSdkConnector.kt @@ -68,15 +68,5 @@ class BreezSdkConnector { val result: ByteArray = storageCipher.decrypt(data) return String(result, charset) } - - internal fun disconnectSDK() { - if(breezSDK != null){ - // Connect to the Breez SDK make it ready for use - Logger.tag(TAG).debug { "Disconnecting Breez SDK" } - breezSDK!!.disconnect() - Logger.tag(TAG).debug { "Disconnected from Breez SDK" } - breezSDK = null - } - } } } \ No newline at end of file