diff --git a/core/src/main/java/io/snabble/sdk/googlepay/GooglePayHelper.kt b/core/src/main/java/io/snabble/sdk/googlepay/GooglePayHelper.kt index 624b6e8e09..58bdff12b5 100644 --- a/core/src/main/java/io/snabble/sdk/googlepay/GooglePayHelper.kt +++ b/core/src/main/java/io/snabble/sdk/googlepay/GooglePayHelper.kt @@ -8,7 +8,13 @@ import android.widget.Toast import androidx.annotation.RestrictTo import androidx.appcompat.app.AppCompatActivity import com.google.android.gms.common.api.ApiException -import com.google.android.gms.wallet.* +import com.google.android.gms.wallet.AutoResolveHelper +import com.google.android.gms.wallet.IsReadyToPayRequest +import com.google.android.gms.wallet.PaymentData +import com.google.android.gms.wallet.PaymentDataRequest +import com.google.android.gms.wallet.PaymentsClient +import com.google.android.gms.wallet.Wallet +import com.google.android.gms.wallet.WalletConstants import com.google.gson.JsonArray import com.google.gson.JsonObject import io.snabble.sdk.PaymentMethod @@ -16,7 +22,6 @@ import io.snabble.sdk.Project import io.snabble.sdk.Snabble import io.snabble.sdk.utils.GsonHolder import io.snabble.sdk.utils.Logger -import java.lang.Exception /** * Class for interfacing with google pay @@ -171,10 +176,12 @@ class GooglePayHelper( */ fun requestPayment(priceToPay: Int): Boolean { val priceToPayDecimal = priceToPay.toBigDecimal().divide(100.toBigDecimal()) - val intent = Intent(context, GooglePayHelperActivity::class.java) - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) - intent.putExtra(GooglePayHelperActivity.INTENT_EXTRA_PROJECT_ID, project.id) - intent.putExtra(GooglePayHelperActivity.INTENT_EXTRA_PAYMENT_PRICE_TO_PAY, priceToPayDecimal.toString()) + val intent = Intent(context, GooglePayHelperActivity::class.java).apply { + setPackage(context.packageName) + addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + putExtra(GooglePayHelperActivity.INTENT_EXTRA_PROJECT_ID, project.id) + putExtra(GooglePayHelperActivity.INTENT_EXTRA_PAYMENT_PRICE_TO_PAY, priceToPayDecimal.toString()) + } context.startActivity(intent) return false @@ -233,4 +240,4 @@ class GooglePayHelper( interface IsReadyToPayListener { fun isReadyToPay(isReadyToPay: Boolean) -} \ No newline at end of file +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1b5219e818..ef4fba0143 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,8 @@ [versions] compileSdk = "34" -targetSdk = "33" +targetSdk = "34" minSdk = "21" -gradlePlugin = "8.4.0" +gradlePlugin = "8.5.1" desugarVersion = "1.1.5" okhttpVersion = "4.10.0" # @pin always, manually updated to ensure overall dependency support diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c4cd..2c3521197d 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 a80b22ce5c..09523c0e54 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index fcb6fca147..f5feea6d6b 100755 --- a/gradlew +++ b/gradlew @@ -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/HEAD/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/. @@ -83,7 +85,9 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +205,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_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" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f13..9d21a21834 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 ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +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 @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +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 diff --git a/ui-toolkit/src/main/kotlin/io/snabble/sdk/SnabbleUiToolkit.kt b/ui-toolkit/src/main/kotlin/io/snabble/sdk/SnabbleUiToolkit.kt index 7e82f23cad..f3b8567dee 100644 --- a/ui-toolkit/src/main/kotlin/io/snabble/sdk/SnabbleUiToolkit.kt +++ b/ui-toolkit/src/main/kotlin/io/snabble/sdk/SnabbleUiToolkit.kt @@ -149,6 +149,7 @@ object SnabbleUiToolkit { unique: Boolean = false, ) { val intent = Intent(context, clazz).apply { + setPackage(context.packageName) if (args != null) putExtras(args) if (!canGoBack) addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY) if (unique) addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) diff --git a/ui-toolkit/src/main/kotlin/io/snabble/sdk/widgets/snabble/version/ui/VersionWidget.kt b/ui-toolkit/src/main/kotlin/io/snabble/sdk/widgets/snabble/version/ui/VersionWidget.kt index e877c48234..7120897e39 100644 --- a/ui-toolkit/src/main/kotlin/io/snabble/sdk/widgets/snabble/version/ui/VersionWidget.kt +++ b/ui-toolkit/src/main/kotlin/io/snabble/sdk/widgets/snabble/version/ui/VersionWidget.kt @@ -47,7 +47,7 @@ fun VersionWidget( modifier = Modifier .fillMaxWidth() .clickable( - interactionSource = remember { MutableInteractionSource() }, + interactionSource = remember { MutableInteractionSource() }, indication = null, ) { onAction(DynamicAction(model)) diff --git a/ui-toolkit/src/main/kotlin/io/snabble/sdk/wlanmanager/usecase/broadcastreceiver/HasScanFinishedUseCase.kt b/ui-toolkit/src/main/kotlin/io/snabble/sdk/wlanmanager/usecase/broadcastreceiver/HasScanFinishedUseCase.kt index 77d4836a28..a550e2a5c6 100644 --- a/ui-toolkit/src/main/kotlin/io/snabble/sdk/wlanmanager/usecase/broadcastreceiver/HasScanFinishedUseCase.kt +++ b/ui-toolkit/src/main/kotlin/io/snabble/sdk/wlanmanager/usecase/broadcastreceiver/HasScanFinishedUseCase.kt @@ -5,6 +5,7 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.net.wifi.WifiManager +import androidx.core.content.ContextCompat import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.withTimeoutOrNull import kotlin.coroutines.resume @@ -33,7 +34,12 @@ internal class ScanIsFinishedImpl( val intentFilter = IntentFilter() intentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION) - context.registerReceiver(scanFinishedReceiver, intentFilter) + ContextCompat.registerReceiver( + context, + scanFinishedReceiver, + intentFilter, + ContextCompat.RECEIVER_EXPORTED + ) continuation.invokeOnCancellation { context.unregisterReceiver(scanFinishedReceiver) diff --git a/ui/src/main/java/io/snabble/sdk/ui/checkout/CheckoutActivity.kt b/ui/src/main/java/io/snabble/sdk/ui/checkout/CheckoutActivity.kt index 86d98f66b8..834bedb2e4 100644 --- a/ui/src/main/java/io/snabble/sdk/ui/checkout/CheckoutActivity.kt +++ b/ui/src/main/java/io/snabble/sdk/ui/checkout/CheckoutActivity.kt @@ -9,7 +9,13 @@ import android.view.View import android.view.ViewGroup import android.view.WindowManager import androidx.appcompat.app.AlertDialog -import androidx.core.view.* +import androidx.core.view.ViewCompat +import androidx.core.view.WindowCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.WindowInsetsControllerCompat +import androidx.core.view.isVisible +import androidx.core.view.updateLayoutParams +import androidx.core.view.updateMargins import androidx.fragment.app.FragmentActivity import androidx.lifecycle.Observer import androidx.navigation.NavController @@ -31,13 +37,11 @@ class CheckoutActivity : FragmentActivity() { @JvmStatic fun startCheckoutFlow(context: Context, newTask: Boolean = false) { - val intent = Intent(context, CheckoutActivity::class.java) - if (newTask) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + val intent = Intent(context, CheckoutActivity::class.java).apply { + setPackage(context.packageName) + if (newTask) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) } - - intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) - context.startActivity(intent) } diff --git a/ui/src/main/java/io/snabble/sdk/ui/payment/SEPACardInputActivity.kt b/ui/src/main/java/io/snabble/sdk/ui/payment/SEPACardInputActivity.kt index 5d72462ac6..a9211b46ca 100644 --- a/ui/src/main/java/io/snabble/sdk/ui/payment/SEPACardInputActivity.kt +++ b/ui/src/main/java/io/snabble/sdk/ui/payment/SEPACardInputActivity.kt @@ -20,6 +20,7 @@ class SEPACardInputActivity : BaseFragmentActivity() { context: Context, paymentOriginCandidate: PaymentOriginCandidateHelper.PaymentOriginCandidate? = null, ): Intent = Intent(context, SEPACardInputActivity::class.java).apply { + setPackage(context.packageName) paymentOriginCandidate?.let { putExtra(ARG_PAYMENT_ORIGIN_CANDIDATE, it) } addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY) } diff --git a/ui/src/main/java/io/snabble/sdk/ui/payment/payone/sepa/form/PayoneSepaActivity.kt b/ui/src/main/java/io/snabble/sdk/ui/payment/payone/sepa/form/PayoneSepaActivity.kt index e7f1258c64..e5c2fb8a4b 100644 --- a/ui/src/main/java/io/snabble/sdk/ui/payment/payone/sepa/form/PayoneSepaActivity.kt +++ b/ui/src/main/java/io/snabble/sdk/ui/payment/payone/sepa/form/PayoneSepaActivity.kt @@ -20,6 +20,7 @@ class PayoneSepaActivity : BaseFragmentActivity() { context: Context, paymentOriginCandidate: PaymentOriginCandidate? = null, ): Intent = Intent(context, PayoneSepaActivity::class.java).apply { + setPackage(context.packageName) paymentOriginCandidate?.let { putExtra(ARG_PAYMENT_ORIGIN_CANDIDATE, it) } addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY) }