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

Feat/tracking impl #257

Merged
merged 89 commits into from
Apr 24, 2024
Merged

Feat/tracking impl #257

merged 89 commits into from
Apr 24, 2024

Conversation

bohdanprog
Copy link
Collaborator

@bohdanprog bohdanprog commented Apr 17, 2024

Here are three tasks in a single PR; unfortunately, they are linked:

Next time, we plan to approach them partially, hoping for a clearer outcome.

Resolves #236
Resolves #237
Resolves #238

CDFN and others added 30 commits April 11, 2024 10:25
Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How difficult would it be to revert significant styling changes that are beyond the scope of this feature? for example, reverting the UI changes made to:

  1. The GPS pill
  2. The big action buttons
  3. tab navigation container

main reason i ask is mostly related to stuff we've talked about elsewhere in terms of limiting the focus of the changes you introduce. would also help reduce the size of PRs in some cases :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you think about wrapping Home (rendered via HomeTabs component) screen with context we created?

Yeah that makes sense to me 👍

What would be benefits of using useSyncExternalStore vs zustand store?

i don't really have strong thoughts on one vs the other. I'm just more familiar with how to deal with subscriptions (i.e. managing event listeners) with useSyncExternalStore than zustand. if it's straightforward to implement with zustand, i'm all for it!

Also subscribing with different parameters will be the trickiest part. Easiest way would be having a store storing few locations with their own subscriptions and different update periods. There could be 3 pre-configured levels of refresh period (slow, medium, fast). You can just subscribe to whatever update frequency you want via selector

yeah definitely the trickiest part. depending on if i'm reading the suggestion here correctly, it could be interesting!

  • one way i'm reading it is that you're suggesting having 3 location subscriptions set up (i.e. addEventListener() 3 times). i'd be worried about due to the potential cost of having multiple active location subscriptions (not sure how the native side is implemented).
  • the other way is that you're suggesting 1 location subscription, but having selectors (e.g. zustand selector) that do the hard work of determining the update frequency (e.g. based on distance difference)

src/frontend/hooks/tracks/useCurrentTrackStore.ts Outdated Show resolved Hide resolved
src/frontend/hooks/tracks/useTracking.ts Outdated Show resolved Hide resolved
src/frontend/hooks/tracks/useTracking.ts Outdated Show resolved Hide resolved
src/frontend/Navigation/ScreenGroups/AppScreens.tsx Outdated Show resolved Hide resolved
src/frontend/hooks/useCurrentTab.ts Show resolved Hide resolved
src/frontend/Navigation/ScreenGroups/AppScreens.tsx Outdated Show resolved Hide resolved
src/frontend/hooks/useNavigationStore.ts Outdated Show resolved Hide resolved
src/frontend/hooks/useNavigationStore.ts Outdated Show resolved Hide resolved
@bohdanprog
Copy link
Collaborator Author

bohdanprog commented Apr 23, 2024

How difficult would it be to revert significant styling changes that are beyond the scope of this feature? for example, reverting the UI changes made to:

  1. The GPS pill
  2. The big action buttons
  3. tab navigation container

main reason i ask is mostly related to stuff we've talked about elsewhere in terms of limiting the focus of the changes you introduce. would also help reduce the size of PRs in some cases :)

  1. We updated the GPS pill styles (it should match those in the main branch).
  2. I haven't made any changes to the large action button. (If I understand correctly, you are referring to a big button on the map screen, correct?)
  3. Are you referring to the size and tab labels? (We made changes to them, and they now look identical to those in Figma.)

@achou11
Copy link
Member

achou11 commented Apr 23, 2024

1. We updated the GPS pill styles (it should match those in the main branch).

2. I haven't made any changes to the large action button. (If I understand correctly, you are referring to a big button on the map screen, correct?)

3. Are you referring to the size and tab labels? (We made changes to them, and they now look identical to those in Figma.)

Yeah apologies for the confusion. I originally asked the questions because of uncertainties we had internally around the more global design changes we wanted to introduce. Will clarify in our chat on Slack with what we've agreed upon internally, but the short sumary is that you can ignore my question about reverting UI changes and instead keep what you have implemented :)!

Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a note about implementing a feature flag setup so that the tracks feature(s) can be hidden behind a flag so as to not be exposed by default. In this PR, the flag should determine whether the tracks tab is rendered

src/frontend/hooks/useCurrentTab.ts Show resolved Hide resolved
src/frontend/hooks/tracks/useTracking.ts Show resolved Hide resolved
src/frontend/hooks/useFormattedTimeSince.ts Outdated Show resolved Hide resolved
src/frontend/sharedComponents/HomeHeader.tsx Outdated Show resolved Hide resolved
src/frontend/Navigation/ScreenGroups/TabBar/TabBarIcon.tsx Outdated Show resolved Hide resolved
@bohdanprog
Copy link
Collaborator Author

@achou11

yeah very strange - would think doing what's described here (but for the beforeRemove event) would be feasible: https://reactnavigation.org/docs/navigation-events/#screenlisteners-prop-on-the-navigator (haven't tried it myself - I'm just reading through docs and hoping they're accurate 😄 )

about that, I found that beforeRemove call is only when we navigate between stacks.
and in screenListeners option state doesn't have value about the target screen, unfortunately :(
That's why I guess using :

screenListeners={{
        tabPress: handleTabPress,
}}

@CDFN CDFN requested a review from achou11 April 24, 2024 14:08
Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes around the feature flag look good!

Think I mentioned this regression before, but think it should be fixed before merging. Reproduction steps:

  1. Navigate to camera tab
  2. Press big button
  3. Press button in top-left to discard observation (i.e. leave observation creation flow)

After (3), you end up in the map tab, but you should end up in the camera tab.

babel.config.js Outdated Show resolved Hide resolved
@CDFN
Copy link
Collaborator

CDFN commented Apr 24, 2024

According to my response here:
#257 (comment)
behaviour you described is not regression. This is how it worked before. For babel plugins order, I pushed a commit fixing it.

@achou11
Copy link
Member

achou11 commented Apr 24, 2024

According to my response here: #257 (comment) behaviour you described is not regression. This is how it worked before. For babel plugins order, I pushed a commit fixing it.

Ah sorry, missed that! This is a regression compared to the old app, but as you said, this is not something that was introduced with your changes. Thanks for pointing that out! will create a separate issue that someone else can tackle separately :)

Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great initial work! hoping the next pieces will involve less back-and-forth 😄

@CDFN CDFN merged commit 7df0cdb into main Apr 24, 2024
3 checks passed
@CDFN CDFN deleted the feat/tracking-impl branch April 24, 2024 16:27
@CDFN CDFN restored the feat/tracking-impl branch April 24, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recording Tracks GPS/Location is on GPS/Location is off
3 participants