mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 23:06:24 +02:00
fix build, use keyPair in textnoteevent, check if loggedInWithAmber in newpostview
This commit is contained in:
@@ -880,8 +880,7 @@ class Account(
|
|||||||
root = root,
|
root = root,
|
||||||
directMentions = directMentions,
|
directMentions = directMentions,
|
||||||
geohash = geohash,
|
geohash = geohash,
|
||||||
pubKey = keyPair.pubKey.toHexKey(),
|
keyPair = keyPair
|
||||||
privateKey = keyPair.privKey
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!signEvent) {
|
if (!signEvent) {
|
||||||
|
@@ -30,6 +30,7 @@ import com.vitorpamplona.quartz.events.ReactionEvent
|
|||||||
import com.vitorpamplona.quartz.events.ReportEvent
|
import com.vitorpamplona.quartz.events.ReportEvent
|
||||||
import com.vitorpamplona.quartz.events.RepostEvent
|
import com.vitorpamplona.quartz.events.RepostEvent
|
||||||
import com.vitorpamplona.quartz.events.SealedGossipEvent
|
import com.vitorpamplona.quartz.events.SealedGossipEvent
|
||||||
|
import com.vitorpamplona.quartz.events.StatusEvent
|
||||||
import com.vitorpamplona.quartz.events.TextNoteEvent
|
import com.vitorpamplona.quartz.events.TextNoteEvent
|
||||||
|
|
||||||
object NostrAccountDataSource : NostrDataSource("AccountData") {
|
object NostrAccountDataSource : NostrDataSource("AccountData") {
|
||||||
|
@@ -234,9 +234,11 @@ fun NewPostView(
|
|||||||
PostButton(
|
PostButton(
|
||||||
onPost = {
|
onPost = {
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
postViewModel.sendPost(relayList = relayList)
|
event = postViewModel.sendPost(relayList = relayList, !accountViewModel.loggedInWithAmber())
|
||||||
|
if (!accountViewModel.loggedInWithAmber()) {
|
||||||
onClose()
|
onClose()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
isActive = postViewModel.canPost()
|
isActive = postViewModel.canPost()
|
||||||
)
|
)
|
||||||
|
@@ -143,7 +143,7 @@ fun SignerDialog(
|
|||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
CloseButton(
|
CloseButton(
|
||||||
onCancel = {
|
onPress = {
|
||||||
onClose()
|
onClose()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@@ -6,6 +6,7 @@ import com.linkedin.urls.detection.UrlDetectorOptions
|
|||||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
import com.vitorpamplona.quartz.encoders.toHexKey
|
import com.vitorpamplona.quartz.encoders.toHexKey
|
||||||
import com.vitorpamplona.quartz.crypto.CryptoUtils
|
import com.vitorpamplona.quartz.crypto.CryptoUtils
|
||||||
|
import com.vitorpamplona.quartz.crypto.KeyPair
|
||||||
import com.vitorpamplona.quartz.encoders.ATag
|
import com.vitorpamplona.quartz.encoders.ATag
|
||||||
import com.vitorpamplona.quartz.encoders.HexKey
|
import com.vitorpamplona.quartz.encoders.HexKey
|
||||||
|
|
||||||
@@ -37,8 +38,7 @@ class TextNoteEvent(
|
|||||||
root: String?,
|
root: String?,
|
||||||
directMentions: Set<HexKey>,
|
directMentions: Set<HexKey>,
|
||||||
geohash: String? = null,
|
geohash: String? = null,
|
||||||
pubKey: HexKey,
|
keyPair: KeyPair,
|
||||||
privateKey: ByteArray?,
|
|
||||||
createdAt: Long = TimeUtils.now()
|
createdAt: Long = TimeUtils.now()
|
||||||
): TextNoteEvent {
|
): TextNoteEvent {
|
||||||
val tags = mutableListOf<List<String>>()
|
val tags = mutableListOf<List<String>>()
|
||||||
@@ -95,8 +95,9 @@ class TextNoteEvent(
|
|||||||
tags.add(listOf("g", it))
|
tags.add(listOf("g", it))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val pubKey = keyPair.pubKey.toHexKey()
|
||||||
val id = generateId(pubKey, createdAt, kind, tags, msg)
|
val id = generateId(pubKey, createdAt, kind, tags, msg)
|
||||||
val sig = if (privateKey == null) null else CryptoUtils.sign(id, privateKey)
|
val sig = if (keyPair.privKey == null) null else CryptoUtils.sign(id, keyPair.privKey)
|
||||||
return TextNoteEvent(id.toHexKey(), pubKey, createdAt, tags, msg, sig?.toHexKey() ?: "")
|
return TextNoteEvent(id.toHexKey(), pubKey, createdAt, tags, msg, sig?.toHexKey() ?: "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user