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: add debug menu to specify endpoint for mobile token server #5049

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

reidzeibel
Copy link
Member

closes https://github.com/AtB-AS/kundevendt/issues/20084

Pretty much self-explanatory, adds debug menu for specifying the mobile token server endpoint.
If there's a better alternative than using the storage function I would love to know more about it 😄

mobile.token.debug.webm

@reidzeibel reidzeibel marked this pull request as ready for review February 28, 2025 08:21
@reidzeibel reidzeibel self-assigned this Feb 28, 2025

const saveDebugIpAddress = async (ipAddress: string) => {
if (ipAddress.length > 0) {
const fullAddress = `http://${ipAddress}:8080`;
Copy link
Member

Choose a reason for hiding this comment

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

Not quite sure what's useful to test in practice, but should we have the input be the whole address instead of just the IP? If it's useful to e.g. for point a prod device to staging servers, where we don't have access to a server running on a local IP.

Copy link
Member

@jorelosorio jorelosorio Mar 4, 2025

Choose a reason for hiding this comment

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

We usually save that into the .env file and read from it.
NOTE: But I see there is a menu so, I agree then that should be full address here

Copy link
Member Author

Choose a reason for hiding this comment

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

We can change it to a whole IP (probably with a http:// prefix added) 👍🏼

Also, pointing a prod device to staging server won't work, because the tokens on Prod are different from tokens from Staging.

This is just to make it easier for testing on staging, either for reproducing a bug, or testing/developing new functionality. For example: we want to replicate a bug with creating tokens, we can just point the token server to local, instead of changing some parameters from the code to allow debug. These changes might be minor, but the added overhead of having to modify the server is something that we could have avoided with this menu.

@@ -0,0 +1,58 @@
import {Button} from '@atb/components/button';
import {ThemeText} from '@atb/components/text';
import {storage} from '@atb/storage';
Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding storage, we recently created usePersistedBoolState.
We might want to either create one for string as well, or make the existing one general purpose. @gorandalum

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it is possible to refactor it into a more generic usePersistedState.

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.

5 participants