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

initFlow should be deprecated and removed #1921

Closed
bartekpacia opened this issue Aug 16, 2024 · 2 comments · Fixed by #1935
Closed

initFlow should be deprecated and removed #1921

bartekpacia opened this issue Aug 16, 2024 · 2 comments · Fixed by #1935
Labels
maestro cli Related to the command-line Maestro tool P3 Issues that are less important tech debt Corners cut, candidates for refactoring, etc.

Comments

@bartekpacia
Copy link
Contributor

Code in question:

/**
* Run the initFlow and return the resulting app OrchestraAppState which can be used to initialize
* app disk state when past into Orchestra.runFlow.
*/
fun runInitFlow(
initFlow: MaestroInitFlow,
): OrchestraAppState? {
val success = runFlow(
initFlow.commands,
)
if (!success) return null
maestro.stopApp(initFlow.appId)
val stateFile = if (stateDir == null) {
Files.createTempFile(null, ".state")
} else {
Files.createTempFile(stateDir.toPath(), null, ".state")
}
return OrchestraAppState(
appId = initFlow.appId,
file = stateFile.toFile(),
)
}

citing @igorsmotto on Slack:

IIRC that's legacy, and we removed from the docs so people won't use it. But we didn't remove because there might be some customer still using it, so we don't want to break for them

The use case itself is the same one after being reintroduced as onFlowStart and onFlowComplete that you can find in the docs

Plan:

  • Add warning whenever initFlow is provided
  • Remove related code from maestro and monorepo
  • Afte some time (2 weeks? a month?) remove support completely. If someone complains, guide them to either use an older version (not recommended), or migrate to onFlowStart
@bartekpacia bartekpacia added maestro cli Related to the command-line Maestro tool P3 Issues that are less important tech debt Corners cut, candidates for refactoring, etc. labels Aug 16, 2024
@bartekpacia bartekpacia changed the title Deprecate and remove initFlow initFlow should be deprecated and removed Aug 22, 2024
@bartekpacia
Copy link
Contributor Author

Actually, the warning is already there:

fun toCommand(flowPath: Path): MaestroCommand {
if (initFlow != null) {
throw MaestroException.DeprecatedCommand("initFlow command used at: $flowPath is deprecated, please use " +
"onFlowStart/onFlowComplete hooks instead. Have a look at the documentation here: " +
"https://maestro.mobile.dev/advanced/onflowstart-onflowcomplete-hooks")
}

It was added in #1318

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.
Thank you for helping keep us our issue tracker clean!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
maestro cli Related to the command-line Maestro tool P3 Issues that are less important tech debt Corners cut, candidates for refactoring, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant