If we always refresh on focus then we will
be making many redundant requests, as well as
causing the list to jump around whenever we
navigate back/forward.
The only downside to this is occasionally the
data may be stale, however the user can just
pull down on the list to refresh.
Closes#165
If `bests` is always an empty array then our logic
for detecting zero graphs is wrong. Now when we haven't
loaded any data `bests` is undefined instead of []
Every time we create/update/delete fire a DeviceEventEmitter
event for gym sets. Then we subscribe to the changes in relevant
components.
Also fixed flickering of "No data yet" on graphs page.
Also prevent flickering of "No sets found"
message on first load.
The infinite scrolling issue was a side-effect
of me messing with our memoization. Some places
didn't specify their deps properly.
This must have been considered a bug in the
React Native Paper codebase, but this was me fixing
the track color being wrong when system theme and app
theme weren't the same.
When we used navigation params to decide whether
or not to update the SetList, we broke reacting to
settings changes. This is because we used to update settings
whenever the user navigated to the page.
Also after saving it makes more sense to just
navigate to PlanList instead of calling
navigation.goBack(). This way we can make sure
we have up-to-date data.
The old way would typically lead to us seeing
stale data. E.g.
1. Tap on a plan
2. Tap on edit
3. Change details of the plan
4. Press save
5. See old plan
Now when we save we instead see the original list of plans.
Previously we would always update the created
field by making a new Date object, even if
the user didn't pick a new date. On some
devices this might slightly change the time
of the day, meaning it jumps somewhere else
on the home page.
Closes brandon.presley/Massive#162
We should just keep it simple and get the most recent set instead of
trying to figure out what the best kind of maximum would be.