update caption after deleting item

This commit is contained in:
Michael Kirk 2018-11-09 16:26:12 -06:00
parent ca30a96451
commit d805246cb7
2 changed files with 8 additions and 8 deletions

View file

@ -477,7 +477,7 @@ class MediaGallery: NSObject, MediaGalleryDataSource, MediaTileViewControllerDel
return
}
pageViewController.currentItem = mediaGalleryItem
pageViewController.setCurrentItem(mediaGalleryItem, direction: .forward, animated: false)
pageViewController.willBePresentedAgain()
// TODO fancy zoom animation

View file

@ -44,21 +44,17 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
}
public var currentItem: MediaGalleryItem! {
get {
return currentViewController.galleryItemBox.value
}
set {
setCurrentItem(newValue, direction: .forward, animated: false)
}
return currentViewController.galleryItemBox.value
}
private func setCurrentItem(_ item: MediaGalleryItem, direction: UIPageViewControllerNavigationDirection, animated isAnimated: Bool) {
public func setCurrentItem(_ item: MediaGalleryItem, direction: UIPageViewControllerNavigationDirection, animated isAnimated: Bool) {
guard let galleryPage = self.buildGalleryPage(galleryItem: item) else {
owsFailDebug("unexpetedly unable to build new gallery page")
return
}
self.updateTitle(item: item)
self.updateCaption(item: item)
self.setViewControllers([galleryPage], direction: direction, animated: isAnimated)
self.updateFooterBarButtonItems(isPlayingVideo: false)
}
@ -717,6 +713,10 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
updateTitle(item: currentItem)
}
private func updateCaption(item: MediaGalleryItem) {
self.currentCaptionView.text = item.captionForDisplay
}
private func updateTitle(item: MediaGalleryItem) {
let name = senderName(message: item.message)
portraitHeaderNameLabel.text = name