move
This commit is contained in:
+16
-5
@@ -1,6 +1,7 @@
|
||||
package aza.instant.network
|
||||
package aza.instant
|
||||
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.HttpClientConfig
|
||||
import io.ktor.client.engine.cio.CIO
|
||||
import io.ktor.client.plugins.HttpTimeoutConfig
|
||||
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
|
||||
@@ -20,7 +21,7 @@ import java.io.File
|
||||
class BackendClient {
|
||||
|
||||
private val client = HttpClient(CIO) {
|
||||
install(ContentNegotiation) {
|
||||
HttpClientConfig.install(ContentNegotiation) {
|
||||
json(Json {
|
||||
prettyPrint = true
|
||||
isLenient = true
|
||||
@@ -46,11 +47,21 @@ class BackendClient {
|
||||
setBody(
|
||||
MultiPartFormDataContent(formData {
|
||||
append("owner_key", ownerKey)
|
||||
append("\"photo\"", originalPhoto.name, ContentType.Image.JPEG, origB.size.toLong()) { write(origB) }
|
||||
append("\"edited_photo\"", editedPhoto.name, ContentType.Image.JPEG, editB.size.toLong()) { write(editB) }
|
||||
append(
|
||||
"\"photo\"",
|
||||
originalPhoto.name,
|
||||
ContentType.Image.JPEG,
|
||||
origB.size.toLong()
|
||||
) { write(origB) }
|
||||
append(
|
||||
"\"edited_photo\"",
|
||||
editedPhoto.name,
|
||||
ContentType.Image.JPEG,
|
||||
editB.size.toLong()
|
||||
) { write(editB) }
|
||||
})
|
||||
)
|
||||
timeout { HttpTimeoutConfig(1 * 60 * 1000L) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import android.content.Context
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.work.CoroutineWorker
|
||||
import androidx.work.WorkerParameters
|
||||
import aza.instant.network.BackendClient
|
||||
import aza.instant.BackendClient
|
||||
import java.io.File
|
||||
|
||||
class UploadWorker(
|
||||
|
||||
Reference in New Issue
Block a user