-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows users to disable insights notification based on the new Environment Variable
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
maestro-cli/src/main/java/maestro/cli/insights/Insights.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package maestro.cli.insights | ||
|
||
import maestro.cli.view.box | ||
|
||
/** | ||
* The Insights helper for Maestro CLI. | ||
* - Uses MAESTRO_CLI_INSIGHTS_NOTIFICATION_DISABLED env var to disable insights notifications | ||
*/ | ||
object Insights { | ||
|
||
private const val DISABLE_INSIGHTS_ENV_VAR = "MAESTRO_CLI_INSIGHTS_NOTIFICATION_DISABLED" | ||
private val disabled: Boolean | ||
get() = System.getenv(DISABLE_INSIGHTS_ENV_VAR) == "true" | ||
|
||
fun maybeNotifyInsights() { | ||
if (disabled) return | ||
|
||
println() | ||
println( | ||
listOf( | ||
"Tryout our new Analyze with Ai feature.\n", | ||
"See what's new:", | ||
// TODO: Add final link to analyze with Ai Docs | ||
"https://github.com/mobile-dev-inc/maestro/blob/main/CHANGELOG.md#blaaa", | ||
"Analyze command:", | ||
"maestro analyze android-flow.yaml | bash\n", | ||
"To disable this notification, set $DISABLE_INSIGHTS_ENV_VAR environment variable to \"true\" before running Maestro." | ||
).joinToString("\n").box() | ||
) | ||
} | ||
} |