fix: crash when muting threads
Fixes a crash when the user mutes a thread. UserDefaults didn't know how to serialize a NoteId for storage, so we'll convert it to the hex id first. Changelog-Fixed: Crash when muting threads Signed-off-by: Bryan Montz <bryanmontz@me.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
14ba33674b
commit
cddb88b890
@@ -24,7 +24,8 @@ func saveMutedThreads(pubkey: Pubkey, currentValue: [NoteId], value: [NoteId]) -
|
|||||||
let uniqueMutedThreads = Array(Set(value))
|
let uniqueMutedThreads = Array(Set(value))
|
||||||
|
|
||||||
if uniqueMutedThreads != currentValue {
|
if uniqueMutedThreads != currentValue {
|
||||||
UserDefaults.standard.set(uniqueMutedThreads, forKey: getMutedThreadsKey(pubkey: pubkey))
|
let ids = uniqueMutedThreads.map { note_id in return note_id.hex() }
|
||||||
|
UserDefaults.standard.set(ids, forKey: getMutedThreadsKey(pubkey: pubkey))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user