DMカラムに同じサマリが複数出ることがあるバグの修正
This commit is contained in:
parent
9bd7c06085
commit
e88e63b0fa
|
@ -6623,34 +6623,36 @@ class Column(
|
|||
) {
|
||||
|
||||
val newMap = HashMap<EntityId, TootConversationSummary>()
|
||||
|
||||
for(o in list_new) {
|
||||
if(o is TootConversationSummary) newMap[o.id] = o
|
||||
}
|
||||
|
||||
if(list_data.isNotEmpty() && newMap.isNotEmpty()) {
|
||||
val removeSet = HashSet<EntityId>()
|
||||
for(i in list_data.size - 1 downTo 0) {
|
||||
val o = list_data[i] as? TootConversationSummary ?: continue
|
||||
val newItem = newMap[o.id] ?: continue
|
||||
|
||||
if(o.last_status.uri == newItem.last_status.uri) {
|
||||
// 投稿が同じなので順序を入れ替えず、その場所で更新する
|
||||
changeList.add(AdapterChange(AdapterChangeType.RangeChange, i, 1))
|
||||
list_data[i] = newItem
|
||||
removeSet.add(newItem.id)
|
||||
log.d("replaceConversationSummary: in-place update")
|
||||
} else {
|
||||
// 投稿が異なるので古い方を削除して、リストの順序を変える
|
||||
changeList.add(AdapterChange(AdapterChangeType.RangeRemove, i, 1))
|
||||
list_data.removeAt(i)
|
||||
log.d("replaceConversationSummary: order change")
|
||||
}
|
||||
}
|
||||
for(i in list_new.size - 1 downTo 0) {
|
||||
val o = list_data[i] as? TootConversationSummary ?: continue
|
||||
if(removeSet.contains(o.id)) list_new.removeAt(i)
|
||||
if( list_data.isEmpty() || newMap.isEmpty()) return
|
||||
|
||||
val removeSet = HashSet<EntityId>()
|
||||
for(i in list_data.size - 1 downTo 0) {
|
||||
val o = list_data[i] as? TootConversationSummary ?: continue
|
||||
val newItem = newMap[o.id] ?: continue
|
||||
|
||||
if(o.last_status.uri == newItem.last_status.uri) {
|
||||
// 投稿が同じなので順序を入れ替えず、その場所で更新する
|
||||
changeList.add(AdapterChange(AdapterChangeType.RangeChange, i, 1))
|
||||
list_data[i] = newItem
|
||||
removeSet.add(newItem.id)
|
||||
log.d("replaceConversationSummary: in-place update")
|
||||
} else {
|
||||
// 投稿が異なるので古い方を削除して、リストの順序を変える
|
||||
changeList.add(AdapterChange(AdapterChangeType.RangeRemove, i, 1))
|
||||
list_data.removeAt(i)
|
||||
log.d("replaceConversationSummary: order change")
|
||||
}
|
||||
}
|
||||
val it = list_new.iterator()
|
||||
while(it.hasNext()){
|
||||
val o = it.next() as? TootConversationSummary ?: continue
|
||||
if(removeSet.contains(o.id)) it.remove()
|
||||
}
|
||||
}
|
||||
|
||||
private fun makeMisskeyBaseParameter(parser : TootParser?) : JSONObject =
|
||||
|
|
Loading…
Reference in New Issue