Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
package com.afkanerd.deku.Router.ui.modals

import androidx.compose.foundation.layout.Arrangement
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.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.SheetValue
import androidx.compose.material3.Text
Expand Down Expand Up @@ -69,69 +74,109 @@ fun GatewayServerAddHttpModal(
style = MaterialTheme.typography.titleMedium
)

HorizontalDivider(Modifier.padding(16.dp))
Spacer(Modifier.padding(10.dp))

OutlinedTextField(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier
.fillMaxWidth()
.height(56.dp),
value = url,
onValueChange = { url = it },
label = {
Text(stringResource(R.string.enter_url))
Text(stringResource(R.string.enter_url),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
},
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
singleLine = true,
textStyle = MaterialTheme.typography.bodyLarge.copy(color = MaterialTheme.colorScheme.onSurface),
shape = RoundedCornerShape(12.dp)
)

OutlinedTextField(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier
.fillMaxWidth()
.height(56.dp),
value = tag,
onValueChange = { tag = it },
label = {
Text(stringResource(R.string.enter_tag_optional))
Text(stringResource(R.string.enter_tag_optional),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant)
},
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
singleLine = true,
textStyle = MaterialTheme.typography.bodyLarge.copy(color = MaterialTheme.colorScheme.onSurface),
shape = RoundedCornerShape(12.dp)
)

Spacer(Modifier.padding(16.dp))

Button(onClick = {
if(gatewayServer != null) {
viewModel.update(
context, gatewayServer.apply {
this.URL = url
this.tag = tag
},
) {
onDismissCallback()
Row(
horizontalArrangement = Arrangement.spacedBy(10.dp)
) {

val buttonModifier = Modifier
.weight(1f)
.height(48.dp)
val sharedShape = MaterialTheme.shapes.medium

Button(onClick = {
if (gatewayServer != null) {
viewModel.update(
context,
gatewayServer.apply {
this.URL = url
this.tag = tag
},
) {
onDismissCallback()
}
} else {
viewModel.update(
context,
GatewayServer().apply {
this.URL = url
this.tag = tag
},
) {
onDismissCallback()
}
}
} else {
viewModel.update(
context, GatewayServer().apply {
this.URL = url
this.tag = tag
},
modifier = buttonModifier,
shape = sharedShape ) {
Text(stringResource(R.string.save))
}
Spacer(Modifier.padding(8.dp))

if (gatewayServer != null || LocalInspectionMode.current) {
OutlinedButton(
onClick = {
viewModel.delete(
context = context,
gatewayClient = gatewayServer!!,
) {
onDismissCallback()
}
},
modifier = buttonModifier,
colors = ButtonDefaults.outlinedButtonColors(
contentColor = MaterialTheme.colorScheme.error
),
border = ButtonDefaults.outlinedButtonBorder,
shape = MaterialTheme.shapes.medium
) {
onDismissCallback()
Text(
text = stringResource(R.string.delete),
fontWeight = FontWeight.SemiBold
)
}
}
}) {
Text(stringResource(R.string.save))
}
// ============

Spacer(Modifier.padding(16.dp))

if(gatewayServer != null || LocalInspectionMode.current) {
Button(onClick = {
viewModel.delete(
context = context,
gatewayClient = gatewayServer!!,
){
onDismissCallback()
}
}, colors = ButtonDefaults
.buttonColors(MaterialTheme.colorScheme.error) ) {
Text(stringResource(R.string.delete))
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
<string name="conversation_secure_popup_request_menu_yes">Send</string>
<string name="conversation_secure_popup_request_menu_cancel">Cancel</string>
<string name="conversation_secure_popup_request_menu_title">Secure Conversation Request</string>
<string name="conversation_secure_popup_request_menu_description">A secure communications request will send an SMS to this contact. \n\nThey will need have Deku SMS installed to receive this request.</string>
<string name="conversation_secure_popup_request_menu_description">A secure communications request will send an SMS to this contact. \n\nThey will need to have Deku SMS installed to receive this request.</string>
<string name="conversation_secure_popup_request_menu_description_subtext">* SMS cost still applies</string>

<string name="conversation_shortcode_description">Can\'t reply to this short code</string>
Expand Down