Fixing crash when calling localcache on the main thread.
This commit is contained in:
@@ -1358,7 +1358,8 @@ class AccountViewModel(val account: Account, val settings: SettingsState) : View
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun cachedDVMContentDiscovery(pubkeyHex: String): Note? {
|
||||
suspend fun cachedDVMContentDiscovery(pubkeyHex: String): Note? =
|
||||
withContext(Dispatchers.IO) {
|
||||
val fifteenMinsAgo = TimeUtils.fifteenMinutesAgo()
|
||||
// First check if we have an actual response from the DVM in LocalCache
|
||||
val response =
|
||||
@@ -1374,7 +1375,7 @@ class AccountViewModel(val account: Account, val settings: SettingsState) : View
|
||||
)
|
||||
|
||||
// If we have a response, get the tagged Request Event otherwise null
|
||||
return response?.event?.tags()?.firstOrNull { it.size > 1 && it[0] == "e" }?.get(1)?.let {
|
||||
return@withContext response?.event?.tags()?.firstOrNull { it.size > 1 && it[0] == "e" }?.get(1)?.let {
|
||||
LocalCache.getOrCreateNote(it)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user