parent
6018050553
commit
7ce3ee3152
|
|
@ -49,7 +49,8 @@ import java.lang.reflect.InvocationTargetException
|
||||||
import java.net.SocketException
|
import java.net.SocketException
|
||||||
import chat.revolt.api.schemas.Channel as ChannelSchema
|
import chat.revolt.api.schemas.Channel as ChannelSchema
|
||||||
|
|
||||||
const val REVOLT_BASE = "https://revolt.chat/api"
|
// The reason this is a var is because in debug builds we have the ability to swap the base URL.
|
||||||
|
var REVOLT_BASE = "https://revolt.chat/api"
|
||||||
const val REVOLT_SUPPORT = "https://support.revolt.chat"
|
const val REVOLT_SUPPORT = "https://support.revolt.chat"
|
||||||
const val REVOLT_MARKETING = "https://revolt.chat"
|
const val REVOLT_MARKETING = "https://revolt.chat"
|
||||||
const val REVOLT_FILES = "https://autumn.revolt.chat"
|
const val REVOLT_FILES = "https://autumn.revolt.chat"
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,18 @@ import androidx.compose.foundation.layout.safeDrawingPadding
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.ElevatedButton
|
import androidx.compose.material3.ElevatedButton
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.LocalContentColor
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material3.LocalTextStyle
|
import androidx.compose.material3.LocalTextStyle
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.rememberModalBottomSheetState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
|
@ -38,14 +42,30 @@ import androidx.compose.ui.text.style.TextAlign
|
||||||
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.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
|
import chat.revolt.BuildConfig
|
||||||
import chat.revolt.R
|
import chat.revolt.R
|
||||||
import chat.revolt.api.REVOLT_MARKETING
|
import chat.revolt.api.REVOLT_MARKETING
|
||||||
import chat.revolt.components.generic.Weblink
|
import chat.revolt.components.generic.Weblink
|
||||||
|
import chat.revolt.internals.extensions.BottomSheetInsets
|
||||||
|
import chat.revolt.sheets.DebugPrepSheet
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun LoginGreetingScreen(navController: NavController) {
|
fun LoginGreetingScreen(navController: NavController) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
var catTaps by remember { mutableIntStateOf(0) }
|
var catTaps by remember { mutableIntStateOf(0) }
|
||||||
|
var showDebugPrep by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
if (showDebugPrep) {
|
||||||
|
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
|
||||||
|
ModalBottomSheet(
|
||||||
|
onDismissRequest = { showDebugPrep = false },
|
||||||
|
sheetState = sheetState,
|
||||||
|
windowInsets = BottomSheetInsets
|
||||||
|
) {
|
||||||
|
DebugPrepSheet()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
@ -73,9 +93,9 @@ fun LoginGreetingScreen(navController: NavController) {
|
||||||
interactionSource = remember(::MutableInteractionSource),
|
interactionSource = remember(::MutableInteractionSource),
|
||||||
indication = null
|
indication = null
|
||||||
) {
|
) {
|
||||||
if (catTaps < 9) {
|
if ((catTaps >= (9 * 2)) && BuildConfig.DEBUG) {
|
||||||
catTaps++
|
showDebugPrep = true
|
||||||
} else {
|
} else if (catTaps == 9) {
|
||||||
Toast
|
Toast
|
||||||
.makeText(
|
.makeText(
|
||||||
context,
|
context,
|
||||||
|
|
@ -83,8 +103,8 @@ fun LoginGreetingScreen(navController: NavController) {
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
)
|
)
|
||||||
.show()
|
.show()
|
||||||
catTaps = 0
|
|
||||||
}
|
}
|
||||||
|
catTaps++
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
package chat.revolt.sheets
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.shape.CornerSize
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.SegmentedButton
|
||||||
|
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import chat.revolt.api.REVOLT_BASE
|
||||||
|
import chat.revolt.components.generic.SheetEnd
|
||||||
|
|
||||||
|
enum class DebugPrepSheetPage {
|
||||||
|
API
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun DebugPrepSheet(modifier: Modifier = Modifier) {
|
||||||
|
var mode by remember { mutableStateOf(DebugPrepSheetPage.API) }
|
||||||
|
|
||||||
|
Column(
|
||||||
|
Modifier
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
|
.padding(horizontal = 16.dp),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
|
) {
|
||||||
|
Text("Debug Preparation", style = MaterialTheme.typography.headlineMedium)
|
||||||
|
SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth()) {
|
||||||
|
SegmentedButton(
|
||||||
|
selected = mode == DebugPrepSheetPage.API,
|
||||||
|
onClick = { mode = DebugPrepSheetPage.API },
|
||||||
|
shape = CircleShape
|
||||||
|
) {
|
||||||
|
Text("API")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
when (mode) {
|
||||||
|
DebugPrepSheetPage.API -> {
|
||||||
|
Text("API Base URL (not reactive)")
|
||||||
|
SingleChoiceSegmentedButtonRow(Modifier.fillMaxWidth()) {
|
||||||
|
SegmentedButton(
|
||||||
|
selected = REVOLT_BASE == "https://api.revolt.chat",
|
||||||
|
onClick = {
|
||||||
|
REVOLT_BASE = "https://api.revolt.chat"
|
||||||
|
},
|
||||||
|
shape = CircleShape.copy(
|
||||||
|
topEnd = CornerSize(0),
|
||||||
|
bottomEnd = CornerSize(0)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Text("api.")
|
||||||
|
}
|
||||||
|
SegmentedButton(
|
||||||
|
selected = REVOLT_BASE == "https://revolt.chat/api",
|
||||||
|
onClick = {
|
||||||
|
REVOLT_BASE = "https://revolt.chat/api"
|
||||||
|
},
|
||||||
|
shape = CircleShape.copy(
|
||||||
|
topStart = CornerSize(0),
|
||||||
|
bottomStart = CornerSize(0)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Text("/api")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SheetEnd()
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue