🔨 Optimizes imports
This commit is contained in:
@@ -1,17 +1,12 @@
|
|||||||
package dev.svitan.plugins
|
package dev.svitan.plugins
|
||||||
|
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||||
import io.ktor.http.HttpStatusCode
|
import io.ktor.http.*
|
||||||
import io.ktor.server.application.Application
|
import io.ktor.server.application.*
|
||||||
import io.ktor.server.application.InvalidBodyException
|
import io.ktor.server.plugins.*
|
||||||
import io.ktor.server.application.install
|
import io.ktor.server.plugins.statuspages.*
|
||||||
import io.ktor.server.application.log
|
import io.ktor.server.request.*
|
||||||
import io.ktor.server.plugins.BadRequestException
|
import io.ktor.server.response.*
|
||||||
import io.ktor.server.plugins.NotFoundException
|
|
||||||
import io.ktor.server.plugins.statuspages.StatusPages
|
|
||||||
import io.ktor.server.request.httpMethod
|
|
||||||
import io.ktor.server.request.uri
|
|
||||||
import io.ktor.server.response.respond
|
|
||||||
|
|
||||||
class AuthorizationException(message: String) : Exception(message)
|
class AuthorizationException(message: String) : Exception(message)
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,10 @@ import androidx.compose.foundation.layout.size
|
|||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
|
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
|
||||||
import androidx.compose.material.icons.filled.Add
|
|
||||||
import androidx.compose.material.icons.filled.Visibility
|
import androidx.compose.material.icons.filled.Visibility
|
||||||
import androidx.compose.material.icons.filled.VisibilityOff
|
import androidx.compose.material.icons.filled.VisibilityOff
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.FloatingActionButton
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
@@ -45,7 +43,6 @@ import androidx.compose.ui.text.input.VisualTransformation
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import dev.svitan.antifed.ui.components.DropdownList
|
|
||||||
import dev.svitan.antifed.ui.theme.AntiFedTheme
|
import dev.svitan.antifed.ui.theme.AntiFedTheme
|
||||||
import io.ktor.client.call.body
|
import io.ktor.client.call.body
|
||||||
import io.ktor.client.request.get
|
import io.ktor.client.request.get
|
||||||
@@ -55,14 +52,12 @@ import kotlinx.coroutines.delay
|
|||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
class AuthActivity : ComponentActivity() {
|
class AuthActivity : ComponentActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
AntiFedTheme {
|
AntiFedTheme {
|
||||||
|
|
||||||
var serverUrl by remember { mutableStateOf("") }
|
var serverUrl by remember { mutableStateOf("") }
|
||||||
var token by remember { mutableStateOf("") }
|
var token by remember { mutableStateOf("") }
|
||||||
var showToken by remember { mutableStateOf(false) }
|
var showToken by remember { mutableStateOf(false) }
|
||||||
@@ -257,37 +252,6 @@ class AuthActivity : ComponentActivity() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
|
||||||
|
|
||||||
if (auths.isNotEmpty()) {
|
|
||||||
DropdownList(
|
|
||||||
itemList = auths.map { it.name },
|
|
||||||
selectedIndex = authIndex.coerceAtLeast(0),
|
|
||||||
onItemClick = {
|
|
||||||
authIndex = it
|
|
||||||
authId = auths[it].id
|
|
||||||
prefs.edit {
|
|
||||||
putString(
|
|
||||||
getString(R.string.auth_key), authId
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modifier = Modifier
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
|
|
||||||
FloatingActionButton(
|
|
||||||
onClick = {
|
|
||||||
println("creating new auth!!")
|
|
||||||
}) {
|
|
||||||
Icon(
|
|
||||||
Icons.Default.Add,
|
|
||||||
contentDescription = stringResource(R.string.create_auth)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,19 +29,20 @@ import androidx.compose.ui.window.PopupProperties
|
|||||||
fun DropdownList(
|
fun DropdownList(
|
||||||
itemList: List<String>,
|
itemList: List<String>,
|
||||||
selectedIndex: Int,
|
selectedIndex: Int,
|
||||||
modifier: Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onItemClick: (Int) -> Unit
|
onItemClick: (Int) -> Unit
|
||||||
) {
|
) {
|
||||||
var showDropdown by rememberSaveable { mutableStateOf(true) }
|
var showDropdown by rememberSaveable { mutableStateOf(false) }
|
||||||
val scrollState = rememberScrollState()
|
val scrollState = rememberScrollState()
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier,
|
modifier = modifier,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.Center
|
verticalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
.background(Color.Red)
|
.background(Color.Red)
|
||||||
.clickable { showDropdown = !showDropdown },
|
.clickable { showDropdown = !showDropdown },
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
|
|||||||
Reference in New Issue
Block a user