Skip to content

Commit

Permalink
Bump Kotlin to 1.9.21 and make use of data object
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rken committed Nov 29, 2023
1 parent a56f070 commit bb6e765
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,35 @@ sealed class AKnownPkg constructor(override val id: Pkg.Id) : Pkg {
ContextCompat.getDrawable(context, R.drawable.ic_default_app_icon_24)!!
}

object AndroidSystem : AKnownPkg("android") {
data object AndroidSystem : AKnownPkg("android") {
override val labelRes: Int = R.string.apps_known_android_system_label
}

object GooglePlay : AKnownPkg("com.android.vending"), AppStore {
data object GooglePlay : AKnownPkg("com.android.vending"), AppStore {
override val labelRes: Int = R.string.apps_known_installer_gplay_label
override val iconRes: Int = R.drawable.ic_baseline_gplay_24
override val urlGenerator: ((Pkg.Id) -> String) = {
"https://play.google.com/store/apps/details?id=${it.name}"
}
}

object VivoAppStore : AKnownPkg("com.vivo.appstore"), AppStore {
data object VivoAppStore : AKnownPkg("com.vivo.appstore"), AppStore {
override val labelRes: Int = R.string.apps_known_installer_vivo_label
}

object OppoMarket : AKnownPkg("com.oppo.market"), AppStore {
data object OppoMarket : AKnownPkg("com.oppo.market"), AppStore {
override val labelRes: Int = R.string.apps_known_installer_oppo_label
}

object HuaweiAppGallery : AKnownPkg("com.huawei.appmarket"), AppStore {
data object HuaweiAppGallery : AKnownPkg("com.huawei.appmarket"), AppStore {
override val labelRes: Int = R.string.apps_known_installer_huawei_label
}

object SamsungAppStore : AKnownPkg("com.sec.android.app.samsungapps"), AppStore {
data object SamsungAppStore : AKnownPkg("com.sec.android.app.samsungapps"), AppStore {
override val labelRes: Int = R.string.apps_known_installer_samsung_label
}

object XiaomiAppStore : AKnownPkg("com.xiaomi.mipicks"), AppStore {
data object XiaomiAppStore : AKnownPkg("com.xiaomi.mipicks"), AppStore {
override val labelRes: Int = R.string.apps_known_installer_xiaomi_label
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ sealed class Permission(
}
}

object WRITE_SECURE_SETTINGS
data object WRITE_SECURE_SETTINGS
: Permission("android.permission.WRITE_SECURE_SETTINGS")

fun Intent.resolveActivities(context: Context): Collection<ResolveInfo> =
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/eu/darken/sdmse/common/MimeTypes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package eu.darken.sdmse.common

sealed class MimeTypes(val value: String) {

object Json : MimeTypes("application/json")
data object Json : MimeTypes("application/json")
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import eu.darken.sdmse.systemcleaner.core.tasks.SystemCleanerDeleteTask

sealed interface DashboardEvents {

object TodoHint : DashboardEvents
object SetupDismissHint : DashboardEvents
data object TodoHint : DashboardEvents
data object SetupDismissHint : DashboardEvents

data class CorpseFinderDeleteConfirmation(
val task: CorpseFinderDeleteTask,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class DashboardFragment : Fragment3(R.layout.dashboard_fragment) {
.setAnchorView(ui.mainAction)
.show()

DashboardEvents.TodoHint -> MaterialAlertDialogBuilder(requireContext()).apply {
is DashboardEvents.TodoHint -> MaterialAlertDialogBuilder(requireContext()).apply {
setMessage(eu.darken.sdmse.common.R.string.general_todo_msg)
}.show()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,12 @@ abstract class SystemCleanerFilterTest : BaseTest() {
}

sealed interface Flag {
object File : Flag
object Dir : Flag
data object File : Flag
data object Dir : Flag

sealed interface Area : Flag {
object Primary : Area
object Secondary : Area
data object Primary : Area
data object Secondary : Area
}
}

Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/java/ProjectConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ fun BaseExtension.setupKotlinOptions() {
"-Xopt-in=kotlinx.coroutines.FlowPreview",
"-Xopt-in=kotlin.time.ExperimentalTime",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xjvm-default=all"
"-Xjvm-default=all",
"-XXLanguage:+DataObjects"
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Versions {
}

object Kotlin {
const val core = "1.8.20"
const val core = "1.9.21"
const val coroutines = "1.6.4"
}

Expand Down

0 comments on commit bb6e765

Please sign in to comment.