Skip to content

Conversation

@esthor
Copy link
Contributor

@esthor esthor commented Aug 12, 2022

Summary:

Hey, so this is a WIP for listing available apple devices in an interactive cli prompt. The intention of this is to be able to let the user select an available simulator vs. having to paste device name/udid strings in.

I wanted to put this up as a WIP first because I don't know which path to take next...

  1. I could have this be its own helper function, that just lists out the sims (its current state) -- Do we want this as an optional helper for users?
  2. I could merge it into the run-ios flow (initial thoughts: if user doesn't select a sim, one isn't booted or the one they supply isn't available/existing, instead of fallbacks we give this prompt and then carry-on the run-ios command)
  3. Something else? Maybe a combination of 1 & 2 (it's available standalone, and also inside run-ios)? 🤔

Some advice would be really helpful here as my only experience with the CLI has been my own (and teams') usage. I don't feel I have the context to make a judgement call here for a whole community. Maybe it's super obvious/simple, I just don't know 🤷

Test Plan:

WIP

Fixes #367

@thymikee
Copy link
Member

How does it look like from the UI perspective? Can you share a screenshot maybe? :)

@esthor
Copy link
Contributor Author

esthor commented Aug 22, 2022

Yeah, definitely. It looks like this right now:

Screen Recording 2022-08-22 at 12 24 28 PM

@esthor
Copy link
Contributor Author

esthor commented Aug 22, 2022

I was thinking about it a bit more, and it should probably not be its own function, but be added to the run-ios command. I think in two cases:

  1. By passing an extra argument/flag like run-ios --list-simulators
  2. Replacing the fallbackSimulators logic with this interactive approach. (fallbackSimulators seems kinda jank anyway...I'd thought of having them live together, but fallbackSimulators seems like a pain to maintain and is a "dumb" approach compared to just asking the user what they want in a simple way vs. assuming)

What do you think?

@liamjones
Copy link
Contributor

This looks nice! Any chance it could list connected real devices as well as simulators too?

@thymikee thymikee requested a review from adamTrz August 26, 2022 11:46
@adamTrz
Copy link
Collaborator

adamTrz commented Aug 26, 2022

Thanks for the contribution @esthor ! 💪

I wanted to put this up as a WIP first because I don't know which path to take next...
I could have this be its own helper function, that just lists out the sims (its current state) -- Do we want this as an optional helper for users?
I could merge it into the run-ios flow (initial thoughts: if user doesn't select a sim, one isn't booted or the one they supply isn't available/existing, instead of fallbacks we give this prompt and then carry-on the run-ios command)
Something else? Maybe a combination of 1 & 2 (it's available standalone, and also inside run-ios)? 🤔

Maybe sth like what doctor is doing? List available devices and if user taps "exit" key we will skip selection of device and fall back to default behaviour? WDYT?

Also, can you add (Booted) info for your listing to show which device is booted and can be used?

@esthor
Copy link
Contributor Author

esthor commented Sep 12, 2022

This looks nice! Any chance it could list connected real devices as well as simulators too?

Yes! Good call. I didn't test this out, but should be doable. I'll put them at the top, and maybe flag them in some way that makes it obvious. I'm imagining that in most cases, if you have a connected physical device, your intention is probably to use that, so I'll put those first.

@esthor
Copy link
Contributor Author

esthor commented Sep 12, 2022

Thanks for the contribution @esthor ! 💪

I wanted to put this up as a WIP first because I don't know which path to take next...
I could have this be its own helper function, that just lists out the sims (its current state) -- Do we want this as an optional helper for users?
I could merge it into the run-ios flow (initial thoughts: if user doesn't select a sim, one isn't booted or the one they supply isn't available/existing, instead of fallbacks we give this prompt and then carry-on the run-ios command)
Something else? Maybe a combination of 1 & 2 (it's available standalone, and also inside run-ios)? 🤔

Maybe sth like what doctor is doing? List available devices and if user taps "exit" key we will skip selection of device and fall back to default behaviour? WDYT?

Also, can you add (Booted) info for your listing to show which device is booted and can be used?

Oh, that sounds interesting. I will take a look at how the doctor works, but sounds very good to me.

And yeah, will add a Booted and a Connected flag or section or some way to call those out and have them show at the top of the list.

  • Add 'Booted' / 'Available'
  • Add 'Connected Physical Devices'

@adamTrz
Copy link
Collaborator

adamTrz commented Dec 7, 2022

Hi @esthor . Do you need any assistance with wrapping this PR? 🙂
Happy to help and continue on this PR if you are swarmed with other tasks :)

@esthor
Copy link
Contributor Author

esthor commented Dec 21, 2022

Hey! Going to look at it this week. 🙏

@adamTrz
Copy link
Collaborator

adamTrz commented Jan 20, 2023

Took the liberty of pushing this PR a bit further - add --list-devices param option to run-ios command:

Screenshot 2023-01-20 at 15 49 03

As visible on screenshot we will also now show connected iPhone's as well.

@adamTrz adamTrz changed the title WIP: feat: List available apple devices feat: List available apple devices Jan 20, 2023
Co-authored-by: Szymon Rybczak <szymon.rybczak@gmail.com>
@github-actions github-actions bot added the docs Documentation change label Jan 20, 2023
@esthor
Copy link
Contributor Author

esthor commented Jan 20, 2023

Oh my gosh. You guys are fantastic. Sorry for delaying this so much. Turns out having a new child can throw off my scheduling. 😂 👨‍🍼 Please lmk how I can assist today

@adamTrz
Copy link
Collaborator

adamTrz commented Jan 20, 2023

Oh my gosh. You guys are fantastic. Sorry for delaying this so much. Turns out having a new child can throw off my scheduling. 😂 👨‍🍼 Please lmk how I can assist today

No worries, there are priorities I guess 👶🏻

You can try to run it locally and see how it goes ;)

@esthor
Copy link
Contributor Author

esthor commented Jan 24, 2023

Nice! Ran it locally, and it's looks great for both iOS and Android! 🚀

@adamTrz adamTrz merged commit ee15ba3 into react-native-community:main Jan 25, 2023
@thymikee thymikee changed the title feat: List available apple devices feat: list available apple devices with run-ios --list-devices Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation change feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve run-ios experience when selecting a device/simulator

5 participants