diff --git a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift index 6b75d3875..c74bde8cf 100644 --- a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift +++ b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift @@ -69,7 +69,7 @@ extension HashtagTimelineViewModel.State { override func didEnter(from previousState: GKState?) { super.didEnter(from: previousState) - guard let viewModel = viewModel, let stateMachine = stateMachine else { return } + guard viewModel != nil, let stateMachine = stateMachine else { return } stateMachine.enter(Loading.self) } diff --git a/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift b/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift index ecc1c0c02..40d171c22 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift @@ -59,7 +59,7 @@ final class SearchDetailViewController: PageboyViewController, NeedsDependency { let searchController: CustomSearchController = { let searchController = CustomSearchController() searchController.automaticallyShowsScopeBar = false - searchController.dimsBackgroundDuringPresentation = false + searchController.obscuresBackgroundDuringPresentation = false return searchController }() private(set) lazy var searchBar: UISearchBar = { diff --git a/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift b/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift index 1b2d62211..4d5691336 100644 --- a/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift +++ b/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift @@ -241,23 +241,24 @@ extension MediaHostToMediaPreviewViewControllerAnimatedTransitioning { return rect }() let maskLayerToPath = maskLayerToRect.flatMap { UIBezierPath(rect: $0) }?.cgPath - let maskLayerToFinalRect: CGRect? = { - guard case .attachments = transitionItem.source else { return nil } - var rect = maskLayerToRect ?? transitionMaskView.frame - // clip tabBar when bar visible - guard let tabBarController = toVC.tabBarController, - !tabBarController.tabBar.isHidden, - let tabBarSuperView = tabBarController.tabBar.superview - else { return rect } - let tabBarFrameInWindow = tabBarSuperView.convert(tabBarController.tabBar.frame, to: nil) - let offset = rect.maxY - tabBarFrameInWindow.minY - guard offset > 0 else { return rect } - rect.size.height -= offset - return rect - }() - + + // FIXME: - let maskLayerToFinalPath = maskLayerToFinalRect.flatMap { UIBezierPath(rect: $0) }?.cgPath +// let maskLayerToFinalRect: CGRect? = { +// guard case .attachments = transitionItem.source else { return nil } +// var rect = maskLayerToRect ?? transitionMaskView.frame +// // clip tabBar when bar visible +// guard let tabBarController = toVC.tabBarController, +// !tabBarController.tabBar.isHidden, +// let tabBarSuperView = tabBarController.tabBar.superview +// else { return rect } +// let tabBarFrameInWindow = tabBarSuperView.convert(tabBarController.tabBar.frame, to: nil) +// let offset = rect.maxY - tabBarFrameInWindow.minY +// guard offset > 0 else { return rect } +// rect.size.height -= offset +// return rect +// }() +// let maskLayerToFinalPath = maskLayerToFinalRect.flatMap { UIBezierPath(rect: $0) }?.cgPath if let maskLayerToPath = maskLayerToPath { maskLayer.path = maskLayerToPath diff --git a/MastodonSDK/Sources/MastodonExtension/UIImage.swift b/MastodonSDK/Sources/MastodonExtension/UIImage.swift index e3560af63..bb50a1428 100644 --- a/MastodonSDK/Sources/MastodonExtension/UIImage.swift +++ b/MastodonSDK/Sources/MastodonExtension/UIImage.swift @@ -48,7 +48,7 @@ extension UIImage { guard let outputImage = filter.outputImage else { return nil } var bitmap = [UInt8](repeating: 0, count: 4) - let context = CIContext(options: [.workingColorSpace: kCFNull]) + let context = CIContext(options: [.workingColorSpace: kCFNull as Any]) context.render(outputImage, toBitmap: &bitmap, rowBytes: 4, bounds: CGRect(x: 0, y: 0, width: 1, height: 1), format: .RGBA8, colorSpace: nil) return UIColor(red: CGFloat(bitmap[0]) / 255, green: CGFloat(bitmap[1]) / 255, blue: CGFloat(bitmap[2]) / 255, alpha: CGFloat(bitmap[3]) / 255) diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView+ViewModel.swift index eec57cb5a..8367f30ec 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView+ViewModel.swift @@ -97,15 +97,11 @@ extension NotificationView.ViewModel { $timestamp, timestampUpdatePublisher.prepend(Date()).eraseToAnyPublisher() ) - .sink { [weak self] timestamp, _ in - guard let self = self else { return } - guard let timestamp = timestamp else { - notificationView.dateLabel.configure(content: PlaintextMetaContent(string: "")) - return - } - - let text = timestamp.localizedTimeAgoSinceNow - notificationView.dateLabel.configure(content: PlaintextMetaContent(string: text)) + .map { timestamp, _ in + PlaintextMetaContent(string: timestamp?.localizedTimeAgoSinceNow ?? "") + } + .sink { text in + notificationView.dateLabel.configure(content: text) } .store(in: &disposeBag) // notification type indicator diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift index f3d9f6f80..0834e29c8 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift @@ -451,7 +451,7 @@ extension StatusView.ViewModel { pollCountdownDescription ) .sink { pollVoteDescription, pollCountdownDescription in - statusView.pollVoteCountLabel.text = pollVoteDescription ?? "-" + statusView.pollVoteCountLabel.text = pollVoteDescription statusView.pollCountdownLabel.text = pollCountdownDescription ?? "-" } .store(in: &disposeBag) diff --git a/MastodonTests/MastodonTests.swift b/MastodonTests/MastodonTests.swift index 7264dde64..44e2cd95a 100644 --- a/MastodonTests/MastodonTests.swift +++ b/MastodonTests/MastodonTests.swift @@ -42,7 +42,9 @@ extension MastodonTests { } receiveValue: { domain in expectation.fulfill() } - wait(for: [expectation], timeout: 10) + withExtendedLifetime(cancellable) { + wait(for: [expectation], timeout: 10) + } } @available(iOS 15.0, *)