- Updating Status on the Drawer

- Reducing font size for statuses and nip05s
This commit is contained in:
Vitor Pamplona
2023-08-24 17:34:02 -04:00
parent 62db68c7b2
commit 5b596d2a56
12 changed files with 200 additions and 8 deletions
@@ -37,5 +37,17 @@ class StatusEvent(
val sig = CryptoUtils.sign(id, privateKey)
return StatusEvent(id.toHexKey(), pubKey, createdAt, tags, msg, sig.toHexKey())
}
fun update(
event: StatusEvent,
newStatus: String,
privateKey: ByteArray,
createdAt: Long = TimeUtils.now()
): StatusEvent {
val pubKey = event.pubKey()
val id = generateId(pubKey, createdAt, kind, event.tags, newStatus)
val sig = CryptoUtils.sign(id, privateKey)
return StatusEvent(id.toHexKey(), pubKey, createdAt, event.tags, newStatus, sig.toHexKey())
}
}
}
@@ -13,6 +13,7 @@ object TimeUtils {
fun now() = System.currentTimeMillis() / 1000
fun fiveMinutesAgo() = now() - fiveMinutes
fun oneHourAgo() = now() - oneHour
fun oneHourAhead() = now() + oneHour
fun oneDayAgo() = now() - oneDay
fun eightHoursAgo() = now() - eightHours
fun oneWeekAgo() = now() - oneWeek