Skip to content

Commit d7a8a40

Browse files
committed
Use a proper http library instead of our wrapper
1 parent a0366a4 commit d7a8a40

File tree

19 files changed

+80
-476
lines changed

19 files changed

+80
-476
lines changed

common/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ val modId: String by project
2121
val fabricLoaderVersion: String by project
2222
val kotlinxCoroutinesVersion: String by project
2323
val discordIPCVersion: String by project
24+
val fuelVersion: String by project
2425

2526
base.archivesName = "${base.archivesName.get()}-api"
2627

@@ -45,6 +46,10 @@ dependencies {
4546
implementation("com.github.Edouard127:KDiscordIPC:$discordIPCVersion")
4647
implementation("com.pngencoder:pngencoder:0.15.0")
4748

49+
// Fuel HTTP library
50+
implementation("com.github.kittinunf.fuel:fuel:$fuelVersion")
51+
implementation("com.github.kittinunf.fuel:fuel-gson:$fuelVersion")
52+
4853
// Add Kotlin
4954
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
5055

common/src/main/kotlin/com/lambda/graphics/renderer/gui/font/glyph/EmojiGlyphs.kt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@
1717

1818
package com.lambda.graphics.renderer.gui.font.glyph
1919

20+
import com.github.kittinunf.fuel.Fuel
21+
import com.github.kittinunf.fuel.core.FuelManager
22+
import com.github.kittinunf.fuel.core.Method
23+
import com.github.kittinunf.fuel.core.await
24+
import com.github.kittinunf.fuel.core.awaitResponse
25+
import com.github.kittinunf.fuel.core.awaitUnit
26+
import com.github.kittinunf.fuel.core.responseUnit
2027
import com.google.common.math.IntMath.pow
2128
import com.lambda.Lambda.LOG
2229
import com.lambda.graphics.texture.MipmapTexture
23-
import com.lambda.http.Method
24-
import com.lambda.http.request
2530
import com.lambda.module.modules.client.RenderSettings
31+
import com.lambda.util.FolderRegister.cache
2632
import com.lambda.util.math.Vec2d
2733
import java.awt.Color
2834
import java.awt.Graphics2D
@@ -33,7 +39,6 @@ import javax.imageio.ImageIO
3339
import kotlin.math.ceil
3440
import kotlin.math.log2
3541
import kotlin.math.sqrt
36-
import kotlin.time.Duration.Companion.days
3742

3843
class EmojiGlyphs(zipUrl: String) {
3944
private val emojiMap = mutableMapOf<String, GlyphInfo>()
@@ -54,9 +59,11 @@ class EmojiGlyphs(zipUrl: String) {
5459
}
5560

5661
private fun downloadAndProcessZip(zipUrl: String) {
57-
val file = request(zipUrl) {
58-
method(Method.GET)
59-
}.maybeDownload("emojis.zip", maxAge = 30.days)
62+
val file = cache.resolve("emojis.zip").toFile()
63+
64+
Fuel.download(zipUrl, Method.GET)
65+
.fileDestination { _, _ -> file }
66+
.responseUnit()
6067

6168
fontTexture = MipmapTexture(processZip(file))
6269
}

common/src/main/kotlin/com/lambda/http/Extensions.kt

Lines changed: 0 additions & 46 deletions
This file was deleted.

common/src/main/kotlin/com/lambda/http/Method.kt

Lines changed: 0 additions & 32 deletions
This file was deleted.

common/src/main/kotlin/com/lambda/http/Request.kt

Lines changed: 0 additions & 158 deletions
This file was deleted.

common/src/main/kotlin/com/lambda/http/RequestBuilder.kt

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)