fix(build): compile against SDK 35

This commit is contained in:
Harsh Shandilya 2024-08-08 02:46:08 +05:30
parent 4eb8f497d5
commit e8cdc2077f
5 changed files with 10 additions and 7 deletions

View file

@ -41,7 +41,9 @@ class ShortcutHandler @Inject constructor(@ApplicationContext val context: Conte
val shortcuts = shortcutManager.dynamicShortcuts
// If we're above or equal to the maximum shortcuts allowed, drop the last item.
if (shortcuts.size >= MAX_SHORTCUT_COUNT) {
shortcuts.removeLast()
// We'd just do List.removeLast but the Kotlin stdlib extension gets shadowed by the API 35
// JDK implementation
shortcuts.removeAt(shortcuts.lastIndex)
}
// Reverse the list so we can append our new shortcut at the 'end'.
shortcuts.reverse()

View file

@ -50,7 +50,10 @@ public fun computeCertificatesHash(context: Context, appPackage: String): String
@SuppressLint("PackageManagerGetSignatures")
@Suppress("DEPRECATION")
val signaturesOld =
context.packageManager.getPackageInfo(appPackage, PackageManager.GET_SIGNATURES).signatures
context.packageManager
.getPackageInfo(appPackage, PackageManager.GET_SIGNATURES)
.signatures
.orEmpty()
val stableHashOld = stableHash(signaturesOld.map { it.toByteArray() })
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val info =
@ -63,7 +66,7 @@ public fun computeCertificatesHash(context: Context, appPackage: String): String
context.packageManager.getPackageInfo(appPackage, PackageManager.GET_SIGNING_CERTIFICATES)
}
val signaturesNew =
info.signingInfo.signingCertificateHistory ?: info.signingInfo.apkContentsSigners
info.signingInfo?.signingCertificateHistory ?: info.signingInfo?.apkContentsSigners.orEmpty()
val stableHashNew = stableHash(signaturesNew.map { it.toByteArray() })
if (stableHashNew != stableHashOld)
logcat("CertificatesHash", ERROR) {

View file

@ -15,7 +15,7 @@ import org.gradle.kotlin.dsl.withType
object AndroidCommon {
fun configure(project: Project) {
project.extensions.configure<TestedExtension> {
compileSdkVersion(34)
compileSdkVersion(35)
defaultConfig {
minSdk = 26
targetSdk = 34

View file

@ -48,6 +48,7 @@ android.disableEarlyManifestParsing=true
# Disable warnings about unsupported features
android.suppressUnsupportedOptionWarnings=android.dependencyResolutionAtConfigurationTime.disallow,android.disableEarlyManifestParsing,android.suppressUnsupportedOptionWarnings
android.suppressUnsupportedCompileSdk=35
# Maven publishing
GROUP=com.github.android-password-store

View file

@ -10,8 +10,6 @@ import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
@ -95,7 +93,6 @@ public fun APSTheme(
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = Color.Transparent.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
}
}