From c91b5562f2974acce32521e5f5656f24c3a1e55c Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Wed, 4 Oct 2023 08:17:18 +0300 Subject: [PATCH 1/3] Prepare for new sprint From f72d833cb6e7b81539440419198295f2a8330a99 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:24:47 +0000 Subject: [PATCH 2/3] Fix unhandled callback when the session is nil. (#1833) --- MatrixSDK/Data/MXRoomState.m | 38 ++++++++++++++++++++++-------------- changelog.d/pr-1833.bugfix | 1 + 2 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 changelog.d/pr-1833.bugfix diff --git a/MatrixSDK/Data/MXRoomState.m b/MatrixSDK/Data/MXRoomState.m index 12ed90b8ee..0f19cd8a88 100644 --- a/MatrixSDK/Data/MXRoomState.m +++ b/MatrixSDK/Data/MXRoomState.m @@ -120,23 +120,31 @@ + (void)loadRoomStateFromStore:(id)store { [store stateOfRoom:roomId success:^(NSArray * _Nonnull stateEvents) { if (!stateEvents.count) { - MXLogWarning(@"[MXRoomState] loadRoomStateFromStore(%@): No state events stored, loading from api", logId); + MXLogWarning(@"[MXRoomState] loadRoomStateFromStore(%@): No state events stored, loading from API", logId); - [matrixSession.matrixRestClient stateOfRoom:roomId success:^(NSArray *JSONData) { - NSArray *events = [MXEvent modelsFromJSON:JSONData]; - MXLogDebug(@"[MXRoomState] loadRoomStateFromStore(%@): Loaded %lu events from api", logId, events.count); - - [roomState handleStateEvents:events]; - onComplete(roomState); - } failure:^(NSError *error) { - NSDictionary *details = @{ - @"log_id": logId ?: @"unknown", - @"error": error ?: @"unknown" - }; - MXLogErrorDetails(@"[MXRoomState] loadRoomStateFromStore: Failed to load any events from api", details); - + if (!matrixSession) + { + MXLogError(@"[MXRoomState] loadRoomStateFromStore: Missing session, unable to load from API") onComplete(roomState); - }]; + } + else + { + [matrixSession.matrixRestClient stateOfRoom:roomId success:^(NSArray *JSONData) { + NSArray *events = [MXEvent modelsFromJSON:JSONData]; + MXLogDebug(@"[MXRoomState] loadRoomStateFromStore(%@): Loaded %lu events from api", logId, events.count); + + [roomState handleStateEvents:events]; + onComplete(roomState); + } failure:^(NSError *error) { + NSDictionary *details = @{ + @"log_id": logId ?: @"unknown", + @"error": error ?: @"unknown" + }; + MXLogErrorDetails(@"[MXRoomState] loadRoomStateFromStore: Failed to load any events from API", details); + + onComplete(roomState); + }]; + } } else { MXLogDebug(@"[MXRoomState] loadRoomStateFromStore(%@): Initializing with %lu state events", logId, stateEvents.count); diff --git a/changelog.d/pr-1833.bugfix b/changelog.d/pr-1833.bugfix new file mode 100644 index 0000000000..b87469de9c --- /dev/null +++ b/changelog.d/pr-1833.bugfix @@ -0,0 +1 @@ +Fix unhandled callback when the session is nil. \ No newline at end of file From 99894c2b526ceae89cdb271f30f51502b05a80f2 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 28 Nov 2023 09:31:24 +0000 Subject: [PATCH 3/3] version++ --- CHANGES.md | 7 +++++++ MatrixSDK.podspec | 2 +- MatrixSDK/MatrixSDKVersion.m | 2 +- changelog.d/pr-1833.bugfix | 1 - 4 files changed, 9 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/pr-1833.bugfix diff --git a/CHANGES.md b/CHANGES.md index cc6eb234af..6a9aa8313f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,10 @@ +## Changes in 0.27.4 (2023-11-28) + +🐛 Bugfixes + +- Fix unhandled callback when the session is nil. ([#1833](https://github.com/matrix-org/matrix-ios-sdk/pull/1833)) + + ## Changes in 0.27.3 (2023-10-04) 🐛 Bugfixes diff --git a/MatrixSDK.podspec b/MatrixSDK.podspec index abcfc24f77..a86e1a6fbc 100644 --- a/MatrixSDK.podspec +++ b/MatrixSDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "MatrixSDK" - s.version = "0.27.3" + s.version = "0.27.4" s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)" s.description = <<-DESC diff --git a/MatrixSDK/MatrixSDKVersion.m b/MatrixSDK/MatrixSDKVersion.m index f52dff1654..bb04b8853d 100644 --- a/MatrixSDK/MatrixSDKVersion.m +++ b/MatrixSDK/MatrixSDKVersion.m @@ -16,4 +16,4 @@ #import -NSString *const MatrixSDKVersion = @"0.27.3"; +NSString *const MatrixSDKVersion = @"0.27.4"; diff --git a/changelog.d/pr-1833.bugfix b/changelog.d/pr-1833.bugfix deleted file mode 100644 index b87469de9c..0000000000 --- a/changelog.d/pr-1833.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix unhandled callback when the session is nil. \ No newline at end of file