Skip to content

Commit

Permalink
Make Login Screen Logo Size Configurable (#3045)
Browse files Browse the repository at this point in the history
* Make LoginScreen app logo configurable

* Hide App title when empty

* Fix failing test

* Update docs
  • Loading branch information
hamza-vd authored Feb 7, 2024
1 parent 8d3f051 commit 72e273e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ data class LoginConfig(
val enablePin: Boolean? = false,
val pinLength: Int = 4,
val pinLoginMessage: String? = null,
val logoHeight: Int = 120,
val logoWidth: Int = 140,
)
Original file line number Diff line number Diff line change
Expand Up @@ -187,23 +187,25 @@ fun LoginPage(
modifier =
modifier
.align(Alignment.CenterHorizontally)
.requiredHeight(120.dp)
.requiredWidth(140.dp)
.requiredHeight(applicationConfiguration.loginConfig.logoHeight.dp)
.requiredWidth(applicationConfiguration.loginConfig.logoWidth.dp)
.testTag(APP_LOGO_TAG),
)
}
Text(
color = if (applicationConfiguration.useDarkTheme) Color.White else LoginDarkColor,
text = applicationConfiguration.appTitle,
fontWeight = FontWeight.Bold,
fontSize = 32.sp,
modifier =
modifier
.wrapContentWidth()
.padding(vertical = 8.dp)
.align(Alignment.CenterHorizontally)
.testTag(APP_NAME_TEXT_TAG),
)
if (applicationConfiguration.appTitle.isNotEmpty()) {
Text(
color = if (applicationConfiguration.useDarkTheme) Color.White else LoginDarkColor,
text = applicationConfiguration.appTitle,
fontWeight = FontWeight.Bold,
fontSize = 32.sp,
modifier =
modifier
.wrapContentWidth()
.padding(vertical = 8.dp)
.align(Alignment.CenterHorizontally)
.testTag(APP_NAME_TEXT_TAG),
)
}
Spacer(modifier = modifier.height(40.dp))
Text(text = stringResource(R.string.username), modifier = modifier.padding(vertical = 4.dp))
OutlinedTextField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ There can only be one instance of application configuration for the entire appli
"loginConfig": {
"showLogo": true,
"enablePin": true
"logoHeight" : 120,
"logoWidth" : 140
},
"deviceToDeviceSync": {
"resourcesToSync": [
Expand Down Expand Up @@ -65,4 +67,6 @@ syncInterval | Configuration duration for periodic sync | Yes | `30` |
syncStrategy | Tag every resource with the values for the resource types indicated here | Yes | `emptyList()` |
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 |
deviceToDeviceSync.resourcesToSync | Types of resource to be synced from one device to another during peer connection | No | `false` |

0 comments on commit 72e273e

Please sign in to comment.