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