baker icon indicating copy to clipboard operation
baker copied to clipboard

Sorting Newsstand Shelf View by a different variable

Open lostinjapan opened this issue 13 years ago • 4 comments

Has anyone customized the shelf view page? I don't mean the background, I mean to change the sort or display 3 icons across instead of 2 and that type of customization.

Basically I am trying to make a newsstand app for a language publication of different levels. I would like all publications of level 1 difficulty to appear together followed by all publications of level 2 and all publications of level 3.

Is it possible to pass a variable from your hpub issue that can be read by the shelf for a sort? I see that the shelf sorts based on date, so I can imagine a scenario in which it could sort by some other variable.

Any clues about passing variable from an issue to the script that controls how the shelf appears (or simply the name of which script file(s) I would need to edit) would be very useful to me.

Also, I suppose as a hack that I could adjust the dates of my "issues" so that all publications in level 1 appear with a date in year 2013, all publications in level 2 have a date 2014 and so on...but I'd like to figure out a better way if possible.

Thank you in advance for any thoughts on this.

(Edit) Or am I overlooking that this could be accomplished by listing issues in a different order in my shelf.json file? I actually haven't tried that since I was using MagRocket

(2nd Edit) Is IssuesManager.m the main file I should look at, specifically around line 84 where it creates a sorted array based on the date? Also, do I create a custom variable by including it in the shelf.json file?

lostinjapan avatar May 21 '13 03:05 lostinjapan

Baker doesn't support this, so it's really up to you if you want to modify the code to support your needs. :)

You have to touch likely all around the BakerShel part, from the JSON parser to the visualization part.

folletto avatar May 21 '13 10:05 folletto

There's two places in IssuesManager.m that relate to issue adding and sorting: The arrangement of NSMutableArray *tmpIssues from line 79 in the the -(BOOL)refresh method, which is what you'll want to alter, and down in -(void)updateNewsstandIssuesList:(NSArray *)issuesList if you want to exclude any issues from the shelf based on whatever criteria you have.

Yes, if you add a field to the shelf.json, you'll be able to access it here and use it for a custom sort comparator, or even an additional one (e.g. sort by your custom level field, then by date).

freney avatar May 21 '13 23:05 freney

Thank you very much for your kind replies.

@folletto I realize it's not supported, so I'm sorry for asking. I just wanted a little help knowing where to modify.

@freney Thank you for your detailed input. Yes, I think I'd want to sort by level and then by date.

It seems our Newsstand project is going to be shelved for a while (har, har) in favor of standalone releases until we have enough issues built up, but it is very good to have a concept of the next step. Thanks again.

lostinjapan avatar May 22 '13 04:05 lostinjapan

No reason to be sorry, as you can see you received good advices, it was totally worth asking. ;)

folletto avatar May 22 '13 10:05 folletto