From 29eb5e581e13f12d014b245f7b429b913a8ec836 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 9 Jan 2025 10:17:52 +0100 Subject: [PATCH 01/26] Updated min sdk version --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 6506be3dedd..8c21ecd4fb5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -40,7 +40,7 @@ gradle.ext.mediaPickerSourceGifBinaryPath = "org.wordpress.mediapicker:source-gi gradle.ext.mediaPickerSourceWordPressBinaryPath = "org.wordpress.mediapicker:source-wordpress" gradle.ext { - compileSdkVersion = 34 + compileSdkVersion = 35 targetSdkVersion = 34 minSdkVersion = 26 } From 77e301fd621ca11da33eb1fd983894a544e10ef1 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 9 Jan 2025 10:18:46 +0100 Subject: [PATCH 02/26] Use compileSdk instead of compileSdkVersion in the modules that won't be deleted --- WooCommerce/build.gradle | 2 +- libs/cardreader/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WooCommerce/build.gradle b/WooCommerce/build.gradle index 71dc80c9291..8c8f5309ab7 100644 --- a/WooCommerce/build.gradle +++ b/WooCommerce/build.gradle @@ -107,7 +107,7 @@ def versionProperties = loadPropertiesFromFile(file("${rootDir}/version.properti android { namespace "com.woocommerce.android" - compileSdkVersion gradle.ext.compileSdkVersion + compileSdk gradle.ext.compileSdkVersion defaultConfig { applicationId "com.woocommerce.android" diff --git a/libs/cardreader/build.gradle b/libs/cardreader/build.gradle index 4a082ede46f..2521864856b 100644 --- a/libs/cardreader/build.gradle +++ b/libs/cardreader/build.gradle @@ -7,7 +7,7 @@ plugins { android { namespace "com.woocommerce.android.cardreader" - compileSdkVersion gradle.ext.compileSdkVersion + compileSdk gradle.ext.compileSdkVersion defaultConfig { minSdkVersion gradle.ext.minSdkVersion From d7c803751159908db3e0ebe498a12daa5b68a707 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 9 Jan 2025 11:39:03 +0100 Subject: [PATCH 03/26] Deprecated on low memory --- .../woocommerce/android/util/ApplicationLifecycleMonitor.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/util/ApplicationLifecycleMonitor.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/util/ApplicationLifecycleMonitor.kt index e1127c9532b..cf81434decf 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/util/ApplicationLifecycleMonitor.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/util/ApplicationLifecycleMonitor.kt @@ -46,10 +46,11 @@ class ApplicationLifecycleMonitor( override fun onActivityCreated(activity: Activity, p1: Bundle?) {} - override fun onLowMemory() {} - override fun onConfigurationChanged(configuration: Configuration) {} + @Deprecated("Parent method is deprecated, so this method has to be also deprecated") + override fun onLowMemory() {} + override fun onTrimMemory(level: Int) { if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) { lastState = LastApplicationState.BACKGROUND From 4b914bbe2ce016046b528ea74aad65ae95579d37 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 10 Jan 2025 11:19:12 +0100 Subject: [PATCH 04/26] Replaced deprecated API usage with theme setting for WooPosCardReaderActivity.kt --- .../android/ui/woopos/cardreader/WooPosCardReaderActivity.kt | 2 -- WooCommerce/src/main/res/values/themes.xml | 5 +++++ build.gradle | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cardreader/WooPosCardReaderActivity.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cardreader/WooPosCardReaderActivity.kt index e52068b301f..b11ee284e64 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cardreader/WooPosCardReaderActivity.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/cardreader/WooPosCardReaderActivity.kt @@ -6,7 +6,6 @@ import android.content.pm.ActivityInfo import android.os.Bundle import android.view.View import androidx.appcompat.app.AppCompatActivity -import androidx.core.content.ContextCompat import androidx.core.view.ViewCompat import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat @@ -37,7 +36,6 @@ class WooPosCardReaderActivity : AppCompatActivity(R.layout.activity_woo_pos_car } private fun setupTopAndBottomInsets() { - window.navigationBarColor = ContextCompat.getColor(this, android.R.color.transparent) WindowCompat.setDecorFitsSystemWindows(window, false) val rootView = findViewById(R.id.snack_root) ViewCompat.setOnApplyWindowInsetsListener(rootView) { view, insets -> diff --git a/WooCommerce/src/main/res/values/themes.xml b/WooCommerce/src/main/res/values/themes.xml index b04f19f7cde..e81933268e0 100644 --- a/WooCommerce/src/main/res/values/themes.xml +++ b/WooCommerce/src/main/res/values/themes.xml @@ -161,5 +161,10 @@ true false true + + @android:color/transparent + @android:color/transparent + true + true diff --git a/build.gradle b/build.gradle index 6fa70f15ae0..a192270bbf4 100644 --- a/build.gradle +++ b/build.gradle @@ -68,7 +68,8 @@ allprojects { tasks.withType(KotlinCompile).all { kotlinOptions { jvmTarget = libs.versions.java.get() - allWarningsAsErrors = true + // todo revert back before merging + allWarningsAsErrors = false freeCompilerArgs += [ "-opt-in=kotlin.RequiresOptIn", "-Xjvm-default=all-compatibility", From 85dc61e044571c705e066a69fd5b74c57506ce57 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 10 Jan 2025 11:29:22 +0100 Subject: [PATCH 05/26] Replaced deprecated API usage with theme setting for WooPosActivity.kt --- WooCommerce/src/main/AndroidManifest.xml | 3 +- .../android/ui/woopos/root/WooPosActivity.kt | 11 ----- WooCommerce/src/main/res/values/themes.xml | 42 ++++++++++++++----- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/WooCommerce/src/main/AndroidManifest.xml b/WooCommerce/src/main/AndroidManifest.xml index 6b96d630962..f3e73dc44b2 100644 --- a/WooCommerce/src/main/AndroidManifest.xml +++ b/WooCommerce/src/main/AndroidManifest.xml @@ -166,10 +166,11 @@ tools:replace="android:screenOrientation" /> + android:theme="@style/Theme.WooPos.Transparent" /> - + - + + - - From 4b3057562f3192aa7ab7046ab853b470de136f5f Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 14 Jan 2025 18:34:22 +0100 Subject: [PATCH 20/26] Use system utils to check Android version --- .../compose/component/WCModalBottomSheetLayout.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt index eeafab435b2..32fbabd164a 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt @@ -38,6 +38,7 @@ import androidx.compose.ui.unit.Dp import androidx.core.view.WindowCompat import com.woocommerce.android.R import com.woocommerce.android.extensions.findActivity +import com.woocommerce.android.util.SystemVersionUtils /** * A wrapper around [ModalBottomSheetLayout] that provides default values for the sheet shape and scrim color. @@ -54,22 +55,22 @@ fun WCModalBottomSheetLayout( ), content: @Composable () -> Unit ) { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.VANILLA_ICE_CREAM) { - ModalBottomSheetLayout( + if (SystemVersionUtils.isAtMostU()) { + ModalBottomSheetLayoutWithStatusBarWorkAround( sheetContent = sheetContent, sheetShape = sheetShape, sheetState = sheetState, - scrimColor = scrimColor(), modifier = modifier, - content = content + content = content, ) } else { - ModalBottomSheetLayoutWithStatusBarWorkAround( + ModalBottomSheetLayout( sheetContent = sheetContent, sheetShape = sheetShape, sheetState = sheetState, + scrimColor = scrimColor(), modifier = modifier, - content = content, + content = content ) } } From d58be6d69d1090b7c025b870c1b87839a24e3c38 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 14 Jan 2025 18:34:50 +0100 Subject: [PATCH 21/26] Fix typo --- .../android/ui/compose/component/WCModalBottomSheetLayout.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt index 32fbabd164a..1670e6ebfa1 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt @@ -56,7 +56,7 @@ fun WCModalBottomSheetLayout( content: @Composable () -> Unit ) { if (SystemVersionUtils.isAtMostU()) { - ModalBottomSheetLayoutWithStatusBarWorkAround( + ModalBottomSheetLayoutWithStatusBarWorkaround( sheetContent = sheetContent, sheetShape = sheetShape, sheetState = sheetState, @@ -85,7 +85,7 @@ fun WCModalBottomSheetLayout( @Suppress("DEPRECATION") @OptIn(ExperimentalMaterialApi::class, ExperimentalLayoutApi::class) @Composable -private fun ModalBottomSheetLayoutWithStatusBarWorkAround( +private fun ModalBottomSheetLayoutWithStatusBarWorkaround( sheetContent: @Composable ColumnScope.() -> Unit, modifier: Modifier = Modifier, sheetState: ModalBottomSheetState, From a3f0637096fdc0a57ddd2e91e4c6a6852d5fb5e1 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 14 Jan 2025 18:43:27 +0100 Subject: [PATCH 22/26] Remove ime nested scroll from bottomsheet modifier --- .../android/ui/compose/component/WCModalBottomSheetLayout.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt index 1670e6ebfa1..da58710290d 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.imeNestedScroll import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.statusBarsPadding @@ -112,7 +111,6 @@ private fun ModalBottomSheetLayoutWithStatusBarWorkaround( modifier = modifier .imePadding() .navigationBarsPadding() - .imeNestedScroll(), ) { val context = LocalContext.current var statusBarColor by remember { mutableStateOf(Color.Transparent) } From 76208b377673f1d1f65d33a104c9d41bd997f3c9 Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 14 Jan 2025 18:45:38 +0100 Subject: [PATCH 23/26] Fix bottomsheet for Blaze intro screen to show content edge to edge --- .../intro/BlazeCampaignCreationIntroScreen.kt | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/intro/BlazeCampaignCreationIntroScreen.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/intro/BlazeCampaignCreationIntroScreen.kt index 9193744b89b..5577ed51875 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/intro/BlazeCampaignCreationIntroScreen.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/intro/BlazeCampaignCreationIntroScreen.kt @@ -56,6 +56,7 @@ import com.woocommerce.android.ui.compose.component.WCColoredButton import com.woocommerce.android.ui.compose.component.WCModalBottomSheetLayout import com.woocommerce.android.ui.compose.component.WCTextButton import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground +import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch @Composable @@ -78,41 +79,40 @@ fun BlazeCampaignCreationIntroScreen( onDismissClick: () -> Unit, onLearnMoreClick: () -> Unit, ) { - Scaffold( - topBar = { - Toolbar( - onNavigationButtonClick = onDismissClick, - navigationIcon = Icons.Default.Clear + val coroutineScope = rememberCoroutineScope() + val modalSheetState = rememberModalBottomSheetState( + initialValue = Hidden, + confirmValueChange = { it != HalfExpanded }, + skipHalfExpanded = true + ) + + WCModalBottomSheetLayout( + sheetContent = { + BlazeCampaignBottomSheetContent( + onDismissClick = { + coroutineScope.launch { modalSheetState.hide() } + } ) }, + sheetState = modalSheetState, modifier = Modifier.background(MaterialTheme.colors.surface) - ) { paddingValues -> - val coroutineScope = rememberCoroutineScope() - val modalSheetState = rememberModalBottomSheetState( - initialValue = Hidden, - confirmValueChange = { it != HalfExpanded }, - skipHalfExpanded = true - ) - - WCModalBottomSheetLayout( - sheetContent = { - BlazeCampaignBottomSheetContent( - onDismissClick = { - coroutineScope.launch { modalSheetState.hide() } - } + ) { + Scaffold( + topBar = { + Toolbar( + onNavigationButtonClick = onDismissClick, + navigationIcon = Icons.Default.Clear ) }, - sheetState = modalSheetState, - modifier = Modifier - .background(MaterialTheme.colors.surface) - .padding(paddingValues) - ) { + modifier = Modifier.background(MaterialTheme.colors.surface) + ) { paddingValues -> BlazeCampaignCreationIntroContent( onContinueClick = onContinueClick, onLearnMoreClick = { coroutineScope.launch { modalSheetState.show() } onLearnMoreClick() - } + }, + modifier = Modifier.padding(paddingValues) ) } } From 5c5aed723a758d14ceb232d757475880375f77af Mon Sep 17 00:00:00 2001 From: jorgemucientesfayos Date: Tue, 14 Jan 2025 19:01:17 +0100 Subject: [PATCH 24/26] Moved imeNestedScroll to the specific bottom sheet that requires it --- ...mpaignCreationAdDestinationParametersBottomSheet.kt | 10 +++++++--- .../ui/compose/component/WCModalBottomSheetLayout.kt | 4 ---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/destination/BlazeCampaignCreationAdDestinationParametersBottomSheet.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/destination/BlazeCampaignCreationAdDestinationParametersBottomSheet.kt index 3fbae44f498..5f2894e179a 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/destination/BlazeCampaignCreationAdDestinationParametersBottomSheet.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/creation/destination/BlazeCampaignCreationAdDestinationParametersBottomSheet.kt @@ -3,9 +3,11 @@ package com.woocommerce.android.ui.blaze.creation.destination import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.imeNestedScroll import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape @@ -33,7 +35,7 @@ import com.woocommerce.android.ui.compose.component.WCOutlinedTextField import com.woocommerce.android.ui.compose.preview.LightDarkThemePreviews import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground -@OptIn(ExperimentalMaterialApi::class) +@OptIn(ExperimentalMaterialApi::class, ExperimentalLayoutApi::class) @Composable fun AdDestinationParametersBottomSheet( viewState: ViewState, @@ -65,10 +67,12 @@ fun AdDestinationParametersBottomSheet( paramsState = viewState.bottomSheetState, onParameterChanged = onParameterChanged, onParameterSaved = onParameterSaved, - modifier = modifier.fillMaxWidth() + modifier = modifier + .fillMaxWidth() ) } - } + }, + modifier = Modifier.imeNestedScroll(), ) { screenContent() } diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt index da58710290d..e2cdc3df515 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/WCModalBottomSheetLayout.kt @@ -5,14 +5,12 @@ import androidx.compose.foundation.background import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.MaterialTheme import androidx.compose.material.ModalBottomSheetDefaults import androidx.compose.material.ModalBottomSheetLayout @@ -42,7 +40,6 @@ import com.woocommerce.android.util.SystemVersionUtils /** * A wrapper around [ModalBottomSheetLayout] that provides default values for the sheet shape and scrim color. */ -@OptIn(ExperimentalMaterialApi::class) @Composable fun WCModalBottomSheetLayout( sheetState: ModalBottomSheetState, @@ -82,7 +79,6 @@ fun WCModalBottomSheetLayout( * */ @Suppress("DEPRECATION") -@OptIn(ExperimentalMaterialApi::class, ExperimentalLayoutApi::class) @Composable private fun ModalBottomSheetLayoutWithStatusBarWorkaround( sheetContent: @Composable ColumnScope.() -> Unit, From 9a0014537b93a44c59a4f95aafc10f0bdab1e7df Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 15 Jan 2025 12:12:30 +0100 Subject: [PATCH 25/26] allWarningsAsErrors back to true as all fixed --- build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index a192270bbf4..6fa70f15ae0 100644 --- a/build.gradle +++ b/build.gradle @@ -68,8 +68,7 @@ allprojects { tasks.withType(KotlinCompile).all { kotlinOptions { jvmTarget = libs.versions.java.get() - // todo revert back before merging - allWarningsAsErrors = false + allWarningsAsErrors = true freeCompilerArgs += [ "-opt-in=kotlin.RequiresOptIn", "-Xjvm-default=all-compatibility", From 542c8f4a51a23f340902f0654fd8da109c77f49b Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 15 Jan 2025 15:20:14 +0100 Subject: [PATCH 26/26] Fixed theme so there is no Translucent status and nav bar --- WooCommerce/src/main/res/values/themes.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/WooCommerce/src/main/res/values/themes.xml b/WooCommerce/src/main/res/values/themes.xml index 3d03738a495..f9b2a46ef27 100644 --- a/WooCommerce/src/main/res/values/themes.xml +++ b/WooCommerce/src/main/res/values/themes.xml @@ -38,7 +38,7 @@ @color/color_primary @color/color_primary @color/color_scrim_background - @color/nav_bar + true @color/woo_white @color/color_primary @@ -158,9 +158,6 @@