mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-16 11:41:21 +01:00
Merge pull request #1257 from Xefir/1038
Backport #1038 : Mastodon's API doesn't have `/api/direct_messages.json`
This commit is contained in:
commit
3687330bee
@ -40,6 +40,9 @@ val AccountExtras.official: Boolean
|
||||
return false
|
||||
}
|
||||
|
||||
val AccountDetails.hasDm: Boolean
|
||||
get() = type in arrayOf(AccountType.FANFOU, AccountType.TWITTER)
|
||||
|
||||
fun <T> AccountDetails.newMicroBlogInstance(context: Context, cls: Class<T>): T {
|
||||
return credentials.newMicroBlogInstance(context, type, cls)
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import org.mariotaku.sqliteqb.library.Expression
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_SHOW_NOTIFICATION
|
||||
import org.mariotaku.twidere.annotation.AccountType
|
||||
import org.mariotaku.twidere.exception.APINotSupportedException
|
||||
import org.mariotaku.twidere.extension.findFieldByTypes
|
||||
import org.mariotaku.twidere.extension.model.*
|
||||
import org.mariotaku.twidere.extension.model.api.target
|
||||
@ -85,6 +86,7 @@ class GetMessagesTask(
|
||||
}
|
||||
val microBlog = details.newMicroBlogInstance(context, cls = MicroBlog::class.java)
|
||||
val messages = try {
|
||||
if (!details.hasDm) throw APINotSupportedException(details.type)
|
||||
getMessages(microBlog, details, param, i)
|
||||
} catch (e: MicroBlogException) {
|
||||
return@forEachIndexed
|
||||
|
Loading…
x
Reference in New Issue
Block a user