Formatting
This commit is contained in:
@@ -6,7 +6,6 @@ import android.util.Log
|
|||||||
import com.vitorpamplona.amethyst.model.toHexKey
|
import com.vitorpamplona.amethyst.model.toHexKey
|
||||||
import com.vitorpamplona.amethyst.ui.actions.ImageDownloader
|
import com.vitorpamplona.amethyst.ui.actions.ImageDownloader
|
||||||
import io.trbl.blurhash.BlurHash
|
import io.trbl.blurhash.BlurHash
|
||||||
import java.net.URL
|
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@@ -24,9 +23,9 @@ class FileHeader(
|
|||||||
try {
|
try {
|
||||||
val imageData: ByteArray? = ImageDownloader().waitAndGetImage(fileUrl)
|
val imageData: ByteArray? = ImageDownloader().waitAndGetImage(fileUrl)
|
||||||
|
|
||||||
if (imageData != null)
|
if (imageData != null) {
|
||||||
prepare(imageData, fileUrl, mimeType, description, onReady, onError)
|
prepare(imageData, fileUrl, mimeType, description, onReady, onError)
|
||||||
else {
|
} else {
|
||||||
onError()
|
onError()
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
@@ -44,4 +44,4 @@ class ImageDownloader {
|
|||||||
|
|
||||||
return imageData
|
return imageData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,8 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import com.vitorpamplona.amethyst.model.*
|
import com.vitorpamplona.amethyst.model.*
|
||||||
import com.vitorpamplona.amethyst.service.FileHeader
|
import com.vitorpamplona.amethyst.service.FileHeader
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.net.HttpURLConnection
|
|
||||||
import java.net.URL
|
|
||||||
|
|
||||||
|
|
||||||
open class NewMediaModel : ViewModel() {
|
open class NewMediaModel : ViewModel() {
|
||||||
var account: Account? = null
|
var account: Account? = null
|
||||||
|
|||||||
@@ -110,10 +110,10 @@ fun NewMediaView(uri: Uri, onClose: () -> Unit, postViewModel: NewMediaModel, ac
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isNIP94Server(selectedServer: ServersAvailable?): Boolean {
|
fun isNIP94Server(selectedServer: ServersAvailable?): Boolean {
|
||||||
return selectedServer == ServersAvailable.NOSTRIMG_NIP_94
|
return selectedServer == ServersAvailable.NOSTRIMG_NIP_94 ||
|
||||||
|| selectedServer == ServersAvailable.IMGUR_NIP_94
|
selectedServer == ServersAvailable.IMGUR_NIP_94 ||
|
||||||
|| selectedServer == ServersAvailable.NOSTR_BUILD_NIP_94
|
selectedServer == ServersAvailable.NOSTR_BUILD_NIP_94 ||
|
||||||
|| selectedServer == ServersAvailable.NOSTRFILES_DEV_NIP_94
|
selectedServer == ServersAvailable.NOSTRFILES_DEV_NIP_94
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@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.isValidURL
|
||||||
import com.vitorpamplona.amethyst.ui.components.noProtocolUrlValidator
|
import com.vitorpamplona.amethyst.ui.components.noProtocolUrlValidator
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user