- Improved glitches with iPad grid view.
- Fixed stories being marked as read while scrolling from a long story to a short story.
This commit is contained in:
David Sinclair 2023-08-29 16:33:12 -06:00
parent 41768bed14
commit a7ca7f0fa2
3 changed files with 14 additions and 2 deletions

View file

@ -98,7 +98,7 @@ struct StoryPagesView: UIViewControllerRepresentable {
let size = storyPagesViewController.currentPage.webView.scrollView.contentSize
storyPagesViewController.preferredContentSize = CGSize(width: size.width, height: 200)
storyPagesViewController.preferredContentSize = CGSize(width: size.width, height: 1000)
storyPagesViewController.currentPage.webView.evaluateJavaScript(
"document.body.lastChild.getBoundingClientRect().bottom + window.scrollY"

View file

@ -136,6 +136,8 @@ class FeedDetailViewController: FeedDetailObjCViewController {
var pendingStories = [Story.ID : Story]()
var suppressMarkAsRead = false
func deferredReload(story: Story? = nil) {
reloadWorkItem?.cancel()
@ -241,7 +243,13 @@ extension FeedDetailViewController: FeedDetailInteraction {
let indexPath = IndexPath(row: story.index, section: 0)
suppressMarkAsRead = true
didSelectItem(at: indexPath)
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.suppressMarkAsRead = false
}
}
func reading(story: Story) {
@ -249,6 +257,10 @@ extension FeedDetailViewController: FeedDetailInteraction {
}
func read(story: Story) {
if suppressMarkAsRead {
return
}
let dict = story.dictionary
if isSwiftUI, storiesCollection.isStoryUnread(dict) {

View file

@ -1553,7 +1553,7 @@
NSInteger position = floor(self->scrollPct * strongSelf.webView.scrollView.contentSize.height);
NSInteger maxPosition = (NSInteger)(floor(strongSelf.webView.scrollView.contentSize.height - strongSelf.webView.frame.size.height));
if (position > maxPosition) {
NSLog(@"Position too far, scaling back to max position: %ld > %ld", (long)position, (long)maxPosition);
NSLog(@"Position too far, scaling back to max position: %@ > %@", @(position), @(maxPosition));
position = maxPosition;
}
if (position > 0) {