From fe8ef21659c14b9b34fa8fdf0dd999f3bab99b44 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Thu, 8 Apr 2021 20:51:39 +0200 Subject: [PATCH 01/59] Fix memory leak in [RecentsDataSource dataSource:didStateChange:] The block passed into `[MXSession listenToEventsOfTypes:onEvent:]` is stored with a strong reference in the `listenerBlock` property of `MXSessionEventListener`. The method also returns the listener and it is then stored into the `roomTagsListenerByUserId` dictionary on `self`. Since a strong reference to `self` is captured in the block that means the block retains `self` (via the capture) and `self` retains the block (via `roomTagsListenerByUserId`) so there is a memory leak. The bug is most easily reproduced during testing #4168 which involves closing the current and creating a new session. Signed-off-by: Johannes Marbach --- CHANGES.rst | 1 + Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 76bb579d0..363aaaa66 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -23,6 +23,7 @@ Changes to be released in next version * Black theme uses dark background for composer (#4192) * Vertical layout of typing notifs can go wonky (#4159) * Crash in [RoomViewController refreshTypingNotification] (#4161) + * Memory leak in [RecentsDataSource dataSource:didStateChange:] ⚠️ API Changes * diff --git a/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m b/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m index 497f80fce..09989ec36 100644 --- a/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m +++ b/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m @@ -337,9 +337,12 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou if ((aState == MXKDataSourceStateReady) && dataSource.mxSession.myUser.userId) { // Register the room tags updates to refresh the favorites order + MXWeakify(self); id roomTagsListener = [dataSource.mxSession listenToEventsOfTypes:@[kMXEventTypeStringRoomTag] onEvent:^(MXEvent *event, MXTimelineDirection direction, id customObject) { + MXStrongifyAndReturnIfNil(self); + // Consider only live event if (direction == MXTimelineDirectionForwards) { From 7ad705d92de9fa82d845ee6cafc66990edb57c46 Mon Sep 17 00:00:00 2001 From: Paulo Pinto Date: Wed, 14 Jul 2021 12:42:27 +0100 Subject: [PATCH 02/59] Standardise casing of identity server Signed-off-by: Paulo Pinto --- Riot/Generated/Strings.swift | 4 ++-- Riot/Modules/Application/LegacyAppDelegate.m | 2 +- Riot/Modules/Authentication/AuthenticationViewController.xib | 2 +- .../SettingsIdentityServerViewController.storyboard | 2 +- Riot/Modules/Settings/SettingsViewController.m | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index e568cf7a8..2c7b1c79b 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -1590,7 +1590,7 @@ internal enum VectorL10n { internal static var identityServerSettingsPlaceHolder: String { return VectorL10n.tr("Vector", "identity_server_settings_place_holder") } - /// Identity Server + /// Identity server internal static var identityServerSettingsTitle: String { return VectorL10n.tr("Vector", "identity_server_settings_title") } @@ -4150,7 +4150,7 @@ internal enum VectorL10n { internal static var settingsDiscoverySettings: String { return VectorL10n.tr("Vector", "settings_discovery_settings") } - /// Agree to the Identity Server (%@) Terms of Service to allow yourself to be discoverable by email address or phone number. + /// Agree to the identity server (%@) Terms of Service to allow yourself to be discoverable by email address or phone number. internal static func settingsDiscoveryTermsNotSigned(_ p1: String) -> String { return VectorL10n.tr("Vector", "settings_discovery_terms_not_signed", p1) } diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index a6df6cb48..73cad0071 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1164,7 +1164,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni return YES; } - // Manage email validation link from Identity Server v1 or v2 + // Manage email validation link from identity server v1 or v2 else if ([webURL.path isEqualToString:validateEmailSubmitTokenAPIPathV1] || [webURL.path isEqualToString:validateEmailSubmitTokenAPIPathV2]) { diff --git a/Riot/Modules/Authentication/AuthenticationViewController.xib b/Riot/Modules/Authentication/AuthenticationViewController.xib index c654446fc..4080c755d 100644 --- a/Riot/Modules/Authentication/AuthenticationViewController.xib +++ b/Riot/Modules/Authentication/AuthenticationViewController.xib @@ -294,7 +294,7 @@ - @@ -86,16 +82,6 @@ - - - - - - - - - - diff --git a/changelog.d/4935.change b/changelog.d/4935.change new file mode 100644 index 000000000..93c0dcc9c --- /dev/null +++ b/changelog.d/4935.change @@ -0,0 +1 @@ +Voice Message scrubbing should require a slightly longer press, to avoid accidental scrubbing when scrolling the timeline \ No newline at end of file From 625b9902d896682ae15ba46c023c299060e364a4 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 8 Oct 2021 15:56:05 +0300 Subject: [PATCH 57/59] Fixes #4970 - Fixed unintentional voice message drafts on automatically cancelled recordings. --- .../VoiceMessageController.swift | 22 ++++++++++++++----- changelog.d/4970.bugfix | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 changelog.d/4970.bugfix diff --git a/Riot/Modules/Room/VoiceMessages/VoiceMessageController.swift b/Riot/Modules/Room/VoiceMessages/VoiceMessageController.swift index 5d1d48254..01a57e742 100644 --- a/Riot/Modules/Room/VoiceMessages/VoiceMessageController.swift +++ b/Riot/Modules/Room/VoiceMessages/VoiceMessageController.swift @@ -130,12 +130,7 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate, } func voiceMessageToolbarViewDidRequestRecordingCancel(_ toolbarView: VoiceMessageToolbarView) { - isInLockedMode = false - audioPlayer?.stop() - audioRecorder?.stopRecording() - deleteRecordingAtURL(temporaryFileURL) - UINotificationFeedbackGenerator().notificationOccurred(.error) - updateUI() + cancelRecording() } func voiceMessageToolbarViewDidRequestLockedModeRecording(_ toolbarView: VoiceMessageToolbarView) { @@ -259,6 +254,8 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate, guard isInLockedMode else { if recordDuration ?? 0 >= Constants.minimumRecordingDuration { sendRecordingAtURL(temporaryFileURL) + } else { + cancelRecording() } return } @@ -268,6 +265,19 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate, updateUI() } + private func cancelRecording() { + isInLockedMode = false + + audioPlayer?.stop() + audioRecorder?.stopRecording() + + deleteRecordingAtURL(temporaryFileURL) + + UINotificationFeedbackGenerator().notificationOccurred(.error) + + updateUI() + } + private func loadDraftRecording() { guard let temporaryFileURL = temporaryFileURL, let roomId = roomId else { diff --git a/changelog.d/4970.bugfix b/changelog.d/4970.bugfix new file mode 100644 index 000000000..365cf4aee --- /dev/null +++ b/changelog.d/4970.bugfix @@ -0,0 +1 @@ +Fixed unintentional voice message drafts on automatically cancelled recordings (under 1 second) \ No newline at end of file From a7b482aa8b4a04a1db91f55fdffd5ec9a7cf735d Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 8 Oct 2021 17:04:44 +0200 Subject: [PATCH 58/59] changelog.d: Upgrade MatrixKit version ([v0.16.5](https://github.com/matrix-org/matrix-ios-kit/releases/tag/v0.16.5)). --- Podfile | 2 +- changelog.d/x-nolink-0.change | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/x-nolink-0.change diff --git a/Podfile b/Podfile index b06b5f92b..49dec32b5 100644 --- a/Podfile +++ b/Podfile @@ -13,7 +13,7 @@ use_frameworks! # - `{ {kit spec hash} => {sdk spec hash}` to depend on specific pod options (:git => …, :podspec => …) for each repo. Used by Fastfile during CI # # Warning: our internal tooling depends on the name of this variable name, so be sure not to change it -$matrixKitVersion = '= 0.16.4' +$matrixKitVersion = '= 0.16.5' # $matrixKitVersion = :local # $matrixKitVersion = {'develop' => 'develop'} diff --git a/changelog.d/x-nolink-0.change b/changelog.d/x-nolink-0.change new file mode 100644 index 000000000..a9359bea0 --- /dev/null +++ b/changelog.d/x-nolink-0.change @@ -0,0 +1 @@ +Upgrade MatrixKit version ([v0.16.5](https://github.com/matrix-org/matrix-ios-kit/releases/tag/v0.16.5)). \ No newline at end of file From a0aca6a1693b39385b2453283a7c2717f1f536cc Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 8 Oct 2021 17:04:44 +0200 Subject: [PATCH 59/59] version++ --- CHANGES.md | 28 ++++++++++++++++++++++++++++ changelog.d/4559.bugfix | 1 - changelog.d/4896.change | 1 - changelog.d/4898.bugfix | 1 - changelog.d/4899.change | 1 - changelog.d/4920.doc | 1 - changelog.d/4935.change | 1 - changelog.d/4937.build | 1 - changelog.d/4939.change | 1 - changelog.d/4951.build | 1 - changelog.d/4955.change | 1 - changelog.d/4970.bugfix | 1 - changelog.d/pr-4193.bugfix | 1 - changelog.d/x-nolink-0.change | 1 - 14 files changed, 28 insertions(+), 13 deletions(-) delete mode 100644 changelog.d/4559.bugfix delete mode 100644 changelog.d/4896.change delete mode 100644 changelog.d/4898.bugfix delete mode 100644 changelog.d/4899.change delete mode 100644 changelog.d/4920.doc delete mode 100644 changelog.d/4935.change delete mode 100644 changelog.d/4937.build delete mode 100644 changelog.d/4939.change delete mode 100644 changelog.d/4951.build delete mode 100644 changelog.d/4955.change delete mode 100644 changelog.d/4970.bugfix delete mode 100644 changelog.d/pr-4193.bugfix delete mode 100644 changelog.d/x-nolink-0.change diff --git a/CHANGES.md b/CHANGES.md index 7ace58680..ecde7c1af 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,31 @@ +## Changes in 1.6.2 (2021-10-08) + +🙌 Improvements + +- Upgrade MatrixKit version ([v0.16.5](https://github.com/matrix-org/matrix-ios-kit/releases/tag/v0.16.5)). +- URL Previews: Use attributed string whitespace for cell heights and stop breaking up the bubble data. ([#4896](https://github.com/vector-im/element-ios/issues/4896)) +- Replaced localizable strings with generated ones throughout the code. Fixed various translation issues. ([#4899](https://github.com/vector-im/element-ios/issues/4899)) +- Voice Message scrubbing should require a slightly longer press, to avoid accidental scrubbing when scrolling the timeline ([#4935](https://github.com/vector-im/element-ios/issues/4935)) +- Pods: Update ffmpeg-kit-ios-audio, FLEX, FlowCommoniOS, Reusable and SwiftLint. ([#4939](https://github.com/vector-im/element-ios/issues/4939)) +- Service Terms: Track an analytics value on accept/decline of an identity server. ([#4955](https://github.com/vector-im/element-ios/issues/4955)) + +🐛 Bugfixes + +- RecentsDataSource: Memory leak in [RecentsDataSource dataSource:didStateChange:]. ([#4193](https://github.com/vector-im/element-ios/pull/4193)) +- i18n: Standardise casing of identity server and integration manager. ([#4559](https://github.com/vector-im/element-ios/issues/4559)) +- MasterTabBarController: Listen to `MXSpaceNotificationCounter` to update the notification badge ([#4898](https://github.com/vector-im/element-ios/issues/4898)) +- Fixed unintentional voice message drafts on automatically cancelled recordings (under 1 second) ([#4970](https://github.com/vector-im/element-ios/issues/4970)) + +🧱 Build + +- Element Alpha: Build on macOS 11 to fix iOS 15 installation error. ([#4937](https://github.com/vector-im/element-ios/issues/4937)) +- Bundler: Update CocoaPods and fastlane and xcode-install. ([#4951](https://github.com/vector-im/element-ios/issues/4951)) + +📄 Documentation + +- Update PR template with a checkbox for accessibility and self review. ([#4920](https://github.com/vector-im/element-ios/issues/4920)) + + ## Changes in 1.6.1 (2021-09-30) 🙌 Improvements diff --git a/changelog.d/4559.bugfix b/changelog.d/4559.bugfix deleted file mode 100644 index 1e0688197..000000000 --- a/changelog.d/4559.bugfix +++ /dev/null @@ -1 +0,0 @@ -i18n: Standardise casing of identity server and integration manager. \ No newline at end of file diff --git a/changelog.d/4896.change b/changelog.d/4896.change deleted file mode 100644 index 00f6d5b4e..000000000 --- a/changelog.d/4896.change +++ /dev/null @@ -1 +0,0 @@ -URL Previews: Use attributed string whitespace for cell heights and stop breaking up the bubble data. \ No newline at end of file diff --git a/changelog.d/4898.bugfix b/changelog.d/4898.bugfix deleted file mode 100644 index 0f4c5faf1..000000000 --- a/changelog.d/4898.bugfix +++ /dev/null @@ -1 +0,0 @@ -MasterTabBarController: Listen to `MXSpaceNotificationCounter` to update the notification badge \ No newline at end of file diff --git a/changelog.d/4899.change b/changelog.d/4899.change deleted file mode 100644 index b53120223..000000000 --- a/changelog.d/4899.change +++ /dev/null @@ -1 +0,0 @@ -Replaced localizable strings with generated ones throughout the code. Fixed various translation issues. \ No newline at end of file diff --git a/changelog.d/4920.doc b/changelog.d/4920.doc deleted file mode 100644 index 746bc48aa..000000000 --- a/changelog.d/4920.doc +++ /dev/null @@ -1 +0,0 @@ -Update PR template with a checkbox for accessibility and self review. \ No newline at end of file diff --git a/changelog.d/4935.change b/changelog.d/4935.change deleted file mode 100644 index 93c0dcc9c..000000000 --- a/changelog.d/4935.change +++ /dev/null @@ -1 +0,0 @@ -Voice Message scrubbing should require a slightly longer press, to avoid accidental scrubbing when scrolling the timeline \ No newline at end of file diff --git a/changelog.d/4937.build b/changelog.d/4937.build deleted file mode 100644 index 2e67b1197..000000000 --- a/changelog.d/4937.build +++ /dev/null @@ -1 +0,0 @@ -Element Alpha: Build on macOS 11 to fix iOS 15 installation error. diff --git a/changelog.d/4939.change b/changelog.d/4939.change deleted file mode 100644 index aed2767eb..000000000 --- a/changelog.d/4939.change +++ /dev/null @@ -1 +0,0 @@ -Pods: Update ffmpeg-kit-ios-audio, FLEX, FlowCommoniOS, Reusable and SwiftLint. \ No newline at end of file diff --git a/changelog.d/4951.build b/changelog.d/4951.build deleted file mode 100644 index 6e7d3ab86..000000000 --- a/changelog.d/4951.build +++ /dev/null @@ -1 +0,0 @@ -Bundler: Update CocoaPods and fastlane and xcode-install. \ No newline at end of file diff --git a/changelog.d/4955.change b/changelog.d/4955.change deleted file mode 100644 index ef63ba876..000000000 --- a/changelog.d/4955.change +++ /dev/null @@ -1 +0,0 @@ -Service Terms: Track an analytics value on accept/decline of an identity server. \ No newline at end of file diff --git a/changelog.d/4970.bugfix b/changelog.d/4970.bugfix deleted file mode 100644 index 365cf4aee..000000000 --- a/changelog.d/4970.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fixed unintentional voice message drafts on automatically cancelled recordings (under 1 second) \ No newline at end of file diff --git a/changelog.d/pr-4193.bugfix b/changelog.d/pr-4193.bugfix deleted file mode 100644 index 10e269cb8..000000000 --- a/changelog.d/pr-4193.bugfix +++ /dev/null @@ -1 +0,0 @@ -RecentsDataSource: Memory leak in [RecentsDataSource dataSource:didStateChange:]. \ No newline at end of file diff --git a/changelog.d/x-nolink-0.change b/changelog.d/x-nolink-0.change deleted file mode 100644 index a9359bea0..000000000 --- a/changelog.d/x-nolink-0.change +++ /dev/null @@ -1 +0,0 @@ -Upgrade MatrixKit version ([v0.16.5](https://github.com/matrix-org/matrix-ios-kit/releases/tag/v0.16.5)). \ No newline at end of file