@@ -109,7 +109,7 @@ - (void)viewDidLoad {
109109 self.dashboardSingleMode = NO ;
110110
111111 self.storyTitlesTable .backgroundColor = UIColorFromRGB (0xf4f4f4 );
112- self.storyTitlesTable .separatorColor = UIColorFromRGB (0xE9E8E4 );
112+ self.storyTitlesTable .separatorColor = UIColorFromLightSepiaMediumDarkRGB (0xE9E8E4 , 0xF2E9DE , 0x383838 , 0x222222 );
113113 if (@available (iOS 15.0 , *)) {
114114 self.storyTitlesTable .allowsFocus = NO ;
115115 }
@@ -1793,8 +1793,38 @@ - (void)finishedLoadingFeed:(NSDictionary *)results feedPage:(NSInteger)feedPage
17931793 }
17941794
17951795 if (!self.isPhoneOrCompact ) {
1796- [appDelegate.storyPagesViewController resizeScrollView ];
1797- [appDelegate.storyPagesViewController setStoryFromScroll: YES ];
1796+ NSInteger pageIndex = appDelegate.storyPagesViewController .currentPage .pageIndex ;
1797+ BOOL storyChanged = NO ;
1798+
1799+ // Check if the story at the current page position has changed after the refresh.
1800+ // This catches all mismatch cases: story moved, story replaced, story gone.
1801+ if (pageIndex >= 0 && pageIndex < storiesCollection.storyLocationsCount && appDelegate.activeStory ) {
1802+ NSInteger storyIndex = [storiesCollection indexFromLocation: pageIndex];
1803+ if (storyIndex >= 0 ) {
1804+ NSDictionary *storyAtPage = [storiesCollection.activeFeedStories objectAtIndex: storyIndex];
1805+ storyChanged = ![[appDelegate.activeStory objectForKey: @" story_hash" ]
1806+ isEqualToString: [storyAtPage objectForKey: @" story_hash" ]];
1807+ }
1808+ } else if (appDelegate.activeStory && storiesCollection.storyLocationsCount > 0 ) {
1809+ // Page index out of range after refresh (fewer stories or initial state)
1810+ storyChanged = YES ;
1811+ }
1812+
1813+ if (storyChanged && storiesCollection.storyLocationsCount > 0 ) {
1814+ // Server data changed the story list. Select the first story and
1815+ // reset pages so the detail pane stays in sync.
1816+ NSInteger firstIndex = [storiesCollection indexFromLocation: 0 ];
1817+ if (firstIndex >= 0 ) {
1818+ appDelegate.activeStory = [storiesCollection.activeFeedStories objectAtIndex: firstIndex];
1819+ }
1820+ appDelegate.storyPagesViewController .currentPage .pageIndex = -2 ;
1821+ appDelegate.storyPagesViewController .nextPage .pageIndex = -2 ;
1822+ appDelegate.storyPagesViewController .previousPage .pageIndex = -2 ;
1823+ [appDelegate.storyPagesViewController changePage: 0 animated: NO ];
1824+ } else {
1825+ [appDelegate.storyPagesViewController resizeScrollView ];
1826+ [appDelegate.storyPagesViewController setStoryFromScroll: YES ];
1827+ }
17981828 }
17991829 [appDelegate.storyPagesViewController advanceToNextUnread ];
18001830
@@ -4455,7 +4485,7 @@ - (void)updateTheme {
44554485
44564486 self.view .backgroundColor = UIColorFromRGB (0xf4f4f4 );
44574487 self.storyTitlesTable .backgroundColor = UIColorFromRGB (0xf4f4f4 );
4458- self.storyTitlesTable .separatorColor = UIColorFromRGB (0xE9E8E4 );
4488+ self.storyTitlesTable .separatorColor = UIColorFromLightSepiaMediumDarkRGB (0xE9E8E4 , 0xF2E9DE , 0x383838 , 0x222222 );
44594489 if (@available (iOS 13.0 , *)) {
44604490 self.storyTitlesTable .overrideUserInterfaceStyle = ThemeManager.shared .isDarkTheme ? UIUserInterfaceStyleDark : UIUserInterfaceStyleLight;
44614491 }
0 commit comments