@ -91,29 +91,23 @@ class MigrationProgressActivity : AbstractMigrationProgressActivity() {
}
// These are the only items we want to show migrating in the UI.
internal val whiteList = m apOf(
Bookmarks to R . string . preferences _sync _bookmarks ,
internal val whiteList = linkedM apOf(
Settings to R . string . settings _title ,
History to R . string . preferences _sync _history ,
Logins to R . string . migration _text _password s,
Settings to R . string . settings _title
Bookmarks to R . string . preferences _sync _bookmark s,
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 ) {