Skip to content

Commit

Permalink
remove repro attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Jul 31, 2024
1 parent de617de commit 4ecdcf1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 34 deletions.
72 changes: 39 additions & 33 deletions maestro-cli/src/main/java/maestro/cli/analytics/Analytics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,49 +113,55 @@ object Analytics {
* Uploads analytics if there was a version update.
*/
fun maybeUploadAnalyticsAsync() {
if (!hasRunBefore) {
logger.trace("First run, not uploading")
return
}
try {
if (!hasRunBefore) {
logger.trace("First run, not uploading")
return
}

if (analyticsDisabledWithEnvVar) {
logger.trace("Analytics disabled with env var, not uploading")
}
if (analyticsDisabledWithEnvVar) {
logger.trace("Analytics disabled with env var, not uploading")
}

if (!analyticsState.enabled) {
logger.trace("Analytics disabled with config file, not uploading")
return
}
if (!analyticsState.enabled) {
logger.trace("Analytics disabled with config file, not uploading")
return
}

if (!uploadConditionsMet) {
logger.trace("Upload conditions not met, not uploading")
return
}
if (!uploadConditionsMet) {
logger.trace("Upload conditions not met, not uploading")
return
}

val report = AnalyticsReport(
uuid = analyticsState.uuid,
freshInstall = !hasRunBefore,
cliVersion = EnvUtils.CLI_VERSION?.toString() ?: "Unknown",
os = EnvUtils.OS_NAME,
osArch = EnvUtils.OS_ARCH,
osVersion = EnvUtils.OS_VERSION,
javaVersion = EnvUtils.getJavaVersion().toString(),
xcodeVersion = IOSEnvUtils.xcodeVersion,
flutterVersion = EnvUtils.getFlutterVersionAndChannel().first,
flutterChannel = EnvUtils.getFlutterVersionAndChannel().second,
androidVersions = AndroidEnvUtils.androidEmulatorSdkVersions,
iosVersions = IOSEnvUtils.simulatorRuntimes,
)
val report = AnalyticsReport(
uuid = analyticsState.uuid,
freshInstall = !hasRunBefore,
cliVersion = EnvUtils.CLI_VERSION?.toString() ?: "Unknown",
os = EnvUtils.OS_NAME,
osArch = EnvUtils.OS_ARCH,
osVersion = EnvUtils.OS_VERSION,
javaVersion = EnvUtils.getJavaVersion().toString(),
xcodeVersion = IOSEnvUtils.xcodeVersion,
flutterVersion = EnvUtils.getFlutterVersionAndChannel().first,
flutterChannel = EnvUtils.getFlutterVersionAndChannel().second,
androidVersions = AndroidEnvUtils.androidEmulatorSdkVersions,
iosVersions = IOSEnvUtils.simulatorRuntimes,
)

logger.trace("Will upload analytics report")
logger.trace(report.toString())
logger.trace("Will upload analytics report")
logger.trace(report.toString())

try {
ApiClient(EnvUtils.BASE_API_URL).sendAnalyticsReport(report)
updateAnalyticsState()
} catch (e: ConnectException) {
// This is fine. We don't care that much about analytics to bug user about it.
// This is fine. The user probably doesn't have internet connection.
// We don't care that much about analytics to bug user about it.
return
} catch (e: Exception) {
// This is less fine. Don't crash, but ask the user to report this.
println("Exception ocurred while uploading analytics. Please report this issue.")
println(e.message)
println(e.stackTraceToString())
}
}

Expand Down
2 changes: 1 addition & 1 deletion maestro-cli/src/main/java/maestro/cli/util/IOSEnvUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object IOSEnvUtils {
get() {
// See also: https://stackoverflow.com/a/78755176/7009800

val topLevelDirs = Path("/Library/Developer/CoreSimulator/VolumesX").toFile()
val topLevelDirs = Path("/Library/Developer/CoreSimulator/Volumes").toFile()
.listFiles()
?.filter { it.exists() } ?: emptyList()

Expand Down

0 comments on commit 4ecdcf1

Please sign in to comment.