Skip to content

Commit

Permalink
Re-add core library desugaring
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelvcaetano committed Dec 2, 2024
1 parent 8e176b7 commit 106521b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true

kotlin {
jvmToolchain(17)
Expand All @@ -103,6 +104,8 @@ android {
dependencies {
val gitHubImplementation by configurations

coreLibraryDesugaring(libs.android.desugaring)

implementation(projects.masterswitch)
implementation(projects.rcheevosApi)
implementation(projects.common)
Expand Down Expand Up @@ -136,6 +139,7 @@ dependencies {
implementation(libs.accompanist.systemuicontroller)
implementation(libs.compose.foundation)
implementation(libs.compose.material)
implementation(libs.compose.material.icons)
implementation(libs.compose.ui)
implementation(libs.compose.ui.tooling.preview)

Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ commonsCompress = "1.21"
composeBom = "2024.11.00"
constraintLayout = "2.2.0"
core = "1.13.1"
desugaring = "1.1.8"
documentFile = "1.0.1"
flexbox = "3.0.0"
fragment = "1.8.5"
Expand Down Expand Up @@ -65,6 +66,7 @@ androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefre
androidx-window = { module = "androidx.window:window", version.ref = "window" }
androidx-work = { module = "androidx.work:work-runtime", version.ref = "work" }
android-material = { module = "com.google.android.material:material", version.ref = "material" }
android-desugaring = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugaring" }

# Compose
compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.magnum.rcheevosapi.dto.mapper
import me.magnum.rcheevosapi.dto.AchievementDto
import me.magnum.rcheevosapi.model.RAAchievement
import me.magnum.rcheevosapi.model.RAGameId
import java.net.URI
import java.net.URL

internal fun AchievementDto.mapToModel(gameId: RAGameId): RAAchievement {
Expand All @@ -15,8 +16,8 @@ internal fun AchievementDto.mapToModel(gameId: RAGameId): RAAchievement {
description = description,
points = points.toIntOrNull() ?: 0,
displayOrder = displayOrder?.toIntOrNull() ?: 0,
badgeUrlUnlocked = URL(badgeUrl),
badgeUrlLocked = URL(badgeUrlLocked),
badgeUrlUnlocked = URI(badgeUrl).toURL(),
badgeUrlLocked = URI(badgeUrlLocked).toURL(),
memoryAddress = memoryAddress,
type = achievementFlagsToType(flags),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package me.magnum.rcheevosapi.dto.mapper
import me.magnum.rcheevosapi.dto.GameDto
import me.magnum.rcheevosapi.model.RAGame
import me.magnum.rcheevosapi.model.RAGameId
import java.net.URL
import java.net.URI

internal fun GameDto.mapToModel(): RAGame {
val gameId = RAGameId(id.toLong())
return RAGame(
id = gameId,
title = title,
icon = URL(iconUrl),
icon = URI(iconUrl).toURL(),
richPresencePatch = richPresencePatch,
achievements = achievements.map {
it.mapToModel(gameId)
Expand Down

0 comments on commit 106521b

Please sign in to comment.