contacts: save the users' latest contact event ID
... to a persistent setting, and try to load it from NostrDB on app start. This commit causes the user's contact list event ID to be saved persistently as a user-specific setting, and to be loaded immediately after startup from the local NostrDB instance. This helps improve reliability around contact lists, since we previously relied on fetching that contact list from other relays. Eventually we will not need the event ID to be stored at all, as we will be able to query NostrDB, but for now having the latest event ID persistently stored will allow us to get around this limitation in the cleanest possible way (i.e. without having to store the event itself into another mechanism, and migrating it later to NostrDB) Other notes: - It uses a mechanism similar to other user settings, so it is pubkey-specific and should handle login/logout cases Signed-off-by: Daniel D’Aquino <daniel@daquino.me> Reviewed-by: William Casarin <jb55@jb55.com> Link: 20240422230912.65056-2-daniel@daquino.me Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
43630cbfa6
commit
43a5bbd53a
@@ -312,6 +312,12 @@ class UserSettingsStore: ObservableObject {
|
||||
return internal_winetranslate_api_key != nil
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Internal, hidden settings
|
||||
|
||||
@Setting(key: "latest_contact_event_id", default_value: nil)
|
||||
var latest_contact_event_id_hex: String?
|
||||
|
||||
}
|
||||
|
||||
func pk_setting_key(_ pubkey: Pubkey, key: String) -> String {
|
||||
|
||||
Reference in New Issue
Block a user