Skip to content

feat: add support for previewing on mobile #50

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

Merged
merged 6 commits into from
Jun 10, 2024

Conversation

maliroteh-sf
Copy link
Contributor

@maliroteh-sf maliroteh-sf commented Jun 6, 2024

What does this PR do?

Adds support for sf lightning preview app command for mobile.

To run the command, ensure that you have authorized at least one org:

  • sf lightning preview app -o MyOrg -n MyApp -t ios -i 'iPhone 15 Pro Max'
  • sf lightning preview app -o MyOrg -n MyApp -t android -i 'Pixel 5 API 34'

What issues does this PR fix or reference?

@W-15813034@
@W-15813106@
@W-15001240@
@W-15578370@

Screenshot 2024-06-05 at 1 45 53 PM

@maliroteh-sf maliroteh-sf requested a review from a team as a code owner June 6, 2024 16:27
@maliroteh-sf maliroteh-sf requested a review from khawkins June 6, 2024 16:35
Comment on lines 75 to 102
# certificate.installation.steps.android

1. Drag & drop the file on to your booted emulator.
2. %s
3. Browse to the certificate file that you transferred from step 1 (usually under `/sdcard/download`).
4. Follow the on-screen instructions to install it.
5. Tap on `User credentials` under `Credential storage` and verify that your certificate is listed there.
6. Tap on `Trusted credentials` under `Credential storage`. Then tap on `USER` and verify that your certificate is listed there.

# certificate.installation.steps.android.nav-target-api-24-25
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we really need to find a better way in the future b/c showing detailed instructions to the user is not sustainable on Android since they seem to keep changing their Settings menu very often and instructions become outdated

this.spinner.stop();

// 4. Generate self-signed certificate and wait for user to install it
// TODO: update the save location to be the same as server config file path
Copy link
Collaborator

Choose a reason for hiding this comment

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

That actually poses a good question. Given that the user needs to interact with the cert (i.e. for manual installation), it rules out putting it in a temp directory. I guess in the absence of the user being able to specify, I'd be inclined (in the final form) to simply save it in the current working directory.

This is one of the many features that will be exponentially nicer in a VSCode UX. 😐

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may be better to save the cert file in the same location as lwr.config.json since we have another work item where we also need to update the config file to include cert & key. Bit I think in most (if not all) cases process.cwd would be the same as the location of lwr.config.json


# certificate.installation.steps.ios

1. Drag and drop the file on to your booted simulator.
Copy link
Collaborator

Choose a reason for hiding this comment

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

For both platforms, if it doesn't blow out the scope I wonder if we should consider more concise "inline" instructions, providing links to markdown pages on our repo that describe the installation instructions, complete with images? Maybe that could be a stretch goal for beta, or a GA consideration. I'm afraid anything less is likely going to result in confusion for our users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to do something like that at first but on Android the steps for navigating through the Settings app is different from one API to another. So I wasn't sure how that would work out if we wanted to use markdown pages containing screenshots that would be different depending on the emulator API level.

But if we go with printing the instructions to console like I'm doing in this PR, at least then I can programmatically determine what is the API level for the user specified emulator and I can dynamically compose the steps.

But in general I think we should try to see if we can find a solution where the user would not need to install the cert manually (if at all possible)

Copy link
Collaborator

@khawkins khawkins left a comment

Choose a reason for hiding this comment

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

Looks good overall.

@maliroteh-sf maliroteh-sf merged commit 0b0a3ee into salesforcecli:main Jun 10, 2024
1 check passed
@maliroteh-sf maliroteh-sf deleted the mobile-preview branch June 10, 2024 22:19
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.

2 participants