Warning fixes

This commit is contained in:
Sven Weidauer 2022-06-06 13:18:30 +02:00
parent b9b4b5a853
commit 1b97feba62
7 changed files with 29 additions and 30 deletions

View File

@ -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)
}

View File

@ -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 = {

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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, *)