Fix bug in addFollowSet, and refactor to use Boolean for checking list visibility. Use runBlocking in getFollowSetNOte(for now).
This commit is contained in:
+8
-7
@@ -63,12 +63,14 @@ class NostrUserListFeedViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getFollowSetNote(
|
fun getFollowSetNote(
|
||||||
noteIdentifier: String,
|
noteIdentifier: String,
|
||||||
account: Account,
|
account: Account,
|
||||||
): AddressableNote? {
|
): AddressableNote? {
|
||||||
checkNotInMainThread()
|
// checkNotInMainThread()
|
||||||
val potentialNote = account.getFollowSetNotes().find { it.dTag() == noteIdentifier }
|
val potentialNote =
|
||||||
|
runBlocking(Dispatchers.IO) { account.getFollowSetNotes() }
|
||||||
|
.find { it.dTag() == noteIdentifier }
|
||||||
return potentialNote
|
return potentialNote
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +78,6 @@ class NostrUserListFeedViewModel(
|
|||||||
setName: String,
|
setName: String,
|
||||||
account: Account,
|
account: Account,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
checkNotInMainThread()
|
|
||||||
val potentialNote =
|
val potentialNote =
|
||||||
runBlocking(viewModelScope.coroutineContext) { account.getFollowSetNotes() }
|
runBlocking(viewModelScope.coroutineContext) { account.getFollowSetNotes() }
|
||||||
.find { (it.event as PeopleListEvent).nameOrTitle() == setName }
|
.find { (it.event as PeopleListEvent).nameOrTitle() == setName }
|
||||||
@@ -116,10 +117,10 @@ class NostrUserListFeedViewModel(
|
|||||||
fun addFollowSet(
|
fun addFollowSet(
|
||||||
setName: String,
|
setName: String,
|
||||||
setDescription: String?,
|
setDescription: String?,
|
||||||
setType: ListVisibility,
|
isListPrivate: Boolean,
|
||||||
account: Account,
|
account: Account,
|
||||||
) {
|
) {
|
||||||
if (account.settings.isWriteable()) {
|
if (!account.settings.isWriteable()) {
|
||||||
println("You are in read-only mode. Please login to make modifications.")
|
println("You are in read-only mode. Please login to make modifications.")
|
||||||
} else {
|
} else {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
@@ -127,7 +128,7 @@ class NostrUserListFeedViewModel(
|
|||||||
dTag = UUID.randomUUID().toString(),
|
dTag = UUID.randomUUID().toString(),
|
||||||
title = setName,
|
title = setName,
|
||||||
description = setDescription,
|
description = setDescription,
|
||||||
isPrivate = setType == ListVisibility.Private,
|
isPrivate = isListPrivate,
|
||||||
signer = account.signer,
|
signer = account.signer,
|
||||||
) {
|
) {
|
||||||
account.sendMyPublicAndPrivateOutbox(it)
|
account.sendMyPublicAndPrivateOutbox(it)
|
||||||
|
|||||||
Reference in New Issue
Block a user