diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index d1cd1b3a9..c86de1d80 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -16,7 +16,7 @@ env: jobs: build: name: Build - runs-on: macos-latest + runs-on: macos-11 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index eac0c885d..65846be15 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -16,7 +16,7 @@ env: jobs: tests: name: Tests - runs-on: macos-latest + runs-on: macos-11 steps: - uses: actions/checkout@v2 diff --git a/CHANGES.md b/CHANGES.md index 8f3248fc0..ce2055130 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,10 @@ +## Changes in 1.6.5 (2021-10-14) + +🙌 Improvements + +- Upgrade MatrixKit version ([v0.16.7](https://github.com/matrix-org/matrix-ios-kit/releases/tag/v0.16.7)). + + ## Changes in 1.6.4 (2021-10-12) 🙌 Improvements diff --git a/Config/AppVersion.xcconfig b/Config/AppVersion.xcconfig index 79d20fa80..6dab241e0 100644 --- a/Config/AppVersion.xcconfig +++ b/Config/AppVersion.xcconfig @@ -15,5 +15,5 @@ // // Version -MARKETING_VERSION = 1.6.5 -CURRENT_PROJECT_VERSION = 1.6.5 +MARKETING_VERSION = 1.6.6 +CURRENT_PROJECT_VERSION = 1.6.6 diff --git a/Podfile b/Podfile index 667702467..b373a6f43 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.6' +$matrixKitVersion = '= 0.16.7' # $matrixKitVersion = :local # $matrixKitVersion = {'develop' => 'develop'} diff --git a/Podfile.lock b/Podfile.lock index e48d77e55..2077a2dab 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -58,29 +58,29 @@ PODS: - MatomoTracker (7.4.1): - MatomoTracker/Core (= 7.4.1) - MatomoTracker/Core (7.4.1) - - MatrixKit (0.16.6): + - MatrixKit (0.16.7): - Down (~> 0.11.0) - DTCoreText (~> 1.6.25) - HPGrowingTextView (~> 1.1) - libPhoneNumber-iOS (~> 0.9.13) - - MatrixKit/Core (= 0.16.6) - - MatrixSDK (= 0.20.6) - - MatrixKit/Core (0.16.6): + - MatrixKit/Core (= 0.16.7) + - MatrixSDK (= 0.20.7) + - MatrixKit/Core (0.16.7): - Down (~> 0.11.0) - DTCoreText (~> 1.6.25) - HPGrowingTextView (~> 1.1) - libPhoneNumber-iOS (~> 0.9.13) - - MatrixSDK (= 0.20.6) - - MatrixSDK (0.20.6): - - MatrixSDK/Core (= 0.20.6) - - MatrixSDK/Core (0.20.6): + - MatrixSDK (= 0.20.7) + - MatrixSDK (0.20.7): + - MatrixSDK/Core (= 0.20.7) + - MatrixSDK/Core (0.20.7): - AFNetworking (~> 4.0.0) - GZIP (~> 1.3.0) - libbase58 (~> 0.1.4) - OLMKit (~> 3.2.5) - Realm (= 10.16.0) - SwiftyBeaver (= 1.9.5) - - MatrixSDK/JingleCallStack (0.20.6): + - MatrixSDK/JingleCallStack (0.20.7): - JitsiMeetSDK (= 3.10.2) - MatrixSDK/Core - OLMKit (3.2.5): @@ -124,7 +124,7 @@ DEPENDENCIES: - KeychainAccess (~> 4.2.2) - KTCenterFlowLayout (~> 1.3.1) - MatomoTracker (~> 7.4.1) - - MatrixKit (= 0.16.6) + - MatrixKit (= 0.16.7) - MatrixSDK - MatrixSDK/JingleCallStack - OLMKit @@ -204,8 +204,8 @@ SPEC CHECKSUMS: LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d Logging: beeb016c9c80cf77042d62e83495816847ef108b MatomoTracker: 24a846c9d3aa76933183fe9d47fd62c9efa863fb - MatrixKit: 38f18f930af238abe44189909b16953e657d0ffc - MatrixSDK: 37d6bc484fa90c39db46ed25fd3a4c707bb70452 + MatrixKit: d0346f60c7d0723066f6a3e94ebee789edc1f580 + MatrixSDK: 1d7a64d1e25f746e35157a68374b4282b5581188 OLMKit: 9fb4799c4a044dd2c06bda31ec31a12191ad30b5 ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d Realm: b6027801398f3743fc222f096faa85281b506e6c @@ -219,6 +219,6 @@ SPEC CHECKSUMS: zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb -PODFILE CHECKSUM: c05591899cb3d6d02e404d4b48a02a1e6187d6bd +PODFILE CHECKSUM: 3c829592a4e938c0248c7eb66e1aa9c4493b2334 COCOAPODS: 1.11.2 diff --git a/Riot/Generated/Images.swift b/Riot/Generated/Images.swift index 78b460c56..c681c2fbe 100644 --- a/Riot/Generated/Images.swift +++ b/Riot/Generated/Images.swift @@ -225,6 +225,7 @@ internal struct ImageAsset { internal typealias Image = UIImage #endif + @available(iOS 8.0, tvOS 9.0, watchOS 2.0, macOS 10.7, *) internal var image: Image { let bundle = BundleToken.bundle #if os(iOS) || os(tvOS) @@ -236,13 +237,25 @@ internal struct ImageAsset { let image = Image(named: name) #endif guard let result = image else { - fatalError("Unable to load image named \(name).") + fatalError("Unable to load image asset named \(name).") } return result } + + #if os(iOS) || os(tvOS) + @available(iOS 8.0, tvOS 9.0, *) + internal func image(compatibleWith traitCollection: UITraitCollection) -> Image { + let bundle = BundleToken.bundle + guard let result = Image(named: name, in: bundle, compatibleWith: traitCollection) else { + fatalError("Unable to load image asset named \(name).") + } + return result + } + #endif } internal extension ImageAsset.Image { + @available(iOS 8.0, tvOS 9.0, watchOS 2.0, *) @available(macOS, deprecated, message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") convenience init!(asset: ImageAsset) { diff --git a/Riot/Modules/Common/SwiftUI/VectorHostingController.swift b/Riot/Modules/Common/SwiftUI/VectorHostingController.swift index 504504312..3e9ad98b4 100644 --- a/Riot/Modules/Common/SwiftUI/VectorHostingController.swift +++ b/Riot/Modules/Common/SwiftUI/VectorHostingController.swift @@ -41,10 +41,22 @@ class VectorHostingController: UIHostingController { override func viewDidLoad() { super.viewDidLoad() + + self.view.backgroundColor = .clear + self.registerThemeServiceDidChangeThemeNotification() self.update(theme: self.theme) } + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + + // Fixes weird iOS 15 bug where the view no longer grows its enclosing host + if #available(iOS 15.0, *) { + self.view.invalidateIntrinsicContentSize() + } + } + private func registerThemeServiceDidChangeThemeNotification() { NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeServiceDidChangeTheme, object: nil) } @@ -54,8 +66,6 @@ class VectorHostingController: UIHostingController { } private func update(theme: Theme) { - self.view.backgroundColor = theme.headerBackgroundColor - if let navigationBar = self.navigationController?.navigationBar { theme.applyStyle(onNavigationBar: navigationBar) } diff --git a/Riot/Modules/Room/DataSources/RoomDataSource.m b/Riot/Modules/Room/DataSources/RoomDataSource.m index 7f94a8c2f..9817f503d 100644 --- a/Riot/Modules/Room/DataSources/RoomDataSource.m +++ b/Riot/Modules/Room/DataSources/RoomDataSource.m @@ -377,6 +377,7 @@ const CGFloat kTypingCellHeight = 24; urlPreviewView = [URLPreviewView instantiate]; urlPreviewView.preview = component.urlPreviewData; urlPreviewView.delegate = self; + urlPreviewView.tag = index; [temporaryViews addObject:urlPreviewView]; @@ -416,6 +417,7 @@ const CGFloat kTypingCellHeight = 24; reactionsView = [BubbleReactionsView new]; reactionsView.viewModel = bubbleReactionsViewModel; + reactionsView.tag = index; [reactionsView updateWithTheme:ThemeService.shared.theme]; bubbleReactionsViewModel.viewModelDelegate = self; diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index aa056250b..2c7bacfc3 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -137,7 +137,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; @interface RoomViewController () + RoomDataSourceDelegate, RoomCreationModalCoordinatorBridgePresenterDelegate, RoomInfoCoordinatorBridgePresenterDelegate, DialpadViewControllerDelegate, RemoveJitsiWidgetViewDelegate, VoiceMessageControllerDelegate, SpaceDetailPresenterDelegate, UserSuggestionCoordinatorBridgeDelegate> { // The preview header @@ -249,6 +249,9 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; @property (nonatomic, strong) VoiceMessageController *voiceMessageController; @property (nonatomic, strong) SpaceDetailPresenter *spaceDetailPresenter; +@property (nonatomic, strong) UserSuggestionCoordinatorBridge *userSuggestionCoordinator; +@property (nonatomic, weak) IBOutlet UIView *userSuggestionContainerView; + @end @implementation RoomViewController @@ -452,6 +455,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; [self userInterfaceThemeDidChange]; }]; + [self userInterfaceThemeDidChange]; // Observe URL preview updates. @@ -1019,6 +1023,12 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; [VoiceMessageMediaServiceProvider.sharedProvider setCurrentRoomSummary:dataSource.room.summary]; _voiceMessageController.roomId = dataSource.roomId; + + _userSuggestionCoordinator = [[UserSuggestionCoordinatorBridge alloc] initWithMediaManager:self.roomDataSource.mxSession.mediaManager + room:dataSource.room]; + _userSuggestionCoordinator.delegate = self; + + [self setupUserSuggestionView]; } - (void)onRoomDataSourceReady @@ -2212,6 +2222,27 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; } } +- (void)setupUserSuggestionView +{ + if(!self.isViewLoaded) { + MXLogError(@"Failed setting up user suggestions. View not loaded."); + return; + } + + UIViewController *suggestionsViewController = self.userSuggestionCoordinator.toPresentable; + [suggestionsViewController.view setTranslatesAutoresizingMaskIntoConstraints:NO]; + + [self addChildViewController:suggestionsViewController]; + [self.userSuggestionContainerView addSubview:suggestionsViewController.view]; + + [NSLayoutConstraint activateConstraints:@[[suggestionsViewController.view.topAnchor constraintEqualToAnchor:self.userSuggestionContainerView.topAnchor], + [suggestionsViewController.view.leadingAnchor constraintEqualToAnchor:self.userSuggestionContainerView.leadingAnchor], + [suggestionsViewController.view.trailingAnchor constraintEqualToAnchor:self.userSuggestionContainerView.trailingAnchor], + [suggestionsViewController.view.bottomAnchor constraintEqualToAnchor:self.userSuggestionContainerView.bottomAnchor],]]; + + [suggestionsViewController didMoveToParentViewController:self]; +} + #pragma mark - Jitsi - (void)showJitsiCallWithWidget:(Widget*)widget @@ -4200,6 +4231,11 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; { [self cancelEventSelection]; } + +- (void)roomInputToolbarViewDidChangeTextMessage:(MXKRoomInputToolbarView *)toolbarView +{ + [self.userSuggestionCoordinator processTextMessage:toolbarView.textMessage]; +} #pragma mark - MXKRoomMemberDetailsViewControllerDelegate @@ -6517,4 +6553,22 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; [[LegacyAppDelegate theDelegate] openSpaceWithId:spaceId]; } +#pragma mark - UserSuggestionCoordinatorBridgeDelegate + +- (void)userSuggestionCoordinatorBridge:(UserSuggestionCoordinatorBridge *)coordinator + didRequestMentionForMember:(MXRoomMember *)member + textTrigger:(NSString *)textTrigger +{ + if (textTrigger.length) { + NSString *textMessage = [self.inputToolbarView textMessage]; + textMessage = [textMessage stringByReplacingOccurrencesOfString:textTrigger + withString:@"" + options:NSBackwardsSearch | NSAnchoredSearch + range:NSMakeRange(0, textMessage.length)]; + [self.inputToolbarView setTextMessage:textMessage]; + } + + [self mention:member]; +} + @end diff --git a/Riot/Modules/Room/RoomViewController.xib b/Riot/Modules/Room/RoomViewController.xib index 5b1a0a909..1c8f83913 100644 --- a/Riot/Modules/Room/RoomViewController.xib +++ b/Riot/Modules/Room/RoomViewController.xib @@ -1,9 +1,9 @@ - + - + @@ -32,6 +32,7 @@ + @@ -136,14 +137,14 @@