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