Skip to content

Commit

Permalink
Merge tag 'null_conversation_body_crash' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
noln committed Jul 23, 2019
2 parents ed206e3 + 06e8b13 commit 3488473
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
applicationId "tech.bigfig.roma"
minSdkVersion 21
targetSdkVersion 28
versionCode 95
versionName "8.1"
versionCode 96
versionName "8.1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,33 @@ class ConversationsRepository @Inject constructor(val mastodonApi: MastodonApi,
val conversations = HashMap<String, Status>()
val conversationsRecentFirst = HashMap<Date, Status>()
var lastFetchedId = ""
val conversationList = ArrayList<Conversation>()

for (status in body?.reversed()!!) {
if (lastFetchedId.isBlank()) lastFetchedId = status.id
status.pleroma?.conversation_id?.let { id -> conversations[id] = status }
}
body?.let {
for (status in body.reversed()) {
if (lastFetchedId.isBlank()) lastFetchedId = status.id
status.pleroma?.conversation_id?.let { id -> conversations[id] = status }
}

for (entry in conversations.entries) {
entry.let { entry.value.createdAt.let { it1 -> conversationsRecentFirst.put(it1, entry.value) } }
}
for (entry in conversations.entries) {
entry.let { entry.value.createdAt.let { it1 -> conversationsRecentFirst.put(it1, entry.value) } }
}

val conversationList = ArrayList<Conversation>()
for (entry in conversationsRecentFirst.toSortedMap(reverseOrder())) {

for (entry in conversationsRecentFirst.toSortedMap(reverseOrder())) {
entry.value.pleroma?.conversation_id.let {

val convoToAdd = Conversation(
id = entry.value.pleroma?.conversation_id!!,
accounts = getAccountObjects(mastodonApi, entry.value.mentions),
lastStatus = entry.value,
unread = false
)
entry.value.pleroma?.conversation_id?.let { it1 ->

conversationList.add(convoToAdd)
conversationList.add(Conversation(
id = it1,
accounts = getAccountObjects(mastodonApi, entry.value.mentions),
lastStatus = entry.value,
unread = false)
)
}
}
}
}

return ConversationHolder(lastFetchedId, conversationList)
Expand Down

0 comments on commit 3488473

Please sign in to comment.