style: run ktlint on code
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
4a866bb40d
commit
ac5148e82c
|
|
@ -9,6 +9,7 @@ import chat.revolt.api.internals.Members
|
|||
import chat.revolt.api.realtime.DisconnectionState
|
||||
import chat.revolt.api.realtime.RealtimeSocket
|
||||
import chat.revolt.api.routes.user.fetchSelf
|
||||
import chat.revolt.api.schemas.Channel as ChannelSchema
|
||||
import chat.revolt.api.schemas.Emoji
|
||||
import chat.revolt.api.schemas.Message
|
||||
import chat.revolt.api.schemas.Server
|
||||
|
|
@ -38,7 +39,6 @@ import kotlinx.coroutines.withContext
|
|||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import chat.revolt.api.schemas.Channel as ChannelSchema
|
||||
|
||||
const val REVOLT_BASE = "https://api.revolt.chat"
|
||||
const val REVOLT_SUPPORT = "https://support.revolt.chat"
|
||||
|
|
|
|||
|
|
@ -27,4 +27,4 @@ suspend fun logoutAllSessions(includingSelf: Boolean = false) {
|
|||
RevoltHttp.delete("/auth/session/all") {
|
||||
parameter("revoke_self", includingSelf)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,10 +41,7 @@ suspend fun fetchSelf(): User {
|
|||
return user
|
||||
}
|
||||
|
||||
suspend fun patchSelf(
|
||||
status: Status? = null,
|
||||
pure: Boolean = false,
|
||||
) {
|
||||
suspend fun patchSelf(status: Status? = null, pure: Boolean = false) {
|
||||
val body = mutableMapOf<String, JsonElement>()
|
||||
if (status != null) {
|
||||
body["status"] = RevoltJson.encodeToJsonElement(Status.serializer(), status)
|
||||
|
|
@ -57,7 +54,8 @@ suspend fun patchSelf(
|
|||
MapSerializer(
|
||||
String.serializer(),
|
||||
JsonElement.serializer()
|
||||
), body
|
||||
),
|
||||
body
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -124,4 +122,4 @@ suspend fun fetchUserProfile(id: String): Profile {
|
|||
}
|
||||
|
||||
return RevoltJson.decodeFromString(Profile.serializer(), response)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import kotlinx.serialization.Serializable
|
|||
@Serializable
|
||||
data class Session(
|
||||
@SerialName("_id") val id: String,
|
||||
val name: String,
|
||||
val name: String
|
||||
) {
|
||||
fun isCurrent(): Boolean {
|
||||
return id == RevoltAPI.sessionId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ import chat.revolt.activities.RevoltTweenFloat
|
|||
import chat.revolt.activities.RevoltTweenInt
|
||||
import chat.revolt.api.schemas.ChannelType
|
||||
|
||||
|
||||
@Composable
|
||||
fun NativeMessageField(
|
||||
value: String,
|
||||
|
|
@ -112,7 +111,7 @@ fun NativeMessageField(
|
|||
Row(
|
||||
modifier = modifier
|
||||
.background(MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp)),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
|
||||
|
|
@ -322,4 +321,4 @@ fun NativeMessageFieldPreview() {
|
|||
cancelEdit = {},
|
||||
onFocusChange = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ fun RowScope.ChannelList(
|
|||
val enableSmallBanner by remember {
|
||||
derivedStateOf {
|
||||
lazyListState.firstVisibleItemScrollOffset > 40 ||
|
||||
lazyListState.firstVisibleItemIndex > 0
|
||||
lazyListState.firstVisibleItemIndex > 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ fun RowScope.ChannelList(
|
|||
|
||||
DrawerChannel(
|
||||
name = partner?.let { p -> User.resolveDefaultName(p) } ?: channel.name
|
||||
?: stringResource(R.string.unknown),
|
||||
?: stringResource(R.string.unknown),
|
||||
channelType = channel.channelType ?: ChannelType.TextChannel,
|
||||
selected = currentDestination == "channel/{channelId}" && currentChannel == channel.id,
|
||||
hasUnread = channel.lastMessageID?.let { lastMessageID ->
|
||||
|
|
@ -408,9 +408,9 @@ fun RowScope.ChannelList(
|
|||
|
||||
Text(
|
||||
text = (
|
||||
server?.name
|
||||
?: stringResource(R.string.unknown)
|
||||
),
|
||||
server?.name
|
||||
?: stringResource(R.string.unknown)
|
||||
),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = if (server?.banner != null) {
|
||||
bannerTextColour
|
||||
|
|
|
|||
|
|
@ -104,9 +104,13 @@ fun StatusButton(
|
|||
.size(48.dp)
|
||||
.clickable { onClick(presence) }
|
||||
.then(
|
||||
if (selected) Modifier.background(
|
||||
MaterialTheme.colorScheme.surfaceColorAtElevation(6.dp)
|
||||
) else Modifier
|
||||
if (selected) {
|
||||
Modifier.background(
|
||||
MaterialTheme.colorScheme.surfaceColorAtElevation(6.dp)
|
||||
)
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
|
|
@ -117,4 +121,4 @@ fun StatusButton(
|
|||
.background(presenceColour(presence))
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,4 +84,4 @@ fun SessionItem(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ import chat.revolt.persistence.KVStorage
|
|||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.ktor.client.request.get
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@HiltViewModel
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
|
|
|
|||
|
|
@ -112,9 +112,9 @@ import com.airbnb.lottie.compose.rememberLottieComposition
|
|||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import io.sentry.Sentry
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
|
|
@ -376,7 +376,7 @@ fun ChatRouterScreen(
|
|||
.distinctUntilChanged()
|
||||
.collect { sizeClass ->
|
||||
useTabletAwareUI = sizeClass.widthSizeClass == WindowWidthSizeClass.Expanded &&
|
||||
sizeClass.heightSizeClass != WindowHeightSizeClass.Compact
|
||||
sizeClass.heightSizeClass != WindowHeightSizeClass.Compact
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -857,21 +857,21 @@ fun Sidebar(
|
|||
// - Add the servers that aren't in the ordering to the end of the list.
|
||||
// - Sort the servers that aren't in the ordering by their ID (creation order).
|
||||
(
|
||||
(
|
||||
RevoltAPI.serverCache.values.filter {
|
||||
SyncedSettings.ordering.servers.contains(
|
||||
it.id
|
||||
)
|
||||
}
|
||||
.sortedBy { SyncedSettings.ordering.servers.indexOf(it.id) }
|
||||
) + (
|
||||
RevoltAPI.serverCache.values.filter {
|
||||
!SyncedSettings.ordering.servers.contains(
|
||||
it.id
|
||||
)
|
||||
}.sortedBy { it.id }
|
||||
)
|
||||
(
|
||||
RevoltAPI.serverCache.values.filter {
|
||||
SyncedSettings.ordering.servers.contains(
|
||||
it.id
|
||||
)
|
||||
}
|
||||
.sortedBy { SyncedSettings.ordering.servers.indexOf(it.id) }
|
||||
) + (
|
||||
RevoltAPI.serverCache.values.filter {
|
||||
!SyncedSettings.ordering.servers.contains(
|
||||
it.id
|
||||
)
|
||||
}.sortedBy { it.id }
|
||||
)
|
||||
)
|
||||
.forEach { server ->
|
||||
if (server.id == null || server.name == null) return@forEach
|
||||
|
||||
|
|
|
|||
|
|
@ -91,10 +91,10 @@ import chat.revolt.sheets.ChannelInfoSheet
|
|||
import chat.revolt.sheets.MessageContextSheet
|
||||
import com.discord.simpleast.core.simple.SimpleMarkdownRules
|
||||
import com.discord.simpleast.core.simple.SimpleRenderer
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
import java.io.FileNotFoundException
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ import chat.revolt.components.generic.FormTextField
|
|||
import chat.revolt.components.generic.Weblink
|
||||
import chat.revolt.persistence.KVStorage
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@HiltViewModel
|
||||
class LoginViewModel @Inject constructor(
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ import chat.revolt.components.generic.CollapsibleCard
|
|||
import chat.revolt.components.generic.FormTextField
|
||||
import chat.revolt.persistence.KVStorage
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@HiltViewModel
|
||||
class MfaScreenViewModel @Inject constructor(
|
||||
|
|
|
|||
|
|
@ -204,7 +204,9 @@ fun SessionSettingsScreen(
|
|||
)
|
||||
|
||||
Text(
|
||||
text = stringResource(R.string.settings_sessions_log_out_other_description),
|
||||
text = stringResource(
|
||||
R.string.settings_sessions_log_out_other_description
|
||||
),
|
||||
style = MaterialTheme.typography.bodySmall.copy(
|
||||
fontWeight = FontWeight.Normal
|
||||
)
|
||||
|
|
@ -236,4 +238,4 @@ fun SessionSettingsScreen(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ import chat.revolt.components.generic.SheetClickable
|
|||
import chat.revolt.components.screens.settings.SelfUserOverview
|
||||
import chat.revolt.persistence.KVStorage
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
@HiltViewModel
|
||||
class SettingsScreenViewModel @Inject constructor(
|
||||
|
|
|
|||
Loading…
Reference in New Issue