Moves all Dispatchers.Default to IO because of the amount of Synchronized code that blocks the thread underneath each coroutine and since Default only has the exact number of threads the processor offers, once they block, we lose computing power
This commit is contained in:
@@ -86,7 +86,7 @@ class AppModules(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val applicationIOScope = CoroutineScope(Dispatchers.IO + SupervisorJob() + exceptionHandler)
|
val applicationIOScope = CoroutineScope(Dispatchers.IO + SupervisorJob() + exceptionHandler)
|
||||||
val applicationDefaultScope = CoroutineScope(Dispatchers.Default + SupervisorJob() + exceptionHandler)
|
val applicationDefaultScope = CoroutineScope(Dispatchers.IO + SupervisorJob() + exceptionHandler)
|
||||||
|
|
||||||
// Blocking load of UI Preferences to avoid theme/language blinking
|
// Blocking load of UI Preferences to avoid theme/language blinking
|
||||||
val uiPrefs by lazy {
|
val uiPrefs by lazy {
|
||||||
|
|||||||
@@ -1761,7 +1761,7 @@ class Account(
|
|||||||
fun observeDonatedInThisVersion() =
|
fun observeDonatedInThisVersion() =
|
||||||
settings
|
settings
|
||||||
.observeDonatedInVersion(BuildConfig.VERSION_NAME)
|
.observeDonatedInVersion(BuildConfig.VERSION_NAME)
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(scope, SharingStarted.Eagerly, hasDonatedInThisVersion())
|
.stateIn(scope, SharingStarted.Eagerly, hasDonatedInThisVersion())
|
||||||
|
|
||||||
fun markDonatedInThisVersion() = settings.markDonatedInThisVersion(BuildConfig.VERSION_NAME)
|
fun markDonatedInThisVersion() = settings.markDonatedInThisVersion(BuildConfig.VERSION_NAME)
|
||||||
|
|||||||
@@ -1962,7 +1962,7 @@ object LocalCache : ILocalCache {
|
|||||||
|
|
||||||
requestNote?.let { request -> zappedNote?.addZapPayment(request, note) }
|
requestNote?.let { request -> zappedNote?.addZapPayment(request, note) }
|
||||||
|
|
||||||
GlobalScope.launch(Dispatchers.Default) {
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
responseCallback(event)
|
responseCallback(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2913,10 +2913,10 @@ class LocalCacheFlow {
|
|||||||
val deletedEventBundles = _deletedEventBundles.asSharedFlow() // read-only public view
|
val deletedEventBundles = _deletedEventBundles.asSharedFlow() // read-only public view
|
||||||
|
|
||||||
// Refreshes observers in batches.
|
// Refreshes observers in batches.
|
||||||
private val bundler = BundledInsert<Note>(1000, Dispatchers.Default)
|
private val bundler = BundledInsert<Note>(1000, Dispatchers.IO)
|
||||||
|
|
||||||
// Refreshes observers in batches.
|
// Refreshes observers in batches.
|
||||||
private val bundler2 = BundledInsert<Note>(1000, Dispatchers.Default)
|
private val bundler2 = BundledInsert<Note>(1000, Dispatchers.IO)
|
||||||
|
|
||||||
fun newNote(newNote: Note) {
|
fun newNote(newNote: Note) {
|
||||||
bundler.invalidateList(newNote) { bundledNewNotes ->
|
bundler.invalidateList(newNote) { bundledNewNotes ->
|
||||||
|
|||||||
+1
-1
@@ -97,7 +97,7 @@ class AccountCacheState(
|
|||||||
client = client,
|
client = client,
|
||||||
scope =
|
scope =
|
||||||
CoroutineScope(
|
CoroutineScope(
|
||||||
Dispatchers.Default +
|
Dispatchers.IO +
|
||||||
SupervisorJob() +
|
SupervisorJob() +
|
||||||
CoroutineExceptionHandler { _, throwable ->
|
CoroutineExceptionHandler { _, throwable ->
|
||||||
Log.e("AccountCacheState", "Account ${signer.pubKey} caught exception: ${throwable.message}", throwable)
|
Log.e("AccountCacheState", "Account ${signer.pubKey} caught exception: ${throwable.message}", throwable)
|
||||||
|
|||||||
+2
-2
@@ -66,7 +66,7 @@ class PrivateStorageRelayListState(
|
|||||||
.map { normalizePrivateOutboxRelayListWithBackup(it.note) }
|
.map { normalizePrivateOutboxRelayListWithBackup(it.note) }
|
||||||
.onStart {
|
.onStart {
|
||||||
emit(normalizePrivateOutboxRelayListWithBackup(privateOutboxListNote))
|
emit(normalizePrivateOutboxRelayListWithBackup(privateOutboxListNote))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -99,7 +99,7 @@ class PrivateStorageRelayListState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Private Home Relay List Collector Start")
|
Log.d("AccountRegisterObservers", "Private Home Relay List Collector Start")
|
||||||
getPrivateOutboxRelayListFlow().collect { noteState ->
|
getPrivateOutboxRelayListFlow().collect { noteState ->
|
||||||
Log.d("AccountRegisterObservers", "Updating Private Home Relay List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Updating Private Home Relay List for ${signer.pubKey}")
|
||||||
|
|||||||
+2
-2
@@ -69,7 +69,7 @@ class EphemeralChatListState(
|
|||||||
emit(ephemeralChatListWithBackup(noteState.note))
|
emit(ephemeralChatListWithBackup(noteState.note))
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(ephemeralChatListWithBackup(ephemeralChatListNote))
|
emit(ephemeralChatListWithBackup(ephemeralChatListNote))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -117,7 +117,7 @@ class EphemeralChatListState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "EphemeralChatList Collector Start")
|
Log.d("AccountRegisterObservers", "EphemeralChatList Collector Start")
|
||||||
getEphemeralChatListFlow().collect { noteState ->
|
getEphemeralChatListFlow().collect { noteState ->
|
||||||
Log.d("AccountRegisterObservers", "EphemeralChatList List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "EphemeralChatList List for ${signer.pubKey}")
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ class LocalRelayListState(
|
|||||||
val flow =
|
val flow =
|
||||||
settings.localRelayServers
|
settings.localRelayServers
|
||||||
.map { normalizeLocalRelayListWithBackup(it) }
|
.map { normalizeLocalRelayListWithBackup(it) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ class AccountHomeRelayState(
|
|||||||
local.flow,
|
local.flow,
|
||||||
) { nip65Outbox, privateOutBox, localRelays ->
|
) { nip65Outbox, privateOutBox, localRelays ->
|
||||||
nip65Outbox + privateOutBox + localRelays
|
nip65Outbox + privateOutBox + localRelays
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ class AccountOutboxRelayState(
|
|||||||
broadcast.flow,
|
broadcast.flow,
|
||||||
) { nip65Outbox, privateOutBox, localRelays, broadcastRelays ->
|
) { nip65Outbox, privateOutBox, localRelays, broadcastRelays ->
|
||||||
nip65Outbox + privateOutBox + localRelays + broadcastRelays
|
nip65Outbox + privateOutBox + localRelays + broadcastRelays
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ class NotificationInboxRelayState(
|
|||||||
localRelayList.flow,
|
localRelayList.flow,
|
||||||
) { nip65Inbox, localRelays ->
|
) { nip65Inbox, localRelays ->
|
||||||
nip65Inbox + localRelays
|
nip65Inbox + localRelays
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -113,7 +113,7 @@ class UserMetadataState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// saves contact list for the next time.
|
// saves contact list for the next time.
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Kind 0 Collector Start")
|
Log.d("AccountRegisterObservers", "Kind 0 Collector Start")
|
||||||
getUserMetadataFlow().collect {
|
getUserMetadataFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating Kind 0 ${it.user.toBestDisplayName()}")
|
Log.d("AccountRegisterObservers", "Updating Kind 0 ${it.user.toBestDisplayName()}")
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ class DeclaredFollowsPerOutboxRelay(
|
|||||||
calculator.authorsPerRelaySnapshot(kind3Follows.flow.value.authors, cache) { it },
|
calculator.authorsPerRelaySnapshot(kind3Follows.flow.value.authors, cache) { it },
|
||||||
)
|
)
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+4
-4
@@ -60,7 +60,7 @@ class FollowListOutboxOrProxyRelays(
|
|||||||
OutboxRelayLoader(true).authorsPerRelaySnapshot(kind3Follows.flow.value.authors, cache) { it.keys },
|
OutboxRelayLoader(true).authorsPerRelaySnapshot(kind3Follows.flow.value.authors, cache) { it.keys },
|
||||||
)
|
)
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -72,7 +72,7 @@ class FollowListOutboxOrProxyRelays(
|
|||||||
followList.minus(blockedRelays)
|
followList.minus(blockedRelays)
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(outboxRelayFlow.value.minus(blockedRelayList.flow.value.toSet()))
|
emit(outboxRelayFlow.value.minus(blockedRelayList.flow.value.toSet()))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -94,7 +94,7 @@ class FollowListOutboxOrProxyRelays(
|
|||||||
outboxRelayMinusBlockedFlow.value
|
outboxRelayMinusBlockedFlow.value
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -108,7 +108,7 @@ class FollowListOutboxOrProxyRelays(
|
|||||||
relayList.mapTo(mutableSetOf()) { it.url }
|
relayList.mapTo(mutableSetOf()) { it.url }
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(flow.value.mapTo(mutableSetOf()) { it.url })
|
emit(flow.value.mapTo(mutableSetOf()) { it.url })
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+4
-4
@@ -78,7 +78,7 @@ class FollowListReusedOutboxOrProxyRelays(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -90,7 +90,7 @@ class FollowListReusedOutboxOrProxyRelays(
|
|||||||
followList.minus(blockedRelays)
|
followList.minus(blockedRelays)
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(outboxRelayFlow.value.minus(blockedRelayList.flow.value.toSet()))
|
emit(outboxRelayFlow.value.minus(blockedRelayList.flow.value.toSet()))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -112,7 +112,7 @@ class FollowListReusedOutboxOrProxyRelays(
|
|||||||
outboxRelayMinusBlockedFlow.value
|
outboxRelayMinusBlockedFlow.value
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -126,7 +126,7 @@ class FollowListReusedOutboxOrProxyRelays(
|
|||||||
relayList.mapTo(mutableSetOf()) { it.url }
|
relayList.mapTo(mutableSetOf()) { it.url }
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(flow.value.mapTo(mutableSetOf()) { it.url })
|
emit(flow.value.mapTo(mutableSetOf()) { it.url })
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+3
-3
@@ -66,7 +66,7 @@ class FollowListState(
|
|||||||
|
|
||||||
val flow =
|
val flow =
|
||||||
innerFlow
|
innerFlow
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -81,7 +81,7 @@ class FollowListState(
|
|||||||
it.authors.mapNotNull {
|
it.authors.mapNotNull {
|
||||||
cache.checkGetOrCreateUser(it)
|
cache.checkGetOrCreateUser(it)
|
||||||
}
|
}
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -166,7 +166,7 @@ class FollowListState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// saves contact list for the next time.
|
// saves contact list for the next time.
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Kind 3 Collector Start")
|
Log.d("AccountRegisterObservers", "Kind 3 Collector Start")
|
||||||
getFollowListFlow().collect {
|
getFollowListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating Kind 3 ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Updating Kind 3 ${signer.pubKey}")
|
||||||
|
|||||||
+3
-3
@@ -60,7 +60,7 @@ class FollowsPerOutboxRelay(
|
|||||||
OutboxRelayLoader().authorsPerRelaySnapshot(kind3Follows.flow.value.authors, cache) { it },
|
OutboxRelayLoader().authorsPerRelaySnapshot(kind3Follows.flow.value.authors, cache) { it },
|
||||||
)
|
)
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -72,7 +72,7 @@ class FollowsPerOutboxRelay(
|
|||||||
followList.minus(blockedRelays)
|
followList.minus(blockedRelays)
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(outboxPerRelayFlow.value.minus(blockedRelayList.flow.value.toSet()))
|
emit(outboxPerRelayFlow.value.minus(blockedRelayList.flow.value.toSet()))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -96,7 +96,7 @@ class FollowsPerOutboxRelay(
|
|||||||
} else {
|
} else {
|
||||||
emit(proxyRelayList.flow.value.associateWith { kind3Follows.flow.value.authors })
|
emit(proxyRelayList.flow.value.associateWith { kind3Follows.flow.value.authors })
|
||||||
}
|
}
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ class IncomingOtsEventVerifier(
|
|||||||
newNotes.forEach {
|
newNotes.forEach {
|
||||||
consume(it)
|
consume(it)
|
||||||
}
|
}
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ class DmInboxRelayState(
|
|||||||
localRelayList.flow,
|
localRelayList.flow,
|
||||||
) { nip65Inbox, dmRelayList, privateOutBox, localRelays ->
|
) { nip65Inbox, dmRelayList, privateOutBox, localRelays ->
|
||||||
nip65Inbox + dmRelayList + privateOutBox + localRelays
|
nip65Inbox + dmRelayList + privateOutBox + localRelays
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+2
-2
@@ -64,7 +64,7 @@ class DmRelayListState(
|
|||||||
getDMRelayListFlow()
|
getDMRelayListFlow()
|
||||||
.map { normalizeDMRelayListWithBackup(it.note) }
|
.map { normalizeDMRelayListWithBackup(it.note) }
|
||||||
.onStart { emit(normalizeDMRelayListWithBackup(dmListNote)) }
|
.onStart { emit(normalizeDMRelayListWithBackup(dmListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -96,7 +96,7 @@ class DmRelayListState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "NIP-17 Relay List Collector Start")
|
Log.d("AccountRegisterObservers", "NIP-17 Relay List Collector Start")
|
||||||
getDMRelayListFlow().collect {
|
getDMRelayListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating DM Relay List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Updating DM Relay List for ${signer.pubKey}")
|
||||||
|
|||||||
+3
-3
@@ -71,7 +71,7 @@ class PublicChatListState(
|
|||||||
emit(publicChatListWithBackup(noteState.note))
|
emit(publicChatListWithBackup(noteState.note))
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(publicChatListWithBackup(publicChatListNote))
|
emit(publicChatListWithBackup(publicChatListNote))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -85,7 +85,7 @@ class PublicChatListState(
|
|||||||
it.mapTo(mutableSetOf()) { it.eventId }
|
it.mapTo(mutableSetOf()) { it.eventId }
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(flow.value.mapTo(mutableSetOf()) { it.eventId })
|
emit(flow.value.mapTo(mutableSetOf()) { it.eventId })
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -132,7 +132,7 @@ class PublicChatListState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Channel List Collector Start")
|
Log.d("AccountRegisterObservers", "Channel List Collector Start")
|
||||||
getChannelListFlow().collect {
|
getChannelListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Channel List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Channel List for ${signer.pubKey}")
|
||||||
|
|||||||
+2
-2
@@ -75,7 +75,7 @@ class EmojiPackState(
|
|||||||
emit(convertEmojiSelectionPack(it.note.event as? EmojiPackSelectionEvent))
|
emit(convertEmojiSelectionPack(it.note.event as? EmojiPackSelectionEvent))
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(convertEmojiSelectionPack(getEmojiPackSelection()))
|
emit(convertEmojiSelectionPack(getEmojiPackSelection()))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -120,7 +120,7 @@ class EmojiPackState(
|
|||||||
)?.map { it.value }?.toTypedArray() ?: emptyArray(),
|
)?.map { it.value }?.toTypedArray() ?: emptyArray(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+3
-3
@@ -76,7 +76,7 @@ class NwcSignerState(
|
|||||||
settings.zapPaymentRequest
|
settings.zapPaymentRequest
|
||||||
.map {
|
.map {
|
||||||
buildSigner(it) ?: signer
|
buildSigner(it) ?: signer
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -91,7 +91,7 @@ class NwcSignerState(
|
|||||||
nip47Signer
|
nip47Signer
|
||||||
.map {
|
.map {
|
||||||
NostrWalletConnectRequestCache(it)
|
NostrWalletConnectRequestCache(it)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(scope, SharingStarted.Eagerly, NostrWalletConnectRequestCache(nip47Signer.value))
|
.stateIn(scope, SharingStarted.Eagerly, NostrWalletConnectRequestCache(nip47Signer.value))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +102,7 @@ class NwcSignerState(
|
|||||||
nip47Signer
|
nip47Signer
|
||||||
.map {
|
.map {
|
||||||
NostrWalletConnectResponseCache(it)
|
NostrWalletConnectResponseCache(it)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(scope, SharingStarted.Eagerly, NostrWalletConnectResponseCache(nip47Signer.value))
|
.stateIn(scope, SharingStarted.Eagerly, NostrWalletConnectResponseCache(nip47Signer.value))
|
||||||
|
|
||||||
fun buildSigner(uri: Nip47WalletConnect.Nip47URINorm?) =
|
fun buildSigner(uri: Nip47WalletConnect.Nip47URINorm?) =
|
||||||
|
|||||||
+7
-7
@@ -78,7 +78,7 @@ class BookmarkListState(
|
|||||||
}.onStart {
|
}.onStart {
|
||||||
emit(publicBookmarks(bookmarkList))
|
emit(publicBookmarks(bookmarkList))
|
||||||
}.debounce(100)
|
}.debounce(100)
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -93,7 +93,7 @@ class BookmarkListState(
|
|||||||
}.onStart {
|
}.onStart {
|
||||||
emit(privateBookmarks(bookmarkList))
|
emit(privateBookmarks(bookmarkList))
|
||||||
}.debounce(100)
|
}.debounce(100)
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -107,7 +107,7 @@ class BookmarkListState(
|
|||||||
.mapNotNull {
|
.mapNotNull {
|
||||||
if (it is EventBookmark) it.eventId else null
|
if (it is EventBookmark) it.eventId else null
|
||||||
}.toSet()
|
}.toSet()
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -121,7 +121,7 @@ class BookmarkListState(
|
|||||||
.mapNotNull {
|
.mapNotNull {
|
||||||
if (it is AddressBookmark) it.address else null
|
if (it is AddressBookmark) it.address else null
|
||||||
}.toSet()
|
}.toSet()
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -135,7 +135,7 @@ class BookmarkListState(
|
|||||||
.mapNotNull {
|
.mapNotNull {
|
||||||
if (it is EventBookmark) it.eventId else null
|
if (it is EventBookmark) it.eventId else null
|
||||||
}.toSet()
|
}.toSet()
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -149,7 +149,7 @@ class BookmarkListState(
|
|||||||
.mapNotNull {
|
.mapNotNull {
|
||||||
if (it is AddressBookmark) it.address else null
|
if (it is AddressBookmark) it.address else null
|
||||||
}.toSet()
|
}.toSet()
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -185,7 +185,7 @@ class BookmarkListState(
|
|||||||
emit(bookmarkList(private, public))
|
emit(bookmarkList(private, public))
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(bookmarkList(privateBookmarks.value, publicBookmarks.value))
|
emit(bookmarkList(privateBookmarks.value, publicBookmarks.value))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ class HiddenUsersState(
|
|||||||
settings.syncedSettings.security.showSensitiveContent.value,
|
settings.syncedSettings.security.showSensitiveContent.value,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ class BlockPeopleListState(
|
|||||||
getBlockListFlow()
|
getBlockListFlow()
|
||||||
.map { blockListWithBackup(it.note) }
|
.map { blockListWithBackup(it.note) }
|
||||||
.onStart { emit(blockListWithBackup(blockListNote)) }
|
.onStart { emit(blockListWithBackup(blockListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+2
-2
@@ -67,7 +67,7 @@ class BlockedRelayListState(
|
|||||||
.map {
|
.map {
|
||||||
normalizeBlockedRelayListWithBackup(it.note)
|
normalizeBlockedRelayListWithBackup(it.note)
|
||||||
}.onStart { emit(normalizeBlockedRelayListWithBackup(blockedListNote)) }
|
}.onStart { emit(normalizeBlockedRelayListWithBackup(blockedListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -99,7 +99,7 @@ class BlockedRelayListState(
|
|||||||
GlobalScope.launch(Dispatchers.IO) { LocalCache.justConsumeMyOwnEvent(it) }
|
GlobalScope.launch(Dispatchers.IO) { LocalCache.justConsumeMyOwnEvent(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Blocked Relay List Collector Start")
|
Log.d("AccountRegisterObservers", "Blocked Relay List Collector Start")
|
||||||
getBlockedRelayListFlow().collect {
|
getBlockedRelayListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating Blocked Relay List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Updating Blocked Relay List for ${signer.pubKey}")
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ class BroadcastRelayListState(
|
|||||||
getBroadcastRelayListFlow()
|
getBroadcastRelayListFlow()
|
||||||
.map { normalizeBroadcastRelayListWithBackup(it.note) }
|
.map { normalizeBroadcastRelayListWithBackup(it.note) }
|
||||||
.onStart { emit(normalizeBroadcastRelayListWithBackup(broadcastListNote)) }
|
.onStart { emit(normalizeBroadcastRelayListWithBackup(broadcastListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -72,5 +72,5 @@ class GeohashListDecryptionCache(
|
|||||||
emit(EmptyGeohashListCard)
|
emit(EmptyGeohashListCard)
|
||||||
}
|
}
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -68,7 +68,7 @@ class GeohashListState(
|
|||||||
emit(geohashListWithBackup(noteState.note))
|
emit(geohashListWithBackup(noteState.note))
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(geohashListWithBackup(geohashListNote))
|
emit(geohashListWithBackup(geohashListNote))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -114,7 +114,7 @@ class GeohashListState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Geohash List Collector Start")
|
Log.d("AccountRegisterObservers", "Geohash List Collector Start")
|
||||||
getGeohashListFlow().collect { noteState ->
|
getGeohashListFlow().collect { noteState ->
|
||||||
Log.d("AccountRegisterObservers", "Geohash List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Geohash List for ${signer.pubKey}")
|
||||||
|
|||||||
+2
-2
@@ -68,7 +68,7 @@ class HashtagListState(
|
|||||||
emit(hashtagListWithBackup(noteState.note))
|
emit(hashtagListWithBackup(noteState.note))
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(hashtagListWithBackup(hashtagListNote))
|
emit(hashtagListWithBackup(hashtagListNote))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Companion.Eagerly,
|
SharingStarted.Companion.Eagerly,
|
||||||
@@ -114,7 +114,7 @@ class HashtagListState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Hashtag List Collector Start")
|
Log.d("AccountRegisterObservers", "Hashtag List Collector Start")
|
||||||
getHashtagListFlow().collect {
|
getHashtagListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Hashtag List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Hashtag List for ${signer.pubKey}")
|
||||||
|
|||||||
+3
-3
@@ -67,7 +67,7 @@ class IndexerRelayListState(
|
|||||||
getIndexerRelayListFlow()
|
getIndexerRelayListFlow()
|
||||||
.map { normalizeIndexerRelayListWithBackup(it.note) }
|
.map { normalizeIndexerRelayListWithBackup(it.note) }
|
||||||
.onStart { emit(normalizeIndexerRelayListWithBackup(indexerListNote)) }
|
.onStart { emit(normalizeIndexerRelayListWithBackup(indexerListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -78,7 +78,7 @@ class IndexerRelayListState(
|
|||||||
getIndexerRelayListFlow()
|
getIndexerRelayListFlow()
|
||||||
.map { normalizeIndexerRelayListWithBackupNoDefaults(it.note) }
|
.map { normalizeIndexerRelayListWithBackupNoDefaults(it.note) }
|
||||||
.onStart { emit(normalizeIndexerRelayListWithBackupNoDefaults(indexerListNote)) }
|
.onStart { emit(normalizeIndexerRelayListWithBackupNoDefaults(indexerListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -109,7 +109,7 @@ class IndexerRelayListState(
|
|||||||
GlobalScope.launch(Dispatchers.IO) { LocalCache.justConsumeMyOwnEvent(it) }
|
GlobalScope.launch(Dispatchers.IO) { LocalCache.justConsumeMyOwnEvent(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Index Relay List Collector Start")
|
Log.d("AccountRegisterObservers", "Index Relay List Collector Start")
|
||||||
getIndexerRelayListFlow().collect {
|
getIndexerRelayListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating Index Relay List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Updating Index Relay List for ${signer.pubKey}")
|
||||||
|
|||||||
+2
-2
@@ -67,7 +67,7 @@ class MuteListState(
|
|||||||
getMuteListFlow()
|
getMuteListFlow()
|
||||||
.map { muteListWithBackup(it.note) }
|
.map { muteListWithBackup(it.note) }
|
||||||
.onStart { emit(muteListWithBackup(muteListNote)) }
|
.onStart { emit(muteListWithBackup(muteListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -149,7 +149,7 @@ class MuteListState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Mute List Collector Start")
|
Log.d("AccountRegisterObservers", "Mute List Collector Start")
|
||||||
getMuteListFlow().collect {
|
getMuteListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating Mute List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Updating Mute List for ${signer.pubKey}")
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ class ProxyRelayListState(
|
|||||||
getProxyRelayListFlow()
|
getProxyRelayListFlow()
|
||||||
.map { normalizeProxyRelayListWithBackup(it.note) }
|
.map { normalizeProxyRelayListWithBackup(it.note) }
|
||||||
.onStart { emit(normalizeProxyRelayListWithBackup(proxyListNote)) }
|
.onStart { emit(normalizeProxyRelayListWithBackup(proxyListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -72,5 +72,5 @@ open class GenericRelayListCache<T : PrivateTagArrayEvent>(
|
|||||||
emit(EmptyRelayListCard)
|
emit(EmptyRelayListCard)
|
||||||
}
|
}
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -67,7 +67,7 @@ class SearchRelayListState(
|
|||||||
getSearchRelayListFlow()
|
getSearchRelayListFlow()
|
||||||
.map { normalizeSearchRelayListWithBackup(it.note) }
|
.map { normalizeSearchRelayListWithBackup(it.note) }
|
||||||
.onStart { emit(normalizeSearchRelayListWithBackup(searchListNote)) }
|
.onStart { emit(normalizeSearchRelayListWithBackup(searchListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Companion.Eagerly,
|
SharingStarted.Companion.Eagerly,
|
||||||
@@ -78,7 +78,7 @@ class SearchRelayListState(
|
|||||||
getSearchRelayListFlow()
|
getSearchRelayListFlow()
|
||||||
.map { normalizeSearchRelayListWithBackupNoDefaults(it.note) }
|
.map { normalizeSearchRelayListWithBackupNoDefaults(it.note) }
|
||||||
.onStart { emit(normalizeSearchRelayListWithBackupNoDefaults(searchListNote)) }
|
.onStart { emit(normalizeSearchRelayListWithBackupNoDefaults(searchListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -109,7 +109,7 @@ class SearchRelayListState(
|
|||||||
GlobalScope.launch(Dispatchers.IO) { LocalCache.justConsumeMyOwnEvent(it) }
|
GlobalScope.launch(Dispatchers.IO) { LocalCache.justConsumeMyOwnEvent(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Search Relay List Collector Start")
|
Log.d("AccountRegisterObservers", "Search Relay List Collector Start")
|
||||||
getSearchRelayListFlow().collect {
|
getSearchRelayListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating Search Relay List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Updating Search Relay List for ${signer.pubKey}")
|
||||||
|
|||||||
+2
-2
@@ -65,7 +65,7 @@ class TrustedRelayListState(
|
|||||||
getTrustedRelayListFlow()
|
getTrustedRelayListFlow()
|
||||||
.map { normalizeTrustedRelayListWithBackup(it.note) }
|
.map { normalizeTrustedRelayListWithBackup(it.note) }
|
||||||
.onStart { emit(normalizeTrustedRelayListWithBackup(trustedListNote)) }
|
.onStart { emit(normalizeTrustedRelayListWithBackup(trustedListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Companion.Eagerly,
|
SharingStarted.Companion.Eagerly,
|
||||||
@@ -96,7 +96,7 @@ class TrustedRelayListState(
|
|||||||
GlobalScope.launch(Dispatchers.IO) { cache.justConsumeMyOwnEvent(it) }
|
GlobalScope.launch(Dispatchers.IO) { cache.justConsumeMyOwnEvent(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Trusted Relay List Collector Start")
|
Log.d("AccountRegisterObservers", "Trusted Relay List Collector Start")
|
||||||
getTrustedRelayListFlow().collect {
|
getTrustedRelayListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating Trusted Relay List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Updating Trusted Relay List for ${signer.pubKey}")
|
||||||
|
|||||||
+4
-4
@@ -71,7 +71,7 @@ class Nip65RelayListState(
|
|||||||
getNIP65RelayListFlow()
|
getNIP65RelayListFlow()
|
||||||
.map { normalizeNIP65WriteRelayListWithBackup(it.note) }
|
.map { normalizeNIP65WriteRelayListWithBackup(it.note) }
|
||||||
.onStart { emit(normalizeNIP65ReadRelayListWithBackup(nip65ListNote)) }
|
.onStart { emit(normalizeNIP65ReadRelayListWithBackup(nip65ListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -82,7 +82,7 @@ class Nip65RelayListState(
|
|||||||
getNIP65RelayListFlow()
|
getNIP65RelayListFlow()
|
||||||
.map { normalizeNIP65ReadRelayListWithBackup(it.note) }
|
.map { normalizeNIP65ReadRelayListWithBackup(it.note) }
|
||||||
.onStart { emit(normalizeNIP65ReadRelayListWithBackup(nip65ListNote)) }
|
.onStart { emit(normalizeNIP65ReadRelayListWithBackup(nip65ListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -93,7 +93,7 @@ class Nip65RelayListState(
|
|||||||
getNIP65RelayListFlow()
|
getNIP65RelayListFlow()
|
||||||
.map { normalizeNIP65AllRelayListWithBackupNoDefaults(it.note) }
|
.map { normalizeNIP65AllRelayListWithBackupNoDefaults(it.note) }
|
||||||
.onStart { emit(normalizeNIP65AllRelayListWithBackupNoDefaults(nip65ListNote)) }
|
.onStart { emit(normalizeNIP65AllRelayListWithBackupNoDefaults(nip65ListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -124,7 +124,7 @@ class Nip65RelayListState(
|
|||||||
GlobalScope.launch(Dispatchers.IO) { cache.justConsumeMyOwnEvent(it) }
|
GlobalScope.launch(Dispatchers.IO) { cache.justConsumeMyOwnEvent(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "NIP-65 Relay List Collector Start")
|
Log.d("AccountRegisterObservers", "NIP-65 Relay List Collector Start")
|
||||||
getNIP65RelayListFlow().collect {
|
getNIP65RelayListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Updating NIP-65 List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Updating NIP-65 List for ${signer.pubKey}")
|
||||||
|
|||||||
+3
-3
@@ -72,7 +72,7 @@ class CommunityListState(
|
|||||||
emit(communityListWithBackup(noteState.note))
|
emit(communityListWithBackup(noteState.note))
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(communityListWithBackup(communityListNote))
|
emit(communityListWithBackup(communityListNote))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -86,7 +86,7 @@ class CommunityListState(
|
|||||||
hint.mapTo(mutableSetOf()) { it.address.toValue() }
|
hint.mapTo(mutableSetOf()) { it.address.toValue() }
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(flow.value.mapTo(mutableSetOf()) { it.address.toValue() })
|
emit(flow.value.mapTo(mutableSetOf()) { it.address.toValue() })
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -147,7 +147,7 @@ class CommunityListState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "Community List Collector Start")
|
Log.d("AccountRegisterObservers", "Community List Collector Start")
|
||||||
getCommunityListFlow().collect {
|
getCommunityListFlow().collect {
|
||||||
Log.d("AccountRegisterObservers", "Community List for ${signer.pubKey}")
|
Log.d("AccountRegisterObservers", "Community List for ${signer.pubKey}")
|
||||||
|
|||||||
+1
-1
@@ -81,7 +81,7 @@ class AppSpecificState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
Log.d("AccountRegisterObservers", "AppSpecificData Collector Start")
|
Log.d("AccountRegisterObservers", "AppSpecificData Collector Start")
|
||||||
getAppSpecificDataFlow().collect {
|
getAppSpecificDataFlow().collect {
|
||||||
try {
|
try {
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ class FileStorageServerListState(
|
|||||||
getFileServersListFlow()
|
getFileServersListFlow()
|
||||||
.map { normalizeServers(it.note) }
|
.map { normalizeServers(it.note) }
|
||||||
.onStart { emit(normalizeServers(fileStorageListNote)) }
|
.onStart { emit(normalizeServers(fileStorageListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ class BlossomServerListState(
|
|||||||
getBlossomServersListFlow()
|
getBlossomServersListFlow()
|
||||||
.map { normalizeServers(it.note) }
|
.map { normalizeServers(it.note) }
|
||||||
.onStart { emit(normalizeServers(blossomListNote)) }
|
.onStart { emit(normalizeServers(blossomListNote)) }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ class UpdatablePropertyFlow<T>(
|
|||||||
) {
|
) {
|
||||||
val stateFlow =
|
val stateFlow =
|
||||||
flow
|
flow
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope = scope,
|
scope = scope,
|
||||||
started = SharingStarted.Eagerly,
|
started = SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -79,7 +79,7 @@ class MergedFollowListsState(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.sample(200)
|
}.sample(200)
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ class MergedFollowPlusMineRelayListsState(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ class MergedFollowPlusMineWithIndexRelayListsState(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ class MergedFollowPlusMineWithSearchRelayListsState(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ class MergedServerListState(
|
|||||||
mergeServerList(nip96s, blossoms)
|
mergeServerList(nip96s, blossoms)
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(mergeServerList(fileServers.flow.value, blossomServers.flow.value))
|
emit(mergeServerList(fileServers.flow.value, blossomServers.flow.value))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@ class TrustedRelayListsState(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -81,7 +81,7 @@ class FeedTopNavFilterState(
|
|||||||
emitAll(loadFlowsFor(listName).flow())
|
emitAll(loadFlowsFor(listName).flow())
|
||||||
}.onStart {
|
}.onStart {
|
||||||
loadFlowsFor(feedFilterListName.value).startValue(this)
|
loadFlowsFor(feedFilterListName.value).startValue(this)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -100,7 +100,7 @@ class MergedTopFeedAuthorListsState(
|
|||||||
notificationNavFilter.value,
|
notificationNavFilter.value,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ class OutboxLoaderState(
|
|||||||
emitAll(filterSettings.toPerRelayFlow(cache))
|
emitAll(filterSettings.toPerRelayFlow(cache))
|
||||||
}.onStart {
|
}.onStart {
|
||||||
emit(topNavFilter.value.startValue(cache))
|
emit(topNavFilter.value.startValue(cache))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Companion.Eagerly,
|
SharingStarted.Companion.Eagerly,
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class TorRelayState(
|
|||||||
trustedRelaysViaTor = torSettingsFlow.trustedRelaysViaTor.value,
|
trustedRelaysViaTor = torSettingsFlow.trustedRelaysViaTor.value,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
@@ -108,7 +108,7 @@ class TorRelayState(
|
|||||||
dmRelayList = dmRelays.value,
|
dmRelayList = dmRelays.value,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ class PokeyReceiver : BroadcastReceiver() {
|
|||||||
Log.e("AmethystCoroutine", "Caught exception: ${throwable.message}", throwable)
|
Log.e("AmethystCoroutine", "Caught exception: ${throwable.message}", throwable)
|
||||||
}
|
}
|
||||||
|
|
||||||
val scope = CoroutineScope(Dispatchers.Default + SupervisorJob() + exceptionHandler)
|
val scope = CoroutineScope(Dispatchers.IO + SupervisorJob() + exceptionHandler)
|
||||||
|
|
||||||
fun register(app: Context) {
|
fun register(app: Context) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class OkHttpWebSocket(
|
|||||||
inner class OkHttpWebsocketListener(
|
inner class OkHttpWebsocketListener(
|
||||||
val out: WebSocketListener,
|
val out: WebSocketListener,
|
||||||
) : okhttp3.WebSocketListener() {
|
) : okhttp3.WebSocketListener() {
|
||||||
val scope = CoroutineScope(Dispatchers.Default + exceptionHandler)
|
val scope = CoroutineScope(Dispatchers.IO + exceptionHandler)
|
||||||
val incomingMessages: Channel<String> = Channel(Channel.UNLIMITED)
|
val incomingMessages: Channel<String> = Channel(Channel.UNLIMITED)
|
||||||
val job = // Launch a coroutine to process messages from the channel.
|
val job = // Launch a coroutine to process messages from the channel.
|
||||||
scope.launch {
|
scope.launch {
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ fun MuteButton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(key1 = controllerVisible) {
|
LaunchedEffect(key1 = controllerVisible) {
|
||||||
launch(Dispatchers.Default) {
|
launch(Dispatchers.IO) {
|
||||||
delay(2000)
|
delay(2000)
|
||||||
holdOn.value = false
|
holdOn.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ abstract class BaseEoseManager<T>(
|
|||||||
fun dismissSubscription(subId: String) = orchestrator.dismissSubscription(subId)
|
fun dismissSubscription(subId: String) = orchestrator.dismissSubscription(subId)
|
||||||
|
|
||||||
// Refreshes observers in batches.
|
// Refreshes observers in batches.
|
||||||
private val bundler = BundledUpdate(sampleTime, Dispatchers.Default)
|
private val bundler = BundledUpdate(sampleTime, Dispatchers.IO)
|
||||||
|
|
||||||
override fun invalidateFilters(ignoreIfDoing: Boolean) {
|
override fun invalidateFilters(ignoreIfDoing: Boolean) {
|
||||||
bundler.invalidate(ignoreIfDoing, ::forceInvalidate)
|
bundler.invalidate(ignoreIfDoing, ::forceInvalidate)
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ class AccountDraftsEoseManager(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
relayFlow(key).collectLatest {
|
relayFlow(key).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -67,7 +67,7 @@ class AccountFollowsLoaderSubAssembler(
|
|||||||
private val orchestrator = SubscriptionController(client)
|
private val orchestrator = SubscriptionController(client)
|
||||||
|
|
||||||
// Refreshes observers in batches of 500ms
|
// Refreshes observers in batches of 500ms
|
||||||
private val bundler = BundledUpdate(500, Dispatchers.Default)
|
private val bundler = BundledUpdate(500, Dispatchers.IO)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This assembler saves the EOSE per user key. That EOSE includes their metadata, etc
|
* This assembler saves the EOSE per user key. That EOSE includes their metadata, etc
|
||||||
@@ -203,7 +203,7 @@ class AccountFollowsLoaderSubAssembler(
|
|||||||
) {
|
) {
|
||||||
accountUpdatesJobMap[user]?.cancel()
|
accountUpdatesJobMap[user]?.cancel()
|
||||||
accountUpdatesJobMap[user] =
|
accountUpdatesJobMap[user] =
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.IO) {
|
||||||
followList.sample(1000).collectLatest {
|
followList.sample(1000).collectLatest {
|
||||||
invalidateFilters(true)
|
invalidateFilters(true)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ class AccountMetadataEoseManager(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
relayFlow(key).collectLatest {
|
relayFlow(key).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -71,12 +71,12 @@ class AccountNotificationsEoseFromInboxRelaysManager(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.account.notificationRelays.flow.sample(1000).collectLatest {
|
key.account.notificationRelays.flow.sample(1000).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.feedContentStates.notifications.lastNoteCreatedAtWhenFullyLoaded.sample(5000).collectLatest {
|
key.feedContentStates.notifications.lastNoteCreatedAtWhenFullyLoaded.sample(5000).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -67,13 +67,13 @@ class AccountNotificationsEoseFromRandomRelaysManager(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
// no need to hurry here. we can wait the app stabilize
|
// no need to hurry here. we can wait the app stabilize
|
||||||
key.account.followsPerRelay.debounce(5000).collectLatest {
|
key.account.followsPerRelay.debounce(5000).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.feedContentStates.notifications.lastNoteCreatedAtWhenFullyLoaded.sample(5000).collectLatest {
|
key.feedContentStates.notifications.lastNoteCreatedAtWhenFullyLoaded.sample(5000).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ class AccountGiftWrapsEoseManager(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.account.dmRelays.flow.collectLatest {
|
key.account.dmRelays.flow.collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -76,7 +76,7 @@ fun observeChannelNoteAuthors(
|
|||||||
channelToParticipatingUsers(baseChannel, accountViewModel),
|
channelToParticipatingUsers(baseChannel, accountViewModel),
|
||||||
)
|
)
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(persistentListOf())
|
return flow.collectAsStateWithLifecycle(persistentListOf())
|
||||||
|
|||||||
+5
-5
@@ -97,7 +97,7 @@ fun <T> observeNoteAndMap(
|
|||||||
.metadata.stateFlow
|
.metadata.stateFlow
|
||||||
.mapLatest { map(it.note) }
|
.mapLatest { map(it.note) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe in the LocalCache for changes that arrive in the device
|
// Subscribe in the LocalCache for changes that arrive in the device
|
||||||
@@ -123,7 +123,7 @@ fun <T, U> observeNoteEventAndMap(
|
|||||||
.metadata.stateFlow
|
.metadata.stateFlow
|
||||||
.mapLatest { (it.note.event as? T)?.let { map(it) } }
|
.mapLatest { (it.note.event as? T)?.let { map(it) } }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe in the LocalCache for changes that arrive in the device
|
// Subscribe in the LocalCache for changes that arrive in the device
|
||||||
@@ -223,7 +223,7 @@ fun observeNoteReactionCount(
|
|||||||
.sample(200)
|
.sample(200)
|
||||||
.mapLatest { it.note.countReactions() }
|
.mapLatest { it.note.countReactions() }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe in the LocalCache for changes that arrive in the device
|
// Subscribe in the LocalCache for changes that arrive in the device
|
||||||
@@ -278,7 +278,7 @@ fun observeNoteRepostsBy(
|
|||||||
.boosts.stateFlow
|
.boosts.stateFlow
|
||||||
.mapLatest { it.note.isBoostedBy(user) }
|
.mapLatest { it.note.isBoostedBy(user) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(note.isBoostedBy(user))
|
return flow.collectAsStateWithLifecycle(note.isBoostedBy(user))
|
||||||
@@ -401,7 +401,7 @@ fun observeCommunityApprovalNeedStatus(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe in the LocalCache for changes that arrive in the device
|
// Subscribe in the LocalCache for changes that arrive in the device
|
||||||
|
|||||||
+13
-13
@@ -253,7 +253,7 @@ fun observeUserFollowCount(
|
|||||||
.mapLatest { userState ->
|
.mapLatest { userState ->
|
||||||
userState.user.transientFollowCount() ?: 0
|
userState.user.transientFollowCount() ?: 0
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(0)
|
return flow.collectAsStateWithLifecycle(0)
|
||||||
@@ -281,7 +281,7 @@ fun observeUserTagFollowCount(
|
|||||||
}.onStart {
|
}.onStart {
|
||||||
emit((accountViewModel.hashtagFollows(user).event as? HashtagListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.size ?: 0)
|
emit((accountViewModel.hashtagFollows(user).event as? HashtagListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.size ?: 0)
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(0)
|
return flow.collectAsStateWithLifecycle(0)
|
||||||
@@ -309,7 +309,7 @@ fun observeUserTagFollows(
|
|||||||
}.onStart {
|
}.onStart {
|
||||||
emit((accountViewModel.hashtagFollows(user).event as? HashtagListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.sorted() ?: emptyList())
|
emit((accountViewModel.hashtagFollows(user).event as? HashtagListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.sorted() ?: emptyList())
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(emptyList())
|
return flow.collectAsStateWithLifecycle(emptyList())
|
||||||
@@ -356,7 +356,7 @@ fun observeUserBookmarkCount(
|
|||||||
.mapLatest { noteState ->
|
.mapLatest { noteState ->
|
||||||
(noteState.note.event as? BookmarkListEvent)?.countBookmarks() ?: 0
|
(noteState.note.event as? BookmarkListEvent)?.countBookmarks() ?: 0
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(0)
|
return flow.collectAsStateWithLifecycle(0)
|
||||||
@@ -396,7 +396,7 @@ fun observeUserFollowerCount(
|
|||||||
.mapLatest { userState ->
|
.mapLatest { userState ->
|
||||||
userState.user.transientFollowerCount()
|
userState.user.transientFollowerCount()
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(0)
|
return flow.collectAsStateWithLifecycle(0)
|
||||||
@@ -426,7 +426,7 @@ fun observeUserIsFollowing(
|
|||||||
.mapLatest { userState ->
|
.mapLatest { userState ->
|
||||||
userState.user.isFollowing(user2) || isUserInFollowSets
|
userState.user.isFollowing(user2) || isUserInFollowSets
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(
|
return flow.collectAsStateWithLifecycle(
|
||||||
@@ -450,7 +450,7 @@ fun observeUserIsFollowingHashtag(
|
|||||||
}.onStart {
|
}.onStart {
|
||||||
emit(hashtag in accountViewModel.account.hashtagList.flow.value)
|
emit(hashtag in accountViewModel.account.hashtagList.flow.value)
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(hashtag in accountViewModel.account.hashtagList.flow.value)
|
return flow.collectAsStateWithLifecycle(hashtag in accountViewModel.account.hashtagList.flow.value)
|
||||||
@@ -471,7 +471,7 @@ fun observeUserIsFollowingGeohash(
|
|||||||
}.onStart {
|
}.onStart {
|
||||||
emit(geohash in accountViewModel.account.geohashList.flow.value)
|
emit(geohash in accountViewModel.account.geohashList.flow.value)
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(geohash in accountViewModel.account.geohashList.flow.value)
|
return flow.collectAsStateWithLifecycle(geohash in accountViewModel.account.geohashList.flow.value)
|
||||||
@@ -496,7 +496,7 @@ fun observeUserIsFollowingChannel(
|
|||||||
.mapLatest { followingChannels ->
|
.mapLatest { followingChannels ->
|
||||||
channel.idHex in followingChannels
|
channel.idHex in followingChannels
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("StateFlowValueCalledInComposition")
|
@SuppressLint("StateFlowValueCalledInComposition")
|
||||||
@@ -522,7 +522,7 @@ fun observeUserIsFollowingChannel(
|
|||||||
.mapLatest { followingChannels ->
|
.mapLatest { followingChannels ->
|
||||||
channel.roomId in followingChannels
|
channel.roomId in followingChannels
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("StateFlowValueCalledInComposition")
|
@SuppressLint("StateFlowValueCalledInComposition")
|
||||||
@@ -563,7 +563,7 @@ fun observeUserZapAmount(
|
|||||||
.mapLatest { userState ->
|
.mapLatest { userState ->
|
||||||
userState.user.zappedAmount()
|
userState.user.zappedAmount()
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(BigDecimal.ZERO)
|
return flow.collectAsStateWithLifecycle(BigDecimal.ZERO)
|
||||||
@@ -630,7 +630,7 @@ fun observeUserStatuses(
|
|||||||
.mapLatest { userState ->
|
.mapLatest { userState ->
|
||||||
LocalCache.findStatusesForUser(userState.user)
|
LocalCache.findStatusesForUser(userState.user)
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(persistentListOf())
|
return flow.collectAsStateWithLifecycle(persistentListOf())
|
||||||
@@ -649,7 +649,7 @@ fun observeUserRelayIntoList(
|
|||||||
.mapLatest { relays ->
|
.mapLatest { relays ->
|
||||||
relayUrl in relays
|
relayUrl in relays
|
||||||
}.distinctUntilChanged()
|
}.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
}
|
}
|
||||||
|
|
||||||
return flow.collectAsStateWithLifecycle(false)
|
return flow.collectAsStateWithLifecycle(false)
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
// Graph doesn't completely clear.
|
// Graph doesn't completely clear.
|
||||||
// @OptIn(DelicateCoroutinesApi::class)
|
// @OptIn(DelicateCoroutinesApi::class)
|
||||||
// GlobalScope.launch(Dispatchers.Default) {
|
// GlobalScope.launch(Dispatchers.IO) {
|
||||||
// serviceManager.trimMemory()
|
// serviceManager.trimMemory()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ fun CashuPreview(
|
|||||||
initialValue = CachedCashuParser.cached(cashutoken),
|
initialValue = CachedCashuParser.cached(cashutoken),
|
||||||
key1 = cashutoken,
|
key1 = cashutoken,
|
||||||
) {
|
) {
|
||||||
val newToken = withContext(Dispatchers.Default) { CachedCashuParser.parse(cashutoken) }
|
val newToken = withContext(Dispatchers.IO) { CachedCashuParser.parse(cashutoken) }
|
||||||
if (value != newToken) {
|
if (value != newToken) {
|
||||||
value = newToken
|
value = newToken
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ fun DisplaySecretEmoji(
|
|||||||
|
|
||||||
if (secretContent == null) {
|
if (secretContent == null) {
|
||||||
LaunchedEffect(segment) {
|
LaunchedEffect(segment) {
|
||||||
launch(Dispatchers.Default) {
|
launch(Dispatchers.IO) {
|
||||||
secretContent =
|
secretContent =
|
||||||
CachedRichTextParser.parseText(
|
CachedRichTextParser.parseText(
|
||||||
EmojiCoder.decode(segment.segmentText),
|
EmojiCoder.decode(segment.segmentText),
|
||||||
|
|||||||
+1
-1
@@ -150,7 +150,7 @@ private fun DialogContent(
|
|||||||
pagerState.scrollToPage(page)
|
pagerState.scrollToPage(page)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
launch(Dispatchers.Default) {
|
launch(Dispatchers.IO) {
|
||||||
delay(2000)
|
delay(2000)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
controllerVisible.value = false
|
controllerVisible.value = false
|
||||||
|
|||||||
+3
-3
@@ -68,7 +68,7 @@ class ChannelFeedContentState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun refresh() {
|
private fun refresh() {
|
||||||
viewModelScope.launch(Dispatchers.Default) { refreshSuspended() }
|
viewModelScope.launch(Dispatchers.IO) { refreshSuspended() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refreshSuspended() {
|
fun refreshSuspended() {
|
||||||
@@ -135,8 +135,8 @@ class ChannelFeedContentState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val bundler = BundledUpdate(250, Dispatchers.Default)
|
private val bundler = BundledUpdate(250, Dispatchers.IO)
|
||||||
private val bundlerInsert = BundledInsert<Set<Note>>(250, Dispatchers.Default)
|
private val bundlerInsert = BundledInsert<Set<Note>>(250, Dispatchers.IO)
|
||||||
|
|
||||||
override fun invalidateData(ignoreIfDoing: Boolean) {
|
override fun invalidateData(ignoreIfDoing: Boolean) {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class FeedContentState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun refresh() {
|
private fun refresh() {
|
||||||
viewModelScope.launch(Dispatchers.Default) { refreshSuspended() }
|
viewModelScope.launch(Dispatchers.IO) { refreshSuspended() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun visibleNotes(): List<Note> {
|
fun visibleNotes(): List<Note> {
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ fun LoadOts(
|
|||||||
|
|
||||||
LaunchedEffect(key1 = noteStatus) {
|
LaunchedEffect(key1 = noteStatus) {
|
||||||
val newOts =
|
val newOts =
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.IO) {
|
||||||
LocalCache.findEarliestOtsForNote(
|
LocalCache.findEarliestOtsForNote(
|
||||||
note = noteStatus?.note ?: note,
|
note = noteStatus?.note ?: note,
|
||||||
otsVerifCache = Amethyst.instance.otsVerifCache,
|
otsVerifCache = Amethyst.instance.otsVerifCache,
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ fun DisplaySecretEmojiAsReaction(
|
|||||||
|
|
||||||
if (secretContent == null) {
|
if (secretContent == null) {
|
||||||
LaunchedEffect(reaction) {
|
LaunchedEffect(reaction) {
|
||||||
launch(Dispatchers.Default) {
|
launch(Dispatchers.IO) {
|
||||||
secretContent =
|
secretContent =
|
||||||
CachedRichTextParser.parseText(
|
CachedRichTextParser.parseText(
|
||||||
EmojiCoder.decode(reaction),
|
EmojiCoder.decode(reaction),
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class PollNoteViewModel : ViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun refreshTallies() {
|
fun refreshTallies() {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
totalZapped = totalZapped()
|
totalZapped = totalZapped()
|
||||||
wasZappedByLoggedInAccount = false
|
wasZappedByLoggedInAccount = false
|
||||||
wasZappedByLoggedInAccount = account.calculateIfNoteWasZappedByAccount(pollNote, 0)
|
wasZappedByLoggedInAccount = account.calculateIfNoteWasZappedByAccount(pollNote, 0)
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ class EmojiSuggestionState(
|
|||||||
} else {
|
} else {
|
||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
|
|
||||||
fun reset() {
|
fun reset() {
|
||||||
if (search.value.isNotEmpty()) {
|
if (search.value.isNotEmpty()) {
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ fun LoadValueFromInvoice(
|
|||||||
@Suppress("ProduceStateDoesNotAssignValue")
|
@Suppress("ProduceStateDoesNotAssignValue")
|
||||||
val lnInvoice by
|
val lnInvoice by
|
||||||
produceState(initialValue = CachedLnInvoiceParser.cached(lnbcWord), key1 = lnbcWord) {
|
produceState(initialValue = CachedLnInvoiceParser.cached(lnbcWord), key1 = lnbcWord) {
|
||||||
val newLnInvoice = withContext(Dispatchers.Default) { CachedLnInvoiceParser.parse(lnbcWord) }
|
val newLnInvoice = withContext(Dispatchers.IO) { CachedLnInvoiceParser.parse(lnbcWord) }
|
||||||
if (value != newLnInvoice) {
|
if (value != newLnInvoice) {
|
||||||
value = newLnInvoice
|
value = newLnInvoice
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ class PreviewState {
|
|||||||
.debounce(500)
|
.debounce(500)
|
||||||
.map { CachedUrlParser.parseValidUrls(it.text) }
|
.map { CachedUrlParser.parseValidUrls(it.text) }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
|
|
||||||
fun reset() {
|
fun reset() {
|
||||||
source.tryEmit(TextFieldValue(""))
|
source.tryEmit(TextFieldValue(""))
|
||||||
|
|||||||
+2
-2
@@ -64,12 +64,12 @@ fun ShowUserSuggestionList(
|
|||||||
AnimateOnNewSearch(userSuggestions, listState)
|
AnimateOnNewSearch(userSuggestions, listState)
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
launch(Dispatchers.Default) {
|
launch(Dispatchers.IO) {
|
||||||
LocalCache.live.newEventBundles.collect {
|
LocalCache.live.newEventBundles.collect {
|
||||||
userSuggestions.invalidateData()
|
userSuggestions.invalidateData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
launch(Dispatchers.Default) {
|
launch(Dispatchers.IO) {
|
||||||
LocalCache.live.deletedEventBundles.collect {
|
LocalCache.live.deletedEventBundles.collect {
|
||||||
userSuggestions.invalidateData()
|
userSuggestions.invalidateData()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ class UserSuggestionState(
|
|||||||
} else {
|
} else {
|
||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
|
|
||||||
fun reset() {
|
fun reset() {
|
||||||
currentWord.tryEmit("")
|
currentWord.tryEmit("")
|
||||||
|
|||||||
+3
-3
@@ -323,7 +323,7 @@ open class CommentPostViewModel :
|
|||||||
cancel()
|
cancel()
|
||||||
|
|
||||||
accountViewModel.account.signAndComputeBroadcast(template, extraNotesToBroadcast)
|
accountViewModel.account.signAndComputeBroadcast(template, extraNotesToBroadcast)
|
||||||
accountViewModel.viewModelScope.launch(Dispatchers.Default) {
|
accountViewModel.viewModelScope.launch(Dispatchers.IO) {
|
||||||
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,7 +465,7 @@ open class CommentPostViewModel :
|
|||||||
onError: (title: String, message: String) -> Unit,
|
onError: (title: String, message: String) -> Unit,
|
||||||
context: Context,
|
context: Context,
|
||||||
) {
|
) {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val myMultiOrchestrator = multiOrchestrator ?: return@launch
|
val myMultiOrchestrator = multiOrchestrator ?: return@launch
|
||||||
|
|
||||||
isUploadingImage = true
|
isUploadingImage = true
|
||||||
@@ -673,7 +673,7 @@ open class CommentPostViewModel :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun updateZapFromText() {
|
override fun updateZapFromText() {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val tagger =
|
val tagger =
|
||||||
NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
||||||
tagger.run()
|
tagger.run()
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ fun RenderAppDefinition(
|
|||||||
var metadata by remember { mutableStateOf<AppMetadata?>(null) }
|
var metadata by remember { mutableStateOf<AppMetadata?>(null) }
|
||||||
|
|
||||||
LaunchedEffect(key1 = noteEvent) {
|
LaunchedEffect(key1 = noteEvent) {
|
||||||
withContext(Dispatchers.Default) { metadata = noteEvent.appMetaData() }
|
withContext(Dispatchers.IO) { metadata = noteEvent.appMetaData() }
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata?.let { theAppMetadata ->
|
metadata?.let { theAppMetadata ->
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ fun RenderFhirResource(
|
|||||||
fun RenderFhirResource(event: FhirResourceEvent) {
|
fun RenderFhirResource(event: FhirResourceEvent) {
|
||||||
@Suppress("ProduceStateDoesNotAssignValue")
|
@Suppress("ProduceStateDoesNotAssignValue")
|
||||||
val state by produceState(initialValue = FhirElementDatabase(), key1 = event) {
|
val state by produceState(initialValue = FhirElementDatabase(), key1 = event) {
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.IO) {
|
||||||
parseResourceBundleOrNull(event.content)?.let {
|
parseResourceBundleOrNull(event.content)?.let {
|
||||||
value = it
|
value = it
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,14 +49,14 @@ abstract class FeedViewModel(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
Log.d("Init", "Starting new Model: ${this.javaClass.simpleName}")
|
Log.d("Init", "Starting new Model: ${this.javaClass.simpleName}")
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
LocalCache.live.newEventBundles.collect { newNotes ->
|
LocalCache.live.newEventBundles.collect { newNotes ->
|
||||||
Log.d("Rendering Metrics", "Update feeds: ${this@FeedViewModel.javaClass.simpleName} with ${newNotes.size}")
|
Log.d("Rendering Metrics", "Update feeds: ${this@FeedViewModel.javaClass.simpleName} with ${newNotes.size}")
|
||||||
feedState.updateFeedWith(newNotes)
|
feedState.updateFeedWith(newNotes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
LocalCache.live.deletedEventBundles.collect { newNotes ->
|
LocalCache.live.deletedEventBundles.collect { newNotes ->
|
||||||
Log.d("Rendering Metrics", "Delete from feeds: ${this@FeedViewModel.javaClass.simpleName} with ${newNotes.size}")
|
Log.d("Rendering Metrics", "Delete from feeds: ${this@FeedViewModel.javaClass.simpleName} with ${newNotes.size}")
|
||||||
feedState.deleteFromFeed(newNotes)
|
feedState.deleteFromFeed(newNotes)
|
||||||
|
|||||||
@@ -253,11 +253,11 @@ class FollowListState(
|
|||||||
|
|
||||||
val kind3GlobalPeopleRoutes =
|
val kind3GlobalPeopleRoutes =
|
||||||
_kind3GlobalPeopleRoutes
|
_kind3GlobalPeopleRoutes
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(viewModelScope, SharingStarted.Eagerly, defaultLists)
|
.stateIn(viewModelScope, SharingStarted.Eagerly, defaultLists)
|
||||||
val kind3GlobalPeople =
|
val kind3GlobalPeople =
|
||||||
_kind3GlobalPeople
|
_kind3GlobalPeople
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(viewModelScope, SharingStarted.Eagerly, defaultLists)
|
.stateIn(viewModelScope, SharingStarted.Eagerly, defaultLists)
|
||||||
|
|
||||||
suspend fun initializeSuspend() {
|
suspend fun initializeSuspend() {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ open class UserFeedViewModel(
|
|||||||
val feedContent = _feedContent.asStateFlow()
|
val feedContent = _feedContent.asStateFlow()
|
||||||
|
|
||||||
private fun refresh() {
|
private fun refresh() {
|
||||||
viewModelScope.launch(Dispatchers.Default) { refreshSuspended() }
|
viewModelScope.launch(Dispatchers.IO) { refreshSuspended() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override val isRefreshing: MutableState<Boolean> = mutableStateOf(false)
|
override val isRefreshing: MutableState<Boolean> = mutableStateOf(false)
|
||||||
@@ -100,14 +100,14 @@ open class UserFeedViewModel(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
Log.d("Init", "${this.javaClass.simpleName}")
|
Log.d("Init", "${this.javaClass.simpleName}")
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
LocalCache.live.newEventBundles.collect { newNotes ->
|
LocalCache.live.newEventBundles.collect { newNotes ->
|
||||||
Log.d("Rendering Metrics", "Update feeds: ${this@UserFeedViewModel.javaClass.simpleName} with ${newNotes.size}")
|
Log.d("Rendering Metrics", "Update feeds: ${this@UserFeedViewModel.javaClass.simpleName} with ${newNotes.size}")
|
||||||
invalidateData()
|
invalidateData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
LocalCache.live.deletedEventBundles.collect { newNotes ->
|
LocalCache.live.deletedEventBundles.collect { newNotes ->
|
||||||
Log.d("Rendering Metrics", "Delete from feeds: ${this@UserFeedViewModel.javaClass.simpleName} with ${newNotes.size}")
|
Log.d("Rendering Metrics", "Delete from feeds: ${this@UserFeedViewModel.javaClass.simpleName} with ${newNotes.size}")
|
||||||
invalidateData()
|
invalidateData()
|
||||||
|
|||||||
+15
-15
@@ -202,7 +202,7 @@ class AccountViewModel(
|
|||||||
|
|
||||||
val notificationHasNewItemsFlow =
|
val notificationHasNewItemsFlow =
|
||||||
notificationHasNewItems
|
notificationHasNewItems
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(30000), false)
|
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(30000), false)
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
@@ -251,7 +251,7 @@ class AccountViewModel(
|
|||||||
|
|
||||||
val messagesHasNewItemsFlow =
|
val messagesHasNewItemsFlow =
|
||||||
messagesHasNewItems
|
messagesHasNewItems
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(30000), false)
|
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(30000), false)
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
@@ -284,7 +284,7 @@ class AccountViewModel(
|
|||||||
|
|
||||||
val homeHasNewItemsFlow =
|
val homeHasNewItemsFlow =
|
||||||
homeHasNewItems
|
homeHasNewItems
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(30000), false)
|
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(30000), false)
|
||||||
|
|
||||||
val hasNewItems =
|
val hasNewItems =
|
||||||
@@ -394,7 +394,7 @@ class AccountViewModel(
|
|||||||
account.kind3FollowList.flow.value.authors,
|
account.kind3FollowList.flow.value.authors,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
viewModelScope,
|
viewModelScope,
|
||||||
SharingStarted.WhileSubscribed(10000, 10000),
|
SharingStarted.WhileSubscribed(10000, 10000),
|
||||||
@@ -412,7 +412,7 @@ class AccountViewModel(
|
|||||||
.relays
|
.relays
|
||||||
.stateFlow
|
.stateFlow
|
||||||
.map { it.note.relays.size > 3 }
|
.map { it.note.relays.size > 3 }
|
||||||
.flowOn(Dispatchers.Default)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
viewModelScope,
|
viewModelScope,
|
||||||
SharingStarted.WhileSubscribed(10000, 10000),
|
SharingStarted.WhileSubscribed(10000, 10000),
|
||||||
@@ -431,7 +431,7 @@ class AccountViewModel(
|
|||||||
|
|
||||||
suspend fun calculateZapAmount(zappedNote: Note): String =
|
suspend fun calculateZapAmount(zappedNote: Note): String =
|
||||||
if (zappedNote.zapPayments.isNotEmpty()) {
|
if (zappedNote.zapPayments.isNotEmpty()) {
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.IO) {
|
||||||
val it = account.calculateZappedAmount(zappedNote)
|
val it = account.calculateZappedAmount(zappedNote)
|
||||||
showAmount(it)
|
showAmount(it)
|
||||||
}
|
}
|
||||||
@@ -442,7 +442,7 @@ class AccountViewModel(
|
|||||||
suspend fun calculateZapraiser(zappedNote: Note): ZapraiserStatus {
|
suspend fun calculateZapraiser(zappedNote: Note): ZapraiserStatus {
|
||||||
val zapraiserAmount = zappedNote.event?.zapraiserAmount() ?: 0
|
val zapraiserAmount = zappedNote.event?.zapraiserAmount() ?: 0
|
||||||
return if (zappedNote.zapPayments.isNotEmpty()) {
|
return if (zappedNote.zapPayments.isNotEmpty()) {
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.IO) {
|
||||||
val newZapAmount = account.calculateZappedAmount(zappedNote)
|
val newZapAmount = account.calculateZappedAmount(zappedNote)
|
||||||
var percentage = newZapAmount.div(zapraiserAmount.toBigDecimal()).toFloat()
|
var percentage = newZapAmount.div(zapraiserAmount.toBigDecimal()).toFloat()
|
||||||
|
|
||||||
@@ -1027,7 +1027,7 @@ class AccountViewModel(
|
|||||||
fun cachedModificationEventsForNote(note: Note) = LocalCache.cachedModificationEventsForNote(note)
|
fun cachedModificationEventsForNote(note: Note) = LocalCache.cachedModificationEventsForNote(note)
|
||||||
|
|
||||||
suspend fun findModificationEventsForNote(note: Note): List<Note> =
|
suspend fun findModificationEventsForNote(note: Note): List<Note> =
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.IO) {
|
||||||
LocalCache.findLatestModificationForNote(note)
|
LocalCache.findLatestModificationForNote(note)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1067,7 +1067,7 @@ class AccountViewModel(
|
|||||||
hexList: List<String>,
|
hexList: List<String>,
|
||||||
onReady: (ImmutableList<User>) -> Unit,
|
onReady: (ImmutableList<User>) -> Unit,
|
||||||
) {
|
) {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
onReady(loadUsersSync(hexList).toImmutableList())
|
onReady(loadUsersSync(hexList).toImmutableList())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1094,7 +1094,7 @@ class AccountViewModel(
|
|||||||
val onIsNew = createdAt > lastTime
|
val onIsNew = createdAt > lastTime
|
||||||
|
|
||||||
if (onIsNew) {
|
if (onIsNew) {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
account.markAsRead(routeForLastRead, createdAt)
|
account.markAsRead(routeForLastRead, createdAt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1142,7 +1142,7 @@ class AccountViewModel(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
Log.d("Init", "AccountViewModel")
|
Log.d("Init", "AccountViewModel")
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
feedStates.init()
|
feedStates.init()
|
||||||
// awaits for init to finish before starting to capture new events.
|
// awaits for init to finish before starting to capture new events.
|
||||||
LocalCache.live.newEventBundles.collect { newNotes ->
|
LocalCache.live.newEventBundles.collect { newNotes ->
|
||||||
@@ -1152,7 +1152,7 @@ class AccountViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
LocalCache.live.deletedEventBundles.collect { newNotes ->
|
LocalCache.live.deletedEventBundles.collect { newNotes ->
|
||||||
logTime("AccountViewModel deletedEventBundle Update with ${newNotes.size} new notes") {
|
logTime("AccountViewModel deletedEventBundle Update with ${newNotes.size} new notes") {
|
||||||
feedStates.deleteNotes(newNotes)
|
feedStates.deleteNotes(newNotes)
|
||||||
@@ -1602,7 +1602,7 @@ class AccountViewModel(
|
|||||||
val accountViewModel: AccountViewModel,
|
val accountViewModel: AccountViewModel,
|
||||||
) : GenericBaseCache<String, LoadedBechLink>(20) {
|
) : GenericBaseCache<String, LoadedBechLink>(20) {
|
||||||
override suspend fun compute(key: String): LoadedBechLink? =
|
override suspend fun compute(key: String): LoadedBechLink? =
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.IO) {
|
||||||
Nip19Parser.uriToRoute(key)?.let {
|
Nip19Parser.uriToRoute(key)?.let {
|
||||||
var returningNote: Note? = null
|
var returningNote: Note? = null
|
||||||
|
|
||||||
@@ -1621,10 +1621,10 @@ class AccountViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
is NEmbed ->
|
is NEmbed ->
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.IO) {
|
||||||
val baseNote = LocalCache.getOrCreateNote(parsed.event)
|
val baseNote = LocalCache.getOrCreateNote(parsed.event)
|
||||||
if (baseNote.event == null) {
|
if (baseNote.event == null) {
|
||||||
launch(Dispatchers.Default) {
|
launch(Dispatchers.IO) {
|
||||||
LocalCache.justConsume(parsed.event, null, false)
|
LocalCache.justConsume(parsed.event, null, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ abstract class ListChangeFeedViewModel(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
Log.d("Init", "Starting new Model: ${this.javaClass.simpleName}")
|
Log.d("Init", "Starting new Model: ${this.javaClass.simpleName}")
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
localFilter.changesFlow().collect {
|
localFilter.changesFlow().collect {
|
||||||
Log.d("Init", "Collecting changes to: ${this@ListChangeFeedViewModel.javaClass.simpleName}")
|
Log.d("Init", "Collecting changes to: ${this@ListChangeFeedViewModel.javaClass.simpleName}")
|
||||||
when (it) {
|
when (it) {
|
||||||
|
|||||||
+3
-3
@@ -361,7 +361,7 @@ class ChatNewMessageViewModel :
|
|||||||
val version = draftTag.current
|
val version = draftTag.current
|
||||||
innerSendPost(null)
|
innerSendPost(null)
|
||||||
cancel()
|
cancel()
|
||||||
accountViewModel.viewModelScope.launch(Dispatchers.Default) {
|
accountViewModel.viewModelScope.launch(Dispatchers.IO) {
|
||||||
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -594,7 +594,7 @@ class ChatNewMessageViewModel :
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateRoomFromUsersInput() {
|
fun updateRoomFromUsersInput() {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
delay(300)
|
delay(300)
|
||||||
val toUsersTagger = NewMessageTagger(toUsers.text, null, null, accountViewModel)
|
val toUsersTagger = NewMessageTagger(toUsers.text, null, null, accountViewModel)
|
||||||
toUsersTagger.run()
|
toUsersTagger.run()
|
||||||
@@ -717,7 +717,7 @@ class ChatNewMessageViewModel :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun updateZapFromText() {
|
override fun updateZapFromText() {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val tagger = NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
val tagger = NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
||||||
tagger.run()
|
tagger.run()
|
||||||
tagger.pTags?.forEach { taggedUser ->
|
tagger.pTags?.forEach { taggedUser ->
|
||||||
|
|||||||
+3
-3
@@ -277,7 +277,7 @@ open class ChannelNewMessageViewModel :
|
|||||||
cancel()
|
cancel()
|
||||||
|
|
||||||
accountViewModel.account.signAndSendPrivately(template, channelRelays)
|
accountViewModel.account.signAndSendPrivately(template, channelRelays)
|
||||||
accountViewModel.viewModelScope.launch(Dispatchers.Default) {
|
accountViewModel.viewModelScope.launch(Dispatchers.IO) {
|
||||||
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,7 +319,7 @@ open class ChannelNewMessageViewModel :
|
|||||||
context: Context,
|
context: Context,
|
||||||
onceUploaded: suspend () -> Unit,
|
onceUploaded: suspend () -> Unit,
|
||||||
) {
|
) {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val uploadState = uploadState ?: return@launch
|
val uploadState = uploadState ?: return@launch
|
||||||
|
|
||||||
val myMultiOrchestrator = uploadState.multiOrchestrator ?: return@launch
|
val myMultiOrchestrator = uploadState.multiOrchestrator ?: return@launch
|
||||||
@@ -630,7 +630,7 @@ open class ChannelNewMessageViewModel :
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateZapFromText() {
|
fun updateZapFromText() {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val tagger = NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
val tagger = NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
||||||
tagger.run()
|
tagger.run()
|
||||||
tagger.pTags?.forEach { taggedUser ->
|
tagger.pTags?.forEach { taggedUser ->
|
||||||
|
|||||||
+2
-2
@@ -61,12 +61,12 @@ class DMsFromUserFilterSubAssembler(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.account.homeRelays.flow.collectLatest {
|
key.account.homeRelays.flow.collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.account.dmRelays.flow.collectLatest {
|
key.account.dmRelays.flow.collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ class FollowingEphemeralChatSubAssembler(
|
|||||||
userJobMap[key.account.userProfile()]?.forEach { it.cancel() }
|
userJobMap[key.account.userProfile()]?.forEach { it.cancel() }
|
||||||
userJobMap[key.account.userProfile()] =
|
userJobMap[key.account.userProfile()] =
|
||||||
listOf(
|
listOf(
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.account.ephemeralChatList.liveEphemeralChatList.sample(500).collectLatest {
|
key.account.ephemeralChatList.liveEphemeralChatList.sample(500).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ class FollowingPublicChatSubAssembler(
|
|||||||
userJobMap[key.account.userProfile()]?.forEach { it.cancel() }
|
userJobMap[key.account.userProfile()]?.forEach { it.cancel() }
|
||||||
userJobMap[key.account.userProfile()] =
|
userJobMap[key.account.userProfile()] =
|
||||||
listOf(
|
listOf(
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.account.publicChatList.flowSet.sample(500).collectLatest {
|
key.account.publicChatList.flowSet.sample(500).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -70,17 +70,17 @@ class DiscoveryFollowsSetsAndLiveStreamsSubAssembler2(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.scope.launch(Dispatchers.Default) {
|
key.scope.launch(Dispatchers.IO) {
|
||||||
key.listNameFlow().collectLatest {
|
key.listNameFlow().collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.scope.launch(Dispatchers.Default) {
|
key.scope.launch(Dispatchers.IO) {
|
||||||
key.followsPerRelayFlow().sample(1000).collectLatest {
|
key.followsPerRelayFlow().sample(1000).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
combine(
|
combine(
|
||||||
key.feedStates.discoverFollowSets.lastNoteCreatedAtWhenFullyLoaded,
|
key.feedStates.discoverFollowSets.lastNoteCreatedAtWhenFullyLoaded,
|
||||||
key.feedStates.discoverLive.lastNoteCreatedAtWhenFullyLoaded,
|
key.feedStates.discoverLive.lastNoteCreatedAtWhenFullyLoaded,
|
||||||
|
|||||||
+3
-3
@@ -72,17 +72,17 @@ class DiscoveryLongFormClassifiedsAndDVMSubAssembler1(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.scope.launch(Dispatchers.Default) {
|
key.scope.launch(Dispatchers.IO) {
|
||||||
key.listNameFlow().collectLatest {
|
key.listNameFlow().collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.scope.launch(Dispatchers.Default) {
|
key.scope.launch(Dispatchers.IO) {
|
||||||
key.followsPerRelayFlow().sample(500).collectLatest {
|
key.followsPerRelayFlow().sample(500).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
combine(
|
combine(
|
||||||
key.feedStates.discoverReads.lastNoteCreatedAtWhenFullyLoaded,
|
key.feedStates.discoverReads.lastNoteCreatedAtWhenFullyLoaded,
|
||||||
key.feedStates.discoverDVMs.lastNoteCreatedAtWhenFullyLoaded,
|
key.feedStates.discoverDVMs.lastNoteCreatedAtWhenFullyLoaded,
|
||||||
|
|||||||
+3
-3
@@ -69,17 +69,17 @@ class DiscoveryPublicChatsAndCommunitiesSubAssembler3(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.scope.launch(Dispatchers.Default) {
|
key.scope.launch(Dispatchers.IO) {
|
||||||
key.listNameFlow().collectLatest {
|
key.listNameFlow().collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.scope.launch(Dispatchers.Default) {
|
key.scope.launch(Dispatchers.IO) {
|
||||||
key.followsPerRelayFlow().sample(500).collectLatest {
|
key.followsPerRelayFlow().sample(500).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
combine(
|
combine(
|
||||||
key.feedStates.discoverPublicChats.lastNoteCreatedAtWhenFullyLoaded,
|
key.feedStates.discoverPublicChats.lastNoteCreatedAtWhenFullyLoaded,
|
||||||
key.feedStates.discoverCommunities.lastNoteCreatedAtWhenFullyLoaded,
|
key.feedStates.discoverCommunities.lastNoteCreatedAtWhenFullyLoaded,
|
||||||
|
|||||||
+3
-3
@@ -297,7 +297,7 @@ open class NewProductViewModel :
|
|||||||
cancel()
|
cancel()
|
||||||
|
|
||||||
accountViewModel.account.signAndSendPrivatelyOrBroadcast(template, relayList = { relayList })
|
accountViewModel.account.signAndSendPrivatelyOrBroadcast(template, relayList = { relayList })
|
||||||
accountViewModel.viewModelScope.launch(Dispatchers.Default) {
|
accountViewModel.viewModelScope.launch(Dispatchers.IO) {
|
||||||
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,7 +379,7 @@ open class NewProductViewModel :
|
|||||||
onError: (title: String, message: String) -> Unit,
|
onError: (title: String, message: String) -> Unit,
|
||||||
context: Context,
|
context: Context,
|
||||||
) {
|
) {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val myAccount = account ?: return@launch
|
val myAccount = account ?: return@launch
|
||||||
val myMultiOrchestrator = multiOrchestrator ?: return@launch
|
val myMultiOrchestrator = multiOrchestrator ?: return@launch
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ open class NewProductViewModel :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun updateZapFromText() {
|
override fun updateZapFromText() {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val tagger = NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel!!)
|
val tagger = NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel!!)
|
||||||
tagger.run()
|
tagger.run()
|
||||||
tagger.pTags?.forEach { taggedUser ->
|
tagger.pTags?.forEach { taggedUser ->
|
||||||
|
|||||||
+3
-3
@@ -483,7 +483,7 @@ open class ShortNotePostViewModel :
|
|||||||
cancel()
|
cancel()
|
||||||
|
|
||||||
accountViewModel.account.signAndComputeBroadcast(template, extraNotesToBroadcast)
|
accountViewModel.account.signAndComputeBroadcast(template, extraNotesToBroadcast)
|
||||||
accountViewModel.viewModelScope.launch(Dispatchers.Default) {
|
accountViewModel.viewModelScope.launch(Dispatchers.IO) {
|
||||||
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -643,7 +643,7 @@ open class ShortNotePostViewModel :
|
|||||||
context: Context,
|
context: Context,
|
||||||
useH265: Boolean,
|
useH265: Boolean,
|
||||||
) {
|
) {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val myMultiOrchestrator = multiOrchestrator ?: return@launch
|
val myMultiOrchestrator = multiOrchestrator ?: return@launch
|
||||||
|
|
||||||
isUploadingImage = true
|
isUploadingImage = true
|
||||||
@@ -899,7 +899,7 @@ open class ShortNotePostViewModel :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun updateZapFromText() {
|
override fun updateZapFromText() {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val tagger =
|
val tagger =
|
||||||
NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
||||||
tagger.run()
|
tagger.run()
|
||||||
|
|||||||
+4
-4
@@ -91,22 +91,22 @@ class HomeOutboxEventsEoseManager(
|
|||||||
userJobMap[user]?.forEach { it.cancel() }
|
userJobMap[user]?.forEach { it.cancel() }
|
||||||
userJobMap[user] =
|
userJobMap[user] =
|
||||||
listOf(
|
listOf(
|
||||||
key.scope.launch(Dispatchers.Default) {
|
key.scope.launch(Dispatchers.IO) {
|
||||||
key.listNameFlow().collectLatest {
|
key.listNameFlow().collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.scope.launch(Dispatchers.Default) {
|
key.scope.launch(Dispatchers.IO) {
|
||||||
key.followRelayFlow().sample(1000).collectLatest {
|
key.followRelayFlow().sample(1000).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.feedState.homeNewThreads.lastNoteCreatedAtWhenFullyLoaded.sample(5000).collectLatest {
|
key.feedState.homeNewThreads.lastNoteCreatedAtWhenFullyLoaded.sample(5000).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
key.account.scope.launch(Dispatchers.Default) {
|
key.account.scope.launch(Dispatchers.IO) {
|
||||||
key.feedState.homeReplies.lastNoteCreatedAtWhenFullyLoaded.sample(5000).collectLatest {
|
key.feedState.homeReplies.lastNoteCreatedAtWhenFullyLoaded.sample(5000).collectLatest {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@ class CardFeedContentState(
|
|||||||
fun lastNoteCreatedAtIfFilled() = lastNoteCreatedAtWhenFullyLoaded.value
|
fun lastNoteCreatedAtIfFilled() = lastNoteCreatedAtWhenFullyLoaded.value
|
||||||
|
|
||||||
fun refresh() {
|
fun refresh() {
|
||||||
viewModelScope.launch(Dispatchers.Default) { refreshSuspended() }
|
viewModelScope.launch(Dispatchers.IO) { refreshSuspended() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
|||||||
+3
-3
@@ -320,7 +320,7 @@ class NewPublicMessageViewModel :
|
|||||||
cancel()
|
cancel()
|
||||||
|
|
||||||
accountViewModel.account.signAndComputeBroadcast(template, extraNotesToBroadcast)
|
accountViewModel.account.signAndComputeBroadcast(template, extraNotesToBroadcast)
|
||||||
accountViewModel.viewModelScope.launch(Dispatchers.Default) {
|
accountViewModel.viewModelScope.launch(Dispatchers.IO) {
|
||||||
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
accountViewModel.account.deleteDraftIgnoreErrors(version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -413,7 +413,7 @@ class NewPublicMessageViewModel :
|
|||||||
onError: (title: String, message: String) -> Unit,
|
onError: (title: String, message: String) -> Unit,
|
||||||
context: Context,
|
context: Context,
|
||||||
) {
|
) {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val myMultiOrchestrator = multiOrchestrator ?: return@launch
|
val myMultiOrchestrator = multiOrchestrator ?: return@launch
|
||||||
|
|
||||||
isUploadingImage = true
|
isUploadingImage = true
|
||||||
@@ -628,7 +628,7 @@ class NewPublicMessageViewModel :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun updateZapFromText() {
|
override fun updateZapFromText() {
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val tagger = NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
val tagger = NewMessageTagger(message.text, emptyList(), emptyList(), accountViewModel)
|
||||||
tagger.run()
|
tagger.run()
|
||||||
tagger.pTags?.forEach { taggedUser ->
|
tagger.pTags?.forEach { taggedUser ->
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user