Skip to content

Commit

Permalink
Merge remote-tracking branch 'master/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
T8RIN committed Apr 17, 2023
2 parents c75e3a6 + 6f0d1e8 commit 42063df
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -943,19 +943,33 @@ fun MainScreen(
}
}

val updateButtonColors = if (viewModel.updateAvailable) {
ButtonDefaults.outlinedButtonColors(
containerColor = MaterialTheme.colorScheme.primaryContainer.copy(
alpha = if (LocalNightMode.current.isNightMode()) 0.5f
else 1f
),
contentColor = MaterialTheme.colorScheme.onPrimaryContainer.copy(
alpha = 0.5f
)
)
} else {
ButtonDefaults.outlinedButtonColors(
containerColor = MaterialTheme.colorScheme.secondaryContainer.copy(
alpha = if (LocalNightMode.current.isNightMode()) 0.5f
else 1f
),
contentColor = MaterialTheme.colorScheme.onSecondaryContainer.copy(
alpha = 0.5f
)
)
}

BottomAppBar(
modifier = Modifier.drawHorizontalStroke(top = true),
actions = {
OutlinedButton(
colors = ButtonDefaults.outlinedButtonColors(
containerColor = MaterialTheme.colorScheme.secondaryContainer.copy(
alpha = if (LocalNightMode.current.isNightMode()) 0.5f
else 1f
),
contentColor = MaterialTheme.colorScheme.onSecondaryContainer.copy(
alpha = 0.5f
),
),
colors = updateButtonColors,
border = BorderStroke(
LocalBorderWidth.current,
MaterialTheme.colorScheme.outlineVariant(onTopOf = MaterialTheme.colorScheme.secondaryContainer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ class MainViewModel @Inject constructor(
private val _showUpdateDialog = mutableStateOf(false)
val showUpdateDialog by _showUpdateDialog

private val _updateAvailable = mutableStateOf(false)
val updateAvailable by _updateAvailable

private val _cancelledUpdate = mutableStateOf(false)

private val _shouldShowDialog = mutableStateOf(true)
Expand Down Expand Up @@ -230,6 +233,7 @@ class MainViewModel @Inject constructor(
}

if (tag != BuildConfig.VERSION_NAME) {
_updateAvailable.value = true
_showUpdateDialog.value = true
} else {
onNoUpdates()
Expand Down

0 comments on commit 42063df

Please sign in to comment.