Skip to content

Commit

Permalink
Upgrade to Kotlin 2.0
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
starry-shivam committed May 27, 2024
1 parent 2072d18 commit 5584f96
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.iml
.gradle
.kotlin
/local.properties
/.idea/caches
/.idea/libraries
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -71,9 +72,6 @@ android {
compose true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.10'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/starry/myne/helpers/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
Expand All @@ -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
}

0 comments on commit 5584f96

Please sign in to comment.