Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make app title visibility configurable in LoginScreen #3063

Merged
merged 8 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ data class LoginConfig(
val pinLoginMessage: String? = null,
val logoHeight: Int = 120,
val logoWidth: Int = 140,
val showAppTitle: Boolean = true,
)
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,29 @@ class LoginScreenTest {
)
}

@Test
fun testAppTitleLoginConfigShouldHideAppTitleWhenFalse() {
val appConfigs =
ApplicationConfiguration(
appTitle = "My app",
appId = "app/debug",
loginConfig = LoginConfig(showLogo = true, showAppTitle = false),
)
composeRule.setContent {
LoginPage(
applicationConfiguration = appConfigs,
username = "user",
onUsernameChanged = { listenerObjectSpy.onUsernameUpdated() },
password = "password",
onPasswordChanged = { listenerObjectSpy.onPasswordUpdated() },
forgotPassword = { listenerObjectSpy.forgotPassword() },
onLoginButtonClicked = { listenerObjectSpy.attemptRemoteLogin() },
appVersionPair = Pair(1, "1.0.1"),
)
}
composeRule.onNodeWithTag(APP_NAME_TEXT_TAG).assertDoesNotExist()
}

private fun verifyUnknownTextErrorMessage(loginErrorState: LoginErrorState, errorMessageId: Int) {
composeRule.setContent {
LoginPage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@
.testTag(APP_LOGO_TAG),
)
}
if (applicationConfiguration.appTitle.isNotEmpty()) {
if (

Check warning on line 195 in android/quest/src/main/java/org/smartregister/fhircore/quest/ui/login/LoginScreen.kt

View check run for this annotation

Codecov / codecov/patch

android/quest/src/main/java/org/smartregister/fhircore/quest/ui/login/LoginScreen.kt#L195

Added line #L195 was not covered by tests
applicationConfiguration.appTitle.isNotEmpty() &&
applicationConfiguration.loginConfig.showAppTitle
) {
Text(
color = if (applicationConfiguration.useDarkTheme) Color.White else LoginDarkColor,
text = applicationConfiguration.appTitle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ There can only be one instance of application configuration for the entire appli
],
"loginConfig": {
"showLogo": true,
"enablePin": true
"enablePin": true,
"showAppTitle" : true,
"logoHeight" : 120,
"logoWidth" : 140
},
Expand Down Expand Up @@ -69,4 +70,5 @@ loginConfig.showLogo | Display logo in login page | Yes | `true` |
loginConfig.enablePin | Request user for pin after login; to be used for subsequent logins | No | `false` |
loginConfig.logoHeight | Set the maximum height a logo can have | No | 120 |
loginConfig.logoWidth | Set the maximum width a logo can have | No | 140 |
loginConfig.showAppTitle | Toggle App title in LoginScreen visibility | No | true |
deviceToDeviceSync.resourcesToSync | Types of resource to be synced from one device to another during peer connection | No | `false` |
Loading