Merge branch 'ios-release'

This commit is contained in:
Maurice Parker 2020-06-18 17:45:12 -05:00
commit 21e79250db
2 changed files with 31 additions and 8 deletions

View File

@ -23,6 +23,9 @@ class MasterTimelineTableViewCell: VibrantTableViewCell {
return NonIntrinsicImageView(image: AppAssets.timelineStarImage)
}()
private var unreadIndicatorPropertyAnimator: UIViewPropertyAnimator?
private var starViewPropertyAnimator: UIViewPropertyAnimator?
var cellData: MasterTimelineCellData! {
didSet {
updateSubviews()
@ -35,7 +38,12 @@ class MasterTimelineTableViewCell: VibrantTableViewCell {
}
override func prepareForReuse() {
unreadIndicatorPropertyAnimator?.stopAnimation(true)
unreadIndicatorPropertyAnimator = nil
unreadIndicatorView.isHidden = true
starViewPropertyAnimator?.stopAnimation(true)
starViewPropertyAnimator = nil
starView.isHidden = true
}
@ -203,10 +211,15 @@ private extension MasterTimelineTableViewCell {
func updateUnreadIndicator() {
if !unreadIndicatorView.isHidden && cellData.read && !cellData.starred {
UIView.animate(withDuration: 0.66, animations: { self.unreadIndicatorView.alpha = 0 }) { _ in
self.unreadIndicatorView.isHidden = true
self.unreadIndicatorView.alpha = 1
unreadIndicatorPropertyAnimator = UIViewPropertyAnimator(duration: 0.66, curve: .easeInOut) { [weak self] in
self?.unreadIndicatorView.alpha = 0
}
unreadIndicatorPropertyAnimator?.addCompletion { [weak self] _ in
self?.unreadIndicatorView.isHidden = true
self?.unreadIndicatorView.alpha = 1
self?.unreadIndicatorPropertyAnimator = nil
}
unreadIndicatorPropertyAnimator?.startAnimation()
} else {
showOrHideView(unreadIndicatorView, cellData.read || cellData.starred)
}
@ -214,10 +227,15 @@ private extension MasterTimelineTableViewCell {
func updateStarView() {
if !starView.isHidden && cellData.read && !cellData.starred {
UIView.animate(withDuration: 0.66, animations: { self.starView.alpha = 0 }) { _ in
self.starView.isHidden = true
self.starView.alpha = 1
starViewPropertyAnimator = UIViewPropertyAnimator(duration: 0.66, curve: .easeInOut) { [weak self] in
self?.starView.alpha = 0
}
starViewPropertyAnimator?.addCompletion { [weak self] _ in
self?.starView.isHidden = true
self?.starView.alpha = 1
self?.starViewPropertyAnimator = nil
}
starViewPropertyAnimator?.startAnimation()
} else {
showOrHideView(starView, !cellData.starred)
}

View File

@ -76,11 +76,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
private var expandedTable = Set<ContainerIdentifier>()
private var readFilterEnabledTable = [FeedIdentifier: Bool]()
private var shadowTable = [[Node]]()
private(set) var preSearchTimelineFeed: Feed?
private var lastSearchString = ""
private var lastSearchScope: SearchScope? = nil
private var isSearching: Bool = false
private var savedSearchArticles: ArticleArray? = nil
private var savedSearchArticleIds: Set<String>? = nil
var isTimelineViewControllerPending = false
var isArticleViewControllerPending = false
@ -859,6 +862,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
func beginSearching() {
isSearching = true
preSearchTimelineFeed = timelineFeed
savedSearchArticles = articles
savedSearchArticleIds = Set(articles.map { $0.articleID })
setTimelineFeed(nil, animated: true)
@ -866,9 +870,9 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
}
func endSearching() {
if let ip = currentFeedIndexPath, let node = nodeFor(ip), let feed = node.representedObject as? Feed {
if let oldTimelineFeed = preSearchTimelineFeed {
emptyTheTimeline()
timelineFeed = feed
timelineFeed = oldTimelineFeed
masterTimelineViewController?.reinitializeArticles(resetScroll: true)
replaceArticles(with: savedSearchArticles!, animated: true)
} else {
@ -877,6 +881,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
lastSearchString = ""
lastSearchScope = nil
preSearchTimelineFeed = nil
savedSearchArticleIds = nil
savedSearchArticles = nil
isSearching = false