#1500 (load first story when opening feed)

- Fixed default behavior of “when opening a site” preference on iPad, so if the preference hasn’t been changed, shows the first story by default, matching the preference.
- Added support for this preference on iPhone, where it defaults to show the stories.
This commit is contained in:
David Sinclair 2022-04-21 20:33:11 -07:00 committed by Samuel Clay
parent 5c2d657d0e
commit edd22ffcd8
4 changed files with 29 additions and 1 deletions

View file

@ -64,6 +64,7 @@
@property (nonatomic) FeedDetailTextSize textSize;
@property (nonatomic, readwrite) BOOL showImagePreview;
@property (nonatomic, readwrite) BOOL invalidateFontCache;
@property (nonatomic, readwrite) BOOL cameFromFeedsList;
- (void)reloadData;
- (void)resetFeedDetail;

View file

@ -637,6 +637,7 @@ typedef NS_ENUM(NSUInteger, MarkReadShowMenu)
self.pageFinished = NO;
self.isOnline = YES;
self.isShowingFetching = NO;
self.cameFromFeedsList = YES;
self.scrollingMarkReadRow = NSNotFound;
appDelegate.activeStory = nil;
[storiesCollection setStories:nil];
@ -1327,7 +1328,7 @@ typedef NS_ENUM(NSUInteger, MarkReadShowMenu)
- (void)testForTryFeed {
if (!appDelegate.inFindingStoryMode ||
!appDelegate.tryFeedStoryId) {
if (appDelegate.activeStory == nil && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad && appDelegate.splitViewController.splitBehavior != UISplitViewControllerSplitBehaviorOverlay) {
if (appDelegate.activeStory == nil && self.cameFromFeedsList && ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone || appDelegate.splitViewController.splitBehavior != UISplitViewControllerSplitBehaviorOverlay)) {
NSInteger storyIndex = [storiesCollection indexFromLocation:0];
if (storyIndex == -1) {
@ -1337,6 +1338,10 @@ typedef NS_ENUM(NSUInteger, MarkReadShowMenu)
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
NSString *feedOpening = [preferences stringForKey:@"feed_opening"];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad && feedOpening == nil) {
feedOpening = @"story";
}
if ([feedOpening isEqualToString:@"story"]) {
appDelegate.activeStory = [[storiesCollection activeFeedStories] objectAtIndex:storyIndex];
[appDelegate loadStoryDetailView];

View file

@ -2174,6 +2174,8 @@
[self.storyPagesViewController.view setNeedsLayout];
[self.storyPagesViewController.view layoutIfNeeded];
self.feedDetailViewController.cameFromFeedsList = NO;
NSDictionary *params = @{@"location" : @(activeStoryLocation), @"animated" : @(animated)};
if (self.isCompactWidth) {

View file

@ -94,6 +94,26 @@
<key>Key</key>
<string>default_confirm_read_filter</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Title</key>
<string>When opening a site</string>
<key>Titles</key>
<array>
<string>Open first story</string>
<string>Show stories</string>
</array>
<key>DefaultValue</key>
<string>list</string>
<key>Values</key>
<array>
<string>story</string>
<string>list</string>
</array>
<key>Key</key>
<string>feed_opening</string>
</dict>
<dict>
<key>FooterText</key>
<string>You can change this setting in the Infrequent Site Stories view.</string>