From e5aa676bc46ff4479c05a930d36d8660474de7d6 Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 4 Oct 2023 10:35:38 +0200 Subject: [PATCH] fix: clear previously cached bearer token on backup client setup fix: return self check after error --- example/Dev.tsx | 2 +- .../src/main/java/com/reactnativeldk/classes/BackupClient.kt | 1 + lib/ios/Classes/BackupClient.swift | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/example/Dev.tsx b/example/Dev.tsx index 25124431..4e3f0783 100644 --- a/example/Dev.tsx +++ b/example/Dev.tsx @@ -665,7 +665,7 @@ const Dev = (): ReactElement => { const backupCheckRes = await ldk.backupSelfCheck(); if (backupCheckRes.isErr()) { console.error('Backup check failed', backupCheckRes.error); - setMessage(backupCheckRes.error.message); + return setMessage(backupCheckRes.error.message); } setMessage('Backup server check passed ✅'); }} diff --git a/lib/android/src/main/java/com/reactnativeldk/classes/BackupClient.kt b/lib/android/src/main/java/com/reactnativeldk/classes/BackupClient.kt index 495a305b..5f83b555 100644 --- a/lib/android/src/main/java/com/reactnativeldk/classes/BackupClient.kt +++ b/lib/android/src/main/java/com/reactnativeldk/classes/BackupClient.kt @@ -96,6 +96,7 @@ class BackupClient { this.network = network this.server = server this.serverPubKey = serverPubKey + this.cachedBearer = null LdkEventEmitter.send( EventTypes.native_log, diff --git a/lib/ios/Classes/BackupClient.swift b/lib/ios/Classes/BackupClient.swift index af3dd5c8..bb755857 100644 --- a/lib/ios/Classes/BackupClient.swift +++ b/lib/ios/Classes/BackupClient.swift @@ -116,6 +116,7 @@ class BackupClient { Self.network = network Self.server = server Self.serverPubKey = serverPubKey + Self.cachedBearer = nil LdkEventEmitter.shared.send(withEvent: .native_log, body: "BackupClient setup for synchronous remote persistence. Server: \(server)") }