Skip to content

Commit

Permalink
using consistent method naming for setting the capabilities override
Browse files Browse the repository at this point in the history
  • Loading branch information
ouchadam committed Mar 10, 2022
1 parent 147de6e commit 64df56b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DebugVectorOverrides(private val context: Context) : VectorOverrides {
}
}

suspend fun updateHomeserverCapabilities(block: HomeserverCapabilitiesOverride.() -> HomeserverCapabilitiesOverride) {
suspend fun setHomeserverCapabilities(block: HomeserverCapabilitiesOverride.() -> HomeserverCapabilitiesOverride) {
val capabilitiesOverride = block(forceHomeserverCapabilities.firstOrNull() ?: HomeserverCapabilitiesOverride(null, null))
context.dataStore.edit { settings ->
when (capabilitiesOverride.canChangeDisplayName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor(
private fun handSetDisplayNameCapabilityOverride(action: SetDisplayNameCapabilityOverride) {
viewModelScope.launch {
val forceDisplayName = action.option.toBoolean()
debugVectorOverrides.updateHomeserverCapabilities { copy(canChangeDisplayName = forceDisplayName) }
debugVectorOverrides.setHomeserverCapabilities { copy(canChangeDisplayName = forceDisplayName) }
}
}

private fun handSetAvatarCapabilityOverride(action: SetAvatarCapabilityOverride) {
viewModelScope.launch {
val forceAvatar = action.option.toBoolean()
debugVectorOverrides.updateHomeserverCapabilities { copy(canChangeAvatar = forceAvatar) }
debugVectorOverrides.setHomeserverCapabilities { copy(canChangeAvatar = forceAvatar) }
}
}
}

0 comments on commit 64df56b

Please sign in to comment.