Skip to content

Commit

Permalink
removing legacy migration flag from 12 months ago
Browse files Browse the repository at this point in the history
  • Loading branch information
ouchadam committed Jul 12, 2022
1 parent bdc3704 commit 6266b20
Showing 1 changed file with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class VectorPreferences @Inject constructor(
private const val SETTINGS_ENABLE_SEND_VOICE_FEATURE_PREFERENCE_KEY = "SETTINGS_ENABLE_SEND_VOICE_FEATURE_PREFERENCE_KEY"

const val SETTINGS_LABS_ALLOW_EXTENDED_LOGS = "SETTINGS_LABS_ALLOW_EXTENDED_LOGS"
const val SETTINGS_LABS_SPACES_HOME_AS_ORPHAN = "SETTINGS_LABS_SPACES_HOME_AS_ORPHAN"
const val SETTINGS_LABS_AUTO_REPORT_UISI = "SETTINGS_LABS_AUTO_REPORT_UISI"
const val SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME = "SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME"

Expand Down Expand Up @@ -1025,27 +1024,7 @@ class VectorPreferences @Inject constructor(
}

fun prefSpacesShowAllRoomInHome(): Boolean {
val defaultValue = false
return when {
defaultPrefs.contains(SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME) -> {
defaultPrefs.getBoolean(SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME, defaultValue)
}
defaultPrefs.contains(SETTINGS_LABS_SPACES_HOME_AS_ORPHAN) -> migrateOrphansInSpacesToShowAllInHome()
else -> defaultValue
}
}

private fun migrateOrphansInSpacesToShowAllInHome(): Boolean {
val showAllRoomsInHome = !labsSpacesOnlyOrphansInHome()
defaultPrefs.edit {
putBoolean(SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME, showAllRoomsInHome)
remove(SETTINGS_LABS_SPACES_HOME_AS_ORPHAN)
}
return showAllRoomsInHome
}

private fun labsSpacesOnlyOrphansInHome(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_SPACES_HOME_AS_ORPHAN, false)
return defaultPrefs.getBoolean(SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME, false)
}

/*
Expand Down

0 comments on commit 6266b20

Please sign in to comment.