fix freeze when going to dms screen
This commit is contained in:
@@ -2570,7 +2570,8 @@ class Account(
|
||||
return when (event) {
|
||||
is PrivateDmEvent -> {
|
||||
if (AmberUtils.cachedDecryptedContent[event.id] == null) {
|
||||
AmberUtils.decrypt(
|
||||
AmberUtils.content = ""
|
||||
AmberUtils.decryptDM(
|
||||
event.content,
|
||||
event.talkingWith(userProfile().pubkeyHex),
|
||||
event.id
|
||||
|
||||
@@ -96,6 +96,16 @@ object AmberUtils {
|
||||
}
|
||||
}
|
||||
|
||||
fun decryptDM(encryptedContent: String, pubKey: HexKey, id: String, signerType: SignerType = SignerType.NIP04_DECRYPT) {
|
||||
openAmber(
|
||||
encryptedContent,
|
||||
signerType,
|
||||
IntentUtils.activityResultLauncher,
|
||||
pubKey,
|
||||
id
|
||||
)
|
||||
}
|
||||
|
||||
fun decryptBookmark(encryptedContent: String, pubKey: HexKey, id: String, signerType: SignerType = SignerType.NIP04_DECRYPT) {
|
||||
openAmber(
|
||||
encryptedContent,
|
||||
|
||||
@@ -1262,7 +1262,8 @@ fun RenderTextEvent(
|
||||
) {
|
||||
val eventContent = remember(note.event) {
|
||||
val subject = (note.event as? TextNoteEvent)?.subject()?.ifEmpty { null }
|
||||
val body = accountViewModel.decrypt(note)
|
||||
val decryptedContent = if (note.event == null) null else AmberUtils.cachedDecryptedContent[note.event!!.id()]
|
||||
val body = decryptedContent ?: accountViewModel.decrypt(note)
|
||||
|
||||
if (!subject.isNullOrBlank() && body?.split("\n")?.get(0)?.contains(subject) == false) {
|
||||
"## $subject\n$body"
|
||||
|
||||
Reference in New Issue
Block a user