From ef642f9e8d97e86a07191bafef8b3819af5def12 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 21 Oct 2021 18:04:27 +0200 Subject: [PATCH 01/27] Prepare for new sprint From 5f3cc7d8ee11f775bdc633e64e28fd66608a4c4a Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Mon, 25 Oct 2021 15:12:10 +0200 Subject: [PATCH 02/27] Readme: Advertise that the repository will be no longer supported soon. --- README.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.rst b/README.rst index d8f74596b..f571f338d 100644 --- a/README.rst +++ b/README.rst @@ -1,3 +1,10 @@ +Deprecated +========= + +The MatrixKit will no longer be supported, the code will be merged into [https://github.com/vector-im/element-ios](https://github.com/vector-im/element-ios) repository. + +Please avoid to create issues or PR in this repository, report them to [Element iOS](https://github.com/vector-im/element-ios) instead. + MatrixKit ========= From 90403c54b637c373b8955038809e5cdbf070b177 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Mon, 25 Oct 2021 15:18:52 +0200 Subject: [PATCH 03/27] Readme: Advertise that the repository will be no longer supported soon. --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index f571f338d..a64a77fed 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,9 @@ Deprecated ========= -The MatrixKit will no longer be supported, the code will be merged into [https://github.com/vector-im/element-ios](https://github.com/vector-im/element-ios) repository. +The MatrixKit will no longer be supported, the code will be merged into `Element iOS `_ repository. -Please avoid to create issues or PR in this repository, report them to [Element iOS](https://github.com/vector-im/element-ios) instead. +Please avoid to create issues or PR in this repository, report them to `Element iOS `_ instead. MatrixKit ========= From 38765a2f90cef649b82dccfd37605c2d7912dc35 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Mon, 25 Oct 2021 15:50:39 +0200 Subject: [PATCH 04/27] Readme: Advertise that the repository will be no longer supported soon. --- README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index a64a77fed..214d0c904 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,11 @@ Deprecated ========= -The MatrixKit will no longer be supported, the code will be merged into `Element iOS `_ repository. +The MatrixKit will no longer be supported, the code will be merged into `Element iOS +`_ repository. -Please avoid to create issues or PR in this repository, report them to `Element iOS `_ instead. +Please avoid to create issues or PR in this repository, report them to `Element iOS +`_ instead. MatrixKit ========= From 76f030f4967c392fd50e39d924dbbc58cabc5b9b Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 28 Oct 2021 14:47:24 +0200 Subject: [PATCH 05/27] MXKRoomViewController: Prevent retain cycles. --- MatrixKit/Controllers/MXKRoomViewController.h | 18 +++++------ MatrixKit/Controllers/MXKRoomViewController.m | 31 +++++++++++++++++-- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/MatrixKit/Controllers/MXKRoomViewController.h b/MatrixKit/Controllers/MXKRoomViewController.h index 718542260..8ae86eccb 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.h +++ b/MatrixKit/Controllers/MXKRoomViewController.h @@ -54,12 +54,12 @@ typedef NS_ENUM(NSUInteger, MXKRoomViewControllerJoinRoomResult) { /** Potential event details view. */ - MXKEventDetailsView *eventDetailsView; + __weak MXKEventDetailsView *eventDetailsView; /** Current alert (if any). */ - UIAlertController *currentAlert; + __weak UIAlertController *currentAlert; /** The document interaction Controller used to share attachment @@ -138,12 +138,12 @@ typedef NS_ENUM(NSUInteger, MXKRoomViewControllerJoinRoomResult) { /** The current title view defined into the view controller. */ -@property (nonatomic, readonly) MXKRoomTitleView* titleView; +@property (nonatomic, weak, readonly) MXKRoomTitleView* titleView; /** The current input toolbar view defined into the view controller. */ -@property (nonatomic, readonly) MXKRoomInputToolbarView* inputToolbarView; +@property (nonatomic, weak, readonly) MXKRoomInputToolbarView* inputToolbarView; /** The current extra info view defined into the view controller. @@ -197,12 +197,12 @@ typedef NS_ENUM(NSUInteger, MXKRoomViewControllerJoinRoomResult) { This object is defined when the displayed room is left. It is added into the bubbles table header. This label is used to display the reason why the room has been left. */ -@property (nonatomic, readonly) UILabel *leftRoomReasonLabel; +@property (nonatomic, weak, readonly) UILabel *leftRoomReasonLabel; -@property (nonatomic) IBOutlet UITableView *bubblesTableView; -@property (nonatomic) IBOutlet UIView *roomTitleViewContainer; -@property (nonatomic) IBOutlet UIView *roomInputToolbarContainer; -@property (nonatomic) IBOutlet UIView *roomActivitiesContainer; +@property (weak, nonatomic) IBOutlet UITableView *bubblesTableView; +@property (weak, nonatomic) IBOutlet UIView *roomTitleViewContainer; +@property (weak, nonatomic) IBOutlet UIView *roomInputToolbarContainer; +@property (weak, nonatomic) IBOutlet UIView *roomActivitiesContainer; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bubblesTableViewTopConstraint; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bubblesTableViewBottomConstraint; diff --git a/MatrixKit/Controllers/MXKRoomViewController.m b/MatrixKit/Controllers/MXKRoomViewController.m index 49a7426bf..525c380ab 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.m +++ b/MatrixKit/Controllers/MXKRoomViewController.m @@ -284,8 +284,6 @@ - (void)viewDidLoad { [self shareEncryptionKeys]; } - - self.navigationController.delegate = self; } - (BOOL)prefersStatusBarHidden @@ -911,10 +909,15 @@ - (void)joinRoomWithRoomIdOrAlias:(NSString*)roomIdOrAlias self->joinRoomRequest = nil; [self stopActivityIndicator]; + MXWeakify(self); + // The room is now part of the user's room MXKRoomDataSourceManager *roomDataSourceManager = [MXKRoomDataSourceManager sharedManagerForMatrixSession:self.mainSession]; [roomDataSourceManager roomDataSourceForRoom:room.roomId create:YES onComplete:^(MXKRoomDataSource *newRoomDataSource) { + + MXStrongifyAndReturnIfNil(self); + // And can be displayed [self displayRoom:newRoomDataSource]; @@ -1799,12 +1802,16 @@ - (void)triggerInitialBackPagination // Trigger back pagination to fill all the screen CGRect frame = [[UIScreen mainScreen] bounds]; + MXWeakify(self); + isPaginationInProgress = YES; [self startActivityIndicator]; [roomDataSource paginateToFillRect:frame direction:MXTimelineDirectionBackwards withMinRequestMessagesCount:_paginationLimit success:^{ + + MXStrongifyAndReturnIfNil(self); // Stop spinner self->isPaginationInProgress = NO; @@ -1866,6 +1873,8 @@ - (void)triggerInitialBackPagination self.bubbleTableViewDisplayInTransition = NO; } failure:^(NSError *error) { + + MXStrongifyAndReturnIfNil(self); // Stop spinner self->isPaginationInProgress = NO; @@ -1906,9 +1915,13 @@ - (void)triggerPagination:(NSUInteger)limit direction:(MXTimelineDirection)direc isPaginationInProgress = YES; + MXWeakify(self); + // Trigger pagination [roomDataSource paginate:limit direction:direction onlyFromStore:NO success:^(NSUInteger addedCellNumber) { + MXStrongifyAndReturnIfNil(self); + // We will adjust the vertical offset in order to unchange the current display (pagination should be inconspicuous) CGFloat verticalOffset = 0; @@ -1979,6 +1992,8 @@ - (void)triggerPagination:(NSUInteger)limit direction:(MXTimelineDirection)direc } failure:^(NSError *error) { + MXStrongifyAndReturnIfNil(self); + self.bubbleTableViewDisplayInTransition = YES; // Reload table on failure because some changes may have been ignored during pagination (see[dataSource:didCellChange:]) @@ -2002,9 +2017,13 @@ - (void)triggerAttachmentBackPagination:(NSString*)eventId isPaginationInProgress = YES; + MXWeakify(self); + // Trigger back pagination to find previous attachments [roomDataSource paginate:_paginationLimit direction:MXTimelineDirectionBackwards onlyFromStore:NO success:^(NSUInteger addedCellNumber) { + MXStrongifyAndReturnIfNil(self); + // Check whether attachments viewer is still visible if (self.attachmentsViewer) { @@ -2052,6 +2071,8 @@ - (void)triggerAttachmentBackPagination:(NSString*)eventId } failure:^(NSError *error) { + MXStrongifyAndReturnIfNil(self); + // Reload table on failure because some changes may have been ignored during back pagination (see[dataSource:didCellChange:]) self.bubbleTableViewDisplayInTransition = YES; self->isPaginationInProgress = NO; @@ -3521,14 +3542,20 @@ - (void)handleTypingNotification:(BOOL)typing lastTypingDate = nil; } + MXWeakify(self); + // Send typing notification to server [roomDataSource.room sendTypingNotification:typing timeout:notificationTimeoutMS success:^{ + + MXStrongifyAndReturnIfNil(self); // Reset last typing date self->lastTypingDate = nil; } failure:^(NSError *error) { + MXStrongifyAndReturnIfNil(self); + MXLogDebug(@"[MXKRoomVC] Failed to send typing notification (%d)", typing); // Cancel timer (if any) From a3d77aaa7d84bdc879a9c1929696794b2f61c222 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 28 Oct 2021 14:47:58 +0200 Subject: [PATCH 06/27] MXKRecentListViewController: Prevent retain cycles. --- MatrixKit/Controllers/MXKRecentListViewController.h | 4 ++-- MatrixKit/Controllers/MXKRecentListViewController.m | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MatrixKit/Controllers/MXKRecentListViewController.h b/MatrixKit/Controllers/MXKRecentListViewController.h index 39ff5de4c..da8d193f3 100644 --- a/MatrixKit/Controllers/MXKRecentListViewController.h +++ b/MatrixKit/Controllers/MXKRecentListViewController.h @@ -57,7 +57,7 @@ limitations under the License. /** The fake top view displayed in case of vertical bounce. */ - UIView *topview; + __weak UIView *topview; } @property (weak, nonatomic) IBOutlet UISearchBar *recentsSearchBar; @@ -74,7 +74,7 @@ limitations under the License. /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** Enable the search option by adding a navigation item in the navigation bar (YES by default). diff --git a/MatrixKit/Controllers/MXKRecentListViewController.m b/MatrixKit/Controllers/MXKRecentListViewController.m index 2ba7ae6c2..478e2315f 100644 --- a/MatrixKit/Controllers/MXKRecentListViewController.m +++ b/MatrixKit/Controllers/MXKRecentListViewController.m @@ -39,7 +39,7 @@ @interface MXKRecentListViewController () /** The reconnection animated view. */ - UIView* reconnectingView; + __weak UIView* reconnectingView; /** The current table view header if any. From 549e69363ea23019bbe5bf7c9dc8b08f8232aa45 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 28 Oct 2021 14:48:21 +0200 Subject: [PATCH 07/27] MXKRoomBubbleCellData: Prevent retain cycles. --- MatrixKit/Models/Room/MXKRoomBubbleCellData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MatrixKit/Models/Room/MXKRoomBubbleCellData.h b/MatrixKit/Models/Room/MXKRoomBubbleCellData.h index eb64f0bea..691f092e6 100644 --- a/MatrixKit/Models/Room/MXKRoomBubbleCellData.h +++ b/MatrixKit/Models/Room/MXKRoomBubbleCellData.h @@ -34,7 +34,7 @@ /** The data source owner of this instance. */ - MXKRoomDataSource *roomDataSource; + __weak MXKRoomDataSource *roomDataSource; /** Array of bubble components. Each bubble is supposed to have at least one component. From 2cf7b167375b9daac1fe07ee0df9ff3b08df26be Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 28 Oct 2021 14:48:48 +0200 Subject: [PATCH 08/27] MXKRoomTitleView: Prevent retain cycles. --- MatrixKit/Views/RoomTitle/MXKRoomTitleView.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m b/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m index 243950124..6b677faa8 100644 --- a/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m +++ b/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m @@ -28,7 +28,7 @@ @interface MXKRoomTitleView () { // Observer kMXRoomSummaryDidChangeNotification to keep updated the room name. - id mxRoomSummaryDidChangeObserver; + __weak id mxRoomSummaryDidChangeObserver; } @end @@ -120,9 +120,13 @@ - (void)setMxRoom:(MXRoom *)mxRoom if (mxRoom) { + MXWeakify(self); + // Register a listener to handle the room name change mxRoomSummaryDidChangeObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXRoomSummaryDidChangeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { + MXStrongifyAndReturnIfNil(self); + // Check whether the text field is editing before refreshing title view if (!self.isEditing) { From 92228475b1ddd4bf2b39e5fa70a9947ecbfa6458 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Thu, 28 Oct 2021 18:55:02 +0200 Subject: [PATCH 09/27] Add changes --- changelog.d/5055.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5055.bugfix diff --git a/changelog.d/5055.bugfix b/changelog.d/5055.bugfix new file mode 100644 index 000000000..bfb33517e --- /dev/null +++ b/changelog.d/5055.bugfix @@ -0,0 +1 @@ +MXKRoomViewController: Fix retain cycles that prevents deallocation. \ No newline at end of file From 88dae686d4c64444d3a7befd291b4a71d8ec7525 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Fri, 29 Oct 2021 10:45:16 +0200 Subject: [PATCH 10/27] MXKGroupListViewController: Prevent retain cycles. --- MatrixKit/Controllers/MXKGroupListViewController.h | 4 ++-- MatrixKit/Controllers/MXKGroupListViewController.m | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/MatrixKit/Controllers/MXKGroupListViewController.h b/MatrixKit/Controllers/MXKGroupListViewController.h index 14155eab1..020f78549 100644 --- a/MatrixKit/Controllers/MXKGroupListViewController.h +++ b/MatrixKit/Controllers/MXKGroupListViewController.h @@ -48,7 +48,7 @@ /** The fake top view displayed in case of vertical bounce. */ - UIView *topview; + __weak UIView *topview; } @property (weak, nonatomic) IBOutlet UISearchBar *groupsSearchBar; @@ -65,7 +65,7 @@ /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** Enable the search option by adding a navigation item in the navigation bar (YES by default). diff --git a/MatrixKit/Controllers/MXKGroupListViewController.m b/MatrixKit/Controllers/MXKGroupListViewController.m index 1d1e533d1..e9950fa3f 100644 --- a/MatrixKit/Controllers/MXKGroupListViewController.m +++ b/MatrixKit/Controllers/MXKGroupListViewController.m @@ -145,10 +145,11 @@ - (void)viewDidLoad // Add a top view which will be displayed in case of vertical bounce. CGFloat height = self.groupsTableView.frame.size.height; - topview = [[UIView alloc] initWithFrame:CGRectMake(0,-height,self.groupsTableView.frame.size.width,height)]; + UIView *topview = [[UIView alloc] initWithFrame:CGRectMake(0,-height,self.groupsTableView.frame.size.width,height)]; topview.autoresizingMask = UIViewAutoresizingFlexibleWidth; topview.backgroundColor = [UIColor groupTableViewBackgroundColor]; [self.groupsTableView addSubview:topview]; + self->topview = topview; } - (void)viewWillAppear:(BOOL)animated @@ -513,8 +514,13 @@ - (void)onSyncNotification { latestServerSync = [NSDate date]; + MXWeakify(self); + // Refresh all groups summary [self.dataSource refreshGroupsSummary:^{ + + MXStrongifyAndReturnIfNil(self); + [self removeReconnectingView]; }]; } From 7929f3a4984b0a4b56ad81733d31367c680fbf9d Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Fri, 29 Oct 2021 10:45:48 +0200 Subject: [PATCH 11/27] MXKGroupCellDataStoring: Prevent retain cycles. --- MatrixKit/Models/Group/MXKGroupCellDataStoring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MatrixKit/Models/Group/MXKGroupCellDataStoring.h b/MatrixKit/Models/Group/MXKGroupCellDataStoring.h index f6a07b3f6..9ca2bd57b 100644 --- a/MatrixKit/Models/Group/MXKGroupCellDataStoring.h +++ b/MatrixKit/Models/Group/MXKGroupCellDataStoring.h @@ -26,7 +26,7 @@ */ @protocol MXKGroupCellDataStoring -@property (nonatomic, readonly) MXKSessionGroupsDataSource *groupsDataSource; +@property (nonatomic, weak, readonly) MXKSessionGroupsDataSource *groupsDataSource; @property (nonatomic, readonly) MXGroup *group; From 43f2a7c8a788d593751b1856c6d070757a30c5cc Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Fri, 29 Oct 2021 10:46:01 +0200 Subject: [PATCH 12/27] Fix weak views usage. --- MatrixKit/Controllers/MXKRecentListViewController.m | 3 ++- MatrixKit/Controllers/MXKRoomViewController.m | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MatrixKit/Controllers/MXKRecentListViewController.m b/MatrixKit/Controllers/MXKRecentListViewController.m index 478e2315f..2f02f7e85 100644 --- a/MatrixKit/Controllers/MXKRecentListViewController.m +++ b/MatrixKit/Controllers/MXKRecentListViewController.m @@ -146,10 +146,11 @@ - (void)viewDidLoad // Add a top view which will be displayed in case of vertical bounce. CGFloat height = self.recentsTableView.frame.size.height; - topview = [[UIView alloc] initWithFrame:CGRectMake(0,-height,self.recentsTableView.frame.size.width,height)]; + UIView *topview = [[UIView alloc] initWithFrame:CGRectMake(0,-height,self.recentsTableView.frame.size.width,height)]; topview.autoresizingMask = UIViewAutoresizingFlexibleWidth; topview.backgroundColor = [UIColor groupTableViewBackgroundColor]; [self.recentsTableView addSubview:topview]; + self->topview = topview; } - (void)viewWillAppear:(BOOL)animated diff --git a/MatrixKit/Controllers/MXKRoomViewController.m b/MatrixKit/Controllers/MXKRoomViewController.m index 525c380ab..f1439063c 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.m +++ b/MatrixKit/Controllers/MXKRoomViewController.m @@ -2109,6 +2109,8 @@ - (void)showEventDetails:(MXEvent *)event // Remove potential existing subviews [self dismissTemporarySubViews]; + MXKEventDetailsView *eventDetailsView; + if (customEventDetailsViewClass) { eventDetailsView = [[customEventDetailsViewClass alloc] initWithEvent:event andMatrixSession:roomDataSource.mxSession]; @@ -2126,6 +2128,8 @@ - (void)showEventDetails:(MXEvent *)event // Add the view and define edge constraints [self.view addSubview:eventDetailsView]; + self->eventDetailsView = eventDetailsView; + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:eventDetailsView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual From 711c221c5187071e4849301ead5b0e7c3cbbcfe3 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Fri, 29 Oct 2021 12:14:08 +0200 Subject: [PATCH 13/27] Add changes --- changelog.d/5058.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5058.bugfix diff --git a/changelog.d/5058.bugfix b/changelog.d/5058.bugfix new file mode 100644 index 000000000..1e8112a36 --- /dev/null +++ b/changelog.d/5058.bugfix @@ -0,0 +1 @@ +Fix retain cycles that prevents deallocation in several classes. \ No newline at end of file From 671c795641e26b3d6db85dc0ffc17750d0a2932a Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Fri, 29 Oct 2021 12:22:50 +0200 Subject: [PATCH 14/27] Weakify strong reference delegates. --- MatrixKit/Controllers/MXKAuthenticationViewController.h | 2 +- MatrixKit/Controllers/MXKContactDetailsViewController.h | 2 +- MatrixKit/Controllers/MXKContactListViewController.h | 2 +- MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h | 2 +- MatrixKit/Views/Authentication/MXKAuthInputsView.h | 2 +- MatrixKit/Views/DeviceView/MXKDeviceView.h | 2 +- MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h | 2 +- MatrixKit/Views/MXKRoomCreationView.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MatrixKit/Controllers/MXKAuthenticationViewController.h b/MatrixKit/Controllers/MXKAuthenticationViewController.h index 49a0edd93..ffb64afbe 100644 --- a/MatrixKit/Controllers/MXKAuthenticationViewController.h +++ b/MatrixKit/Controllers/MXKAuthenticationViewController.h @@ -146,7 +146,7 @@ /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** current ongoing MXHTTPOperation. Nil if none. diff --git a/MatrixKit/Controllers/MXKContactDetailsViewController.h b/MatrixKit/Controllers/MXKContactDetailsViewController.h index 3d2e13222..417f586a7 100644 --- a/MatrixKit/Controllers/MXKContactDetailsViewController.h +++ b/MatrixKit/Controllers/MXKContactDetailsViewController.h @@ -56,7 +56,7 @@ /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; #pragma mark - Class methods diff --git a/MatrixKit/Controllers/MXKContactListViewController.h b/MatrixKit/Controllers/MXKContactListViewController.h index 47de9e5e9..e516aa15d 100644 --- a/MatrixKit/Controllers/MXKContactListViewController.h +++ b/MatrixKit/Controllers/MXKContactListViewController.h @@ -62,7 +62,7 @@ /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** Enable the search option by adding a navigation item in the navigation bar (YES by default). diff --git a/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h b/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h index 9d74a2ce0..6724f6998 100644 --- a/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h +++ b/MatrixKit/Controllers/MXKRoomMemberDetailsViewController.h @@ -142,7 +142,7 @@ typedef enum : NSUInteger /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; #pragma mark - Class methods diff --git a/MatrixKit/Views/Authentication/MXKAuthInputsView.h b/MatrixKit/Views/Authentication/MXKAuthInputsView.h index 8131d4c0a..c71b022ae 100644 --- a/MatrixKit/Views/Authentication/MXKAuthInputsView.h +++ b/MatrixKit/Views/Authentication/MXKAuthInputsView.h @@ -122,7 +122,7 @@ typedef enum { /** The view delegate. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** The current authentication type (`MXKAuthenticationTypeLogin` by default). diff --git a/MatrixKit/Views/DeviceView/MXKDeviceView.h b/MatrixKit/Views/DeviceView/MXKDeviceView.h index a729b1470..9e69cc1a7 100644 --- a/MatrixKit/Views/DeviceView/MXKDeviceView.h +++ b/MatrixKit/Views/DeviceView/MXKDeviceView.h @@ -69,7 +69,7 @@ /** The delegate. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** The default text color in the text view. [UIColor blackColor] by default. diff --git a/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h b/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h index e55a7fdbe..80afc81e1 100644 --- a/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h +++ b/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.h @@ -48,7 +48,7 @@ @property (weak, nonatomic) IBOutlet UIButton *blockButton; @property (weak, nonatomic) IBOutlet UIButton *confirmVerifyButton; -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** Initialise an `MXKEncryptionInfoView` instance based on an encrypted event diff --git a/MatrixKit/Views/MXKRoomCreationView.h b/MatrixKit/Views/MXKRoomCreationView.h index 46d296194..f269dbe87 100644 --- a/MatrixKit/Views/MXKRoomCreationView.h +++ b/MatrixKit/Views/MXKRoomCreationView.h @@ -68,7 +68,7 @@ /** The delegate. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** Hide room name field (NO by default). From 43f1315d199ad390c76daf62a3c5ab08329ee19b Mon Sep 17 00:00:00 2001 From: Doug Date: Mon, 1 Nov 2021 15:05:02 +0000 Subject: [PATCH 15/27] Present alerts before assigning to currentAlert. --- MatrixKit/Controllers/MXKRoomViewController.m | 190 ++++++++++-------- 1 file changed, 103 insertions(+), 87 deletions(-) diff --git a/MatrixKit/Controllers/MXKRoomViewController.m b/MatrixKit/Controllers/MXKRoomViewController.m index f1439063c..8d6ace052 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.m +++ b/MatrixKit/Controllers/MXKRoomViewController.m @@ -841,18 +841,21 @@ - (void)onTimelineError:(NSNotification *)notif [currentAlert dismissViewControllerAnimated:NO completion:nil]; __weak typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:errorTitle message:errorMessage preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:errorTitle + message:errorMessage + preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [errorAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; }]]; - [self presentViewController:currentAlert animated:YES completion:nil]; + [self presentViewController:errorAlert animated:YES completion:nil]; + currentAlert = errorAlert; } } @@ -964,11 +967,13 @@ - (void)processRoomJoinFailureWithError:(NSError *)error completion:(void(^)(MXK MXWeakify(self); [self->currentAlert dismissViewControllerAnimated:NO completion:nil]; - self->currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n roomErrorJoinFailedTitle] message:msg preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n roomErrorJoinFailedTitle] + message:msg + preferredStyle:UIAlertControllerStyleAlert]; - [self->currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [errorAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { MXStrongifyAndReturnIfNil(self); self->currentAlert = nil; @@ -979,7 +984,8 @@ - (void)processRoomJoinFailureWithError:(NSError *)error completion:(void(^)(MXK } }]]; - [self presentViewController:self->currentAlert animated:YES completion:nil]; + [self presentViewController:errorAlert animated:YES completion:nil]; + currentAlert = errorAlert; } - (void)leaveRoomOnEvent:(MXEvent*)event @@ -2188,20 +2194,22 @@ - (void)promptUserToResendEvent:(NSString *)eventId __weak typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n resendMessage] message:textMessage preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *resendAlert = [UIAlertController alertControllerWithTitle:[MatrixKitL10n resendMessage] + message:textMessage + preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [resendAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [resendAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2211,7 +2219,8 @@ - (void)promptUserToResendEvent:(NSString *)eventId }]]; - [self presentViewController:currentAlert animated:YES completion:nil]; + [self presentViewController:resendAlert animated:YES completion:nil]; + currentAlert = resendAlert; } } @@ -2630,20 +2639,22 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac } __weak __typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:nil message:[MatrixKitL10n attachmentCancelDownload] preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *cancelAlert = [UIAlertController alertControllerWithTitle:nil + message:[MatrixKitL10n attachmentCancelDownload] + preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [cancelAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [cancelAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2660,7 +2671,8 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac }]]; - [self presentViewController:currentAlert animated:YES completion:nil]; + [self presentViewController:cancelAlert animated:YES completion:nil]; + currentAlert = cancelAlert; } else if (roomBubbleTableViewCell.bubbleData.attachment.eventSentState == MXEventSentStatePreparing || roomBubbleTableViewCell.bubbleData.attachment.eventSentState == MXEventSentStateEncrypting || @@ -2677,20 +2689,22 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac } __weak __typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:nil message:[MatrixKitL10n attachmentCancelUpload] preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *cancelAlert = [UIAlertController alertControllerWithTitle:nil + message:[MatrixKitL10n attachmentCancelUpload] + preferredStyle:UIAlertControllerStyleAlert]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [cancelAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [cancelAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { // TODO cancel the attachment encryption if it is in progress. @@ -2717,7 +2731,8 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac }]]; - [self presentViewController:currentAlert animated:YES completion:nil]; + [self presentViewController:cancelAlert animated:YES completion:nil]; + currentAlert = cancelAlert; } } } @@ -2734,6 +2749,7 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac if (currentAlert) { [currentAlert dismissViewControllerAnimated:NO completion:nil]; + currentAlert = nil; // Cancel potential text selection in other bubbles for (MXKRoomBubbleTableViewCell *bubble in self.bubblesTableView.visibleCells) @@ -2743,14 +2759,14 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac } __weak __typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; // Add actions for a failed event if (selectedEvent.sentState == MXEventSentStateFailed) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n resend] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n resend] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2760,9 +2776,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n delete] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n delete] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2790,9 +2806,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac selectedComponent = nil; } - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n copy] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n copy] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2814,9 +2830,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac if ([MXKAppSettings standardAppSettings].messageDetailsAllowSharing) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n share] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n share] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2841,9 +2857,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac if (components.count > 1) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n selectAll] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n selectAll] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2859,9 +2875,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac { if ([MXKAppSettings standardAppSettings].messageDetailsAllowSaving) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n save] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n save] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2892,9 +2908,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac if (attachment.type != MXKAttachmentTypeSticker) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n copyButtonName] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n copyButtonName] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2923,9 +2939,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac if ([MXKAppSettings standardAppSettings].messageDetailsAllowSharing) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n share] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n share] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -2967,9 +2983,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac NSString *uploadId = roomBubbleTableViewCell.bubbleData.attachment.contentURL; if ([MXMediaManager existingUploaderWithId:uploadId]) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancelUpload] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancelUpload] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { // TODO cancel the attachment encryption if it is in progress. @@ -3008,9 +3024,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac NSString *downloadId = roomBubbleTableViewCell.bubbleData.attachment.downloadId; if ([MXMediaManager existingDownloaderWithIdentifier:downloadId]) { - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancelDownload] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancelDownload] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -3028,9 +3044,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac } } - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n showDetails] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n showDetails] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -3044,9 +3060,9 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac }]]; } - [currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] - style:UIAlertActionStyleCancel - handler:^(UIAlertAction * action) { + [actionSheet addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel] + style:UIAlertActionStyleCancel + handler:^(UIAlertAction * action) { typeof(self) self = weakSelf; self->currentAlert = nil; @@ -3057,15 +3073,12 @@ - (void)dataSource:(MXKDataSource *)dataSource didRecognizeAction:(NSString *)ac }]]; // Do not display empty action sheet - if (currentAlert.actions.count > 1) + if (actionSheet.actions.count > 1) { - [currentAlert popoverPresentationController].sourceView = roomBubbleTableViewCell; - [currentAlert popoverPresentationController].sourceRect = roomBubbleTableViewCell.bounds; - [self presentViewController:currentAlert animated:YES completion:nil]; - } - else - { - currentAlert = nil; + [actionSheet popoverPresentationController].sourceView = roomBubbleTableViewCell; + [actionSheet popoverPresentationController].sourceRect = roomBubbleTableViewCell.bounds; + [self presentViewController:actionSheet animated:YES completion:nil]; + currentAlert = actionSheet; } } } @@ -3704,11 +3717,13 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell [self->currentAlert dismissViewControllerAnimated:NO completion:nil]; __weak typeof(self) weakSelf = self; - self->currentAlert = [UIAlertController alertControllerWithTitle:@"" message:[MatrixKitL10n attachmentE2eKeysFilePrompt] preferredStyle:UIAlertControllerStyleAlert]; + UIAlertController *keysPrompt = [UIAlertController alertControllerWithTitle:@"" + message:[MatrixKitL10n attachmentE2eKeysFilePrompt] + preferredStyle:UIAlertControllerStyleAlert]; - [self->currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n view] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [keysPrompt addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n view] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { // View file content if (weakSelf) @@ -3721,9 +3736,9 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell }]]; - [self->currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n attachmentE2eKeysImport] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { + [keysPrompt addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n attachmentE2eKeysImport] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { if (weakSelf) { @@ -3747,7 +3762,8 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell }]]; - [self presentViewController:self->currentAlert animated:YES completion:nil]; + [self presentViewController:keysPrompt animated:YES completion:nil]; + currentAlert = keysPrompt; } else { From 81ae3a7b91b47631c8ef4e9b84fe0ff32fc260b3 Mon Sep 17 00:00:00 2001 From: Doug Date: Mon, 1 Nov 2021 16:27:02 +0000 Subject: [PATCH 16/27] Keep strong refs to weak views before display. --- MatrixKit/Controllers/MXKRoomViewController.m | 9 ++++----- changelog.d/5071.bugfix | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 changelog.d/5071.bugfix diff --git a/MatrixKit/Controllers/MXKRoomViewController.m b/MatrixKit/Controllers/MXKRoomViewController.m index 8d6ace052..13dbab73c 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.m +++ b/MatrixKit/Controllers/MXKRoomViewController.m @@ -1065,8 +1065,7 @@ - (void)setRoomTitleViewClass:(Class)roomTitleViewClass [titleView destroy]; } - titleView = [roomTitleViewClass roomTitleView]; - + titleView = self.navigationItem.titleView = [roomTitleViewClass roomTitleView]; titleView.delegate = self; // Define directly the navigation titleView with the custom title view instance. Do not use anymore a container. @@ -1109,9 +1108,9 @@ - (void)setRoomInputToolbarViewClass:(Class)roomInputToolbarViewClass MXLogDebug(@"[MXKRoomVC] setRoomInputToolbarViewClass: Set inputToolbarView to class %@", roomInputToolbarViewClass); - inputToolbarView = [roomInputToolbarViewClass roomInputToolbarView]; - - inputToolbarView.delegate = self; + id inputToolbarView = [roomInputToolbarViewClass roomInputToolbarView]; + self->inputToolbarView = inputToolbarView; + self->inputToolbarView.delegate = self; // Add the input toolbar view and define edge constraints [_roomInputToolbarContainer addSubview:inputToolbarView]; diff --git a/changelog.d/5071.bugfix b/changelog.d/5071.bugfix new file mode 100644 index 000000000..40e26a7da --- /dev/null +++ b/changelog.d/5071.bugfix @@ -0,0 +1 @@ +Ensure alerts with weak references are retained until they've been presented. \ No newline at end of file From a4b569cbca7d99d39aed3ebd6abaa1c88df62368 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 10 Nov 2021 15:48:53 +0100 Subject: [PATCH 17/27] MXKAppSettings: Add kMXEventTypeStringRoomMember to allowed room last messages in order to fix room ordering. --- MatrixKit/Models/MXKAppSettings.m | 1 + 1 file changed, 1 insertion(+) diff --git a/MatrixKit/Models/MXKAppSettings.m b/MatrixKit/Models/MXKAppSettings.m index 7365fc8c2..22b48f831 100644 --- a/MatrixKit/Models/MXKAppSettings.m +++ b/MatrixKit/Models/MXKAppSettings.m @@ -182,6 +182,7 @@ -(instancetype)init kMXEventTypeStringRoomCreate, // Without any messages, calls or stickers an event is needed to provide a date. kMXEventTypeStringRoomEncrypted, // Show a UTD string rather than the previous message. kMXEventTypeStringRoomMessage, + kMXEventTypeStringRoomMember, kMXEventTypeStringCallInvite, kMXEventTypeStringCallAnswer, kMXEventTypeStringCallHangup, From 911cc6857e135429a46730e3d6f551a49de5582a Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 10 Nov 2021 15:50:42 +0100 Subject: [PATCH 18/27] Update changes --- changelog.d/5105.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5105.bugfix diff --git a/changelog.d/5105.bugfix b/changelog.d/5105.bugfix new file mode 100644 index 000000000..de2ce7389 --- /dev/null +++ b/changelog.d/5105.bugfix @@ -0,0 +1 @@ +Fix room ordering regression. \ No newline at end of file From 2be5261d67ae71a745f0c23cc38cde2c2193b566 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 9 Nov 2021 16:09:03 +0000 Subject: [PATCH 19/27] Fix attachment previews on iOS 12. --- .../en.lproj/MatrixKit.strings | 2 + MatrixKit/Controllers/MXKRoomViewController.m | 38 +++++++++++++++++++ MatrixKit/Generated/Strings.swift | 8 ++++ MatrixKit/Models/Room/MXKAttachment.h | 8 ++++ MatrixKit/Models/Room/MXKAttachment.m | 5 +++ MatrixKit/Utils/MXKUTI.swift | 1 + Podfile.lock | 2 +- changelog.d/pr-949.bugfix | 1 + 8 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 changelog.d/pr-949.bugfix diff --git a/MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings b/MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings index b97ed7514..f9e40406a 100644 --- a/MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings +++ b/MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings @@ -281,6 +281,8 @@ "attachment_multiselection_original" = "Actual Size"; "attachment_e2e_keys_file_prompt" = "This file contains encryption keys exported from a Matrix client.\nDo you want to view the file content or import the keys it contains?"; "attachment_e2e_keys_import" = "Import..."; +"attachment_unsupported_preview_title" = "Unable to preview"; +"attachment_unsupported_preview_message" = "This file type is not supported."; // Contacts "contact_mx_users" = "Matrix Users"; diff --git a/MatrixKit/Controllers/MXKRoomViewController.m b/MatrixKit/Controllers/MXKRoomViewController.m index 13dbab73c..7bf47117b 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.m +++ b/MatrixKit/Controllers/MXKRoomViewController.m @@ -3678,7 +3678,45 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell [self stopActivityIndicator]; + MXWeakify(self); void(^viewAttachment)(void) = ^() { + + MXStrongifyAndReturnIfNil(self); + if ([selectedAttachment conformsToUTI:MXKUTI.html] && UIDevice.currentDevice.systemVersion.floatValue < 13) + { + // We don't support previewing HTML files on iOS 12. Show a share + // sheet if allowed, otherwise display an error to inform the user. + if (self.allowActionsInDocumentPreview) + { + UIActivityViewController *shareSheet = [[UIActivityViewController alloc] initWithActivityItems:@[fileURL] + applicationActivities:nil]; + MXWeakify(self); + shareSheet.completionWithItemsHandler = ^(UIActivityType activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) { + MXStrongifyAndReturnIfNil(self); + [selectedAttachment onShareEnded]; + self->currentSharedAttachment = nil; + }; + + self->currentSharedAttachment = selectedAttachment; + [self presentViewController:shareSheet animated:YES completion:nil]; + } + else + { + UIAlertController *alert = [UIAlertController alertControllerWithTitle:MatrixKitL10n.attachmentUnsupportedPreviewTitle + message:MatrixKitL10n.attachmentUnsupportedPreviewMessage + preferredStyle:UIAlertControllerStyleAlert]; + MXWeakify(self); + [alert addAction:[UIAlertAction actionWithTitle:MatrixKitL10n.ok style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + MXStrongifyAndReturnIfNil(self); + self->currentAlert = nil; + }]]; + + [self presentViewController:alert animated:YES completion:nil]; + self->currentAlert = alert; + } + + return; + } if (self.allowActionsInDocumentPreview) { diff --git a/MatrixKit/Generated/Strings.swift b/MatrixKit/Generated/Strings.swift index 7f4279e3e..e5c1e7f31 100644 --- a/MatrixKit/Generated/Strings.swift +++ b/MatrixKit/Generated/Strings.swift @@ -159,6 +159,14 @@ public class MatrixKitL10n: NSObject { public static func attachmentSmallWithResolution(_ p1: String, _ p2: String) -> String { return MatrixKitL10n.tr("attachment_small_with_resolution", p1, p2) } + /// This file type is not supported. + public static var attachmentUnsupportedPreviewMessage: String { + return MatrixKitL10n.tr("attachment_unsupported_preview_message") + } + /// Unable to preview + public static var attachmentUnsupportedPreviewTitle: String { + return MatrixKitL10n.tr("attachment_unsupported_preview_title") + } /// Invalid username public static var authInvalidUserName: String { return MatrixKitL10n.tr("auth_invalid_user_name") diff --git a/MatrixKit/Models/Room/MXKAttachment.h b/MatrixKit/Models/Room/MXKAttachment.h index 3e8c7b51b..f11287e76 100644 --- a/MatrixKit/Models/Room/MXKAttachment.h +++ b/MatrixKit/Models/Room/MXKAttachment.h @@ -18,6 +18,8 @@ #import #import +@class MXKUTI; + NS_ASSUME_NONNULL_BEGIN extern NSString * const kMXKAttachmentErrorDomain; @@ -187,6 +189,12 @@ typedef enum : NSUInteger { */ - (void)copy:(void (^_Nullable)(void))onSuccess failure:(void (^_Nullable)(NSError * _Nullable error))onFailure; +/** + Whether or not the attachment conforms to the specified UTI. + @param uti The UTI to check for conformance of. + */ +- (BOOL)conformsToUTI:(MXKUTI *)uti; + /** Prepare the attachment data to share it. The original name of the attachment (if any) is used to name the prepared file. diff --git a/MatrixKit/Models/Room/MXKAttachment.m b/MatrixKit/Models/Room/MXKAttachment.m index 10355b3c4..1557f8738 100644 --- a/MatrixKit/Models/Room/MXKAttachment.m +++ b/MatrixKit/Models/Room/MXKAttachment.m @@ -653,6 +653,11 @@ - (void)copy:(void (^)(void))onSuccess failure:(void (^)(NSError *error))onFailu } failure:onFailure]; } +- (BOOL)conformsToUTI:(MXKUTI *)uti +{ + return [[[MXKUTI alloc] initWithMimeType:mimetype] conformsTo:uti]; +} + - (void)prepareShare:(void (^)(NSURL *fileURL))onReadyToShare failure:(void (^)(NSError *error))onFailure { MXWeakify(self); diff --git a/MatrixKit/Utils/MXKUTI.swift b/MatrixKit/Utils/MXKUTI.swift index aea659556..79bc8e65d 100644 --- a/MatrixKit/Utils/MXKUTI.swift +++ b/MatrixKit/Utils/MXKUTI.swift @@ -171,6 +171,7 @@ extension MXKUTI { public static let jpeg = MXKUTI(cfRawValue: kUTTypeJPEG)! public static let url = MXKUTI(cfRawValue: kUTTypeURL)! public static let fileUrl = MXKUTI(cfRawValue: kUTTypeFileURL)! + public static let html = MXKUTI(cfRawValue: kUTTypeHTML)! } // MARK: - Convenients static methods diff --git a/Podfile.lock b/Podfile.lock index 53ea062fc..fbaea6032 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -105,4 +105,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: d9157cfcdbe95d4c55d08cfdfb27286e2bb643e0 -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.2 diff --git a/changelog.d/pr-949.bugfix b/changelog.d/pr-949.bugfix new file mode 100644 index 000000000..0ba8b1f8a --- /dev/null +++ b/changelog.d/pr-949.bugfix @@ -0,0 +1 @@ +MXKRoomViewController: Share sheet is properly presented on iOS 12 when necessary. \ No newline at end of file From 202f18d289edfa3eb5cd0ad19a09cbb6ec0733e0 Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 10 Nov 2021 17:35:52 +0100 Subject: [PATCH 20/27] MXKEventFormatter: Remove non needed fallback. --- MatrixKit/Utils/EventFormatter/MXKEventFormatter.m | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m b/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m index f1dce0891..e6904dd09 100644 --- a/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m +++ b/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m @@ -1942,14 +1942,7 @@ - (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary // Note that we use the current room state (roomState) because when we display // users displaynames, we want current displaynames MXKEventFormatterError error; - NSString *lastMessageString = [self stringFromEvent:event withRoomState:roomState error:&error]; - - if ([event.type isEqualToString:kMXEventTypeStringRoomCreate]) - { - // Temporarily fallback to the room joined notice when the last event is for the room's creation. - // This will be improved as part of https://github.com/vector-im/element-ios/issues/4918 - lastMessageString = MatrixKitL10n.noticeRoomJoinByYou; - } + NSString *lastMessageString = [self stringFromEvent:event withRoomState:roomState error:&error]; if (0 == lastMessageString.length) { From fc4af259c61133508fdb412fc04a6137e27a04af Mon Sep 17 00:00:00 2001 From: SBiOSoftWhare Date: Wed, 10 Nov 2021 18:01:47 +0100 Subject: [PATCH 21/27] Update MatrixKit/Utils/EventFormatter/MXKEventFormatter.m Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> --- MatrixKit/Utils/EventFormatter/MXKEventFormatter.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m b/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m index e6904dd09..67406b8f9 100644 --- a/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m +++ b/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m @@ -1942,7 +1942,7 @@ - (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary // Note that we use the current room state (roomState) because when we display // users displaynames, we want current displaynames MXKEventFormatterError error; - NSString *lastMessageString = [self stringFromEvent:event withRoomState:roomState error:&error]; + NSString *lastMessageString = [self stringFromEvent:event withRoomState:roomState error:&error]; if (0 == lastMessageString.length) { From 0dbe71f5ffd8cd9eb3b08c9b7bb811f1a7022675 Mon Sep 17 00:00:00 2001 From: Doug Date: Fri, 12 Nov 2021 10:56:32 +0000 Subject: [PATCH 22/27] Remove room summary observer on MXKRoomTitleView. Make conditional. --- MatrixKit/Views/RoomTitle/MXKRoomTitleView.m | 6 ++++++ changelog.d/pr-951.bugfix | 1 + 2 files changed, 7 insertions(+) create mode 100644 changelog.d/pr-951.bugfix diff --git a/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m b/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m index 6b677faa8..5ea74fc37 100644 --- a/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m +++ b/MatrixKit/Views/RoomTitle/MXKRoomTitleView.m @@ -96,6 +96,12 @@ - (void)destroy { self.delegate = nil; self.mxRoom = nil; + + if (mxRoomSummaryDidChangeObserver) + { + [NSNotificationCenter.defaultCenter removeObserver:mxRoomSummaryDidChangeObserver]; + mxRoomSummaryDidChangeObserver = nil; + } } - (void)dismissKeyboard diff --git a/changelog.d/pr-951.bugfix b/changelog.d/pr-951.bugfix new file mode 100644 index 000000000..52054155d --- /dev/null +++ b/changelog.d/pr-951.bugfix @@ -0,0 +1 @@ +MXKRoomTitleView: Remove room summary observer on destroy. \ No newline at end of file From f1188e20b2b9501f62b292dc021986c66312cfcb Mon Sep 17 00:00:00 2001 From: Doug Date: Mon, 15 Nov 2021 10:10:33 +0000 Subject: [PATCH 23/27] Improve file preview handling. --- MatrixKit/Controllers/MXKRoomViewController.m | 36 +++++++++++++++++-- MatrixKit/Utils/MXKUTI.swift | 4 ++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/MatrixKit/Controllers/MXKRoomViewController.m b/MatrixKit/Controllers/MXKRoomViewController.m index 7bf47117b..fd242960b 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.m +++ b/MatrixKit/Controllers/MXKRoomViewController.m @@ -3682,9 +3682,10 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell void(^viewAttachment)(void) = ^() { MXStrongifyAndReturnIfNil(self); - if ([selectedAttachment conformsToUTI:MXKUTI.html] && UIDevice.currentDevice.systemVersion.floatValue < 13) + + if (![self canPreviewFileAttachment:selectedAttachment withLocalFileURL:fileURL]) { - // We don't support previewing HTML files on iOS 12. Show a share + // When we don't support showing a preview for a file, show a share // sheet if allowed, otherwise display an error to inform the user. if (self.allowActionsInDocumentPreview) { @@ -3708,6 +3709,7 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell MXWeakify(self); [alert addAction:[UIAlertAction actionWithTitle:MatrixKitL10n.ok style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { MXStrongifyAndReturnIfNil(self); + [selectedAttachment onShareEnded]; self->currentAlert = nil; }]]; @@ -3800,7 +3802,7 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell }]]; [self presentViewController:keysPrompt animated:YES completion:nil]; - currentAlert = keysPrompt; + self->currentAlert = keysPrompt; } else { @@ -3827,6 +3829,34 @@ - (void)showAttachmentInCell:(UITableViewCell*)cell } } +- (BOOL)canPreviewFileAttachment:(MXKAttachment *)attachment withLocalFileURL:(NSURL *)localFileURL +{ + // Sanity check. + if (![NSFileManager.defaultManager isReadableFileAtPath:localFileURL.path]) + { + return NO; + } + + if (UIDevice.currentDevice.systemVersion.floatValue >= 13) + { + return YES; + } + + MXKUTI *fileUTI = [[MXKUTI alloc] initWithLocalFileURL:localFileURL]; + if (!fileUTI) + { + return NO; + } + + if ([attachment conformsToUTI:MXKUTI.html] || [attachment conformsToUTI:MXKUTI.xml] || [attachment conformsToUTI:MXKUTI.svg] + || [fileUTI conformsTo:MXKUTI.html] || [fileUTI conformsTo:MXKUTI.xml] || [fileUTI conformsTo:MXKUTI.svg]) + { + return NO; + } + + return YES; +} + #pragma mark - MXKAttachmentsViewControllerDelegate - (BOOL)attachmentsViewController:(MXKAttachmentsViewController*)attachmentsViewController paginateAttachmentBefore:(NSString*)eventId diff --git a/MatrixKit/Utils/MXKUTI.swift b/MatrixKit/Utils/MXKUTI.swift index 79bc8e65d..232a937f2 100644 --- a/MatrixKit/Utils/MXKUTI.swift +++ b/MatrixKit/Utils/MXKUTI.swift @@ -169,12 +169,14 @@ extension MXKUTI { public static let image = MXKUTI(cfRawValue: kUTTypeImage)! public static let png = MXKUTI(cfRawValue: kUTTypePNG)! public static let jpeg = MXKUTI(cfRawValue: kUTTypeJPEG)! + public static let svg = MXKUTI(cfRawValue: kUTTypeScalableVectorGraphics)! public static let url = MXKUTI(cfRawValue: kUTTypeURL)! public static let fileUrl = MXKUTI(cfRawValue: kUTTypeFileURL)! public static let html = MXKUTI(cfRawValue: kUTTypeHTML)! + public static let xml = MXKUTI(cfRawValue: kUTTypeXML)! } -// MARK: - Convenients static methods +// MARK: - Convenience static methods extension MXKUTI { public static func mimeType(from fileExtension: String) -> String? { From 7121be5d22608d4ab5bb985687230612a25f5f70 Mon Sep 17 00:00:00 2001 From: Doug Date: Mon, 15 Nov 2021 11:58:37 +0000 Subject: [PATCH 24/27] Add conformsToAny(of:) to MXKUTI. --- MatrixKit/Controllers/MXKRoomViewController.m | 7 ++++--- MatrixKit/Models/Room/MXKAttachment.h | 11 +++++------ MatrixKit/Models/Room/MXKAttachment.m | 4 ++-- MatrixKit/Utils/MXKUTI.swift | 14 ++++++++++++++ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/MatrixKit/Controllers/MXKRoomViewController.m b/MatrixKit/Controllers/MXKRoomViewController.m index fd242960b..382373a92 100644 --- a/MatrixKit/Controllers/MXKRoomViewController.m +++ b/MatrixKit/Controllers/MXKRoomViewController.m @@ -3842,14 +3842,15 @@ - (BOOL)canPreviewFileAttachment:(MXKAttachment *)attachment withLocalFileURL:(N return YES; } + MXKUTI *attachmentUTI = attachment.uti; MXKUTI *fileUTI = [[MXKUTI alloc] initWithLocalFileURL:localFileURL]; - if (!fileUTI) + if (!attachmentUTI || !fileUTI) { return NO; } - if ([attachment conformsToUTI:MXKUTI.html] || [attachment conformsToUTI:MXKUTI.xml] || [attachment conformsToUTI:MXKUTI.svg] - || [fileUTI conformsTo:MXKUTI.html] || [fileUTI conformsTo:MXKUTI.xml] || [fileUTI conformsTo:MXKUTI.svg]) + NSArray *unsupportedUTIs = @[MXKUTI.html, MXKUTI.xml, MXKUTI.svg]; + if ([attachmentUTI conformsToAnyOf:unsupportedUTIs] || [fileUTI conformsToAnyOf:unsupportedUTIs]) { return NO; } diff --git a/MatrixKit/Models/Room/MXKAttachment.h b/MatrixKit/Models/Room/MXKAttachment.h index f11287e76..07e878161 100644 --- a/MatrixKit/Models/Room/MXKAttachment.h +++ b/MatrixKit/Models/Room/MXKAttachment.h @@ -116,6 +116,11 @@ typedef enum : NSUInteger { */ @property (nonatomic, readonly) BOOL isEncrypted; +/** + The UTI of this attachment. + */ +@property (nonatomic, readonly, nullable) MXKUTI *uti; + /** Create a `MXKAttachment` instance for the passed event. The created instance copies the current data of the event (content, event id, sent state...). @@ -189,12 +194,6 @@ typedef enum : NSUInteger { */ - (void)copy:(void (^_Nullable)(void))onSuccess failure:(void (^_Nullable)(NSError * _Nullable error))onFailure; -/** - Whether or not the attachment conforms to the specified UTI. - @param uti The UTI to check for conformance of. - */ -- (BOOL)conformsToUTI:(MXKUTI *)uti; - /** Prepare the attachment data to share it. The original name of the attachment (if any) is used to name the prepared file. diff --git a/MatrixKit/Models/Room/MXKAttachment.m b/MatrixKit/Models/Room/MXKAttachment.m index 1557f8738..e15fd70b3 100644 --- a/MatrixKit/Models/Room/MXKAttachment.m +++ b/MatrixKit/Models/Room/MXKAttachment.m @@ -653,9 +653,9 @@ - (void)copy:(void (^)(void))onSuccess failure:(void (^)(NSError *error))onFailu } failure:onFailure]; } -- (BOOL)conformsToUTI:(MXKUTI *)uti +- (MXKUTI *)uti { - return [[[MXKUTI alloc] initWithMimeType:mimetype] conformsTo:uti]; + return [[MXKUTI alloc] initWithMimeType:mimetype]; } - (void)prepareShare:(void (^)(NSURL *fileURL))onReadyToShare failure:(void (^)(NSError *error))onFailure diff --git a/MatrixKit/Utils/MXKUTI.swift b/MatrixKit/Utils/MXKUTI.swift index 232a937f2..911beec65 100644 --- a/MatrixKit/Utils/MXKUTI.swift +++ b/MatrixKit/Utils/MXKUTI.swift @@ -104,6 +104,20 @@ open class MXKUTI: NSObject, RawRepresentable { public func conforms(to otherUTI: MXKUTI) -> Bool { return self.utiWrapper.conforms(to: otherUTI.utiWrapper) } + + /// Check whether the current UTI conforms to any UTIs within an array. + /// + /// - Parameter otherUTIs: UTI which to conform with. + /// - Returns: true if self conforms to any of the other UTIs. + public func conformsToAny(of otherUTIs: [MXKUTI]) -> Bool { + for uti in otherUTIs { + if conforms(to: uti) { + return true + } + } + + return false + } } // MARK: - Other convenients initializers From a6dc0122c567b812840b7c582b8c7c9356850f90 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 17 Nov 2021 15:06:05 +0000 Subject: [PATCH 25/27] changelog.d: Upgrade MatrixSDK version ([v0.20.10](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.20.10)). --- MatrixKit.podspec | 4 ++-- MatrixKit/MatrixKitVersion.m | 2 +- Podfile | 2 +- changelog.d/x-nolink-0.change | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changelog.d/x-nolink-0.change diff --git a/MatrixKit.podspec b/MatrixKit.podspec index 595b290d0..9461b2d8b 100644 --- a/MatrixKit.podspec +++ b/MatrixKit.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "MatrixKit" - s.version = "0.16.9" + s.version = "0.16.10" s.summary = "The Matrix reusable UI library for iOS based on MatrixSDK." s.description = <<-DESC @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.swift_version = '5.0' - s.dependency 'MatrixSDK', "= 0.20.9" + s.dependency 'MatrixSDK', "= 0.20.10" s.dependency 'HPGrowingTextView', '~> 1.1' s.dependency 'libPhoneNumber-iOS', '~> 0.9.13' s.dependency 'DTCoreText', '~> 1.6.25' diff --git a/MatrixKit/MatrixKitVersion.m b/MatrixKit/MatrixKitVersion.m index 7e9e79525..1ba29cf68 100644 --- a/MatrixKit/MatrixKitVersion.m +++ b/MatrixKit/MatrixKitVersion.m @@ -16,4 +16,4 @@ #import -NSString *const MatrixKitVersion = @"0.16.9"; +NSString *const MatrixKitVersion = @"0.16.10"; diff --git a/Podfile b/Podfile index 189fd1cbb..d7cb4ce03 100644 --- a/Podfile +++ b/Podfile @@ -8,7 +8,7 @@ abstract_target 'MatrixKitSamplePods' do # Different flavours of pods to Matrix SDK # The tagged version on which this version of MatrixKit has been built - pod 'MatrixSDK', '= 0.20.9' + pod 'MatrixSDK', '= 0.20.10' # The lastest release available on the CocoaPods repository #pod 'MatrixSDK' diff --git a/changelog.d/x-nolink-0.change b/changelog.d/x-nolink-0.change new file mode 100644 index 000000000..f44954b77 --- /dev/null +++ b/changelog.d/x-nolink-0.change @@ -0,0 +1 @@ +Upgrade MatrixSDK version ([v0.20.10](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.20.10)). \ No newline at end of file From 327743224c17bfb1e404171238c55213bc467839 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 17 Nov 2021 15:06:05 +0000 Subject: [PATCH 26/27] version++ --- CHANGES.md | 16 ++++++++++++++++ changelog.d/5055.bugfix | 1 - changelog.d/5058.bugfix | 1 - changelog.d/5071.bugfix | 1 - changelog.d/5105.bugfix | 1 - changelog.d/pr-949.bugfix | 1 - changelog.d/pr-951.bugfix | 1 - changelog.d/x-nolink-0.change | 1 - 8 files changed, 16 insertions(+), 7 deletions(-) delete mode 100644 changelog.d/5055.bugfix delete mode 100644 changelog.d/5058.bugfix delete mode 100644 changelog.d/5071.bugfix delete mode 100644 changelog.d/5105.bugfix delete mode 100644 changelog.d/pr-949.bugfix delete mode 100644 changelog.d/pr-951.bugfix delete mode 100644 changelog.d/x-nolink-0.change diff --git a/CHANGES.md b/CHANGES.md index d8ba1a0ad..5bd8b8d8f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,19 @@ +## Changes in 0.16.10 (2021-11-17) + +🙌 Improvements + +- Upgrade MatrixSDK version ([v0.20.10](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.20.10)). + +🐛 Bugfixes + +- MXKRoomViewController: Share sheet is properly presented on iOS 12 when necessary. ([#949](https://github.com/matrix-org/matrix-ios-kit/pull/949)) +- MXKRoomTitleView: Remove room summary observer on destroy. ([#951](https://github.com/matrix-org/matrix-ios-kit/pull/951)) +- MXKRoomViewController: Fix retain cycles that prevents deallocation. ([#5055](https://github.com/vector-im/element-ios/issues/5055)) +- Fix retain cycles that prevents deallocation in several classes. ([#5058](https://github.com/vector-im/element-ios/issues/5058)) +- Ensure alerts with weak references are retained until they've been presented. ([#5071](https://github.com/vector-im/element-ios/issues/5071)) +- Fix room ordering regression. ([#5105](https://github.com/vector-im/element-ios/issues/5105)) + + ## Changes in 0.16.9 (2021-10-21) 🙌 Improvements diff --git a/changelog.d/5055.bugfix b/changelog.d/5055.bugfix deleted file mode 100644 index bfb33517e..000000000 --- a/changelog.d/5055.bugfix +++ /dev/null @@ -1 +0,0 @@ -MXKRoomViewController: Fix retain cycles that prevents deallocation. \ No newline at end of file diff --git a/changelog.d/5058.bugfix b/changelog.d/5058.bugfix deleted file mode 100644 index 1e8112a36..000000000 --- a/changelog.d/5058.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix retain cycles that prevents deallocation in several classes. \ No newline at end of file diff --git a/changelog.d/5071.bugfix b/changelog.d/5071.bugfix deleted file mode 100644 index 40e26a7da..000000000 --- a/changelog.d/5071.bugfix +++ /dev/null @@ -1 +0,0 @@ -Ensure alerts with weak references are retained until they've been presented. \ No newline at end of file diff --git a/changelog.d/5105.bugfix b/changelog.d/5105.bugfix deleted file mode 100644 index de2ce7389..000000000 --- a/changelog.d/5105.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix room ordering regression. \ No newline at end of file diff --git a/changelog.d/pr-949.bugfix b/changelog.d/pr-949.bugfix deleted file mode 100644 index 0ba8b1f8a..000000000 --- a/changelog.d/pr-949.bugfix +++ /dev/null @@ -1 +0,0 @@ -MXKRoomViewController: Share sheet is properly presented on iOS 12 when necessary. \ No newline at end of file diff --git a/changelog.d/pr-951.bugfix b/changelog.d/pr-951.bugfix deleted file mode 100644 index 52054155d..000000000 --- a/changelog.d/pr-951.bugfix +++ /dev/null @@ -1 +0,0 @@ -MXKRoomTitleView: Remove room summary observer on destroy. \ 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 f44954b77..000000000 --- a/changelog.d/x-nolink-0.change +++ /dev/null @@ -1 +0,0 @@ -Upgrade MatrixSDK version ([v0.20.10](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.20.10)). \ No newline at end of file From 35024d7bdac6bc2684e8182cd745908f414c2c95 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 17 Nov 2021 15:48:25 +0000 Subject: [PATCH 27/27] finish version++ --- Podfile.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index fbaea6032..d377ff7b2 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -39,9 +39,9 @@ PODS: - JSQSystemSoundPlayer (2.0.1) - libbase58 (0.1.4) - libPhoneNumber-iOS (0.9.15) - - MatrixSDK (0.20.9): - - MatrixSDK/Core (= 0.20.9) - - MatrixSDK/Core (0.20.9): + - MatrixSDK (0.20.10): + - MatrixSDK/Core (= 0.20.10) + - MatrixSDK/Core (0.20.10): - AFNetworking (~> 4.0.0) - GZIP (~> 1.3.0) - libbase58 (~> 0.1.4) @@ -65,7 +65,7 @@ DEPENDENCIES: - HPGrowingTextView (~> 1.1) - JSQMessagesViewController (~> 7.3.5) - libPhoneNumber-iOS (~> 0.9.13) - - MatrixSDK (= 0.20.9) + - MatrixSDK (= 0.20.10) - SwiftGen (~> 6.3) SPEC REPOS: @@ -97,12 +97,12 @@ SPEC CHECKSUMS: JSQSystemSoundPlayer: c5850e77a4363ffd374cd851154b9af93264ed8d libbase58: 7c040313537b8c44b6e2d15586af8e21f7354efd libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75 - MatrixSDK: 9e312e3874027bf9eab61be7d0779102f8bd323a + MatrixSDK: 0e2ed8fc6f004cac4b4ab46f038a86fe49ce4007 OLMKit: 9fb4799c4a044dd2c06bda31ec31a12191ad30b5 Realm: b6027801398f3743fc222f096faa85281b506e6c SwiftGen: a6d22010845f08fe18fbdf3a07a8e380fd22e0ea SwiftyBeaver: 84069991dd5dca07d7069100985badaca7f0ce82 -PODFILE CHECKSUM: d9157cfcdbe95d4c55d08cfdfb27286e2bb643e0 +PODFILE CHECKSUM: 52ecdadffcff0d873e111bf272eddb813796523e COCOAPODS: 1.11.2