Merge branch 'develop' into steve/5903_lls_start

# Conflicts:
#	Riot/Modules/Room/RoomViewController.h
#	RiotSwiftUI/Modules/Room/LocationSharing/Coordinator/LocationSharingCoordinator.swift
#	RiotSwiftUI/Modules/Room/LocationSharing/LocationSharingModels.swift
#	RiotSwiftUI/Modules/Room/LocationSharing/LocationSharingViewModel.swift
This commit is contained in:
SBiOSoftWhare
2022-04-08 11:09:06 +02:00
221 changed files with 8846 additions and 1792 deletions
+99 -26
View File
@@ -97,7 +97,7 @@ static CGSize kThreadListBarButtonItemImageSize;
@interface RoomViewController () <UISearchBarDelegate, UIGestureRecognizerDelegate, UIScrollViewAccessibilityDelegate, RoomTitleViewTapGestureDelegate, MXKRoomMemberDetailsViewControllerDelegate, ContactsTableViewControllerDelegate, MXServerNoticesDelegate, RoomContextualMenuViewControllerDelegate,
ReactionsMenuViewModelCoordinatorDelegate, EditHistoryCoordinatorBridgePresenterDelegate, MXKDocumentPickerPresenterDelegate, EmojiPickerCoordinatorBridgePresenterDelegate,
ReactionHistoryCoordinatorBridgePresenterDelegate, CameraPresenterDelegate, MediaPickerCoordinatorBridgePresenterDelegate,
RoomDataSourceDelegate, RoomCreationModalCoordinatorBridgePresenterDelegate, RoomInfoCoordinatorBridgePresenterDelegate, DialpadViewControllerDelegate, RemoveJitsiWidgetViewDelegate, VoiceMessageControllerDelegate, SpaceDetailPresenterDelegate, UserSuggestionCoordinatorBridgeDelegate, ThreadsCoordinatorBridgePresenterDelegate, MXThreadingServiceDelegate, RoomParticipantsInviteCoordinatorBridgePresenterDelegate>
RoomDataSourceDelegate, RoomCreationModalCoordinatorBridgePresenterDelegate, RoomInfoCoordinatorBridgePresenterDelegate, DialpadViewControllerDelegate, RemoveJitsiWidgetViewDelegate, VoiceMessageControllerDelegate, SpaceDetailPresenterDelegate, UserSuggestionCoordinatorBridgeDelegate, ThreadsCoordinatorBridgePresenterDelegate, ThreadsBetaCoordinatorBridgePresenterDelegate, MXThreadingServiceDelegate, RoomParticipantsInviteCoordinatorBridgePresenterDelegate>
{
// The preview header
@@ -210,6 +210,8 @@ static CGSize kThreadListBarButtonItemImageSize;
@property (nonatomic, strong) CustomSizedPresentationController *customSizedPresentationController;
@property (nonatomic, strong) RoomParticipantsInviteCoordinatorBridgePresenter *participantsInvitePresenter;
@property (nonatomic, strong) ThreadsCoordinatorBridgePresenter *threadsBridgePresenter;
@property (nonatomic, strong) ThreadsBetaCoordinatorBridgePresenter *threadsBetaBridgePresenter;
@property (nonatomic, strong) SlidingModalPresenter *threadsNoticeModalPresenter;
@property (nonatomic, getter=isActivitiesViewExpanded) BOOL activitiesViewExpanded;
@property (nonatomic, getter=isScrollToBottomHidden) BOOL scrollToBottomHidden;
@property (nonatomic, getter=isMissedDiscussionsBadgeHidden) BOOL missedDiscussionsBadgeHidden;
@@ -655,6 +657,11 @@ static CGSize kThreadListBarButtonItemImageSize;
}
self.showSettingsInitially = NO;
if (!RiotSettings.shared.threadsNoticeDisplayed && RiotSettings.shared.enableThreads)
{
[self showThreadsNotice];
}
}
- (void)viewDidDisappear:(BOOL)animated
@@ -966,17 +973,13 @@ static CGSize kThreadListBarButtonItemImageSize;
#pragma mark - Loading indicators
- (BOOL)providesCustomActivityIndicator {
return [self.delegate roomViewControllerCanDelegateUserIndicators:self];
return YES;
}
// Override of a legacy method to determine whether to use a newer implementation instead.
// Will be removed in the future https://github.com/vector-im/element-ios/issues/5608
- (void)startActivityIndicator {
if ([self providesCustomActivityIndicator]) {
[self.delegate roomViewControllerDidStartLoading:self];
} else {
[super startActivityIndicator];
}
[self.delegate roomViewControllerDidStartLoading:self];
}
// Override of a legacy method to determine whether to use a newer implementation instead.
@@ -989,15 +992,11 @@ static CGSize kThreadListBarButtonItemImageSize;
[MXSDKOptions.sharedInstance.profiler stopMeasuringTaskWithProfile:notificationTaskProfile];
notificationTaskProfile = nil;
}
if ([self providesCustomActivityIndicator]) {
// The legacy super implementation of `stopActivityIndicator` contains a number of checks grouped under `canStopActivityIndicator`
// to determine whether the indicator can be stopped or not (and the method should thus rather be called `stopActivityIndicatorIfPossible`).
// Since the newer indicators are not calling super implementation, the check for `canStopActivityIndicator` has to be performed manually.
if ([self canStopActivityIndicator]) {
[self stopLoadingUserIndicator];
}
} else {
[super stopActivityIndicator];
// The legacy super implementation of `stopActivityIndicator` contains a number of checks grouped under `canStopActivityIndicator`
// to determine whether the indicator can be stopped or not (and the method should thus rather be called `stopActivityIndicatorIfPossible`).
// Since the newer indicators are not calling super implementation, the check for `canStopActivityIndicator` has to be performed manually.
if ([self canStopActivityIndicator]) {
[self stopLoadingUserIndicator];
}
}
@@ -1597,6 +1596,11 @@ static CGSize kThreadListBarButtonItemImageSize;
- (BOOL)isRoomPreview
{
if (self.isContextPreview)
{
return YES;
}
// Check first whether some preview data are defined.
if (roomPreviewData)
{
@@ -4735,9 +4739,7 @@ static CGSize kThreadListBarButtonItemImageSize;
- (IBAction)onThreadListTapped:(id)sender
{
self.threadsBridgePresenter = [[ThreadsCoordinatorBridgePresenter alloc] initWithSession:self.mainSession
roomId:self.roomDataSource.roomId
threadId:nil];
self.threadsBridgePresenter = [self.delegate threadsCoordinatorForRoomViewController:self threadId:nil];
self.threadsBridgePresenter.delegate = self;
[self.threadsBridgePresenter pushFrom:self.navigationController animated:YES];
@@ -6406,7 +6408,7 @@ static CGSize kThreadListBarButtonItemImageSize;
BOOL showMoreOption = (event.isState && RiotSettings.shared.roomContextualMenuShowMoreOptionForStates)
|| (!event.isState && RiotSettings.shared.roomContextualMenuShowMoreOptionForMessages);
BOOL showThreadOption = RiotSettings.shared.enableThreads && !self.roomDataSource.threadId && !event.threadId;
BOOL showThreadOption = !self.roomDataSource.threadId && !event.threadId;
NSMutableArray<RoomContextualMenuItem*> *items = [NSMutableArray arrayWithCapacity:5];
@@ -6768,7 +6770,14 @@ static CGSize kThreadListBarButtonItemImageSize;
[self hideContextualMenuAnimated:YES cancelEventSelection:NO completion:nil];
[self openThreadWithId:event.eventId];
if (RiotSettings.shared.enableThreads)
{
[self openThreadWithId:event.eventId];
}
else
{
[self showThreadsBetaForEvent:event];
}
};
return item;
@@ -6790,6 +6799,49 @@ static CGSize kThreadListBarButtonItemImageSize;
#pragma mark - Threads
- (void)showThreadsNotice
{
if (!self.threadsNoticeModalPresenter)
{
self.threadsNoticeModalPresenter = [SlidingModalPresenter new];
}
[self.threadsNoticeModalPresenter dismissWithAnimated:NO completion:nil];
ThreadsNoticeViewController *threadsNoticeVC = [ThreadsNoticeViewController instantiate];
MXWeakify(self);
threadsNoticeVC.didTapDoneButton = ^{
MXStrongifyAndReturnIfNil(self);
[self.threadsNoticeModalPresenter dismissWithAnimated:YES completion:^{
RiotSettings.shared.threadsNoticeDisplayed = YES;
}];
};
[self.threadsNoticeModalPresenter present:threadsNoticeVC
from:self.presentedViewController?:self
animated:YES
options:SlidingModalPresenter.SpanningOption
completion:nil];
}
- (void)showThreadsBetaForEvent:(MXEvent *)event
{
if (self.threadsBetaBridgePresenter)
{
[self.threadsBetaBridgePresenter dismissWithAnimated:YES completion:nil];
self.threadsBetaBridgePresenter = nil;
}
self.threadsBetaBridgePresenter = [[ThreadsBetaCoordinatorBridgePresenter alloc] initWithThreadId:event.eventId];
self.threadsBetaBridgePresenter.delegate = self;
[self.threadsBetaBridgePresenter presentFrom:self.presentedViewController?:self animated:YES];
}
- (void)openThreadWithId:(NSString *)threadId
{
if (self.threadsBridgePresenter)
@@ -6798,9 +6850,7 @@ static CGSize kThreadListBarButtonItemImageSize;
self.threadsBridgePresenter = nil;
}
self.threadsBridgePresenter = [[ThreadsCoordinatorBridgePresenter alloc] initWithSession:self.mainSession
roomId:self.roomDataSource.roomId
threadId:threadId];
self.threadsBridgePresenter = [self.delegate threadsCoordinatorForRoomViewController:self threadId:threadId];
self.threadsBridgePresenter.delegate = self;
[self.threadsBridgePresenter pushFrom:self.navigationController animated:YES];
}
@@ -7156,7 +7206,7 @@ static CGSize kThreadListBarButtonItemImageSize;
self.cameraPresenter = nil;
}
- (void)cameraPresenter:(CameraPresenter *)cameraPresenter didSelectImageData:(NSData *)imageData withUTI:(MXKUTI *)uti
- (void)cameraPresenter:(CameraPresenter *)cameraPresenter didSelectImage:(UIImage *)image
{
[cameraPresenter dismissWithAnimated:YES completion:nil];
self.cameraPresenter = nil;
@@ -7164,8 +7214,9 @@ static CGSize kThreadListBarButtonItemImageSize;
RoomInputToolbarView *roomInputToolbarView = [self inputToolbarViewAsRoomInputToolbarView];
if (roomInputToolbarView)
{
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[roomInputToolbarView sendSelectedImage:imageData
withMimeType:uti.mimeType
withMimeType:MXKUTI.jpeg.mimeType
andCompressionMode:MediaCompressionHelper.defaultCompressionMode
isPhotoLibraryAsset:NO];
}
@@ -7389,6 +7440,28 @@ static CGSize kThreadListBarButtonItemImageSize;
self.threadsBridgePresenter = nil;
}
#pragma mark - ThreadsBetaCoordinatorBridgePresenterDelegate
- (void)threadsBetaCoordinatorBridgePresenterDelegateDidTapEnable:(ThreadsBetaCoordinatorBridgePresenter *)coordinatorBridgePresenter
{
MXWeakify(self);
[self.threadsBetaBridgePresenter dismissWithAnimated:YES completion:^{
MXStrongifyAndReturnIfNil(self);
[self cancelEventSelection];
[self.roomDataSource reload];
[self openThreadWithId:coordinatorBridgePresenter.threadId];
}];
}
- (void)threadsBetaCoordinatorBridgePresenterDelegateDidTapCancel:(ThreadsBetaCoordinatorBridgePresenter *)coordinatorBridgePresenter
{
MXWeakify(self);
[self.threadsBetaBridgePresenter dismissWithAnimated:YES completion:^{
MXStrongifyAndReturnIfNil(self);
[self cancelEventSelection];
}];
}
#pragma mark - MXThreadingServiceDelegate
- (void)threadingServiceDidUpdateThreads:(MXThreadingService *)service