-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload files, settings OpenAiKey, auth fixes
- Loading branch information
Showing
10 changed files
with
155 additions
and
39 deletions.
There are no files selected for viewing
File renamed without changes.
1 change: 1 addition & 0 deletions
1
server/xefMobile/composeApp/src/androidMain/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...efMobile/composeApp/src/androidMain/kotlin/com/xef/xefMobile/ui/screens/SettingsScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.xef.xefMobile.ui.screens | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.* | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import androidx.navigation.NavController | ||
import com.server.movile.xef.android.ui.viewmodels.IAuthViewModel | ||
import kotlinx.coroutines.launch | ||
import org.xef.xefMobile.R | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun SettingsScreen(navController: NavController, authViewModel: IAuthViewModel) { | ||
var apiKey by remember { mutableStateOf("") } | ||
val coroutineScope = rememberCoroutineScope() | ||
val customColors = Color(0xFFADD8E6) | ||
val CustomTextBlue = Color(0xFF0199D7) | ||
|
||
Box( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(Color.White) | ||
.padding(16.dp) | ||
) { | ||
Column( | ||
modifier = Modifier.align(Alignment.Center), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center | ||
) { | ||
Text( | ||
text = "Settings", | ||
fontSize = 24.sp, | ||
fontWeight = FontWeight.Bold, | ||
color = Color.Black | ||
) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
Text( | ||
text = "These are xef-server settings.", | ||
fontSize = 16.sp, | ||
color = Color.Gray | ||
) | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
TextField( | ||
value = apiKey, | ||
onValueChange = { apiKey = it }, | ||
label = { Text("OpenAI API key") }, | ||
modifier = Modifier.fillMaxWidth() | ||
) | ||
Spacer(modifier = Modifier.height(16.dp)) | ||
Button( | ||
onClick = { | ||
coroutineScope.launch { | ||
// Handle saving the API key | ||
// Example: authViewModel.saveApiKey(apiKey) | ||
} | ||
}, | ||
colors = ButtonDefaults.buttonColors(containerColor = customColors), | ||
modifier = Modifier.fillMaxWidth() | ||
) { | ||
Row( | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.Center | ||
) { | ||
Image( | ||
painter = painterResource(id = R.drawable.save_24dp), | ||
contentDescription = "save settings icon", | ||
modifier = Modifier.size(24.dp), | ||
colorFilter = ColorFilter.tint(CustomTextBlue) | ||
) | ||
Spacer(modifier = Modifier.width(8.dp)) | ||
Text(text = "Save Settings", color = CustomTextBlue) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
server/xefMobile/composeApp/src/main/res/drawable/save_24dp.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="960" | ||
android:viewportHeight="960"> | ||
<path | ||
android:pathData="M840,280v480q0,33 -23.5,56.5T760,840L200,840q-33,0 -56.5,-23.5T120,760v-560q0,-33 23.5,-56.5T200,120h480l160,160ZM760,314L646,200L200,200v560h560v-446ZM480,720q50,0 85,-35t35,-85q0,-50 -35,-85t-85,-35q-50,0 -85,35t-35,85q0,50 35,85t85,35ZM240,400h360v-160L240,240v160ZM200,314v446,-560 114Z" | ||
android:fillColor="#5f6368"/> | ||
</vector> |