fix: track KeyPackage published status and subscribe to own key packages
The publish KeyPackage button was always active because the app didn't track whether a key package had already been published. This adds: - hasActiveKeyPackages() to KeyPackageRotationManager and MarmotManager - hasPublishedKeyPackage() to Account, checking both in-memory bundles and the local cache for existing kind:30443 events - Own key package filter in MarmotSubscriptionManager and the EOSE manager so previously published key packages are downloaded from relays on app restart - UI feedback: primary-colored key icon when published, contextual empty-state message, and a spinner during publishing https://claude.ai/code/session_01BVe7aSEWd2KLi5Ks6RZkcc
This commit is contained in:
+8
@@ -140,6 +140,13 @@ class MarmotSubscriptionManager(
|
||||
MarmotFilters.giftWrapsForUser(userPubKey)
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a filter for the current user's own KeyPackages (kind:30443).
|
||||
* Used to discover previously published KeyPackages on relay connect/reconnect,
|
||||
* so the app can track whether a KeyPackage has already been published.
|
||||
*/
|
||||
fun ownKeyPackageFilter(): Filter = MarmotFilters.keyPackagesByAuthor(userPubKey)
|
||||
|
||||
/**
|
||||
* Build a KeyPackage filter for a specific user.
|
||||
* Used on-demand when inviting a user to a group.
|
||||
@@ -166,6 +173,7 @@ class MarmotSubscriptionManager(
|
||||
val filters = mutableListOf<Filter>()
|
||||
filters.addAll(activeGroupFilters())
|
||||
filters.add(giftWrapFilter())
|
||||
filters.add(ownKeyPackageFilter())
|
||||
return filters
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -154,6 +154,12 @@ class KeyPackageRotationManager {
|
||||
*/
|
||||
fun needsRotation(): Boolean = pendingRotations.isNotEmpty()
|
||||
|
||||
/**
|
||||
* Check if there are any active (non-consumed) KeyPackage bundles.
|
||||
* Returns true if at least one slot has been generated and not yet consumed.
|
||||
*/
|
||||
fun hasActiveKeyPackages(): Boolean = activeBundles.isNotEmpty()
|
||||
|
||||
/**
|
||||
* Rotate a consumed slot: generate a new KeyPackage for the same d-tag.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user