mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
Add account information to the encryption and decryption screens
- Update `EncryptDecryptData` and `EncryptDecryptBunkerData` to accept an `Account` parameter. - Display the `SigningAs` component within the encryption/decryption flows to clarify which account is being used. - Adjust layout spacing and ensure `SigningAs` occupies the full width. - Pass the current account from `IntentSingleEventHomeScreen` and `BunkerSingleEventHomeScreen` to the updated components.
This commit is contained in:
+5
@@ -365,6 +365,7 @@ fun BunkerSingleEventHomeScreen(
|
||||
shouldRunOnAccept = acceptOrReject,
|
||||
appName = appName,
|
||||
type = type,
|
||||
account = account,
|
||||
onAccept = {
|
||||
BunkerRequestUtils.sendResult(
|
||||
context = context,
|
||||
@@ -428,6 +429,7 @@ fun BunkerSingleEventHomeScreen(
|
||||
shouldRunOnAccept = acceptOrReject,
|
||||
appName = appName,
|
||||
type = type,
|
||||
account = account,
|
||||
onAccept = {
|
||||
val result = bunkerRequest.encryptedData?.result ?: ""
|
||||
|
||||
@@ -493,6 +495,7 @@ fun BunkerSingleEventHomeScreen(
|
||||
shouldRunOnAccept = acceptOrReject,
|
||||
appName = appName,
|
||||
type = type,
|
||||
account = account,
|
||||
onAccept = {
|
||||
val result = bunkerRequest.encryptedData?.result ?: ""
|
||||
|
||||
@@ -558,6 +561,7 @@ fun BunkerSingleEventHomeScreen(
|
||||
shouldRunOnAccept = acceptOrReject,
|
||||
appName = appName,
|
||||
type = type,
|
||||
account = account,
|
||||
onAccept = {
|
||||
val result = bunkerRequest.encryptedData?.result ?: ""
|
||||
|
||||
@@ -707,6 +711,7 @@ fun BunkerSingleEventHomeScreen(
|
||||
shouldRunOnAccept = acceptOrReject,
|
||||
appName = appName,
|
||||
type = type,
|
||||
account = account,
|
||||
onAccept = {
|
||||
val result =
|
||||
if (bunkerRequest.encryptedData?.result == "Could not decrypt the message") {
|
||||
|
||||
@@ -26,6 +26,7 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.greenart7c3.nostrsigner.Amber
|
||||
import com.greenart7c3.nostrsigner.R
|
||||
import com.greenart7c3.nostrsigner.models.Account
|
||||
import com.greenart7c3.nostrsigner.models.ClearTextEncryptedDataKind
|
||||
import com.greenart7c3.nostrsigner.models.EncryptedDataKind
|
||||
import com.greenart7c3.nostrsigner.models.EventEncryptedDataKind
|
||||
@@ -43,6 +44,7 @@ fun EncryptDecryptData(
|
||||
shouldRunOnAccept: Boolean?,
|
||||
packageName: String?,
|
||||
type: SignerType,
|
||||
account: Account,
|
||||
onAccept: (RememberType) -> Unit,
|
||||
onReject: (RememberType) -> Unit,
|
||||
) {
|
||||
@@ -91,7 +93,6 @@ fun EncryptDecryptData(
|
||||
text.trim().capitalize(Locale.current),
|
||||
fontSize = 18.sp,
|
||||
)
|
||||
Spacer(Modifier.size(4.dp))
|
||||
|
||||
Card(
|
||||
modifier = Modifier
|
||||
@@ -144,6 +145,8 @@ fun EncryptDecryptData(
|
||||
}
|
||||
} else {
|
||||
if (encryptedData is TagArrayEncryptedDataKind) {
|
||||
Spacer(Modifier.size(16.dp))
|
||||
SigningAs(account)
|
||||
EncryptedTagArraySection(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -168,7 +171,11 @@ fun EncryptDecryptData(
|
||||
}
|
||||
}
|
||||
|
||||
if (encryptedData !is TagArrayEncryptedDataKind) Spacer(modifier = Modifier.weight(1f))
|
||||
if (encryptedData !is TagArrayEncryptedDataKind) {
|
||||
Spacer(Modifier.size(16.dp))
|
||||
SigningAs(account)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
}
|
||||
|
||||
RememberMyChoice(
|
||||
shouldRunOnAccept,
|
||||
@@ -203,6 +210,7 @@ fun BunkerEncryptDecryptData(
|
||||
shouldRunOnAccept: Boolean?,
|
||||
appName: String,
|
||||
type: SignerType,
|
||||
account: Account,
|
||||
onAccept: (RememberType) -> Unit,
|
||||
onReject: (RememberType) -> Unit,
|
||||
) {
|
||||
@@ -248,7 +256,6 @@ fun BunkerEncryptDecryptData(
|
||||
},
|
||||
fontSize = 18.sp,
|
||||
)
|
||||
Spacer(Modifier.size(4.dp))
|
||||
|
||||
Card(
|
||||
modifier = Modifier
|
||||
@@ -295,6 +302,8 @@ fun BunkerEncryptDecryptData(
|
||||
}
|
||||
} else {
|
||||
if (encryptedData is TagArrayEncryptedDataKind) {
|
||||
Spacer(Modifier.size(16.dp))
|
||||
SigningAs(account)
|
||||
EncryptedTagArraySection(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -319,7 +328,11 @@ fun BunkerEncryptDecryptData(
|
||||
}
|
||||
}
|
||||
|
||||
if (encryptedData !is TagArrayEncryptedDataKind) Spacer(modifier = Modifier.weight(1f))
|
||||
if (encryptedData !is TagArrayEncryptedDataKind) {
|
||||
Spacer(Modifier.size(16.dp))
|
||||
SigningAs(account)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
}
|
||||
|
||||
RememberMyChoice(
|
||||
shouldRunOnAccept,
|
||||
|
||||
+1
@@ -183,6 +183,7 @@ fun IntentSingleEventHomeScreen(
|
||||
shouldRunOnAccept = acceptOrReject,
|
||||
packageName = packageName,
|
||||
type = intentData.type,
|
||||
account = account,
|
||||
onAccept = {
|
||||
val result =
|
||||
if (intentData.encryptedData?.result == "Could not decrypt the message" && (intentData.type == SignerType.DECRYPT_ZAP_EVENT)) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.greenart7c3.nostrsigner.ui.components
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
@@ -33,7 +34,9 @@ import com.greenart7c3.nostrsigner.ui.theme.fromHex
|
||||
@Composable
|
||||
fun SigningAs(account: Account, modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier.padding(vertical = 8.dp),
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user