rename runIOCatching to launchSigner
This commit is contained in:
+3
-3
@@ -102,7 +102,7 @@ class NewUserMetadataViewModel : ViewModel() {
|
||||
|
||||
fun create() {
|
||||
// Tries to not delete any existing attribute that we do not work with.
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
val metadata =
|
||||
account.userMetadata.sendNewUserMetadata(
|
||||
name = displayName.value,
|
||||
@@ -145,7 +145,7 @@ class NewUserMetadataViewModel : ViewModel() {
|
||||
context: Context,
|
||||
onError: (String, String) -> Unit,
|
||||
) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
upload(
|
||||
uri,
|
||||
context,
|
||||
@@ -161,7 +161,7 @@ class NewUserMetadataViewModel : ViewModel() {
|
||||
context: Context,
|
||||
onError: (String, String) -> Unit,
|
||||
) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
upload(
|
||||
uri,
|
||||
context,
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ class BlossomServersViewModel : ViewModel() {
|
||||
|
||||
fun saveFileServers() {
|
||||
if (isModified) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
val serverList = _fileServers.value.map { it.baseUrl }
|
||||
account.sendBlossomServersList(serverList)
|
||||
refresh()
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ class NIP96ServersViewModel : ViewModel() {
|
||||
|
||||
fun saveFileServers() {
|
||||
if (isModified) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
val serverList = _fileServers.value.map { it.baseUrl }
|
||||
account.sendFileServersList(serverList)
|
||||
refresh()
|
||||
|
||||
+3
-3
@@ -138,7 +138,7 @@ fun GenericCommentPostScreen(
|
||||
WatchAndLoadMyEmojiList(accountViewModel)
|
||||
|
||||
BackHandler {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
@@ -152,7 +152,7 @@ fun GenericCommentPostScreen(
|
||||
onCancel = {
|
||||
// uses the accountViewModel scope to avoid cancelling this
|
||||
// function when the postViewModel is released
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
@@ -161,7 +161,7 @@ fun GenericCommentPostScreen(
|
||||
onPost = {
|
||||
// uses the accountViewModel scope to avoid cancelling this
|
||||
// function when the postViewModel is released
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendPostSync()
|
||||
nav.popBack()
|
||||
}
|
||||
|
||||
+55
-55
@@ -313,7 +313,7 @@ class AccountViewModel(
|
||||
note: Note,
|
||||
reaction: String,
|
||||
) {
|
||||
runIOCatching {
|
||||
launchSigner {
|
||||
val currentReactions = note.allReactionsOfContentByAuthor(userProfile(), reaction)
|
||||
if (currentReactions.isNotEmpty()) {
|
||||
account.delete(currentReactions)
|
||||
@@ -679,7 +679,7 @@ class AccountViewModel(
|
||||
onProgress: (percent: Float) -> Unit,
|
||||
onPayViaIntent: (ImmutableList<ZapPaymentHandler.Payable>) -> Unit,
|
||||
zapType: LnZapEvent.ZapType? = null,
|
||||
) = runIOCatching {
|
||||
) = launchSigner {
|
||||
ZapPaymentHandler(account).zap(
|
||||
note = note,
|
||||
amountMilliSats = amountInMillisats,
|
||||
@@ -699,23 +699,23 @@ class AccountViewModel(
|
||||
note: Note,
|
||||
type: ReportType,
|
||||
content: String = "",
|
||||
) = runIOCatching { account.report(note, type, content) }
|
||||
) = launchSigner { account.report(note, type, content) }
|
||||
|
||||
fun report(
|
||||
user: User,
|
||||
type: ReportType,
|
||||
) {
|
||||
runIOCatching {
|
||||
launchSigner {
|
||||
account.report(user, type)
|
||||
account.hideUser(user.pubkeyHex)
|
||||
}
|
||||
}
|
||||
|
||||
fun boost(note: Note) = runIOCatching { account.boost(note) }
|
||||
fun boost(note: Note) = launchSigner { account.boost(note) }
|
||||
|
||||
fun removeEmojiPack(emojiPack: Note) = runIOCatching { account.removeEmojiPack(emojiPack) }
|
||||
fun removeEmojiPack(emojiPack: Note) = launchSigner { account.removeEmojiPack(emojiPack) }
|
||||
|
||||
fun addEmojiPack(emojiPack: Note) = runIOCatching { account.addEmojiPack(emojiPack) }
|
||||
fun addEmojiPack(emojiPack: Note) = launchSigner { account.addEmojiPack(emojiPack) }
|
||||
|
||||
fun addMediaToGallery(
|
||||
hex: String,
|
||||
@@ -725,40 +725,40 @@ class AccountViewModel(
|
||||
dim: DimensionTag?,
|
||||
hash: String?,
|
||||
mimeType: String?,
|
||||
) = runIOCatching { account.addToGallery(hex, url, relay, blurhash, dim, hash, mimeType) }
|
||||
) = launchSigner { account.addToGallery(hex, url, relay, blurhash, dim, hash, mimeType) }
|
||||
|
||||
fun removeFromMediaGallery(note: Note) = runIOCatching { account.removeFromGallery(note) }
|
||||
fun removeFromMediaGallery(note: Note) = launchSigner { account.removeFromGallery(note) }
|
||||
|
||||
fun hashtagFollows(user: User): Note = LocalCache.getOrCreateAddressableNote(HashtagListEvent.createAddress(user.pubkeyHex))
|
||||
|
||||
fun bookmarks(user: User): Note = LocalCache.getOrCreateAddressableNote(BookmarkListEvent.createBookmarkAddress(user.pubkeyHex))
|
||||
|
||||
fun addPrivateBookmark(note: Note) = runIOCatching { account.addBookmark(note, true) }
|
||||
fun addPrivateBookmark(note: Note) = launchSigner { account.addBookmark(note, true) }
|
||||
|
||||
fun addPublicBookmark(note: Note) = runIOCatching { account.addBookmark(note, false) }
|
||||
fun addPublicBookmark(note: Note) = launchSigner { account.addBookmark(note, false) }
|
||||
|
||||
fun removePrivateBookmark(note: Note) = runIOCatching { account.removeBookmark(note, true) }
|
||||
fun removePrivateBookmark(note: Note) = launchSigner { account.removeBookmark(note, true) }
|
||||
|
||||
fun removePublicBookmark(note: Note) = runIOCatching { account.removeBookmark(note, false) }
|
||||
fun removePublicBookmark(note: Note) = launchSigner { account.removeBookmark(note, false) }
|
||||
|
||||
fun broadcast(note: Note) = runIOCatching { account.broadcast(note) }
|
||||
fun broadcast(note: Note) = launchSigner { account.broadcast(note) }
|
||||
|
||||
fun timestamp(note: Note) = runIOCatching { account.otsState.timestamp(note) }
|
||||
fun timestamp(note: Note) = launchSigner { account.otsState.timestamp(note) }
|
||||
|
||||
fun delete(notes: List<Note>) = runIOCatching { account.delete(notes) }
|
||||
fun delete(notes: List<Note>) = launchSigner { account.delete(notes) }
|
||||
|
||||
fun delete(note: Note) = runIOCatching { account.delete(note) }
|
||||
fun delete(note: Note) = launchSigner { account.delete(note) }
|
||||
|
||||
fun cachedDecrypt(note: Note): String? = account.cachedDecryptContent(note)
|
||||
|
||||
fun decrypt(
|
||||
note: Note,
|
||||
onReady: (String) -> Unit,
|
||||
) = runIOCatching {
|
||||
) = launchSigner {
|
||||
account.decryptContent(note)?.let { onReady(it) }
|
||||
}
|
||||
|
||||
inline fun runIOCatching(crossinline action: suspend () -> Unit) {
|
||||
inline fun launchSigner(crossinline action: suspend () -> Unit) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
action()
|
||||
@@ -796,35 +796,35 @@ class AccountViewModel(
|
||||
fun approveCommunityPost(
|
||||
post: Note,
|
||||
community: AddressableNote,
|
||||
) = runIOCatching { account.approveCommunityPost(post, community) }
|
||||
) = launchSigner { account.approveCommunityPost(post, community) }
|
||||
|
||||
fun follow(community: AddressableNote) = runIOCatching { account.follow(community) }
|
||||
fun follow(community: AddressableNote) = launchSigner { account.follow(community) }
|
||||
|
||||
fun follow(channel: PublicChatChannel) = runIOCatching { account.follow(channel) }
|
||||
fun follow(channel: PublicChatChannel) = launchSigner { account.follow(channel) }
|
||||
|
||||
fun follow(channel: EphemeralChatChannel) = runIOCatching { account.follow(channel) }
|
||||
fun follow(channel: EphemeralChatChannel) = launchSigner { account.follow(channel) }
|
||||
|
||||
fun unfollow(community: AddressableNote) = runIOCatching { account.unfollow(community) }
|
||||
fun unfollow(community: AddressableNote) = launchSigner { account.unfollow(community) }
|
||||
|
||||
fun unfollow(channel: PublicChatChannel) = runIOCatching { account.unfollow(channel) }
|
||||
fun unfollow(channel: PublicChatChannel) = launchSigner { account.unfollow(channel) }
|
||||
|
||||
fun unfollow(channel: EphemeralChatChannel) = runIOCatching { account.unfollow(channel) }
|
||||
fun unfollow(channel: EphemeralChatChannel) = launchSigner { account.unfollow(channel) }
|
||||
|
||||
fun follow(user: User) = runIOCatching { account.follow(user) }
|
||||
fun follow(user: User) = launchSigner { account.follow(user) }
|
||||
|
||||
fun unfollow(user: User) = runIOCatching { account.unfollow(user) }
|
||||
fun unfollow(user: User) = launchSigner { account.unfollow(user) }
|
||||
|
||||
fun followGeohash(tag: String) = runIOCatching { account.followGeohash(tag) }
|
||||
fun followGeohash(tag: String) = launchSigner { account.followGeohash(tag) }
|
||||
|
||||
fun unfollowGeohash(tag: String) = runIOCatching { account.unfollowGeohash(tag) }
|
||||
fun unfollowGeohash(tag: String) = launchSigner { account.unfollowGeohash(tag) }
|
||||
|
||||
fun followHashtag(tag: String) = runIOCatching { account.followHashtag(tag) }
|
||||
fun followHashtag(tag: String) = launchSigner { account.followHashtag(tag) }
|
||||
|
||||
fun unfollowHashtag(tag: String) = runIOCatching { account.unfollowHashtag(tag) }
|
||||
fun unfollowHashtag(tag: String) = launchSigner { account.unfollowHashtag(tag) }
|
||||
|
||||
fun showWord(word: String) = runIOCatching { account.showWord(word) }
|
||||
fun showWord(word: String) = launchSigner { account.showWord(word) }
|
||||
|
||||
fun hideWord(word: String) = runIOCatching { account.hideWord(word) }
|
||||
fun hideWord(word: String) = launchSigner { account.hideWord(word) }
|
||||
|
||||
fun isLoggedUser(pubkeyHex: HexKey?): Boolean = account.signer.pubKey == pubkeyHex
|
||||
|
||||
@@ -859,21 +859,21 @@ class AccountViewModel(
|
||||
|
||||
fun filterSpamFromStrangers() = account.settings.syncedSettings.security.filterSpamFromStrangers
|
||||
|
||||
fun updateWarnReports(warnReports: Boolean) = runIOCatching { account.updateWarnReports(warnReports) }
|
||||
fun updateWarnReports(warnReports: Boolean) = launchSigner { account.updateWarnReports(warnReports) }
|
||||
|
||||
fun updateFilterSpam(filterSpam: Boolean) =
|
||||
runIOCatching {
|
||||
launchSigner {
|
||||
if (account.updateFilterSpam(filterSpam)) {
|
||||
LocalCache.antiSpam.active = filterSpamFromStrangers().value
|
||||
}
|
||||
}
|
||||
|
||||
fun updateShowSensitiveContent(show: Boolean?) = runIOCatching { account.updateShowSensitiveContent(show) }
|
||||
fun updateShowSensitiveContent(show: Boolean?) = launchSigner { account.updateShowSensitiveContent(show) }
|
||||
|
||||
fun changeReactionTypes(
|
||||
reactionSet: List<String>,
|
||||
onDone: () -> Unit,
|
||||
) = runIOCatching {
|
||||
) = launchSigner {
|
||||
account.changeReactionTypes(reactionSet)
|
||||
onDone()
|
||||
}
|
||||
@@ -882,37 +882,37 @@ class AccountViewModel(
|
||||
amountSet: List<Long>,
|
||||
selectedZapType: LnZapEvent.ZapType,
|
||||
nip47Update: Nip47WalletConnect.Nip47URINorm?,
|
||||
) = runIOCatching { account.updateZapAmounts(amountSet, selectedZapType, nip47Update) }
|
||||
) = launchSigner { account.updateZapAmounts(amountSet, selectedZapType, nip47Update) }
|
||||
|
||||
fun toggleDontTranslateFrom(languageCode: String) = runIOCatching { account.toggleDontTranslateFrom(languageCode) }
|
||||
fun toggleDontTranslateFrom(languageCode: String) = launchSigner { account.toggleDontTranslateFrom(languageCode) }
|
||||
|
||||
fun updateTranslateTo(languageCode: Locale) = runIOCatching { account.updateTranslateTo(languageCode) }
|
||||
fun updateTranslateTo(languageCode: Locale) = launchSigner { account.updateTranslateTo(languageCode) }
|
||||
|
||||
fun prefer(
|
||||
source: String,
|
||||
target: String,
|
||||
preference: String,
|
||||
) = runIOCatching { account.prefer(source, target, preference) }
|
||||
) = launchSigner { account.prefer(source, target, preference) }
|
||||
|
||||
fun show(user: User) = runIOCatching { account.showUser(user.pubkeyHex) }
|
||||
fun show(user: User) = launchSigner { account.showUser(user.pubkeyHex) }
|
||||
|
||||
fun hide(user: User) = runIOCatching { account.hideUser(user.pubkeyHex) }
|
||||
fun hide(user: User) = launchSigner { account.hideUser(user.pubkeyHex) }
|
||||
|
||||
fun hide(word: String) = runIOCatching { account.hideWord(word) }
|
||||
fun hide(word: String) = launchSigner { account.hideWord(word) }
|
||||
|
||||
fun showUser(pubkeyHex: String) = runIOCatching { account.showUser(pubkeyHex) }
|
||||
fun showUser(pubkeyHex: String) = launchSigner { account.showUser(pubkeyHex) }
|
||||
|
||||
fun createStatus(newStatus: String) = runIOCatching { account.createStatus(newStatus) }
|
||||
fun createStatus(newStatus: String) = launchSigner { account.createStatus(newStatus) }
|
||||
|
||||
fun updateStatus(
|
||||
address: Address,
|
||||
newStatus: String,
|
||||
) = runIOCatching {
|
||||
) = launchSigner {
|
||||
account.updateStatus(LocalCache.getOrCreateAddressableNote(address), newStatus)
|
||||
}
|
||||
|
||||
fun deleteStatus(address: Address) =
|
||||
runIOCatching {
|
||||
launchSigner {
|
||||
account.deleteStatus(LocalCache.getOrCreateAddressableNote(address))
|
||||
}
|
||||
|
||||
@@ -1181,7 +1181,7 @@ class AccountViewModel(
|
||||
val hint = note.toEventHint<VoiceEvent>()
|
||||
if (hint == null) return
|
||||
|
||||
runIOCatching {
|
||||
launchSigner {
|
||||
val uploader = UploadOrchestrator()
|
||||
val result =
|
||||
uploader.upload(
|
||||
@@ -1274,7 +1274,7 @@ class AccountViewModel(
|
||||
if (isWriteable()) {
|
||||
val boosts = baseNote.boostedBy(userProfile())
|
||||
if (boosts.isNotEmpty()) {
|
||||
runIOCatching {
|
||||
launchSigner {
|
||||
account.delete(boosts)
|
||||
}
|
||||
} else {
|
||||
@@ -1404,7 +1404,7 @@ class AccountViewModel(
|
||||
fun unwrapIfNeeded(
|
||||
note: Note?,
|
||||
onReady: (Note) -> Unit = {},
|
||||
) = runIOCatching {
|
||||
) = launchSigner {
|
||||
val noteEvent = note?.event
|
||||
if (noteEvent != null) {
|
||||
val resultingNote = unwrapIfNeeded(noteEvent)
|
||||
@@ -1436,7 +1436,7 @@ class AccountViewModel(
|
||||
dvmPublicKey: User,
|
||||
onReady: (event: Note) -> Unit,
|
||||
) {
|
||||
runIOCatching {
|
||||
launchSigner {
|
||||
account.requestDVMContentDiscovery(dvmPublicKey) {
|
||||
onReady(LocalCache.getOrCreateNote(it.id))
|
||||
}
|
||||
@@ -1470,7 +1470,7 @@ class AccountViewModel(
|
||||
zappedNote: Note?,
|
||||
onSent: () -> Unit = {},
|
||||
onResponse: (Response?) -> Unit,
|
||||
) = runIOCatching {
|
||||
) = launchSigner {
|
||||
account.sendZapPaymentRequestFor(bolt11, zappedNote, onResponse)
|
||||
onSent()
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ class AccountViewModel(
|
||||
root: InteractiveStoryBaseEvent,
|
||||
readingScene: InteractiveStoryBaseEvent,
|
||||
) {
|
||||
runIOCatching {
|
||||
launchSigner {
|
||||
val sceneNoteRelayHint = LocalCache.getOrCreateAddressableNote(readingScene.address()).relayHintUrl()
|
||||
|
||||
val readingState = getInteractiveStoryReadingState(root.addressTag())
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ fun NewChatroomSubjectDialog(
|
||||
|
||||
PostButton(
|
||||
onPost = {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
val template =
|
||||
ChatMessageEvent.build(
|
||||
message.value,
|
||||
|
||||
+3
-3
@@ -114,7 +114,7 @@ class ChatNewMessageViewModel :
|
||||
draftTag.versions.collectLatest {
|
||||
// don't save the first
|
||||
if (it > 0) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
sendDraftSync()
|
||||
}
|
||||
}
|
||||
@@ -393,7 +393,7 @@ class ChatNewMessageViewModel :
|
||||
) {
|
||||
val uploadState = uploadState ?: return
|
||||
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
if (nip17) {
|
||||
ChatFileUploader(account).justUploadNIP17(uploadState, onError, context) {
|
||||
uploadsWaitingToBeSent += it
|
||||
@@ -418,7 +418,7 @@ class ChatNewMessageViewModel :
|
||||
val room = room ?: return
|
||||
val uploadState = uploadState ?: return
|
||||
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
if (nip17) {
|
||||
ChatFileUploader(account).justUploadNIP17(uploadState, onError, context) {
|
||||
ChatFileSender(room, account).sendNIP17(it)
|
||||
|
||||
+3
-3
@@ -169,7 +169,7 @@ fun NewGroupDMScreen(
|
||||
WatchAndLoadMyEmojiList(accountViewModel)
|
||||
|
||||
BackHandler {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
@@ -184,7 +184,7 @@ fun NewGroupDMScreen(
|
||||
onCancel = {
|
||||
// uses the accountViewModel scope to avoid cancelling this
|
||||
// function when the postViewModel is released
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
@@ -193,7 +193,7 @@ fun NewGroupDMScreen(
|
||||
onPost = {
|
||||
// uses the accountViewModel scope to avoid cancelling this
|
||||
// function when the postViewModel is released
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendPostSync()
|
||||
postViewModel.room?.let {
|
||||
nav.nav(routeToMessage(it, null, null, null, null, accountViewModel))
|
||||
|
||||
+2
-2
@@ -85,7 +85,7 @@ fun PrivateMessageEditFieldRow(
|
||||
nav: INav,
|
||||
) {
|
||||
BackHandler {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
channelScreenModel.sendDraftSync()
|
||||
channelScreenModel.cancel()
|
||||
}
|
||||
@@ -170,7 +170,7 @@ fun EditField(
|
||||
isActive = channelScreenModel.canPost(),
|
||||
modifier = EditFieldTrailingIconModifier,
|
||||
) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
channelScreenModel.sendPostSync()
|
||||
onSendNewMessage()
|
||||
}
|
||||
|
||||
+2
-2
@@ -107,7 +107,7 @@ open class ChannelNewMessageViewModel :
|
||||
draftTag.versions.collectLatest {
|
||||
// don't save the first
|
||||
if (it > 0) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
sendDraftSync()
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,7 @@ open class ChannelNewMessageViewModel :
|
||||
}
|
||||
|
||||
fun sendPost(onDone: suspend () -> Unit) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
sendPostSync()
|
||||
onDone()
|
||||
}
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ fun EditFieldRow(
|
||||
nav: INav,
|
||||
) {
|
||||
BackHandler {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
channelScreenModel.sendDraftSync()
|
||||
channelScreenModel.cancel()
|
||||
}
|
||||
|
||||
+2
-2
@@ -139,7 +139,7 @@ fun NewProductScreen(
|
||||
WatchAndLoadMyEmojiList(accountViewModel)
|
||||
|
||||
BackHandler {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
@@ -154,7 +154,7 @@ fun NewProductScreen(
|
||||
onCancel = {
|
||||
// uses the accountViewModel scope to avoid cancelling this
|
||||
// function when the postViewModel is released
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ open class NewProductViewModel :
|
||||
draftTag.versions.collectLatest {
|
||||
// don't save the first
|
||||
if (it > 0) {
|
||||
accountViewModel?.runIOCatching {
|
||||
accountViewModel?.launchSigner {
|
||||
sendDraftSync()
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -167,7 +167,7 @@ private fun NewPostScreenInner(
|
||||
WatchAndLoadMyEmojiList(accountViewModel)
|
||||
|
||||
BackHandler {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
@@ -181,7 +181,7 @@ private fun NewPostScreenInner(
|
||||
onPost = {
|
||||
// uses the accountViewModel scope to avoid cancelling this
|
||||
// function when the postViewModel is released
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendPostSync()
|
||||
nav.popBack()
|
||||
}
|
||||
@@ -189,7 +189,7 @@ private fun NewPostScreenInner(
|
||||
onCancel = {
|
||||
// uses the accountViewModel scope to avoid cancelling this
|
||||
// function when the postViewModel is released
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ open class ShortNotePostViewModel :
|
||||
draftTag.versions.collectLatest {
|
||||
// don't save the first
|
||||
if (it > 0) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
sendDraftSync()
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -237,7 +237,7 @@ private fun ListViewAndEditColumn(
|
||||
pagerState = pagerState,
|
||||
modifier = Modifier.weight(1f),
|
||||
onDeleteUser = { user, isPrivate ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
viewModel.removeUserFromSet(user, isPrivate)
|
||||
}
|
||||
},
|
||||
@@ -303,7 +303,7 @@ private fun RenderAddUserFieldAndSuggestions(
|
||||
viewModel.hasUserFlow(user, pagerState.currentPage == 1)
|
||||
},
|
||||
onSelect = { user ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
viewModel.addUserToSet(user, pagerState.currentPage == 1)
|
||||
}
|
||||
userName =
|
||||
@@ -312,7 +312,7 @@ private fun RenderAddUserFieldAndSuggestions(
|
||||
)
|
||||
},
|
||||
onDelete = { user ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
viewModel.removeUserFromSet(user, pagerState.currentPage == 1)
|
||||
}
|
||||
userName =
|
||||
@@ -563,14 +563,14 @@ fun ListActionsMenuButton(
|
||||
) {
|
||||
ListActionsMenuButton(
|
||||
onBroadcastList = {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
viewModel.loadNote()?.let { updatedSetNote ->
|
||||
accountViewModel.broadcast(updatedSetNote)
|
||||
}
|
||||
}
|
||||
},
|
||||
onDeleteList = {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
viewModel.deleteFollowSet()
|
||||
}
|
||||
nav.popBack()
|
||||
|
||||
+5
-5
@@ -52,7 +52,7 @@ fun ListOfPeopleListsScreen(
|
||||
ListOfPeopleListsScreen(
|
||||
listFlow = accountViewModel.account.peopleLists.uiListFlow,
|
||||
addItem = { title: String, description: String? ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
accountViewModel.account.peopleLists.addFollowList(
|
||||
listName = title,
|
||||
listDescription = description,
|
||||
@@ -64,7 +64,7 @@ fun ListOfPeopleListsScreen(
|
||||
nav.nav(Route.PeopleListView(it))
|
||||
},
|
||||
renameItem = { followSet, newValue ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
accountViewModel.account.peopleLists.renameFollowList(
|
||||
newName = newValue,
|
||||
peopleList = followSet,
|
||||
@@ -73,7 +73,7 @@ fun ListOfPeopleListsScreen(
|
||||
}
|
||||
},
|
||||
changeItemDescription = { followSet, newDescription ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
accountViewModel.account.peopleLists.modifyFollowSetDescription(
|
||||
newDescription = newDescription,
|
||||
peopleList = followSet,
|
||||
@@ -82,7 +82,7 @@ fun ListOfPeopleListsScreen(
|
||||
}
|
||||
},
|
||||
cloneItem = { followSet, customName, customDescription ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
accountViewModel.account.peopleLists.cloneFollowSet(
|
||||
currentPeopleList = followSet,
|
||||
customCloneName = customName,
|
||||
@@ -92,7 +92,7 @@ fun ListOfPeopleListsScreen(
|
||||
}
|
||||
},
|
||||
deleteItem = { followSet ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
accountViewModel.account.peopleLists.deleteFollowSet(
|
||||
identifierTag = followSet.identifierTag,
|
||||
account = accountViewModel.account,
|
||||
|
||||
+1
-1
@@ -135,7 +135,7 @@ private fun PeopleListAndUserFab(accountViewModel: AccountViewModel) {
|
||||
isOpen = false
|
||||
},
|
||||
onCreateList = { name, description ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
accountViewModel.account.peopleLists.addFollowList(
|
||||
listName = name,
|
||||
listDescription = description,
|
||||
|
||||
+2
-2
@@ -75,7 +75,7 @@ fun PeopleListAndUserView(
|
||||
userIsPrivateMember = list.privateMembers.contains(userToAddOrRemove),
|
||||
userIsPublicMember = list.publicMembers.contains(userToAddOrRemove),
|
||||
onRemoveUser = {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
accountViewModel.account.peopleLists.removeUserFromSet(
|
||||
userToAddOrRemove,
|
||||
isPrivate = list.privateMembers.contains(userToAddOrRemove),
|
||||
@@ -87,7 +87,7 @@ fun PeopleListAndUserView(
|
||||
privateMemberSize = list.privateMembers.size,
|
||||
publicMemberSize = list.publicMembers.size,
|
||||
onAddUserToList = { userShouldBePrivate ->
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
accountViewModel.account.peopleLists.addUserToSet(
|
||||
userToAddOrRemove,
|
||||
list.identifierTag,
|
||||
|
||||
+3
-3
@@ -129,7 +129,7 @@ fun NewPublicMessageScreen(
|
||||
WatchAndLoadMyEmojiList(accountViewModel)
|
||||
|
||||
BackHandler {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
@@ -144,7 +144,7 @@ fun NewPublicMessageScreen(
|
||||
onCancel = {
|
||||
// uses the accountViewModel scope to avoid cancelling this
|
||||
// function when the postViewModel is released
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendDraftSync()
|
||||
postViewModel.cancel()
|
||||
}
|
||||
@@ -153,7 +153,7 @@ fun NewPublicMessageScreen(
|
||||
onPost = {
|
||||
// uses the accountViewModel scope to avoid cancelling this
|
||||
// function when the postViewModel is released
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
postViewModel.sendPostSync()
|
||||
nav.popBack()
|
||||
}
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ class NewPublicMessageViewModel :
|
||||
draftTag.versions.collectLatest {
|
||||
// don't save the first
|
||||
if (it > 0) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
sendDraftSync()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ abstract class BasicRelaySetupInfoModel : ViewModel() {
|
||||
|
||||
fun create() {
|
||||
if (hasModified) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
saveRelayList(_relays.value.map { it.relay })
|
||||
clear()
|
||||
}
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ class Nip65RelayListViewModel : ViewModel() {
|
||||
|
||||
fun create() {
|
||||
if (hasModified) {
|
||||
accountViewModel.runIOCatching {
|
||||
accountViewModel.launchSigner {
|
||||
val writes = _homeRelays.value.map { it.relay }.toSet()
|
||||
val reads = _notificationRelays.value.map { it.relay }.toSet()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user