Fetch posts on login, purge on logout#24
Conversation
|
I probably should've mentioned this in #22, but there's actually an experimental, undocumented API feature (originally deployed for the v2.0 Android app) that saves on API calls upon login. When you call the We should of course support reloading collections + posts separately (once logged in), but during login, I think we should include the Given that information, does this PR need to be changed, or can we still use it as-is for features like #32? |
|
That's a good parameter to have! Because any calls to the WriteFreely/Write.as API are being handled by the Swift package, rather than this client app, I think it makes more sense to implement this as is for now, and open an issue in the package repo to add something like a Once that's implemented in the package, we can add the behaviour to the client. You mention that it's "experimental", @thebaer — is there anything that might need to be guarded against in production? |
|
That sounds like a good plan! As for being "experimental," I mostly mention that for the audience, to note we can change this particular interface at any time without notice. But otherwise it's ready and safe to use in production -- we just need to pick which parameter/value we want to make "official" (again, my suggestion: |
a9f5878 to
beda0d7
Compare
Closes #13.
This PR adds an API call (and result handler) to the WriteFreelyModel to fetch user posts from the server, and calls it on login. The handler matches posts that are in a collection to the fetched collections (hence its dependency) and then adds them to the PostStore, which updates the PostListView.
A
purge()method is also added to the PostStore, to purge the fetch posts when the user logs out.