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

Add OnboardingPreview #594

Merged
merged 11 commits into from
Jun 30, 2023
Merged

Add OnboardingPreview #594

merged 11 commits into from
Jun 30, 2023

Conversation

maciek-rdx
Copy link
Contributor

@maciek-rdx maciek-rdx commented Jun 28, 2023

Jira ticket: no ticket, fine without, likely unless we decide that some testing is necessary. Read more in Notes 👇

Description

This PR brings a preview of the Onboarding feature.

Notes

I implemented it according to what we agreed upon with @CyonAlexRDX. It works, but there is a couple of things that I don't like about it and we can potentially do better:

  • most importantly, I don't like the fact that we're cluttering the production code with preview-related stuff 😬 Optimally, I'd rather keep it fully outside the production code and handle it in some wrapper around the OnboardingCoordinator in the private scope of the preview app. That's a bit more demanding I think, in a couple of hours I can make some PoC if that's an idea that we consider worth chasing.
  • the CombineReducers and additional Reduce that I'm injecting into FeaturesPreviewer, look like something potentially reusable in other cases. I didn't want to do it now (let me know if I should), but I guess it makes sense to pull in that behavior inside FeaturesPreviewer and make it useful for other previews as well.
  • In PreviewResult.View we currently use just .navigationTitle("Feature Result"). Maybe it makes sense to inject some more meaningful string there (like "New account" in the case of this preview)?

How to test

Not sure if testing is necessary... I'd say yes (at least smoke testing of the Onboarding completion paths, as I've had to touch the production code), but on the other hand, I'm wondering how you guys prefer to handle such things.

For now, no testing in a QA sense is necessary, as this is our development infra. If you wanna try it just select the OnboardingPreview scheme and cmd+R it.

Video

Simulator.Screen.Recording.-.iPhone.14.-.2023-06-28.at.12.09.38.mp4

PR submission checklist

  • I have tested the Device Factor Source Kind Path in the app

@maciek-rdx maciek-rdx changed the title Maciek/temp/preview Add OnboardingPreview Jun 28, 2023
Copy link
Contributor

@CyonAlexRDX CyonAlexRDX left a comment

Choose a reason for hiding this comment

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

Nice! Good job! LGTM! Hopefully this can help you trying to solve the original issue with the runtime warnings when creating account?

@CyonAlexRDX
Copy link
Contributor

@maciek-rdx I think the CombineReducers was neat, needed if one needs to reset state in between runs. Only needed for this PreviewApp I think.

I dont think you ckutter the production code with the code you added in the OnboardingFeature itself, fine by me!

Comment on lines +84 to +86
private func sendDelegateCompleted(state: State) -> EffectTask<Action> {
.send(.delegate(.completed(state.newAccount)))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should avoid special functions like this, they hide what's going on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before that, we've had two places where .send(.delegate(.completed))) has been returned. My goal was to keep them together to eliminate the duplication and centralize the provision of state.newAccount. I don't see it as being super wrong, I pretty much followed this best practice, but fine to revert.

Just let me know @kugel3 👍

@@ -18,7 +18,7 @@ public struct OnboardingCoordinator: Sendable, FeatureReducer {
}

public enum DelegateAction: Sendable, Equatable {
case completed
case completed(Profile.Network.Account?)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to complete the onboarding without an account?

Copy link
Contributor Author

@maciek-rdx maciek-rdx Jun 28, 2023

Choose a reason for hiding this comment

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

Good question! So we send .completed in two paths:

  1. Via New Wallet
  2. Via Restore From Backup

Currently, with @CyonAlexRDX we agreed to focus solely on the New Wallet/Device factor source kind, so the Restore From Backup path will return nil

@maciek-rdx maciek-rdx requested a review from kugel3 June 28, 2023 15:38
@maciek-rdx maciek-rdx changed the base branch from main to ABW-1818_poc_versioning_profile June 29, 2023 10:19
@maciek-rdx maciek-rdx changed the base branch from ABW-1818_poc_versioning_profile to main June 29, 2023 10:19
# Conflicts:
#	App/BabylonWallet.xcodeproj/project.pbxproj
@maciek-rdx maciek-rdx merged commit c15a277 into main Jun 30, 2023
2 checks passed
@maciek-rdx maciek-rdx deleted the maciek/temp/preview branch June 30, 2023 11:35
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants