Skip to content

Commit

Permalink
Release/1.7.4 #202
Browse files Browse the repository at this point in the history
  • Loading branch information
kelianClerc authored Apr 6, 2023
2 parents 1a5c38c + 4013450 commit 7e39ad7
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 14 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/prCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 🍇 Development PR check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]

jobs:
lint:
name: Run linter
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3 # Necessary to access local action
- name: Checkout Grapes repo
uses: actions/checkout@v3

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Launch lint
run: ./gradlew lint

test:
name: Run unit tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3 # Necessary to access local action
- name: Checkout Grapes repo
uses: actions/checkout@v3

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Launch unit tests
run: ./gradlew test

build:
name: Build grapes
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3 # Necessary to access local action
- name: Checkout Grapes repo
uses: actions/checkout@v3

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Launch clean build
run: ./gradlew clean assembleDebug
38 changes: 38 additions & 0 deletions .github/workflows/publishSampleOnAppDistrib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 🚀 App distrib delivery
on:
workflow_dispatch:
push:
branches:
- 'main'

jobs:
publishDebugApp:
name: Publish sample app to Firebase app distrib
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3 # Necessary to access local action
- name: Checkout Grapes repo
uses: actions/checkout@v3

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Download keystore file
shell: bash
run: |
echo "Downloading keystore..."
sudo curl -H "Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}" -H "Accept: application/vnd.github.v3.raw" -o ${{ github.workspace }}/sample/spendesk-grapes.keystore -L ${{ secrets.KEYSTORE_URL }}
ls -l config/keystores
- name: Deploy sample to app distrib
env:
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
FIREBASE_TOKEN: $${{ secrets.FIREBASE_TOKEN }}
run: ./gradlew assembleRelease appDistributionUploadRelease
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
buildscript {

ext {
grapes_version = '1.7.3'
grapes_version = '1.7.4'

kotlin_version = '1.7.10'
firebase_app_distribution_version = '2.1.2'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.spendesk.grapes.compose.message

import androidx.annotation.DrawableRes
import androidx.compose.animation.animateColorAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand All @@ -13,6 +15,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.Checkbox
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand All @@ -22,7 +25,9 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.spendesk.grapes.compose.theme.GrapesTheme

Expand All @@ -41,7 +46,7 @@ fun PasswordValidation(
validationEntries: List<PasswordValidationEntry>
) {
Column(modifier = modifier.fillMaxWidth()) {
validationEntries.forEach {
validationEntries.iterator().forEach {
PasswordValidationItem(label = it.label, isValid = it.isValid)
}
}
Expand All @@ -57,16 +62,27 @@ private fun PasswordValidationItem(
if (isValid) PasswordValidationDefaults.SuccessColor else PasswordValidationDefaults.ErrorColor
)

@DrawableRes
val itemIcon: Int = if (isValid) {
PasswordValidationDefaults.ValidIcon
} else {
PasswordValidationDefaults.InvalidIcon
}

val iconSize: Dp = if (isValid) {
PasswordValidationDefaults.ValidationSuccessItemSize
} else {
PasswordValidationDefaults.ValidationItemSize
}

Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(GrapesTheme.dimensions.paddingSmall)
) {
Spacer(
modifier = Modifier
.size(PasswordValidationDefaults.ValidationItemCircleSize)
.background(itemColor, CircleShape)
)
Box(modifier = Modifier.size(PasswordValidationDefaults.ValidationBoxSize), contentAlignment = Alignment.Center) {
Icon(painter = painterResource(id = itemIcon), contentDescription = null, tint = itemColor, modifier = Modifier.size(iconSize))
}
Text(text = label, style = GrapesTheme.typography.bodyS, color = itemColor)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.spendesk.grapes.compose.message

import androidx.annotation.DrawableRes
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.spendesk.grapes.compose.R
import com.spendesk.grapes.compose.theme.GrapesTheme

/**
Expand All @@ -12,8 +14,13 @@ import com.spendesk.grapes.compose.theme.GrapesTheme
*/
@Immutable
object PasswordValidationDefaults {
val ValidationItemCircleSize = 6.dp
val ValidationItemSize = 6.dp
val ValidationSuccessItemSize = 10.dp
val ValidationBoxSize = 16.dp

val SuccessColor: Color @Composable get() = GrapesTheme.colors.mainSuccessNormal
val ErrorColor: Color @Composable get() = GrapesTheme.colors.mainAlertNormal

@DrawableRes val ValidIcon: Int = R.drawable.ic_valid_tick
@DrawableRes val InvalidIcon: Int = R.drawable.ic_neutral_tick
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fun GrapesSelect(
onDismissRequest = { isExpanded = false },
modifier = Modifier.background(GrapesTheme.colors.mainBackground)
) {
entries.forEach {
entries.iterator().forEach {
DropdownMenuItem(
text = { Text(it.label) },
onClick = {
Expand Down Expand Up @@ -102,7 +102,7 @@ private fun Select(
horizontalArrangement = Arrangement.spacedBy(GrapesTheme.dimensions.paddingLarge),
modifier = modifier
.background(itemColor, shape = RoundedCornerShape(50, 50, radiusSize, radiusSize))
.border(1.dp, GrapesTheme.colors.mainPrimaryLighter, shape = RoundedCornerShape(50, 50, radiusSize, radiusSize))
.border(1.dp, GrapesTheme.colors.mainNeutralLight, shape = RoundedCornerShape(50, 50, radiusSize, radiusSize))
.padding(horizontal = GrapesTheme.dimensions.paddingLarge, vertical = GrapesTheme.dimensions.paddingMedium)
) {
Text(text = label, style = GrapesTheme.typography.titleS, color = contentColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ object GrapesTextFieldDefaults {
@Composable
fun textFieldColors(
textColor: Color = GrapesTheme.colors.mainNeutralDarkest,
disabledTextColor: Color = textColor.copy(ContentAlpha.disabled),
disabledTextColor: Color = GrapesTheme.colors.mainNeutralDarkest,
backgroundColor: Color = GrapesTheme.colors.mainWhite,
disabledBackgroundColor: Color = GrapesTheme.colors.mainNeutralLighter,
cursorColor: Color = GrapesTheme.colors.mainPrimaryLight,
errorCursorColor: Color = GrapesTheme.colors.mainAlertNormal,
focusedBorderColor: Color = GrapesTheme.colors.mainNeutralLight,
unfocusedBorderColor: Color = GrapesTheme.colors.mainNeutralLight,
disabledBorderColor: Color = GrapesTheme.colors.mainNeutralLighter,
disabledBorderColor: Color = GrapesTheme.colors.mainNeutralLight,
errorBorderColor: Color = GrapesTheme.colors.mainAlertNormal,
leadingIconColor: Color = Color.Yellow, // Todo replace
disabledLeadingIconColor: Color = Color.Yellow, // Todo replace
Expand Down Expand Up @@ -132,6 +133,7 @@ object GrapesTextFieldDefaults {
disabledTrailingIconColor = disabledTrailingIconColor,
errorTrailingIconColor = errorTrailingIconColor,
backgroundColor = backgroundColor,
disabledBackgroundColor = disabledBackgroundColor,
focusedLabelColor = focusedLabelColor,
unfocusedLabelColor = unfocusedLabelColor,
disabledLabelColor = disabledLabelColor,
Expand Down Expand Up @@ -161,6 +163,7 @@ private data class DefaultGrapesGrapesTextFieldColors(
private val disabledTrailingIconColor: Color,
private val errorTrailingIconColor: Color,
private val backgroundColor: Color,
private val disabledBackgroundColor: Color,
private val focusedLabelColor: Color,
private val unfocusedLabelColor: Color,
private val disabledLabelColor: Color,
Expand Down Expand Up @@ -232,7 +235,7 @@ private data class DefaultGrapesGrapesTextFieldColors(

@Composable
override fun backgroundColor(enabled: Boolean): State<Color> {
return rememberUpdatedState(backgroundColor)
return rememberUpdatedState(if (enabled) backgroundColor else disabledBackgroundColor)
}

@Composable
Expand Down
9 changes: 9 additions & 0 deletions library-compose/src/main/res/drawable/ic_neutral_tick.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="4dp"
android:height="4dp"
android:viewportWidth="4"
android:viewportHeight="4">
<path
android:pathData="M2,2m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0"
android:fillColor="#48465E"/>
</vector>
12 changes: 12 additions & 0 deletions library-compose/src/main/res/drawable/ic_valid_tick.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="10dp"
android:height="8dp"
android:viewportWidth="10"
android:viewportHeight="8">
<path
android:pathData="M1.445,4L4.112,6.667L8.556,1.333"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#0B831B"/>
</vector>
1 change: 0 additions & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ android {
firebaseAppDistribution {
groups = "release-candidate"
appId = "1:1044115290075:android:0ab502faa6ab13f24b59fe"
serviceCredentialsFile = "sample/spendesk-grapes-mobile-firebase-app-distribution.json"
}
}

Expand Down

0 comments on commit 7e39ad7

Please sign in to comment.