mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-21 23:03:28 +02:00
Organize imports to simplify merge
This commit is contained in:
@@ -326,7 +326,8 @@ object LocalCache {
|
|||||||
|
|
||||||
// Log.d("PM", "${author.toBestDisplayName()} to ${recipient?.toBestDisplayName()}")
|
// Log.d("PM", "${author.toBestDisplayName()} to ${recipient?.toBestDisplayName()}")
|
||||||
|
|
||||||
val repliesTo = event.tags.filter { it.firstOrNull() == "e" }.mapNotNull { it.getOrNull(1) }.mapNotNull { checkGetOrCreateNote(it) }
|
val repliesTo = event.tags.filter { it.firstOrNull() == "e" }.mapNotNull { it.getOrNull(1) }
|
||||||
|
.mapNotNull { checkGetOrCreateNote(it) }
|
||||||
|
|
||||||
note.loadEvent(event, author, repliesTo)
|
note.loadEvent(event, author, repliesTo)
|
||||||
|
|
||||||
@@ -347,7 +348,8 @@ object LocalCache {
|
|||||||
deleteNote.author?.removeNote(deleteNote)
|
deleteNote.author?.removeNote(deleteNote)
|
||||||
|
|
||||||
// reverts the add
|
// reverts the add
|
||||||
val mentions = deleteNote.event?.tags()?.filter { it.firstOrNull() == "p" }?.mapNotNull { it.getOrNull(1) }?.mapNotNull { checkGetOrCreateUser(it) }
|
val mentions = deleteNote.event?.tags()?.filter { it.firstOrNull() == "p" }
|
||||||
|
?.mapNotNull { it.getOrNull(1) }?.mapNotNull { checkGetOrCreateUser(it) }
|
||||||
|
|
||||||
mentions?.forEach { user ->
|
mentions?.forEach { user ->
|
||||||
user.removeReport(deleteNote)
|
user.removeReport(deleteNote)
|
||||||
@@ -571,7 +573,10 @@ object LocalCache {
|
|||||||
val mentions = event.zappedAuthor().mapNotNull { checkGetOrCreateUser(it) }
|
val mentions = event.zappedAuthor().mapNotNull { checkGetOrCreateUser(it) }
|
||||||
val repliesTo = event.zappedPost().mapNotNull { checkGetOrCreateNote(it) } +
|
val repliesTo = event.zappedPost().mapNotNull { checkGetOrCreateNote(it) } +
|
||||||
event.taggedAddresses().map { getOrCreateAddressableNote(it) } +
|
event.taggedAddresses().map { getOrCreateAddressableNote(it) } +
|
||||||
((zapRequest?.event as? LnZapRequestEvent)?.taggedAddresses()?.map { getOrCreateAddressableNote(it) } ?: emptySet<Note>())
|
(
|
||||||
|
(zapRequest?.event as? LnZapRequestEvent)?.taggedAddresses()
|
||||||
|
?.map { getOrCreateAddressableNote(it) } ?: emptySet<Note>()
|
||||||
|
)
|
||||||
|
|
||||||
note.loadEvent(event, author, repliesTo)
|
note.loadEvent(event, author, repliesTo)
|
||||||
|
|
||||||
@@ -662,7 +667,9 @@ object LocalCache {
|
|||||||
// Doesn't need to clean up the replies and mentions.. Too small to matter.
|
// Doesn't need to clean up the replies and mentions.. Too small to matter.
|
||||||
|
|
||||||
// reverts the add
|
// reverts the add
|
||||||
val mentions = it.event?.tags()?.filter { it.firstOrNull() == "p" }?.mapNotNull { it.getOrNull(1) }?.mapNotNull { checkGetOrCreateUser(it) }
|
val mentions =
|
||||||
|
it.event?.tags()?.filter { it.firstOrNull() == "p" }?.mapNotNull { it.getOrNull(1) }
|
||||||
|
?.mapNotNull { checkGetOrCreateUser(it) }
|
||||||
|
|
||||||
// Counts the replies
|
// Counts the replies
|
||||||
it.replyTo?.forEach { replyingNote ->
|
it.replyTo?.forEach { replyingNote ->
|
||||||
@@ -709,7 +716,8 @@ object LocalCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocalCacheLiveData(val cache: LocalCache) : LiveData<LocalCacheState>(LocalCacheState(cache)) {
|
class LocalCacheLiveData(val cache: LocalCache) :
|
||||||
|
LiveData<LocalCacheState>(LocalCacheState(cache)) {
|
||||||
|
|
||||||
// Refreshes observers in batches.
|
// Refreshes observers in batches.
|
||||||
var handlerWaiting = AtomicBoolean()
|
var handlerWaiting = AtomicBoolean()
|
||||||
|
@@ -25,7 +25,12 @@ class LnZapRequestEvent(
|
|||||||
companion object {
|
companion object {
|
||||||
const val kind = 9734
|
const val kind = 9734
|
||||||
|
|
||||||
fun create(originalNote: EventInterface, relays: Set<String>, privateKey: ByteArray, createdAt: Long = Date().time / 1000): LnZapRequestEvent {
|
fun create(
|
||||||
|
originalNote: EventInterface,
|
||||||
|
relays: Set<String>,
|
||||||
|
privateKey: ByteArray,
|
||||||
|
createdAt: Long = Date().time / 1000
|
||||||
|
): LnZapRequestEvent {
|
||||||
val content = ""
|
val content = ""
|
||||||
val pubKey = Utils.pubkeyCreate(privateKey).toHexKey()
|
val pubKey = Utils.pubkeyCreate(privateKey).toHexKey()
|
||||||
var tags = listOf(
|
var tags = listOf(
|
||||||
@@ -42,7 +47,12 @@ class LnZapRequestEvent(
|
|||||||
return LnZapRequestEvent(id.toHexKey(), pubKey, createdAt, tags, content, sig.toHexKey())
|
return LnZapRequestEvent(id.toHexKey(), pubKey, createdAt, tags, content, sig.toHexKey())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun create(userHex: String, relays: Set<String>, privateKey: ByteArray, createdAt: Long = Date().time / 1000): LnZapRequestEvent {
|
fun create(
|
||||||
|
userHex: String,
|
||||||
|
relays: Set<String>,
|
||||||
|
privateKey: ByteArray,
|
||||||
|
createdAt: Long = Date().time / 1000
|
||||||
|
): LnZapRequestEvent {
|
||||||
val content = ""
|
val content = ""
|
||||||
val pubKey = Utils.pubkeyCreate(privateKey).toHexKey()
|
val pubKey = Utils.pubkeyCreate(privateKey).toHexKey()
|
||||||
val tags = listOf(
|
val tags = listOf(
|
||||||
|
Reference in New Issue
Block a user