Refactor: Clean up Discover screen components and ServerDataRepository

- Removed unused imports and variables in `DiscoverServersList.kt`, `ServerInviteHandler.kt`, and `ServerInviteDialog.kt` to improve code cleanliness.
- Deleted the unused `getServerCategories` function from `ServerDataRepository.kt`.
This commit is contained in:
AbronStudio 2025-08-05 12:09:36 +03:30
parent 54a8e7e1ce
commit 300cacc6e5
4 changed files with 1 additions and 28 deletions

View File

@ -29,26 +29,7 @@ class ServerDataRepository {
}
emit(servers)
}.flowOn(Dispatchers.IO)
/**
* Fetches server categories from Google Sheets and returns as a Flow
* @param sheetUrl The URL of the published Google Sheet (CSV or JSON)
* @return Flow of ServerCategory list
*/
fun getServerCategories(sheetUrl: String): Flow<List<ServerCategory>> = flow {
val categories = GoogleSheetsService.fetchSheetData(
sheetUrl = sheetUrl
) { rowData ->
ServerCategory(
id = rowData["id"] ?: "",
name = rowData["name"] ?: "",
description = rowData["description"] ?: "",
iconName = rowData["iconName"] ?: "",
sortOrder = rowData["sortOrder"]?.toIntOrNull() ?: 0
)
}
emit(categories)
}.flowOn(Dispatchers.IO)
}
/**

View File

@ -21,9 +21,6 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter

View File

@ -1,15 +1,11 @@
package chat.revolt.composables.screens.chat.discover
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button

View File

@ -22,7 +22,6 @@ fun ServerInviteHandler(
onDismiss: () -> Unit = {},
onJoinSuccess: () -> Unit = {}
) {
val context = LocalContext.current
val scope = rememberCoroutineScope()
var isLoading by remember { mutableStateOf(true) }
var showDialog by remember { mutableStateOf(true) }