diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModel.kt index 425a64dd71b4..4099e524807d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModel.kt @@ -38,6 +38,7 @@ class AccountViewModel( } .stateIn(viewModelScope, SharingStarted.WhileSubscribed(), AccountUiState.default()) + @Suppress("konsist.ensurePublicPropertiesUsePermittedNames") val enterTransitionEndAction = _enterTransitionEndAction.asSharedFlow() fun onManageAccountClick() { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt index 88337aea00e9..c554bd4daa48 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt @@ -37,9 +37,10 @@ class DeviceListViewModel( private val _loadingDevices = MutableStateFlow>(emptyList()) private val _toastMessages = MutableSharedFlow(extraBufferCapacity = 1) + @Suppress("konsist.ensurePublicPropertiesUsePermittedNames") val toastMessages = _toastMessages.asSharedFlow() - var accountToken: String? = null + @Suppress("konsist.ensurePublicPropertiesUsePermittedNames") var accountToken: String? = null private var cachedDeviceList: List? = null val uiState = diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt index 4b7bca151d69..2ae361c96440 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt @@ -66,7 +66,9 @@ class SelectLocationViewModel(private val serviceConnectionManager: ServiceConne SelectLocationUiState.Loading ) + @Suppress("konsist.ensurePublicPropertiesUsePermittedNames") val uiCloseAction = _closeAction.asSharedFlow() + @Suppress("konsist.ensurePublicPropertiesUsePermittedNames") val enterTransitionEndAction = _enterTransitionEndAction.asSharedFlow() fun selectRelay(relayItem: RelayItem?) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt index eaeaf33933e8..89adbe20befd 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt @@ -45,6 +45,7 @@ class SettingsViewModel( SettingsUiState(appVersion = "", isLoggedIn = false, isUpdateAvailable = false) ) + @Suppress("konsist.ensurePublicPropertiesUsePermittedNames") val enterTransitionEndAction = _enterTransitionEndAction.asSharedFlow() fun onTransitionAnimationEnd() { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt index 5bd56f150d20..7d3344d9487d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt @@ -51,6 +51,7 @@ class VpnSettingsViewModel( ) : ViewModel() { private val _toastMessages = MutableSharedFlow(extraBufferCapacity = 1) + @Suppress("konsist.ensurePublicPropertiesUsePermittedNames") val toastMessages = _toastMessages.asSharedFlow() private val dialogState = diff --git a/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/ViewModelTests.kt b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/ViewModelTests.kt index 47736e96111f..8347c799d71f 100644 --- a/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/ViewModelTests.kt +++ b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/ViewModelTests.kt @@ -20,8 +20,9 @@ class ViewModelTests { // properties that shouldn't be exposed. @Test fun ensurePublicPropertiesUsePermittedNames() { - allViewModels().properties().withPublicOrDefaultModifier().assert { property -> - permittedPublicPropertyNames.contains(property.name) + allViewModels().properties(includeNested = false).withPublicOrDefaultModifier().assert { + property -> + property.name == "uiState" || property.name == "uiSideEffect" } } @@ -34,17 +35,4 @@ class ViewModelTests { private fun allViewModels() = Konsist.scopeFromProject().classes().withAllParentsOf(ViewModel::class) - - companion object { - // TODO: The goal is to reduce this list to only "uiState" and "uiSideEffect". - private val permittedPublicPropertyNames = - listOf( - "uiState", - "uiSideEffect", - "toastMessages", - "uiCloseAction", - "enterTransitionEndAction", - "accountToken" - ) - } }