feat: for server owners, add a temporary shortcut to the web app for server settings
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
ddb010cf55
commit
3c5c7bc30a
|
|
@ -14,6 +14,7 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
|
|
@ -27,6 +28,7 @@ fun SheetSelection(
|
|||
title: @Composable () -> Unit,
|
||||
description: @Composable () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
arrowTint: Color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
onClick: () -> Unit,
|
||||
) {
|
||||
Row(
|
||||
|
|
@ -55,7 +57,7 @@ fun SheetSelection(
|
|||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Default.KeyboardArrowRight,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
tint = arrowTint
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package chat.revolt.sheets
|
||||
|
||||
import android.content.Intent
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
|
|
@ -17,9 +19,12 @@ import androidx.compose.material3.Checkbox
|
|||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
|
|
@ -27,18 +32,22 @@ import androidx.compose.runtime.rememberCoroutineScope
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.platform.LocalClipboardManager
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.net.toUri
|
||||
import chat.revolt.R
|
||||
import chat.revolt.api.REVOLT_APP
|
||||
import chat.revolt.api.RevoltAPI
|
||||
import chat.revolt.api.routes.server.leaveOrDeleteServer
|
||||
import chat.revolt.composables.generic.SheetButton
|
||||
import chat.revolt.composables.markdown.RichMarkdown
|
||||
import chat.revolt.composables.screens.settings.ServerOverview
|
||||
import chat.revolt.composables.sheets.SheetSelection
|
||||
import chat.revolt.internals.Platform
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
|
@ -161,6 +170,38 @@ fun ServerContextSheet(
|
|||
)
|
||||
}
|
||||
|
||||
if (server.owner == RevoltAPI.selfId) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.clip(MaterialTheme.shapes.medium)
|
||||
.background(MaterialTheme.colorScheme.primary)
|
||||
) {
|
||||
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onPrimary) {
|
||||
SheetSelection(
|
||||
icon = {},
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(id = R.string.server_context_sheet_moderators_early_disclaimer_title)
|
||||
)
|
||||
},
|
||||
description = {
|
||||
Text(
|
||||
text = stringResource(id = R.string.server_context_sheet_moderators_early_disclaimer_body)
|
||||
)
|
||||
},
|
||||
arrowTint = LocalContentColor.current.copy(alpha = 0.5f),
|
||||
) {
|
||||
context.startActivity(
|
||||
Intent(
|
||||
Intent.ACTION_VIEW,
|
||||
"$REVOLT_APP/server/${server.id}/settings".toUri()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HorizontalDivider()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -388,6 +388,8 @@
|
|||
<string name="server_context_sheet_actions_leave_confirm_no">Stay</string>
|
||||
<string name="server_context_sheet_actions_leave_silently">Leave Silently</string>
|
||||
<string name="server_context_sheet_actions_report">Report</string>
|
||||
<string name="server_context_sheet_moderators_early_disclaimer_title">Looking for server settings?</string>
|
||||
<string name="server_context_sheet_moderators_early_disclaimer_body">We\'re still working on bringing server management to our Android app. Please use the web app to manage your server for now.</string>
|
||||
|
||||
<string name="user_info_sheet_open">Open user info</string>
|
||||
<string name="user_info_sheet_user_not_found">Can\'t resolve this user</string>
|
||||
|
|
|
|||
Loading…
Reference in New Issue