mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
Code review fixes.
This commit is contained in:
parent
5eb786b55f
commit
abea9b686a
8 changed files with 10 additions and 9 deletions
|
@ -51,12 +51,13 @@
|
|||
<bool name="settings_labs_rich_text_editor_default">false</bool>
|
||||
<bool name="settings_labs_enable_voice_broadcast_visible">true</bool>
|
||||
<bool name="settings_labs_enable_voice_broadcast_default">false</bool>
|
||||
<bool name="settings_device_manager_show_ip_address">false</bool>
|
||||
<!-- Level 1: Advanced settings -->
|
||||
|
||||
<!-- Level 1: Help and about -->
|
||||
|
||||
<!-- Level 1: Legals -->
|
||||
|
||||
<!-- Level 3: Security & Privacy, Sessions -->
|
||||
<bool name="settings_session_manager_show_ip_address">false</bool>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1232,8 +1232,8 @@ class VectorPreferences @Inject constructor(
|
|||
defaultPrefs.getBoolean(SETTINGS_LABS_VOICE_BROADCAST_KEY, getDefault(R.bool.settings_labs_enable_voice_broadcast_default))
|
||||
}
|
||||
|
||||
fun showIpAddressInDeviceManagerScreens(): Boolean {
|
||||
return defaultPrefs.getBoolean(SETTINGS_SESSION_MANAGER_SHOW_IP_ADDRESS, getDefault(R.bool.settings_device_manager_show_ip_address))
|
||||
fun showIpAddressInSessionManagerScreens(): Boolean {
|
||||
return defaultPrefs.getBoolean(SETTINGS_SESSION_MANAGER_SHOW_IP_ADDRESS, getDefault(R.bool.settings_session_manager_show_ip_address))
|
||||
}
|
||||
|
||||
fun setIpAddressVisibilityInDeviceManagerScreens(isVisible: Boolean) {
|
||||
|
|
|
@ -88,7 +88,7 @@ class DevicesViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
private fun refreshIpAddressVisibility() {
|
||||
val shouldShowIpAddress = vectorPreferences.showIpAddressInDeviceManagerScreens()
|
||||
val shouldShowIpAddress = vectorPreferences.showIpAddressInSessionManagerScreens()
|
||||
setState {
|
||||
copy(isShowingIpAddress = shouldShowIpAddress)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class ToggleIpAddressVisibilityUseCase @Inject constructor(
|
|||
) {
|
||||
|
||||
fun execute() {
|
||||
val currentVisibility = vectorPreferences.showIpAddressInDeviceManagerScreens()
|
||||
val currentVisibility = vectorPreferences.showIpAddressInSessionManagerScreens()
|
||||
vectorPreferences.setIpAddressVisibilityInDeviceManagerScreens(!currentVisibility)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class OtherSessionsViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
private fun refreshIpAddressVisibility() {
|
||||
val shouldShowIpAddress = vectorPreferences.showIpAddressInDeviceManagerScreens()
|
||||
val shouldShowIpAddress = vectorPreferences.showIpAddressInSessionManagerScreens()
|
||||
setState {
|
||||
copy(isShowingIpAddress = shouldShowIpAddress)
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class SessionOverviewViewModel @AssistedInject constructor(
|
|||
super.onCleared()
|
||||
}
|
||||
private fun refreshIpAddressVisibility() {
|
||||
val shouldShowIpAddress = vectorPreferences.showIpAddressInDeviceManagerScreens()
|
||||
val shouldShowIpAddress = vectorPreferences.showIpAddressInSessionManagerScreens()
|
||||
setState {
|
||||
copy(isShowingIpAddress = shouldShowIpAddress)
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ class DevicesViewModelTest {
|
|||
val viewModelTest = viewModel.test()
|
||||
every { toggleIpAddressVisibilityUseCase.execute() } just runs
|
||||
every { fakeVectorPreferences.instance.setIpAddressVisibilityInDeviceManagerScreens(true) } just runs
|
||||
every { fakeVectorPreferences.instance.showIpAddressInDeviceManagerScreens() } returns true
|
||||
every { fakeVectorPreferences.instance.showIpAddressInSessionManagerScreens() } returns true
|
||||
|
||||
viewModel.handle(DevicesAction.ToggleIpAddressVisibility)
|
||||
viewModel.onSharedPreferenceChanged(null, null)
|
||||
|
|
|
@ -54,6 +54,6 @@ class FakeVectorPreferences {
|
|||
}
|
||||
|
||||
fun givenSessionManagerShowIpAddress(showIpAddress: Boolean) {
|
||||
every { instance.showIpAddressInDeviceManagerScreens() } returns showIpAddress
|
||||
every { instance.showIpAddressInSessionManagerScreens() } returns showIpAddress
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue