Removing more warnings
This commit is contained in:
@@ -357,6 +357,7 @@ object LocalCache : ILocalCache, ICacheProvider {
|
||||
}
|
||||
}.buffer(kotlinx.coroutines.channels.Channel.CONFLATED)
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun <T : Event> observeLatestEvent(filter: Filter) = observeEvents(filter).map { it.firstNotNullOfOrNull { it as? T } }
|
||||
|
||||
fun observeLatestNote(filter: Filter) = observeNotes(filter).map { it.firstOrNull() }
|
||||
|
||||
+1
@@ -29,6 +29,7 @@ import androidx.annotation.RequiresApi
|
||||
import com.vitorpamplona.quartz.utils.Log
|
||||
import java.io.IOException
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
class ReverseGeolocation {
|
||||
companion object {
|
||||
fun execute(
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ class RecordingResult(
|
||||
val duration: Int,
|
||||
)
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
class VoiceMessageRecorder {
|
||||
@Volatile
|
||||
private var recorder: MediaRecorder? = null
|
||||
|
||||
@@ -22,7 +22,6 @@ package com.vitorpamplona.amethyst.ui.navigation
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Parcelable
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
@@ -35,6 +34,7 @@ import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.core.content.IntentCompat
|
||||
import androidx.core.util.Consumer
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
@@ -409,7 +409,7 @@ private fun NavigateIfIntentRequested(
|
||||
|
||||
var media by remember {
|
||||
mutableStateOf(
|
||||
(activity.intent.getParcelableExtra<Parcelable>(Intent.EXTRA_STREAM) as? Uri),
|
||||
IntentCompat.getParcelableExtra(activity.intent, Intent.EXTRA_STREAM, Uri::class.java),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ private fun NavigateIfIntentRequested(
|
||||
nav.newStack(Route.NewShortNote(message = it))
|
||||
}
|
||||
|
||||
(intent.getParcelableExtra<Parcelable>(Intent.EXTRA_STREAM) as? Uri)?.let {
|
||||
IntentCompat.getParcelableExtra(intent, Intent.EXTRA_STREAM, Uri::class.java)?.let {
|
||||
nav.newStack(Route.NewShortNote(attachment = it.toString()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.vitorpamplona.amethyst.ui.note
|
||||
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
|
||||
+1
@@ -155,6 +155,7 @@ class BookmarkGroupViewModel(
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
class Initializer(
|
||||
val account: Account,
|
||||
val bookmarkGroupIdentifier: String,
|
||||
|
||||
+2
-2
@@ -23,7 +23,6 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.home
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Parcelable
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
@@ -58,6 +57,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.IntentCompat
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.util.Consumer
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
@@ -169,7 +169,7 @@ fun ShortNotePostScreen(
|
||||
postViewModel.addToMessage(it)
|
||||
}
|
||||
|
||||
(intent.getParcelableExtra<Parcelable>(Intent.EXTRA_STREAM) as? Uri)?.let {
|
||||
IntentCompat.getParcelableExtra(activity.intent, Intent.EXTRA_STREAM, Uri::class.java)?.let {
|
||||
val mediaType = context.contentResolver.getType(it)
|
||||
postViewModel.selectImage(persistentListOf(SelectedMedia(it, mediaType)))
|
||||
}
|
||||
|
||||
+2
@@ -18,6 +18,8 @@
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.vitorpamplona.amethyst.ui.screen.loggedIn.threadview
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
|
||||
+9
-3
@@ -21,7 +21,7 @@
|
||||
package com.vitorpamplona.amethyst.commons.preview
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import java.net.URL
|
||||
import java.net.URI
|
||||
|
||||
@Immutable
|
||||
class UrlInfoItem(
|
||||
@@ -31,10 +31,16 @@ class UrlInfoItem(
|
||||
val image: String = "",
|
||||
val mimeType: String,
|
||||
) {
|
||||
val verifiedUrl = runCatching { URL(url) }.getOrNull()
|
||||
val verifiedUrl = runCatching { URI(url).toURL() }.getOrNull()
|
||||
val imageUrlFullPath =
|
||||
if (image.startsWith("/")) {
|
||||
URL(verifiedUrl, image).toString()
|
||||
runCatching {
|
||||
verifiedUrl
|
||||
?.toURI()
|
||||
?.resolve(image)
|
||||
?.toURL()
|
||||
?.toString()
|
||||
}.getOrNull() ?: image
|
||||
} else {
|
||||
image
|
||||
}
|
||||
|
||||
+9
-3
@@ -40,8 +40,8 @@ import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.collections.immutable.toImmutableMap
|
||||
import kotlinx.collections.immutable.toPersistentList
|
||||
import java.net.MalformedURLException
|
||||
import java.net.URI
|
||||
import java.net.URISyntaxException
|
||||
import java.net.URL
|
||||
import kotlin.coroutines.cancellation.CancellationException
|
||||
|
||||
class RichTextParser {
|
||||
@@ -424,12 +424,18 @@ class RichTextParser {
|
||||
|
||||
fun isValidURL(url: String?): Boolean =
|
||||
try {
|
||||
URL(url).toURI()
|
||||
true
|
||||
if (url != null) {
|
||||
URI(url).toURL()
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} catch (e: MalformedURLException) {
|
||||
false
|
||||
} catch (e: URISyntaxException) {
|
||||
false
|
||||
} catch (e: IllegalArgumentException) {
|
||||
false
|
||||
}
|
||||
|
||||
fun parseImageOrVideo(fullUrl: String): BaseMediaContent {
|
||||
|
||||
+2
-1
@@ -47,6 +47,7 @@ import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.PlainTooltip
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TooltipAnchorPosition
|
||||
import androidx.compose.material3.TooltipBox
|
||||
import androidx.compose.material3.TooltipDefaults
|
||||
import androidx.compose.material3.rememberTooltipState
|
||||
@@ -243,7 +244,7 @@ private fun ServerRow(
|
||||
) {
|
||||
// Status indicator with tooltip
|
||||
TooltipBox(
|
||||
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
|
||||
positionProvider = TooltipDefaults.rememberTooltipPositionProvider(TooltipAnchorPosition.Above, 4.dp),
|
||||
tooltip = {
|
||||
PlainTooltip {
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user