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