言語フィルタ画面で戻るボタンを押した際の変更判定を修正

This commit is contained in:
tateisu 2024-03-21 03:01:56 +09:00
parent add0014304
commit 6871d134e1
1 changed files with 5 additions and 5 deletions

View File

@ -203,12 +203,12 @@ class LanguageFilterViewModel(
}
fun isLanguageListChanged(): Boolean {
fun JsonObject.encodeSorted(): String {
val clone = this.toString().decodeJsonObject()
if (!clone.contains(TootStatus.LANGUAGE_CODE_DEFAULT)) {
clone[TootStatus.LANGUAGE_CODE_DEFAULT] = true
fun JsonObject.encodeSorted() = toString().decodeJsonObject().run {
if (!contains(TootStatus.LANGUAGE_CODE_DEFAULT)) {
put(TootStatus.LANGUAGE_CODE_DEFAULT, true)
}
return clone.keys.sorted().joinToString(",") { "$it=${this[it]}" }
entries.sortedBy { it.key }
.joinToString(",") { "${it.key}=${it.value}" }
}
val current = (encodeLanguageList()).encodeSorted()