Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ val modId: String by project
val fabricLoaderVersion: String by project
val kotlinxCoroutinesVersion: String by project
val discordIPCVersion: String by project
val fuelVersion: String by project

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

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

// Fuel HTTP library
implementation("com.github.kittinunf.fuel:fuel:$fuelVersion")
implementation("com.github.kittinunf.fuel:fuel-gson:$fuelVersion")

// Add Kotlin
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@

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

import com.github.kittinunf.fuel.Fuel
import com.github.kittinunf.fuel.core.FuelManager
import com.github.kittinunf.fuel.core.Method
import com.github.kittinunf.fuel.core.await
import com.github.kittinunf.fuel.core.awaitResponse
import com.github.kittinunf.fuel.core.awaitUnit
import com.github.kittinunf.fuel.core.responseUnit
import com.google.common.math.IntMath.pow
import com.lambda.Lambda.LOG
import com.lambda.graphics.texture.MipmapTexture
import com.lambda.http.Method
import com.lambda.http.request
import com.lambda.module.modules.client.RenderSettings
import com.lambda.util.FolderRegister.cache
import com.lambda.util.math.Vec2d
import java.awt.Color
import java.awt.Graphics2D
Expand All @@ -33,7 +39,6 @@ import javax.imageio.ImageIO
import kotlin.math.ceil
import kotlin.math.log2
import kotlin.math.sqrt
import kotlin.time.Duration.Companion.days

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

private fun downloadAndProcessZip(zipUrl: String) {
val file = request(zipUrl) {
method(Method.GET)
}.maybeDownload("emojis.zip", maxAge = 30.days)
val file = cache.resolve("emojis.zip").toFile()

Fuel.download(zipUrl, Method.GET)
.fileDestination { _, _ -> file }
.responseUnit()

fontTexture = MipmapTexture(processZip(file))
}
Expand Down
46 changes: 0 additions & 46 deletions common/src/main/kotlin/com/lambda/http/Extensions.kt

This file was deleted.

32 changes: 0 additions & 32 deletions common/src/main/kotlin/com/lambda/http/Method.kt

This file was deleted.

158 changes: 0 additions & 158 deletions common/src/main/kotlin/com/lambda/http/Request.kt

This file was deleted.

77 changes: 0 additions & 77 deletions common/src/main/kotlin/com/lambda/http/RequestBuilder.kt

This file was deleted.

Loading
Loading