diff --git a/.gitignore b/.gitignore index 56c126e..e4d2a4e 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ local.properties /.idea/ /.secrets /.env +/keystore.properties +/keystore/keystore.jks diff --git a/composesensors/build.gradle.kts b/composesensors/build.gradle.kts index b1cff9d..5034d79 100644 --- a/composesensors/build.gradle.kts +++ b/composesensors/build.gradle.kts @@ -1,5 +1,3 @@ -@file:Suppress("UnstableApiUsage") - plugins { id("com.android.library") id("org.jetbrains.kotlin.android") @@ -8,7 +6,7 @@ plugins { android { namespace = "com.mutualmobile.composesensors" - compileSdk = 33 + compileSdk = 34 defaultConfig { minSdk = 21 @@ -27,11 +25,11 @@ android { } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "11" } buildFeatures { compose = true diff --git a/composesensors/src/main/java/com/mutualmobile/composesensors/SensorType.kt b/composesensors/src/main/java/com/mutualmobile/composesensors/SensorType.kt index e66cec6..78dea3e 100644 --- a/composesensors/src/main/java/com/mutualmobile/composesensors/SensorType.kt +++ b/composesensors/src/main/java/com/mutualmobile/composesensors/SensorType.kt @@ -9,40 +9,40 @@ import androidx.compose.runtime.remember import androidx.compose.ui.platform.LocalContext sealed class SensorType(val name: String) { - object Accelerometer : SensorType(name = "Accelerometer") - object MagneticField : SensorType(name = "MagneticField") - object Gyroscope : SensorType(name = "Gyroscope") - object Light : SensorType(name = "Light") - object Pressure : SensorType(name = "Pressure") - object Proximity : SensorType(name = "Proximity") - object Gravity : SensorType(name = "Gravity") - object LinearAcceleration : SensorType(name = "LinearAcceleration") - object RotationVector : SensorType(name = "RotationVector") - object RelativeHumidity : SensorType(name = "RelativeHumidity") - object AmbientTemperature : SensorType(name = "AmbientTemperature") - object MagneticFieldUncalibrated : SensorType(name = "MagneticFieldUncalibrated") - object GameRotationVector : SensorType(name = "GameRotationVector") - object GyroscopeUncalibrated : SensorType(name = "GyroscopeUncalibrated") - object SignificantMotion : SensorType(name = "SignificantMotion") - object StepDetector : SensorType(name = "StepDetector") - object StepCounter : SensorType(name = "StepCounter") - object GeomagneticRotationVector : SensorType(name = "GeomagneticRotationVector") - object HeartRate : SensorType(name = "HeartRate") - object Pose6DOF : SensorType(name = "Pose6DOF") - object StationaryDetect : SensorType(name = "StationaryDetect") - object MotionDetect : SensorType(name = "MotionDetect") - object HeartBeat : SensorType(name = "HeartBeat") - object LowLatencyOffBodyDetect : SensorType(name = "LowLatencyOffBodyDetect") - object AccelerometerUncalibrated : SensorType(name = "AccelerometerUncalibrated") - object HingeAngle : SensorType(name = "HingeAngle") - object HeadTracker : SensorType(name = "HeadTracker") - object AccelerometerLimitedAxes : SensorType(name = "AccelerometerLimitedAxes") - object GyroscopeLimitedAxes : SensorType(name = "GyroscopeLimitedAxes") - object AccelerometerLimitedAxesUncalibrated : + data object Accelerometer : SensorType(name = "Accelerometer") + data object MagneticField : SensorType(name = "MagneticField") + data object Gyroscope : SensorType(name = "Gyroscope") + data object Light : SensorType(name = "Light") + data object Pressure : SensorType(name = "Pressure") + data object Proximity : SensorType(name = "Proximity") + data object Gravity : SensorType(name = "Gravity") + data object LinearAcceleration : SensorType(name = "LinearAcceleration") + data object RotationVector : SensorType(name = "RotationVector") + data object RelativeHumidity : SensorType(name = "RelativeHumidity") + data object AmbientTemperature : SensorType(name = "AmbientTemperature") + data object MagneticFieldUncalibrated : SensorType(name = "MagneticFieldUncalibrated") + data object GameRotationVector : SensorType(name = "GameRotationVector") + data object GyroscopeUncalibrated : SensorType(name = "GyroscopeUncalibrated") + data object SignificantMotion : SensorType(name = "SignificantMotion") + data object StepDetector : SensorType(name = "StepDetector") + data object StepCounter : SensorType(name = "StepCounter") + data object GeomagneticRotationVector : SensorType(name = "GeomagneticRotationVector") + data object HeartRate : SensorType(name = "HeartRate") + data object Pose6DOF : SensorType(name = "Pose6DOF") + data object StationaryDetect : SensorType(name = "StationaryDetect") + data object MotionDetect : SensorType(name = "MotionDetect") + data object HeartBeat : SensorType(name = "HeartBeat") + data object LowLatencyOffBodyDetect : SensorType(name = "LowLatencyOffBodyDetect") + data object AccelerometerUncalibrated : SensorType(name = "AccelerometerUncalibrated") + data object HingeAngle : SensorType(name = "HingeAngle") + data object HeadTracker : SensorType(name = "HeadTracker") + data object AccelerometerLimitedAxes : SensorType(name = "AccelerometerLimitedAxes") + data object GyroscopeLimitedAxes : SensorType(name = "GyroscopeLimitedAxes") + data object AccelerometerLimitedAxesUncalibrated : SensorType(name = "AccelerometerLimitedAxesUncalibrated") - object GyroscopeLimitedAxesUncalibrated : SensorType(name = "GyroscopeLimitedAxesUncalibrated") - object Heading : SensorType(name = "Heading") + data object GyroscopeLimitedAxesUncalibrated : SensorType(name = "GyroscopeLimitedAxesUncalibrated") + data object Heading : SensorType(name = "Heading") fun toAndroidSensorType(): Int { return when (this) { @@ -123,5 +123,5 @@ private inline fun checkApi(expectedApi: Int, block: () -> T): T { private class OldApiException(currentApi: Int, expectedApi: Int) : Exception( "The current API ($currentApi) is too low. At least API ($expectedApi) is required to use" + - "this sensor." + " this sensor." ) diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 7330b33..bf36e53 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -1,4 +1,4 @@ -@file:Suppress("UnstableApiUsage") +import java.util.Properties plugins { id("com.android.application") @@ -7,12 +7,12 @@ plugins { android { namespace = "com.mutualmobile.sample" - compileSdk = 33 + compileSdk = 34 defaultConfig { applicationId = "com.mutualmobile.sample" minSdk = 21 - targetSdk = 33 + targetSdk = 34 versionCode = 1 versionName = "1.0" @@ -22,6 +22,19 @@ android { } } + signingConfigs { + create("release") { + // Load keystore + val keystoreProperties = Properties().apply{ + load(File("keystore.properties").reader()) + } + storeFile = File(keystoreProperties.getProperty("storeFile")) + storePassword = keystoreProperties.getProperty("storePassword") + keyAlias = keystoreProperties.getProperty("keyAlias") + keyPassword= keystoreProperties.getProperty("keyPassword") + } + } + buildTypes { release { isMinifyEnabled = false @@ -29,14 +42,15 @@ android { getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) + signingConfig = signingConfigs.getByName("release") } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "11" } buildFeatures { compose = true @@ -44,7 +58,7 @@ android { composeOptions { kotlinCompilerExtensionVersion = "1.5.1" } - packagingOptions { + packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" } diff --git a/wearablesample/build.gradle.kts b/wearablesample/build.gradle.kts index 8641201..fd5e446 100644 --- a/wearablesample/build.gradle.kts +++ b/wearablesample/build.gradle.kts @@ -1,3 +1,5 @@ +import java.util.Properties + plugins { id("com.android.application") id("org.jetbrains.kotlin.android") @@ -5,12 +7,12 @@ plugins { android { namespace = "com.mutualmobile.wearablesample" - compileSdk = 33 + compileSdk = 34 defaultConfig { applicationId = "com.mutualmobile.wearablesample" minSdk = 26 - targetSdk = 33 + targetSdk = 34 versionCode = 1 versionName = "1.0" vectorDrawables { @@ -18,21 +20,35 @@ android { } } + signingConfigs { + create("release") { + // Load keystore + val keystoreProperties = Properties().apply{ + load(File("keystore.properties").reader()) + } + storeFile = File(keystoreProperties.getProperty("storeFile")) + storePassword = keystoreProperties.getProperty("storePassword") + keyAlias = keystoreProperties.getProperty("keyAlias") + keyPassword= keystoreProperties.getProperty("keyPassword") + } + } + buildTypes { release { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro", + "proguard-rules.pro" ) + signingConfig = signingConfigs.getByName("release") } } compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "11" } buildFeatures { compose = true @@ -40,7 +56,7 @@ android { composeOptions { kotlinCompilerExtensionVersion = "1.5.1" } - packagingOptions { + packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" }