diff --git a/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/ApkConfig.kt b/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/ApkConfig.kt index c180388908..6e8ec6ea21 100644 --- a/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/ApkConfig.kt +++ b/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/ApkConfig.kt @@ -10,6 +10,7 @@ object ApkConfig { const val TARGET_SDK_VERSION = 35 const val COMPILE_SDK_VERSION = 35 + const val ROBOELECTRIC_SDK_VERSION = 34 private const val DEBUG_VERSION = "DEBUG_VERSION" diff --git a/components/bridge/dao/impl/build.gradle.kts b/components/bridge/dao/impl/build.gradle.kts index b1a5534b61..720d334a58 100644 --- a/components/bridge/dao/impl/build.gradle.kts +++ b/components/bridge/dao/impl/build.gradle.kts @@ -29,6 +29,7 @@ dependencies { // Testing testImplementation(projects.components.core.test) + testImplementation(projects.components.core.buildKonfig) testImplementation(libs.junit) testImplementation(libs.mockk) testImplementation(libs.mockito.kotlin) diff --git a/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/DatabaseKeyContentConverterTest.kt b/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/DatabaseKeyContentConverterTest.kt index a4df0dd4b0..71fad4f229 100644 --- a/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/DatabaseKeyContentConverterTest.kt +++ b/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/DatabaseKeyContentConverterTest.kt @@ -1,7 +1,5 @@ package com.flipperdevices.bridge.dao.impl.api.key -import android.content.Context -import android.os.Build import android.os.Looper import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.model.FlipperKeyContent @@ -11,9 +9,9 @@ import com.flipperdevices.bridge.dao.impl.converters.StubMD5Converter import com.flipperdevices.bridge.dao.impl.md5.MD5FileProviderImpl import com.flipperdevices.bridge.dao.impl.model.DatabaseKeyContent import com.flipperdevices.core.FlipperStorageProvider +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.test.FlipperStorageProviderTestRule import io.mockk.every -import io.mockk.mockk import io.mockk.mockkStatic import kotlinx.coroutines.test.runTest import okio.Path @@ -30,19 +28,14 @@ import org.robolectric.annotation.Config import org.robolectric.shadows.ShadowLooper @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class DatabaseKeyContentConverterTest { - - private lateinit var context: Context - @get:Rule val storageProviderRule = FlipperStorageProviderTestRule() private lateinit var storageProvider: FlipperStorageProvider @Before fun setUp() { - context = mockk() - storageProvider = storageProviderRule.flipperStorageProvider mockkStatic(Looper::class) diff --git a/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/FileComparatorTest.kt b/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/FileComparatorTest.kt index f3355acd63..2532f970c8 100644 --- a/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/FileComparatorTest.kt +++ b/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/FileComparatorTest.kt @@ -1,6 +1,5 @@ package com.flipperdevices.bridge.dao.impl.api.key -import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.impl.comparator.FileComparator import com.flipperdevices.core.FlipperStorageProvider import com.flipperdevices.core.sourceOrEmpty @@ -13,9 +12,7 @@ import org.junit.Assert import org.junit.Before import org.junit.Rule import org.junit.Test -import org.junit.runner.RunWith -@RunWith(AndroidJUnit4::class) class FileComparatorTest { private lateinit var fileComparator: FileComparator diff --git a/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/ShouldSynchronizeHelperTest.kt b/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/ShouldSynchronizeHelperTest.kt index 32ed0caee7..27fc546004 100644 --- a/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/ShouldSynchronizeHelperTest.kt +++ b/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/api/key/ShouldSynchronizeHelperTest.kt @@ -1,12 +1,12 @@ package com.flipperdevices.bridge.dao.impl.api.key -import android.os.Build import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.model.FlipperFile import com.flipperdevices.bridge.dao.api.model.FlipperFilePath import com.flipperdevices.bridge.dao.api.model.FlipperKey import com.flipperdevices.bridge.dao.api.model.FlipperKeyContent +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.storage.AndroidFlipperStorageProvider import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toPersistentList @@ -39,7 +39,7 @@ private val EXAMPLE_FLIPPER_KEY = FlipperKey( ) @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class ShouldSynchronizeHelperTest { @Test fun `edit name of key`() = runTest { diff --git a/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/md5/MD5FileProviderTest.kt b/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/md5/MD5FileProviderTest.kt index 4417cbd5be..2e699e2bd6 100644 --- a/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/md5/MD5FileProviderTest.kt +++ b/components/bridge/dao/impl/src/test/java/com/flipperdevices/bridge/dao/impl/md5/MD5FileProviderTest.kt @@ -1,7 +1,6 @@ package com.flipperdevices.bridge.dao.impl.md5 import android.content.Context -import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.model.FlipperKeyContent import com.flipperdevices.bridge.dao.impl.comparator.FileComparator import com.flipperdevices.core.FlipperStorageProvider @@ -12,9 +11,7 @@ import org.junit.Assert import org.junit.Before import org.junit.Rule import org.junit.Test -import org.junit.runner.RunWith -@RunWith(AndroidJUnit4::class) class MD5FileProviderTest { private lateinit var context: Context diff --git a/components/bridge/impl/build.gradle.kts b/components/bridge/impl/build.gradle.kts index 8f341d27e5..b21c923ae1 100644 --- a/components/bridge/impl/build.gradle.kts +++ b/components/bridge/impl/build.gradle.kts @@ -33,6 +33,7 @@ dependencies { // Testing testImplementation(projects.components.core.test) + testImplementation(projects.components.core.buildKonfig) testImplementation(libs.junit) testImplementation(libs.mockk) testImplementation(libs.mockito.kotlin) diff --git a/components/bridge/impl/src/test/java/com/flipperdevices/bridge/impl/scanner/FlipperScannerImplTest.kt b/components/bridge/impl/src/test/java/com/flipperdevices/bridge/impl/scanner/FlipperScannerImplTest.kt index 2093e90544..65c996a0b1 100644 --- a/components/bridge/impl/src/test/java/com/flipperdevices/bridge/impl/scanner/FlipperScannerImplTest.kt +++ b/components/bridge/impl/src/test/java/com/flipperdevices/bridge/impl/scanner/FlipperScannerImplTest.kt @@ -9,6 +9,7 @@ import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.api.scanner.DiscoveredBluetoothDevice import com.flipperdevices.bridge.api.scanner.FlipperScanner +import com.flipperdevices.core.buildkonfig.BuildKonfig import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic @@ -30,7 +31,7 @@ import org.robolectric.annotation.Config import org.robolectric.util.ReflectionHelpers @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class FlipperScannerImplTest { private lateinit var scanner: BluetoothLeScannerCompat private lateinit var bluetoothAdapter: BluetoothAdapter diff --git a/components/bridge/service/impl/build.gradle.kts b/components/bridge/service/impl/build.gradle.kts index 8cff3d2bd9..4b8150f41c 100644 --- a/components/bridge/service/impl/build.gradle.kts +++ b/components/bridge/service/impl/build.gradle.kts @@ -46,6 +46,7 @@ dependencies { implementation(libs.dagger) testImplementation(projects.components.core.test) + testImplementation(projects.components.core.buildKonfig) testImplementation(libs.junit) testImplementation(libs.mockito.kotlin) testImplementation(libs.ktx.testing) diff --git a/components/bridge/service/impl/src/test/java/com/flipperdevices/bridge/service/impl/provider/FlipperServiceProviderTest.kt b/components/bridge/service/impl/src/test/java/com/flipperdevices/bridge/service/impl/provider/FlipperServiceProviderTest.kt index c0e58ddfdc..5aec3983cd 100644 --- a/components/bridge/service/impl/src/test/java/com/flipperdevices/bridge/service/impl/provider/FlipperServiceProviderTest.kt +++ b/components/bridge/service/impl/src/test/java/com/flipperdevices/bridge/service/impl/provider/FlipperServiceProviderTest.kt @@ -2,7 +2,6 @@ package com.flipperdevices.bridge.service.impl.provider import android.content.Context import android.content.ServiceConnection -import android.os.Build import androidx.datastore.core.DataStore import androidx.test.ext.junit.runners.AndroidJUnit4 import com.arkivanov.essenty.lifecycle.LifecycleOwner @@ -11,6 +10,7 @@ import com.flipperdevices.bridge.service.api.FlipperServiceApi import com.flipperdevices.bridge.service.api.provider.FlipperBleServiceConsumer import com.flipperdevices.bridge.service.impl.FlipperService import com.flipperdevices.bridge.service.impl.FlipperServiceBinder +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.preference.pb.Settings import com.flipperdevices.core.test.TimberRule import kotlinx.coroutines.flow.MutableStateFlow @@ -32,7 +32,7 @@ import org.mockito.kotlin.verify import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class FlipperServiceProviderTest { private lateinit var applicationContext: Context private lateinit var subject: FlipperServiceProviderImpl diff --git a/components/bridge/synchronization/impl/build.gradle.kts b/components/bridge/synchronization/impl/build.gradle.kts index d9a9cdeca9..1e9d872384 100644 --- a/components/bridge/synchronization/impl/build.gradle.kts +++ b/components/bridge/synchronization/impl/build.gradle.kts @@ -46,6 +46,7 @@ dependencies { // Testing testImplementation(projects.components.core.test) + testImplementation(projects.components.core.buildKonfig) testImplementation(libs.junit) testImplementation(libs.mockk) testImplementation(libs.ktx.testing) diff --git a/components/bridge/synchronization/impl/src/test/java/com/flipperdevices/bridge/synchronization/impl/repository/favorites/FavoriteSynchronizationTestSingle.kt b/components/bridge/synchronization/impl/src/test/java/com/flipperdevices/bridge/synchronization/impl/repository/favorites/FavoriteSynchronizationTestSingle.kt index 28b1741b6b..a364f4cb9b 100644 --- a/components/bridge/synchronization/impl/src/test/java/com/flipperdevices/bridge/synchronization/impl/repository/favorites/FavoriteSynchronizationTestSingle.kt +++ b/components/bridge/synchronization/impl/src/test/java/com/flipperdevices/bridge/synchronization/impl/repository/favorites/FavoriteSynchronizationTestSingle.kt @@ -1,7 +1,6 @@ package com.flipperdevices.bridge.synchronization.impl.repository.favorites import android.content.Context -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.delegates.FavoriteApi import com.flipperdevices.bridge.dao.api.model.FlipperFile @@ -17,6 +16,7 @@ import com.flipperdevices.bridge.synchronization.impl.repository.manifest.Manife import com.flipperdevices.bridge.synchronization.impl.repository.manifest.ManifestStorage import com.flipperdevices.bridge.synchronization.impl.repository.manifest.ManifestStorageImpl import com.flipperdevices.bridge.synchronization.impl.utils.detailedProgressWrapperTrackerStub +import com.flipperdevices.core.buildkonfig.BuildKonfig import io.mockk.coEvery import io.mockk.coVerify import io.mockk.every @@ -31,7 +31,7 @@ import org.junit.runner.RunWith import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class FavoriteSynchronizationTestSingle { @get:Rule val folder = TemporaryFolder() diff --git a/components/bridge/synchronization/impl/src/test/java/com/flipperdevices/bridge/synchronization/impl/repository/manifest/ManifestStorageTest.kt b/components/bridge/synchronization/impl/src/test/java/com/flipperdevices/bridge/synchronization/impl/repository/manifest/ManifestStorageTest.kt index d1d59eaff9..5866492506 100644 --- a/components/bridge/synchronization/impl/src/test/java/com/flipperdevices/bridge/synchronization/impl/repository/manifest/ManifestStorageTest.kt +++ b/components/bridge/synchronization/impl/src/test/java/com/flipperdevices/bridge/synchronization/impl/repository/manifest/ManifestStorageTest.kt @@ -1,10 +1,10 @@ package com.flipperdevices.bridge.synchronization.impl.repository.manifest import android.content.Context -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.model.FlipperFilePath import com.flipperdevices.bridge.synchronization.impl.model.KeyWithHash +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.test.readTestAsset import io.mockk.every import io.mockk.mockk @@ -21,7 +21,7 @@ import org.robolectric.annotation.Config import java.io.File @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class ManifestStorageTest { @get:Rule var folder = TemporaryFolder() diff --git a/components/core/build-konfig/build.gradle.kts b/components/core/build-konfig/build.gradle.kts index 8d093fe04a..202cbb1188 100644 --- a/components/core/build-konfig/build.gradle.kts +++ b/components/core/build-konfig/build.gradle.kts @@ -1,3 +1,4 @@ +import com.flipperdevices.buildlogic.ApkConfig import com.flipperdevices.buildlogic.ApkConfig.CURRENT_FLAVOR_TYPE plugins { @@ -26,4 +27,9 @@ buildConfig { "LOGGING_PENDING_COMMANDS", CURRENT_FLAVOR_TYPE.loggingPendingCommands ) + buildConfigField( + Integer::class.java, + "ROBOELECTRIC_SDK_VERSION", + ApkConfig.ROBOELECTRIC_SDK_VERSION + ) } diff --git a/components/core/ktx/src/commonMain/kotlin/com/flipperdevices/core/ktx/jre/MutableListRemoveKtx.kt b/components/core/ktx/src/commonMain/kotlin/com/flipperdevices/core/ktx/jre/MutableListRemoveKtx.kt new file mode 100644 index 0000000000..ed85c8503c --- /dev/null +++ b/components/core/ktx/src/commonMain/kotlin/com/flipperdevices/core/ktx/jre/MutableListRemoveKtx.kt @@ -0,0 +1,13 @@ +package com.flipperdevices.core.ktx.jre + +fun MutableList.safeRemoveFirst() { + if (this.isNotEmpty()) { + this.removeAt(0) + } +} + +fun MutableList.safeRemoveLast() { + if (this.isNotEmpty()) { + this.removeAt(this.size - 1) + } +} diff --git a/components/faphub/screenshotspreview/impl/src/main/kotlin/com/flipperdevices/faphub/screenshotspreview/impl/viewmodel/UrlImageShareViewModel.kt b/components/faphub/screenshotspreview/impl/src/main/kotlin/com/flipperdevices/faphub/screenshotspreview/impl/viewmodel/UrlImageShareViewModel.kt index 9f60de504b..e77b57bccd 100644 --- a/components/faphub/screenshotspreview/impl/src/main/kotlin/com/flipperdevices/faphub/screenshotspreview/impl/viewmodel/UrlImageShareViewModel.kt +++ b/components/faphub/screenshotspreview/impl/src/main/kotlin/com/flipperdevices/faphub/screenshotspreview/impl/viewmodel/UrlImageShareViewModel.kt @@ -2,6 +2,7 @@ package com.flipperdevices.faphub.screenshotspreview.impl.viewmodel import android.content.Context import android.graphics.Bitmap +import android.graphics.Bitmap.Config import android.graphics.BitmapFactory import android.graphics.Canvas import android.graphics.Paint @@ -21,7 +22,6 @@ import java.util.Date import java.util.Locale import javax.inject.Inject import com.flipperdevices.core.ui.res.R as DesignSystem -import android.graphics.Bitmap.Config private const val SCREENSHOT_FILE_PREFIX = "flpr" private const val TIMEFORMAT = "yyyy-MM-dd-HH-mm-ss" diff --git a/components/firstpair/impl/build.gradle.kts b/components/firstpair/impl/build.gradle.kts index f13a72a403..eda8c0f547 100644 --- a/components/firstpair/impl/build.gradle.kts +++ b/components/firstpair/impl/build.gradle.kts @@ -47,6 +47,7 @@ dependencies { // Testing testImplementation(projects.components.core.test) + testImplementation(projects.components.core.buildKonfig) testImplementation(libs.junit) testImplementation(libs.mockk) testImplementation(libs.ktx.testing) diff --git a/components/firstpair/impl/src/test/kotlin/com/flipperdevices/firstpair/impl/viewmodels/connecting/PairDeviceViewModelTest.kt b/components/firstpair/impl/src/test/kotlin/com/flipperdevices/firstpair/impl/viewmodels/connecting/PairDeviceViewModelTest.kt index 4114b8d86a..7c1222b5bd 100644 --- a/components/firstpair/impl/src/test/kotlin/com/flipperdevices/firstpair/impl/viewmodels/connecting/PairDeviceViewModelTest.kt +++ b/components/firstpair/impl/src/test/kotlin/com/flipperdevices/firstpair/impl/viewmodels/connecting/PairDeviceViewModelTest.kt @@ -1,11 +1,11 @@ package com.flipperdevices.firstpair.impl.viewmodels.connecting -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.api.manager.ktx.state.ConnectionState import com.flipperdevices.bridge.api.manager.ktx.state.FlipperSupportedState import com.flipperdevices.bridge.api.manager.ktx.stateAsFlow import com.flipperdevices.bridge.api.scanner.DiscoveredBluetoothDevice +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.test.TimberRule import com.flipperdevices.core.test.mockScope import com.flipperdevices.core.ui.lifecycle.DecomposeViewModelCoroutineScopeProvider @@ -31,7 +31,7 @@ import org.junit.runner.RunWith import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class PairDeviceViewModelTest { @get:Rule var timberRule = TimberRule() diff --git a/components/infrared/editor/build.gradle.kts b/components/infrared/editor/build.gradle.kts index 099178b4cb..e24e85506e 100644 --- a/components/infrared/editor/build.gradle.kts +++ b/components/infrared/editor/build.gradle.kts @@ -47,6 +47,7 @@ dependencies { implementation(libs.kotlin.immutable.collections) // Testing + testImplementation(projects.components.core.buildKonfig) testImplementation(projects.components.core.test) testImplementation(libs.junit) testImplementation(libs.mockk) diff --git a/components/infrared/editor/src/test/kotlin/com/flipperdevices/infrared/editor/viewmodel/InfraredKeyParserTest.kt b/components/infrared/editor/src/test/kotlin/com/flipperdevices/infrared/editor/viewmodel/InfraredKeyParserTest.kt index ba9f5a5126..6fca81c248 100644 --- a/components/infrared/editor/src/test/kotlin/com/flipperdevices/infrared/editor/viewmodel/InfraredKeyParserTest.kt +++ b/components/infrared/editor/src/test/kotlin/com/flipperdevices/infrared/editor/viewmodel/InfraredKeyParserTest.kt @@ -1,8 +1,8 @@ package com.flipperdevices.infrared.editor.viewmodel -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.model.FlipperFileFormat +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.test.readTestAssetString import com.flipperdevices.infrared.editor.core.model.InfraredRemote import com.flipperdevices.infrared.editor.core.parser.InfraredKeyParser @@ -12,7 +12,7 @@ import org.junit.runner.RunWith import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class InfraredKeyParserTest { @Test diff --git a/components/infrared/editor/src/test/kotlin/com/flipperdevices/infrared/editor/viewmodel/InfraredStateParserTest.kt b/components/infrared/editor/src/test/kotlin/com/flipperdevices/infrared/editor/viewmodel/InfraredStateParserTest.kt index 6568724523..bf8bcdf3ad 100644 --- a/components/infrared/editor/src/test/kotlin/com/flipperdevices/infrared/editor/viewmodel/InfraredStateParserTest.kt +++ b/components/infrared/editor/src/test/kotlin/com/flipperdevices/infrared/editor/viewmodel/InfraredStateParserTest.kt @@ -1,11 +1,11 @@ package com.flipperdevices.infrared.editor.viewmodel -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.model.FlipperFile import com.flipperdevices.bridge.dao.api.model.FlipperFileFormat import com.flipperdevices.bridge.dao.api.model.FlipperFilePath import com.flipperdevices.bridge.dao.api.model.FlipperKey +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.test.readTestAssetString import com.flipperdevices.infrared.editor.core.parser.InfraredKeyParser import com.flipperdevices.infrared.editor.model.InfraredEditorState @@ -16,7 +16,7 @@ import org.junit.runner.RunWith import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class InfraredStateParserTest { @Test diff --git a/components/keyparser/impl/build.gradle.kts b/components/keyparser/impl/build.gradle.kts index 1e626eba69..ea75e6dc13 100644 --- a/components/keyparser/impl/build.gradle.kts +++ b/components/keyparser/impl/build.gradle.kts @@ -19,6 +19,7 @@ dependencies { // Testing testImplementation(projects.components.core.test) + testImplementation(projects.components.core.buildKonfig) testImplementation(libs.junit) testImplementation(libs.mockk) testImplementation(libs.ktx.testing) diff --git a/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/InfraredParserTest.kt b/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/InfraredParserTest.kt index f36c32dae0..e88f4b3bfc 100644 --- a/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/InfraredParserTest.kt +++ b/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/InfraredParserTest.kt @@ -1,12 +1,12 @@ package com.flipperdevices.keyparser.impl -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.model.FlipperFile import com.flipperdevices.bridge.dao.api.model.FlipperFileFormat import com.flipperdevices.bridge.dao.api.model.FlipperFilePath import com.flipperdevices.bridge.dao.api.model.FlipperKey import com.flipperdevices.bridge.dao.api.model.FlipperKeyContent +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.test.readTestAsset import com.flipperdevices.core.test.readTestAssetString import com.flipperdevices.keyparser.api.model.FlipperKeyParsed @@ -18,7 +18,7 @@ import org.junit.runner.RunWith import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class InfraredParserTest { private val underTest = InfraredParser() diff --git a/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/NFCParserTest.kt b/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/NFCParserTest.kt index 7dd5a737a4..ce87e5a3a1 100644 --- a/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/NFCParserTest.kt +++ b/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/NFCParserTest.kt @@ -1,12 +1,12 @@ package com.flipperdevices.keyparser.impl -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.model.FlipperFile import com.flipperdevices.bridge.dao.api.model.FlipperFileFormat import com.flipperdevices.bridge.dao.api.model.FlipperFilePath import com.flipperdevices.bridge.dao.api.model.FlipperKey import com.flipperdevices.bridge.dao.api.model.FlipperKeyContent +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.test.readTestAsset import com.flipperdevices.core.test.readTestAssetString import com.flipperdevices.keyparser.api.model.FlipperKeyParsed @@ -19,7 +19,7 @@ import org.junit.runner.RunWith import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class NFCParserTest { private val underTest = NFCParser() diff --git a/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/url/FFFUrlDecoderTest.kt b/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/url/FFFUrlDecoderTest.kt index 643177c5dd..bf702a5236 100644 --- a/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/url/FFFUrlDecoderTest.kt +++ b/components/keyparser/impl/src/test/kotlin/com/flipperdevices/keyparser/impl/url/FFFUrlDecoderTest.kt @@ -1,8 +1,8 @@ package com.flipperdevices.keyparser.impl.url import android.net.Uri -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.keyparser.impl.parsers.url.FFFUrlDecoder import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull @@ -13,7 +13,7 @@ import org.junit.runner.RunWith import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class FFFUrlDecoderTest { private val underTest = FFFUrlDecoder() diff --git a/components/nfceditor/impl/build.gradle.kts b/components/nfceditor/impl/build.gradle.kts index a13902c6b9..db612aa1db 100644 --- a/components/nfceditor/impl/build.gradle.kts +++ b/components/nfceditor/impl/build.gradle.kts @@ -47,6 +47,7 @@ dependencies { // Testing testImplementation(projects.components.core.test) + testImplementation(projects.components.core.buildKonfig) testImplementation(libs.roboelectric) testImplementation(libs.junit) testImplementation(libs.ktx.testing) diff --git a/components/nfceditor/impl/src/test/kotlin/com/flipperdevices/nfceditor/impl/viewmodel/NfcEditorStateProducerHelperTest.kt b/components/nfceditor/impl/src/test/kotlin/com/flipperdevices/nfceditor/impl/viewmodel/NfcEditorStateProducerHelperTest.kt index ec3b97951d..35f2b16ac6 100644 --- a/components/nfceditor/impl/src/test/kotlin/com/flipperdevices/nfceditor/impl/viewmodel/NfcEditorStateProducerHelperTest.kt +++ b/components/nfceditor/impl/src/test/kotlin/com/flipperdevices/nfceditor/impl/viewmodel/NfcEditorStateProducerHelperTest.kt @@ -1,12 +1,12 @@ package com.flipperdevices.nfceditor.impl.viewmodel -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.dao.api.model.FlipperFile import com.flipperdevices.bridge.dao.api.model.FlipperFilePath import com.flipperdevices.bridge.dao.api.model.FlipperFileType import com.flipperdevices.bridge.dao.api.model.FlipperKey import com.flipperdevices.bridge.dao.api.model.FlipperKeyContent +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.test.readTestAsset import com.flipperdevices.core.test.readTestAssetString import com.flipperdevices.keyparser.api.model.FlipperKeyParsed @@ -25,7 +25,7 @@ import org.junit.runner.RunWith import org.robolectric.annotation.Config @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class NfcEditorStateProducerHelperTest { @Test fun `1k apply color rules for each last line`() { diff --git a/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/viewmodel/HistoryViewModel.kt b/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/viewmodel/HistoryViewModel.kt index 57ef0a1c5d..3db3b6b4b9 100644 --- a/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/viewmodel/HistoryViewModel.kt +++ b/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/viewmodel/HistoryViewModel.kt @@ -1,5 +1,6 @@ package com.flipperdevices.remotecontrols.impl.setup.presentation.viewmodel +import com.flipperdevices.core.ktx.jre.safeRemoveLast import com.flipperdevices.core.ui.lifecycle.DecomposeViewModel import com.flipperdevices.ifrmvp.backend.model.SignalModel import com.flipperdevices.ifrmvp.backend.model.SignalRequestModel.SignalResultData @@ -24,7 +25,7 @@ class HistoryViewModel @Inject constructor() : DecomposeViewModel() { get() = flatData.isEmpty() fun forgetLast() { - flatData.removeLast() + flatData.safeRemoveLast() } fun rememberSuccessful(signalModel: SignalModel) { diff --git a/components/updater/card/build.gradle.kts b/components/updater/card/build.gradle.kts index 8f52fd5768..f812bbfce1 100644 --- a/components/updater/card/build.gradle.kts +++ b/components/updater/card/build.gradle.kts @@ -48,6 +48,7 @@ dependencies { implementation(libs.decompose) // Testing + testImplementation(projects.components.core.buildKonfig) testImplementation(libs.junit) testImplementation(libs.kotlin.coroutines.test) testImplementation(libs.roboelectric) diff --git a/components/updater/card/src/test/kotlin/com/flipperdevices/updater/card/viewmodel/UpdateRequestViewModelTest.kt b/components/updater/card/src/test/kotlin/com/flipperdevices/updater/card/viewmodel/UpdateRequestViewModelTest.kt index 6ac790b0c4..1bb3125921 100644 --- a/components/updater/card/src/test/kotlin/com/flipperdevices/updater/card/viewmodel/UpdateRequestViewModelTest.kt +++ b/components/updater/card/src/test/kotlin/com/flipperdevices/updater/card/viewmodel/UpdateRequestViewModelTest.kt @@ -3,13 +3,13 @@ package com.flipperdevices.updater.card.viewmodel import android.content.ContentResolver import android.content.Context import android.net.Uri -import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import com.flipperdevices.bridge.api.model.FlipperGATTInformation import com.flipperdevices.bridge.service.api.FlipperServiceApi import com.flipperdevices.bridge.service.api.provider.FlipperServiceProvider import com.flipperdevices.bridge.synchronization.api.SynchronizationApi import com.flipperdevices.bridge.synchronization.api.SynchronizationState +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.core.ktx.android.filename import com.flipperdevices.core.ktx.android.length import com.flipperdevices.core.ktx.jre.FlipperDispatchers @@ -47,7 +47,7 @@ private val requestServer = UpdatePending.Request( ) @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class UpdateRequestViewModelTest { private lateinit var serviceProvider: FlipperServiceProvider private lateinit var serviceApi: FlipperServiceApi diff --git a/components/updater/subghz/build.gradle.kts b/components/updater/subghz/build.gradle.kts index fdb35e4e92..53c54d8bbf 100644 --- a/components/updater/subghz/build.gradle.kts +++ b/components/updater/subghz/build.gradle.kts @@ -32,6 +32,7 @@ dependencies { implementation(libs.compose.material) // Testing + testImplementation(projects.components.core.buildKonfig) testImplementation(projects.components.core.test) testImplementation(libs.junit) testImplementation(libs.mockk) diff --git a/components/updater/subghz/src/test/kotlin/com/flipperdevices/updater/subghz/tasks/RegionProvisioningHelperTest.kt b/components/updater/subghz/src/test/kotlin/com/flipperdevices/updater/subghz/tasks/RegionProvisioningHelperTest.kt index 3a5d9b6859..6fab054ce2 100644 --- a/components/updater/subghz/src/test/kotlin/com/flipperdevices/updater/subghz/tasks/RegionProvisioningHelperTest.kt +++ b/components/updater/subghz/src/test/kotlin/com/flipperdevices/updater/subghz/tasks/RegionProvisioningHelperTest.kt @@ -6,6 +6,7 @@ import android.os.Build import android.os.LocaleList import android.telephony.TelephonyManager import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.flipperdevices.core.buildkonfig.BuildKonfig import com.flipperdevices.updater.subghz.helpers.RegionProvisioningHelper import com.flipperdevices.updater.subghz.helpers.RegionProvisioningHelperImpl import com.flipperdevices.updater.subghz.model.RegionProvisioningSource @@ -27,7 +28,7 @@ import org.robolectric.util.ReflectionHelpers import java.util.Locale @RunWith(AndroidJUnit4::class) -@Config(sdk = [Build.VERSION_CODES.TIRAMISU]) +@Config(sdk = [BuildKonfig.ROBOELECTRIC_SDK_VERSION]) class RegionProvisioningHelperTest { @OptIn(DelicateCoroutinesApi::class) private val mainThreadSurrogate = newSingleThreadContext("UI thread")