Fix for #8426 - Migration steps displayed in a different order than UI specifications

Changed the order of the whitelisted migrations in order to respect the UI specifications.

Now using linked hash map instead of hash map for the whitelisted migrations so we can preserve the
order of the steps upon status changing in the migration process.
fennec/beta
Sparky93 4 years ago committed by Sebastian Kaspari
parent d65bd4f7cd
commit 640d24974f

@ -91,29 +91,23 @@ class MigrationProgressActivity : AbstractMigrationProgressActivity() {
}
// These are the only items we want to show migrating in the UI.
internal val whiteList = mapOf(
Bookmarks to R.string.preferences_sync_bookmarks,
internal val whiteList = linkedMapOf(
Settings to R.string.settings_title,
History to R.string.preferences_sync_history,
Logins to R.string.migration_text_passwords,
Settings to R.string.settings_title
Bookmarks to R.string.preferences_sync_bookmarks,
Logins to R.string.migration_text_passwords
)
internal fun MigrationResults.toItemList() = filterKeys {
whiteList.keys.contains(it)
}.map { (type, status) ->
MigrationItem(
type,
status.success
)
}.toMutableList()
.plus(
whiteList
.filterKeys { !this.containsKey(it) }
.keys
.map { MigrationItem(it, false) }
).sortedBy { it.migration.javaClass.simpleName }
internal data class MigrationItem(val migration: Migration, val status: Boolean)
internal fun MigrationResults.toItemList() = whiteList.keys
.map {
if (containsKey(it)) {
MigrationItem(it, getValue(it).success)
} else {
MigrationItem(it)
}
}
internal data class MigrationItem(val migration: Migration, val status: Boolean = false)
internal class MigrationStatusAdapter :
ListAdapter<MigrationItem, MigrationStatusAdapter.ViewHolder>(DiffCallback) {

Loading…
Cancel
Save