Skip to content

Commit

Permalink
Add signing config
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBernard03 committed Jul 3, 2024
1 parent 4c604f3 commit 4dd8ecf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 57 deletions.
10 changes: 10 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,18 @@ android {
}
}

signingConfigs {
create("release") {
storeFile = file("Keystore")
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = System.getenv("KEYSTORE_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
}
}

buildTypes {
release {
signingConfigs.getByName("release")
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import fr.thomasbernard03.tarot.commons.SmallPadding
import fr.thomasbernard03.tarot.commons.calculateDefenderScore
import fr.thomasbernard03.tarot.commons.calculatePartnerScore
import fr.thomasbernard03.tarot.commons.calculateTakerScore
import fr.thomasbernard03.tarot.commons.extensions.calculateScore
import fr.thomasbernard03.tarot.commons.extensions.toColor
import fr.thomasbernard03.tarot.domain.models.GameModel
import fr.thomasbernard03.tarot.presentation.components.PlayerIcon
Expand All @@ -32,41 +33,12 @@ fun LazyListScope.playersScoreHeader(
game : GameModel
) {
stickyHeader {
val playersWithScore = game.players.map { player ->
player to
game.rounds.sumOf {
val takerScore = calculateTakerScore(
points = it.points,
bid = it.bid,
oudlers = it.oudlers.size,
calledHimSelf = it.calledPlayer == it.taker
)

val partnerScore = calculatePartnerScore(takerScore)

if (it.taker == player)
takerScore
else if (it.calledPlayer == player)
partnerScore
else {
if (it.taker == it.calledPlayer){
calculateDefenderScore(takerScore, 4)
}
else {
val attackScore = takerScore + partnerScore
calculateDefenderScore(attackScore, 3)
}
}
}
}
.sortedByDescending { it.second }

Row(
modifier = Modifier
.background(MaterialTheme.colorScheme.background)
.padding(horizontal = SmallPadding, vertical = LargePadding)
) {
playersWithScore.forEach { playerWithScore ->
game.calculateScore().sortedByDescending { it.second }.forEach { playerWithScore ->
Column(
modifier = Modifier.weight(1f),
horizontalAlignment = Alignment.CenterHorizontally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import fr.thomasbernard03.tarot.commons.SmallPadding
import fr.thomasbernard03.tarot.commons.calculateDefenderScore
import fr.thomasbernard03.tarot.commons.calculatePartnerScore
import fr.thomasbernard03.tarot.commons.calculateTakerScore
import fr.thomasbernard03.tarot.commons.extensions.calculateScore
import fr.thomasbernard03.tarot.commons.extensions.toColor
import fr.thomasbernard03.tarot.domain.models.GameModel
import fr.thomasbernard03.tarot.presentation.components.PlayerIcon
Expand Down Expand Up @@ -94,44 +95,18 @@ fun LazyListScope.historyList(
}
else {
Column(verticalArrangement = Arrangement.spacedBy(SmallPadding)) {
game.players.forEach { player ->
game.calculateScore().forEach { (player, score) ->
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(LargePadding)
) {
val score = game.rounds.sumOf {
val takerScore = calculateTakerScore(
points = it.points,
bid = it.bid,
oudlers = it.oudlers.size,
calledHimSelf = it.calledPlayer == it.taker
)

val partnerScore = calculatePartnerScore(takerScore)

if (it.taker == player)
takerScore
else if (it.calledPlayer == player)
partnerScore
else {
if (it.taker == it.calledPlayer){
calculateDefenderScore(takerScore, 4)
}
else {
val attackScore = takerScore + partnerScore
calculateDefenderScore(attackScore, 3)
}
}
}

PlayerIcon(
name = player.name,
color = player.color.toColor(),
)

Text(text = score.toString())
}

}
}
}
Expand Down

0 comments on commit 4dd8ecf

Please sign in to comment.