Skip to content

Commit

Permalink
Merge pull request #179 from JohannesPtaszyk/release/2024.3.0
Browse files Browse the repository at this point in the history
Release/2024.3.0
  • Loading branch information
JohannesPtaszyk authored Jun 23, 2024
2 parents 4289190 + e8c9bbc commit fc14d7d
Show file tree
Hide file tree
Showing 20 changed files with 239 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
distribution: zulu

- name: Setup Gradle
uses: gradle/gradle-build-action@v3
uses: gradle/actions/setup-gradle@v3

- name: Assemble Debug APK
run: ./gradlew assembleDebug
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
4 changes: 2 additions & 2 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]
on: [push]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
- uses: gradle/actions/wrapper-validation@v3
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ jobs:
distribution: zulu

- name: Setup Gradle
uses: gradle/gradle-build-action@v3
uses: gradle/actions/setup-gradle@v3

- name: Bundle Release AAB
env:
ABONITY_KEY_STORE_PASSWORD: ${{ secrets.ABONITY_KEY_STORE_PASSWORD }}
ABONITY_KEY_STORE_KEY_ALIAS: ${{ secrets.ABONITY_KEY_STORE_KEY_ALIAS }}
ABONITY_KEY_STORE_KEY_PASSWORD: ${{ secrets.ABONITY_KEY_STORE_KEY_PASSWORD }}
run: ./gradlew bundleRelease

- name: Promote Internal to Release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
distribution: zulu

- name: Setup Gradle
uses: gradle/gradle-build-action@v3
uses: gradle/actions/setup-gradle@v3

- name: Bundle Release AAB
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.gradle.api.provider.ValueSourceParameters
import org.gradle.process.ExecOperations
import javax.inject.Inject

private const val VERSION_CODE_OFFSET = 2
private const val VERSION_CODE_OFFSET = 3

abstract class RcTagVersionCodeValueSource : ValueSource<Int, ValueSourceParameters.None> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ class GetUpcomingSubscriptionsUseCase @Inject constructor(
) { subscriptions, settings ->
val today = clock.todayIn(TimeZone.currentSystemDefault())
UpcomingSubscriptions(
subscriptions.filter {
val lastDayOfCurrentPeriod = today.getLastDayOfCurrentPeriod(settings.period)
it.nextPaymentDate in today..lastDayOfCurrentPeriod
},
subscriptions
.filter {
val lastDayOfCurrentPeriod =
today.getLastDayOfCurrentPeriod(settings.period)
it.nextPaymentDate in today..lastDayOfCurrentPeriod
}
.groupBy { it.nextPaymentDate }
.toSortedMap(),
subscriptions.isNotEmpty(),
settings.period,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GetUpcomingSubscriptionsUseCaseTest {
lateinit var testDispatcher: CoroutineDispatcher

@Test
fun `GIVEN upcoming subscriptions WHEN invoked THEN return filtered list`() {
fun `GIVEN upcoming subscriptions WHEN invoked THEN return filtered sorted map`() {
runTest {
val subscription1 = createTestSubscription(
paymentInfo = PaymentInfo(
Expand Down Expand Up @@ -79,16 +79,18 @@ class GetUpcomingSubscriptionsUseCaseTest {
tested().test {
assertThat(awaitItem()).isEqualTo(
UpcomingSubscriptions(
subscriptions = listOf(
SubscriptionWithPeriodInfo(
subscription = subscription1,
periodPrice = Price(14.0, Currency.getInstance("EUR")),
nextPaymentDate = LocalDate(2022, 2, 1),
),
SubscriptionWithPeriodInfo(
subscription = subscription2,
periodPrice = Price(2.0, Currency.getInstance("USD")),
nextPaymentDate = LocalDate(2022, 2, 1),
subscriptions = mapOf(
LocalDate(2022, 2, 1) to listOf(
SubscriptionWithPeriodInfo(
subscription = subscription1,
periodPrice = Price(14.0, Currency.getInstance("EUR")),
nextPaymentDate = LocalDate(2022, 2, 1),
),
SubscriptionWithPeriodInfo(
subscription = subscription2,
periodPrice = Price(2.0, Currency.getInstance("USD")),
nextPaymentDate = LocalDate(2022, 2, 1),
),
),
),
hasAnySubscriptions = true,
Expand Down Expand Up @@ -132,7 +134,7 @@ class GetUpcomingSubscriptionsUseCaseTest {
tested().test {
assertThat(awaitItem()).isEqualTo(
UpcomingSubscriptions(
subscriptions = emptyList(),
subscriptions = emptyMap(),
true,
PaymentPeriod.MONTHS,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package dev.pott.abonity.core.entity.subscription

import kotlinx.datetime.LocalDate

data class UpcomingSubscriptions(
val subscriptions: List<SubscriptionWithPeriodInfo>,
val subscriptions: Map<LocalDate, List<SubscriptionWithPeriodInfo>>,
val hasAnySubscriptions: Boolean,
val period: PaymentPeriod,
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import java.util.Currency
fun SubscriptionCard(
subscription: Subscription,
periodPrice: Price,
currentPeriod: PaymentPeriod,
onClick: () -> Unit,
isSelected: Boolean,
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -88,14 +89,19 @@ fun SubscriptionCard(
)
}
Spacer(Modifier.width(8.dp))
PaymentInfo(subscription.paymentInfo, periodPrice)
PaymentInfo(subscription.paymentInfo, periodPrice, currentPeriod)
}
Spacer(modifier = Modifier.height(16.dp))
}
}

@Composable
private fun PaymentInfo(paymentInfo: PaymentInfo, price: Price, modifier: Modifier = Modifier) {
private fun PaymentInfo(
paymentInfo: PaymentInfo,
price: Price,
currentPeriod: PaymentPeriod,
modifier: Modifier = Modifier,
) {
Column(horizontalAlignment = Alignment.End, modifier = modifier) {
FormattedPrice(
price = price,
Expand All @@ -104,7 +110,7 @@ private fun PaymentInfo(paymentInfo: PaymentInfo, price: Price, modifier: Modifi
)

val paymentType = paymentInfo.type
if (paymentType is PaymentType.Periodic && paymentInfo.price != price) {
if (paymentType is PaymentType.Periodic && paymentType.period != currentPeriod) {
PeriodicPriceInfo(paymentType, paymentInfo)
}
}
Expand All @@ -122,6 +128,7 @@ private fun SubscriptionCardPreview(
periodPrice = item.periodPrice,
onClick = {},
isSelected = false,
currentPeriod = PaymentPeriod.MONTHS,
)
}
}
Expand Down
2 changes: 2 additions & 0 deletions core/ui/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<string name="home_btn_open_subscriptions">Alle anzeigen</string>
<string name="home_screen_title">Übersicht</string>
<string name="home_upcoming_subscriptions_label">Bevorstehende Zahlungen</string>
<string name="home_upcoming_subscriptions_today">Heute</string>
<string name="navigation_item_home">Startseite</string>
<string name="navigation_item_settings">Einstellungen</string>
<string name="navigation_item_subscription">Zahlungen</string>
Expand Down Expand Up @@ -148,4 +149,5 @@
<string name="tracking_consent_dialog_cta_privacy_policy">Datenschutz-Bestimmungen</string>
<string name="tracking_consent_dialog_second_layer_cta_privacy_policy">Für weitere Details besuchen Sie bitte unsere Datenschutz-Bestimmungen</string>
<string name="add_new_category_cta">Neu</string>
<string name="home_upcoming_subscriptions_tomorrow">Morgen</string>
</resources>
2 changes: 2 additions & 0 deletions core/ui/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@
<string name="tracking_consent_dialog_cta_privacy_policy">Politique de confidentialité</string>
<string name="tracking_consent_dialog_second_layer_cta_privacy_policy">Pour plus de détails, veuillez consulter notre Politique de confidentialité</string>
<string name="add_new_category_cta">Nouveau</string>
<string name="home_upcoming_subscriptions_today">Aujourd\'hui</string>
<string name="home_upcoming_subscriptions_tomorrow">Matin</string>
</resources>
2 changes: 2 additions & 0 deletions core/ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
<string name="home_btn_open_subscriptions">Show all</string>
<string name="home_screen_title">Overview</string>
<string name="home_upcoming_subscriptions_label">Upcoming Payments</string>
<string name="home_upcoming_subscriptions_today">Today</string>
<string name="home_upcoming_subscriptions_tomorrow">Tomorrow</string>
<string name="navigation_item_home">Home</string>
<string name="navigation_item_settings">Settings</string>
<string name="navigation_item_subscription">Payments</string>
Expand Down
Loading

0 comments on commit fc14d7d

Please sign in to comment.