Output: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1489daf..985de13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: distribution: 'temurin' - name: Set up Gradle - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@v6 with: cache-read-only: ${{ github.ref != 'refs/heads/master' }} cache-cleanup: on-success @@ -72,7 +72,7 @@ jobs: distribution: 'temurin' - name: Set up Gradle - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@v6 with: cache-read-only: ${{ github.ref != 'refs/heads/master' }} cache-cleanup: on-success diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 2f31ccf..91c4d10 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -40,7 +40,7 @@ jobs: distribution: 'temurin' - name: Set up Gradle - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@v6 with: cache-read-only: ${{ github.ref != 'refs/heads/master' }} cache-cleanup: on-success diff --git a/app/src/main/java/com/servicebook/ServiceBookApplication.kt b/app/src/main/java/com/servicebook/ServiceBookApplication.kt index 89dc81e..32559d2 100644 --- a/app/src/main/java/com/servicebook/ServiceBookApplication.kt +++ b/app/src/main/java/com/servicebook/ServiceBookApplication.kt @@ -74,7 +74,7 @@ open class ServiceBookApplication : Application() { } } - internal open fun doSentryInit(dsn: String) { + protected open fun doSentryInit(dsn: String) { SentryAndroid.init(this) { options -> configureSentryOptions(options, dsn) } @@ -97,10 +97,10 @@ open class ServiceBookApplication : Application() { options.setBeforeSend(::beforeSend) } - internal open val sentryEnvironment: String + protected open val sentryEnvironment: String get() = if (BuildConfig.DEBUG) "debug" else "release" - internal open val sentryRelease: String + protected open val sentryRelease: String get() = "${BuildConfig.APPLICATION_ID}@${BuildConfig.VERSION_NAME}+${BuildConfig.VERSION_CODE}" fun enableSentryNow() { diff --git a/app/src/main/java/com/servicebook/ui/reportbug/ReportBugScreen.kt b/app/src/main/java/com/servicebook/ui/reportbug/ReportBugScreen.kt index dfe3c98..4eecdf5 100644 --- a/app/src/main/java/com/servicebook/ui/reportbug/ReportBugScreen.kt +++ b/app/src/main/java/com/servicebook/ui/reportbug/ReportBugScreen.kt @@ -230,12 +230,11 @@ fun ReportBugScreen( enabled = !state.isSubmitting, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email), isError = state.isEmailInvalid, - supportingText = - if (state.isEmailInvalid) { - { Text(stringResource(R.string.report_bug_contact_email_invalid)) } - } else { - null - }, + supportingText = if (state.isEmailInvalid) { + { Text(stringResource(R.string.report_bug_contact_email_invalid)) } + } else { + null + }, ) Spacer(Modifier.height(24.dp)) diff --git a/app/src/main/java/com/servicebook/ui/reportbug/ReportBugViewModel.kt b/app/src/main/java/com/servicebook/ui/reportbug/ReportBugViewModel.kt index 3452403..ce21632 100644 --- a/app/src/main/java/com/servicebook/ui/reportbug/ReportBugViewModel.kt +++ b/app/src/main/java/com/servicebook/ui/reportbug/ReportBugViewModel.kt @@ -153,8 +153,8 @@ class ReportBugViewModel( sentryWrapper.lazyInitAndSendFeedback( app, BuildConfig.SENTRY_DSN, - app.sentryEnvironment, - app.sentryRelease, + if (BuildConfig.DEBUG) "debug" else "release", + "${BuildConfig.APPLICATION_ID}@${BuildConfig.VERSION_NAME}+${BuildConfig.VERSION_CODE}", comments, email, submissionTags, diff --git a/app/src/main/java/com/servicebook/ui/settings/SettingsScreen.kt b/app/src/main/java/com/servicebook/ui/settings/SettingsScreen.kt index ab089d2..c56361b 100644 --- a/app/src/main/java/com/servicebook/ui/settings/SettingsScreen.kt +++ b/app/src/main/java/com/servicebook/ui/settings/SettingsScreen.kt @@ -44,7 +44,6 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.ListItem import androidx.compose.material3.ListItemDefaults import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.OutlinedButton import androidx.compose.material3.RadioButton import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.Surface @@ -573,11 +572,8 @@ fun SettingsScreen( color = MaterialTheme.colorScheme.primary, modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp), ) - OutlinedButton( - onClick = { - @Suppress("TooGenericExceptionThrown") - throw RuntimeException("ServiceBook dev test crash") - }, + TextButton( + onClick = { throw RuntimeException("ServiceBook dev test crash") }, modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp), ) { Text( diff --git a/app/src/main/java/com/servicebook/util/SentryWrapper.kt b/app/src/main/java/com/servicebook/util/SentryWrapper.kt index 2650e3e..3b59c4a 100644 --- a/app/src/main/java/com/servicebook/util/SentryWrapper.kt +++ b/app/src/main/java/com/servicebook/util/SentryWrapper.kt @@ -20,7 +20,6 @@ interface SentryWrapper { * requested to submit this specific piece of manual feedback. The Sentry instance is immediately * closed after the submission to prevent background telemetry collection. */ - @Suppress("LongParameterList") fun lazyInitAndSendFeedback( context: Context, dsn: String, diff --git a/app/src/test/java/com/servicebook/ServiceBookApplicationTest.kt b/app/src/test/java/com/servicebook/ServiceBookApplicationTest.kt index 2acbc94..1873857 100644 --- a/app/src/test/java/com/servicebook/ServiceBookApplicationTest.kt +++ b/app/src/test/java/com/servicebook/ServiceBookApplicationTest.kt @@ -38,11 +38,6 @@ internal class SentryDisabledApp : TestServiceBookApplication() { override val sentryDsn = "https://test@sentry.io/123" - override fun initDependencies() { - super.initDependencies() - every { preferences.isCrashReportingEnabledSync() } returns false - } - override fun doSentryInit(dsn: String) { doSentryInitCalled = true } diff --git a/app/src/test/java/com/servicebook/ui/reportbug/ReportBugViewModelTest.kt b/app/src/test/java/com/servicebook/ui/reportbug/ReportBugViewModelTest.kt index 9fc3e98..61c05e7 100644 --- a/app/src/test/java/com/servicebook/ui/reportbug/ReportBugViewModelTest.kt +++ b/app/src/test/java/com/servicebook/ui/reportbug/ReportBugViewModelTest.kt @@ -94,7 +94,7 @@ class ReportBugViewModelTest { } @Test - fun `canSubmit reflects email validity`() = + fun `canSubmit should be false when email is invalid`() = runTest { viewModel = createViewModel() viewModel.onEvent(ReportBugEvent.SummaryChanged("Problem")) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d3f6923..5142f89 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ ktlint = "12.1.1" detekt = "1.23.6" git-hooks = "0.0.2" mockk = "1.14.9" -truth = "1.4.2" +truth = "1.4.5" turbine = "1.2.1" agp = "8.9.1" kotlin = "2.3.21" @@ -17,11 +17,11 @@ kotlinx-serialization = "1.11.0" kotlinx-coroutines = "1.10.2" coil = "2.6.0" documentfile = "1.1.0" -core-ktx = "1.13.1" +core-ktx = "1.18.0" activity-compose = "1.13.0" robolectric = "4.16.1" billing = "8.3.0" -sentry = "7.20.0" +sentry = "8.41.0" [libraries] sentry-android = { module = "io.sentry:sentry-android", version.ref = "sentry" } @@ -57,7 +57,7 @@ roborazzi = { module = "io.github.takahirom.roborazzi:roborazzi", version.ref = roborazzi-compose = { module = "io.github.takahirom.roborazzi:roborazzi-compose", version.ref = "roborazzi" } roborazzi-junit = { module = "io.github.takahirom.roborazzi:roborazzi-junit", version.ref = "roborazzi" } uiautomator = { module = "androidx.test.uiautomator:uiautomator", version = "2.3.0" } -espresso-intents = { module = "androidx.test.espresso:espresso-intents", version = "3.6.1" } +espresso-intents = { module = "androidx.test.espresso:espresso-intents", version = "3.7.0" } google-billing = { module = "com.android.billingclient:billing-ktx", version.ref = "billing" } [plugins] diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e644113..b1b8ef5 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e2847c8..df6a6ad 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1aa94a4..b9bb139 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -170,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -203,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 7101f8e..aa5f10b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -21,8 +23,8 @@ @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -49,7 +51,7 @@ echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -63,30 +65,18 @@ echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% Process Group PGID: 2046516