Formatting

This commit is contained in:
Vitor Pamplona
2023-05-08 09:39:54 -04:00
parent ae268cc197
commit d0eadcf30d
5 changed files with 7 additions and 13 deletions
@@ -6,7 +6,6 @@ import android.util.Log
import com.vitorpamplona.amethyst.model.toHexKey
import com.vitorpamplona.amethyst.ui.actions.ImageDownloader
import io.trbl.blurhash.BlurHash
import java.net.URL
import java.security.MessageDigest
import kotlin.math.roundToInt
@@ -24,9 +23,9 @@ class FileHeader(
try {
val imageData: ByteArray? = ImageDownloader().waitAndGetImage(fileUrl)
if (imageData != null)
if (imageData != null) {
prepare(imageData, fileUrl, mimeType, description, onReady, onError)
else {
} else {
onError()
}
} catch (e: Exception) {
@@ -44,4 +44,4 @@ class ImageDownloader {
return imageData
}
}
}
@@ -11,12 +11,8 @@ import androidx.lifecycle.viewModelScope
import com.vitorpamplona.amethyst.model.*
import com.vitorpamplona.amethyst.service.FileHeader
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.launch
import java.net.HttpURLConnection
import java.net.URL
open class NewMediaModel : ViewModel() {
var account: Account? = null
@@ -110,10 +110,10 @@ fun NewMediaView(uri: Uri, onClose: () -> Unit, postViewModel: NewMediaModel, ac
}
fun isNIP94Server(selectedServer: ServersAvailable?): Boolean {
return selectedServer == ServersAvailable.NOSTRIMG_NIP_94
|| selectedServer == ServersAvailable.IMGUR_NIP_94
|| selectedServer == ServersAvailable.NOSTR_BUILD_NIP_94
|| selectedServer == ServersAvailable.NOSTRFILES_DEV_NIP_94
return selectedServer == ServersAvailable.NOSTRIMG_NIP_94 ||
selectedServer == ServersAvailable.IMGUR_NIP_94 ||
selectedServer == ServersAvailable.NOSTR_BUILD_NIP_94 ||
selectedServer == ServersAvailable.NOSTRFILES_DEV_NIP_94
}
@Composable
@@ -19,7 +19,6 @@ import com.vitorpamplona.amethyst.service.model.TextNoteEvent
import com.vitorpamplona.amethyst.ui.components.isValidURL
import com.vitorpamplona.amethyst.ui.components.noProtocolUrlValidator
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.launch