style: fix linter issues
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
3ddc125286
commit
745b3a3847
|
|
@ -3,8 +3,6 @@
|
|||
#include <string>
|
||||
#include <cmark.h>
|
||||
|
||||
#define TAG "Stendal"
|
||||
|
||||
#define STENDAL_ASTNODE_CONSTRUCTOR_SIGNATURE "(ILjava/lang/String;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V"
|
||||
|
||||
namespace Stendal {
|
||||
|
|
@ -27,10 +25,6 @@ namespace Stendal {
|
|||
return std::equal(suffix.rbegin(), suffix.rend(), value.rbegin());
|
||||
}
|
||||
|
||||
inline bool paragraph_is_math(std::string const &value) {
|
||||
return string_starts_with(value, "$") && string_ends_with(value, "$");
|
||||
}
|
||||
|
||||
void init(JNIEnv *env) {
|
||||
jclass localArrayListClass = env->FindClass("java/util/ArrayList");
|
||||
arrayListClass = (jclass) env->NewGlobalRef(localArrayListClass);
|
||||
|
|
@ -146,12 +140,12 @@ namespace Stendal {
|
|||
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_chat_revolt_ndk_Stendal_init(JNIEnv *env, jobject thiz) {
|
||||
Java_chat_revolt_ndk_Stendal_init(JNIEnv *env, [[maybe_unused]] jobject thiz) {
|
||||
Stendal::init(env);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jobject JNICALL
|
||||
Java_chat_revolt_ndk_Stendal_render(JNIEnv *env, jobject thiz, jstring input) {
|
||||
Java_chat_revolt_ndk_Stendal_render(JNIEnv *env, [[maybe_unused]] jobject thiz, jstring input) {
|
||||
const char *inputStr = env->GetStringUTFChars(input, nullptr);
|
||||
cmark_node *doc = cmark_parse_document(inputStr, strlen(inputStr),
|
||||
CMARK_OPT_DEFAULT | CMARK_OPT_HARDBREAKS |
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ import chat.revolt.api.settings.GlobalState
|
|||
import chat.revolt.api.settings.SyncedSettings
|
||||
import chat.revolt.provider.getAttachmentContentUri
|
||||
import chat.revolt.ui.theme.RevoltTheme
|
||||
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
|
||||
import io.ktor.client.request.get
|
||||
import io.ktor.client.statement.readBytes
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -84,7 +83,7 @@ class ImageViewActivity : ComponentActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalGlideComposeApi::class, ExperimentalMaterial3Api::class)
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun ImageViewScreen(resource: AutumnResource, onClose: () -> Unit = {}) {
|
||||
val resourceUrl = "$REVOLT_FILES/attachments/${resource.id}/${resource.filename}"
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ enum class DisconnectionState {
|
|||
}
|
||||
|
||||
sealed class RealtimeSocketFrames {
|
||||
data class Reconnected(val unit: Unit = Unit) : RealtimeSocketFrames()
|
||||
data object Reconnected : RealtimeSocketFrames()
|
||||
}
|
||||
|
||||
object RealtimeSocket {
|
||||
|
|
@ -598,6 +598,6 @@ object RealtimeSocket {
|
|||
}
|
||||
|
||||
private suspend fun pushReconnectEvent() {
|
||||
RevoltAPI.wsFrameChannel.send(RealtimeSocketFrames.Reconnected())
|
||||
RevoltAPI.wsFrameChannel.send(RealtimeSocketFrames.Reconnected)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package chat.revolt.api.routes.channel
|
||||
|
||||
import android.util.Log
|
||||
import chat.revolt.api.RevoltAPI
|
||||
import chat.revolt.api.RevoltError
|
||||
import chat.revolt.api.RevoltHttp
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ package chat.revolt.api.routes.misc
|
|||
import chat.revolt.api.RevoltHttp
|
||||
import io.ktor.client.call.*
|
||||
import io.ktor.client.request.*
|
||||
import io.ktor.client.statement.*
|
||||
import io.ktor.http.*
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
@ -83,19 +83,19 @@ private fun DisconnectedNoticeBase(
|
|||
|
||||
@Composable
|
||||
fun DisconnectedNotice(state: DisconnectionState, onReconnect: () -> Unit) {
|
||||
val retries = remember { mutableStateOf(0) }
|
||||
val retries = remember { mutableIntStateOf(0) }
|
||||
|
||||
LaunchedEffect(state) {
|
||||
when (state) {
|
||||
DisconnectionState.Disconnected -> {
|
||||
if (retries.value < 3) {
|
||||
if (retries.intValue < 3) {
|
||||
onReconnect()
|
||||
retries.value++
|
||||
retries.intValue++
|
||||
}
|
||||
}
|
||||
|
||||
DisconnectionState.Connected -> {
|
||||
retries.value = 0
|
||||
retries.intValue = 0
|
||||
}
|
||||
|
||||
else -> Unit
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ private fun argbAsCssColour(argb: Int): String {
|
|||
@Composable
|
||||
fun WebMarkdown(
|
||||
text: String,
|
||||
modifier: Modifier = Modifier,
|
||||
maskLoading: Boolean = false,
|
||||
simpleLineBreaks: Boolean = true,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val contentColour = LocalContentColor.current
|
||||
val materialColourScheme = MaterialTheme.colorScheme
|
||||
|
|
@ -98,10 +98,10 @@ fun WebMarkdown(
|
|||
// Capture clicks on invite links
|
||||
if (webResourceRequest.url.host == "rvlt.gg" ||
|
||||
(
|
||||
webResourceRequest.url.host?.endsWith("revolt.chat") == true && webResourceRequest.url.path?.startsWith(
|
||||
"/invite"
|
||||
) == true
|
||||
)
|
||||
webResourceRequest.url.host?.endsWith("revolt.chat") == true && webResourceRequest.url.path?.startsWith(
|
||||
"/invite"
|
||||
) == true
|
||||
)
|
||||
) {
|
||||
val intent = Intent(
|
||||
context,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import androidx.compose.material3.LocalTextStyle
|
|||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
|
|
@ -60,10 +60,10 @@ fun WeblinkPreview() {
|
|||
@Composable
|
||||
fun AnyLinkPreview() {
|
||||
val clicked = remember {
|
||||
mutableStateOf(0)
|
||||
mutableIntStateOf(0)
|
||||
}
|
||||
|
||||
AnyLink(text = "Click me! #${clicked.value}", action = {
|
||||
clicked.value++
|
||||
AnyLink(text = "Click me! #${clicked.intValue}", action = {
|
||||
clicked.intValue++
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import androidx.compose.material3.surfaceColorAtElevation
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.mutableLongStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
|
|
@ -56,7 +57,7 @@ fun AudioPlayer(url: String, filename: String, contentType: String) {
|
|||
|
||||
val showMenu = remember { mutableStateOf(false) }
|
||||
|
||||
val currentTime = remember { mutableStateOf(0L) }
|
||||
val currentTime = remember { mutableLongStateOf(0L) }
|
||||
val isPlaying = remember { mutableStateOf(false) }
|
||||
val isLoading = remember { mutableStateOf(false) }
|
||||
|
||||
|
|
@ -86,7 +87,7 @@ fun AudioPlayer(url: String, filename: String, contentType: String) {
|
|||
|
||||
fun seekTo(position: Long) {
|
||||
player.seekTo(position)
|
||||
currentTime.value = position
|
||||
currentTime.longValue = position
|
||||
}
|
||||
|
||||
fun formatTime(time: Long): String {
|
||||
|
|
@ -166,8 +167,8 @@ fun AudioPlayer(url: String, filename: String, contentType: String) {
|
|||
|
||||
LaunchedEffect(Unit) {
|
||||
while (true) {
|
||||
if (currentTime.value != player.currentPosition && player.isPlaying) {
|
||||
currentTime.value = player.currentPosition
|
||||
if (currentTime.longValue != player.currentPosition && player.isPlaying) {
|
||||
currentTime.longValue = player.currentPosition
|
||||
}
|
||||
|
||||
if (player.currentPosition == player.duration) {
|
||||
|
|
@ -176,7 +177,7 @@ fun AudioPlayer(url: String, filename: String, contentType: String) {
|
|||
}
|
||||
|
||||
if (player.duration < 0) {
|
||||
currentTime.value = 0
|
||||
currentTime.longValue = 0
|
||||
}
|
||||
|
||||
delay(100)
|
||||
|
|
@ -208,7 +209,7 @@ fun AudioPlayer(url: String, filename: String, contentType: String) {
|
|||
)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Text(
|
||||
text = formatTime(currentTime.value),
|
||||
text = formatTime(currentTime.longValue),
|
||||
fontWeight = FontWeight.Medium
|
||||
)
|
||||
if (player.duration >= 0) {
|
||||
|
|
|
|||
|
|
@ -243,10 +243,7 @@ class ChatRouterViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(
|
||||
ExperimentalComposeUiApi::class,
|
||||
ExperimentalMaterial3Api::class
|
||||
)
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun ChatRouterScreen(
|
||||
topNav: NavController,
|
||||
|
|
|
|||
|
|
@ -621,8 +621,4 @@ fun ColourSelectorSheet(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun String.toSnakeCase(): String {
|
||||
return this.replace(Regex("([a-z])([A-Z]+)"), "$1_$2").lowercase()
|
||||
}
|
||||
Loading…
Reference in New Issue