Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable favoriting of sessions #6

Open
BasThomas opened this issue Aug 11, 2016 · 9 comments
Open

Enable favoriting of sessions #6

BasThomas opened this issue Aug 11, 2016 · 9 comments

Comments

@BasThomas
Copy link
Collaborator

This can then be used to filter only your favorite sessions, for example. This should probably use Core Data, but we might get away with NSUserDefaults for now?

@davedelong
Copy link

NSUbiquitousKeyValueStore would give you rudimentary favorites syncing for free, assuming you just synced a list of session identifiers.

@lfarah
Copy link

lfarah commented Aug 26, 2016

@BasThomas I almost finished the functionality. I added my new FavoriteTableViewCell to the SessionDetailsViewController but it won't show up. On what other class do I need to register and add the nib?

You can check my code in my fork

@BasThomas
Copy link
Collaborator Author

Because your numberOfRowsInSection returns 4, not 5. Also, favoriting crashes the app as a Presentation is not a valid for saving in NSUserDefaults.

@BasThomas
Copy link
Collaborator Author

@davedelong I don't have experience with NSUbiquitousKeyValueStore, but that sounds promising. PR welcome!

@davedelong
Copy link

@BasThomas it's pretty much just like an NSUserDefaults that syncs over the user's iCloud account. A notification gets posted when there's new content.

For storing favorites, there are two really simple approaches you could take:

  1. Have a key "favorites" whose value is an array of session identifiers. This is pretty simple, but prone to merge conflicts. If two devices are updating the list of favorites at roughly the same time, one is going to lose out.
  2. Have a key be "\(sessionIdentifier)-favorite" (or something similar), and then value is a Bool of whether or not the session is favorited. This is less prone to merge conflicts.

You're only allowed up to 1,024 keys in the KVS, and only up to 1MB of data. But given the size of the conference, I'm guessing you'd fall well short of that limit. :)

@BasThomas
Copy link
Collaborator Author

Cool! Might take a look at it this weekend.

@lfarah
Copy link

lfarah commented Aug 26, 2016

@BasThomas new commit released my fork fixing what you talked about.

New question: why only the first talk for each hour have a favorite? How does the app handle these sections?

@BasThomas
Copy link
Collaborator Author

Because of the difference between a presentation and Q&A. These are separate VCs, and you haven't yet added the favorite button to Q&A (see OfficeHoursDetailViewController).

@lfarah
Copy link

lfarah commented Aug 27, 2016

Oh, that's gonna be hard because Presentation is different than Session. Lemme try.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants