From 5584f961cc9c1b7f7ea3ee256af6226279116fa9 Mon Sep 17 00:00:00 2001 From: starry-shivam Date: Mon, 27 May 2024 20:35:44 +0530 Subject: [PATCH] Upgrade to Kotlin 2.0 See: https://kotlinlang.org/docs/whatsnew20.html While on that, also optimise MIUI checker function to not run on non Xiaomi devices. Signed-off-by: starry-shivam --- .gitignore | 1 + .idea/kotlinc.xml | 2 +- app/build.gradle | 6 ++---- app/src/main/java/com/starry/myne/helpers/Utils.kt | 5 +++++ build.gradle | 7 ++++--- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index aa724b77..04f46af2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.iml .gradle +.kotlin /local.properties /.idea/caches /.idea/libraries diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 8d81632f..6d0ee1c2 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index d2b4576f..8c76d357 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.kotlin.plugin.compose' id 'dagger.hilt.android.plugin' id 'com.google.devtools.ksp' id "com.mikepenz.aboutlibraries.plugin" version "11.1.3" @@ -71,9 +72,6 @@ android { compose true buildConfig = true } - composeOptions { - kotlinCompilerExtensionVersion '1.5.10' - } packagingOptions { resources { excludes += '/META-INF/{AL2.0,LGPL2.1}' @@ -135,7 +133,7 @@ dependencies { // Lottie animations. implementation "com.airbnb.android:lottie-compose:6.4.0" // TapTarget Compose - implementation "com.pierfrancescosoffritti.taptargetcompose:core:1.1.1" + implementation "com.pierfrancescosoffritti.taptargetcompose:core:1.1.2" // DataStore Preferences. implementation("androidx.datastore:datastore-preferences:1.1.1") // Open Source Libraries Screen. diff --git a/app/src/main/java/com/starry/myne/helpers/Utils.kt b/app/src/main/java/com/starry/myne/helpers/Utils.kt index fcad3cba..13aac783 100644 --- a/app/src/main/java/com/starry/myne/helpers/Utils.kt +++ b/app/src/main/java/com/starry/myne/helpers/Utils.kt @@ -17,6 +17,7 @@ package com.starry.myne.helpers +import android.os.Build import java.io.BufferedReader import java.io.IOException import java.io.InputStreamReader @@ -57,6 +58,10 @@ object Utils { * @return True if the device is running on MIUI, false otherwise */ fun isMiui(excludeHyperOS: Boolean = true): Boolean { + // Return false if the device is not from Xiaomi, Redmi, or POCO. + val brand = Build.BRAND.lowercase() + if (!setOf("xiaomi", "redmi", "poco").contains(brand)) return false + // Check if the device is running on MIUI and not HyperOS. val isMiui = !getProperty("ro.miui.ui.version.name").isNullOrBlank() val isHyperOS = !getProperty("ro.mi.os.version.name").isNullOrBlank() return isMiui && (!excludeHyperOS || !isHyperOS) diff --git a/build.gradle b/build.gradle index 5e133756..50d2c105 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ buildscript { ext { - kotlin_version = '1.9.22' - gradle_version = '8.4.0' + kotlin_version = '2.0.0' + gradle_version = '8.4.1' hilt_version = '2.50' room_version = '2.6.1' } @@ -24,5 +24,6 @@ plugins { id 'com.android.application' version "$gradle_version" apply false id 'com.android.library' version "$gradle_version" apply false id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false - id 'com.google.devtools.ksp' version '1.9.22-1.0.17' apply false + id 'org.jetbrains.kotlin.plugin.compose' version "$kotlin_version" apply false + id 'com.google.devtools.ksp' version '2.0.0-1.0.21' apply false } \ No newline at end of file