Skip to content

Commit

Permalink
Merge branch 'release/3.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitletondor committed Sep 9, 2024
2 parents 48742d5 + 7d6fbcc commit 2d3a764
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 46 deletions.
29 changes: 13 additions & 16 deletions Android/EasyBudget/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ android {
compileSdk = 35
minSdk = 23
targetSdk = 35
versionCode = 152
versionName = "3.3.4"
versionCode = 153
versionName = "3.3.5"
vectorDrawables.useSupportLibrary = true
}

Expand Down Expand Up @@ -116,47 +116,44 @@ dependencies {
val realmVersion: String by rootProject.extra

implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2")

coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.2")

implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.activity:activity-ktx:1.9.1")
implementation("androidx.activity:activity-ktx:1.9.2")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.4")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.5")
implementation("androidx.work:work-runtime-ktx:2.9.1")
implementation("androidx.work:work-gcm:2.9.1")
implementation("com.google.android.play:review-ktx:2.0.1")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")

implementation(platform("com.google.firebase:firebase-bom:33.1.2"))
implementation(platform("com.google.firebase:firebase-bom:33.2.0"))
implementation("com.google.firebase:firebase-messaging-ktx")
implementation("com.google.firebase:firebase-storage")
implementation("com.google.firebase:firebase-crashlytics")
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-firestore-ktx")
implementation("com.firebaseui:firebase-ui-auth:8.0.2")

val composeBom = platform("androidx.compose:compose-bom:2024.06.00")
val composeBom = platform("androidx.compose:compose-bom:2024.09.00")
implementation(composeBom)
androidTestImplementation(composeBom)
debugImplementation("androidx.compose.ui:ui-tooling")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.ui:ui")
implementation("androidx.activity:activity-compose:1.9.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4")
implementation("androidx.activity:activity-compose:1.9.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.5")
implementation("androidx.navigation:navigation-compose:2.8.0")

// TODO migrate to bom when 1.7.0 is stable
implementation("androidx.compose.foundation:foundation:1.7.0-beta07")
implementation("androidx.navigation:navigation-compose:2.8.0-beta07")

implementation("com.google.accompanist:accompanist-themeadapter-material3:0.34.0")
implementation("com.google.accompanist:accompanist-permissions:0.34.0")
implementation("com.google.accompanist:accompanist-themeadapter-material3:0.36.0")
implementation("com.google.accompanist:accompanist-permissions:0.36.0")
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")

implementation("com.android.billingclient:billing-ktx:7.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import biweekly.property.Status
import biweekly.property.Summary
import biweekly.util.ICalDate
import com.benoitletondor.easybudgetapp.db.onlineimpl.Account
import com.benoitletondor.easybudgetapp.helper.Logger
import com.benoitletondor.easybudgetapp.helper.getDBValue
import com.benoitletondor.easybudgetapp.helper.getRealValueFromDB
import com.benoitletondor.easybudgetapp.helper.localDateFromTimestamp
Expand Down Expand Up @@ -103,19 +104,30 @@ class RecurringExpenseEntity() : RealmObject {
iCalRepresentation = cal.write()
}

private fun ICalendar.findNonExceptionEventForOriginalOccurrenceDate(originalOccurrenceDate: LocalDate): VEvent
= events
.filterExceptions()
.let { nonExceptionEvents ->
val firstNonExceptionEvent = nonExceptionEvents.firstOrNull {
it.dateEnd == null || !it.dateEnd.value.before(originalOccurrenceDate.toStartOfDayDate())
}

if (firstNonExceptionEvent != null) {
return@let firstNonExceptionEvent
}

Logger.warning("No non exception event found for original occurrence date $originalOccurrenceDate, using first event")
return@let nonExceptionEvents.first { it.dateEnd !== null && !it.dateStart.value.after(originalOccurrenceDate.toStartOfDayDate()) }
}

private fun ICalendar.addExceptionFromExpense(expense: Expense, originalOccurrenceDate: LocalDate) {
val exceptionEvent = VEvent()
exceptionEvent.dateStart = DateStart(expense.date.toStartOfDayDate(), false)
exceptionEvent.summary = Summary(expense.title)
exceptionEvent.status = Status.accepted()
exceptionEvent.addExperimentalProperty(AMOUNT_KEY, expense.amount.getDBValue().toString())
exceptionEvent.addExperimentalProperty(CHECKED_KEY, expense.checked.toString())
exceptionEvent.uid = events
.filterExceptions()
.first {
it.dateEnd == null || !it.dateEnd.value.before(originalOccurrenceDate.toStartOfDayDate())
}
.uid
exceptionEvent.uid = findNonExceptionEventForOriginalOccurrenceDate(originalOccurrenceDate).uid

val recurrenceId = RecurrenceId(ICalDate(originalOccurrenceDate.toStartOfDayDate(), false))
exceptionEvent.recurrenceId = recurrenceId
Expand All @@ -137,10 +149,7 @@ class RecurringExpenseEntity() : RealmObject {

val exceptionEvent = VEvent()
exceptionEvent.dateStart = DateStart(occurrenceDate.toStartOfDayDate(), false)
exceptionEvent.uid = cal.events
.filterExceptions()
.first { it.dateEnd == null || !it.dateEnd.value.before(originalOccurrenceDate.toStartOfDayDate()) }
.uid
exceptionEvent.uid = cal.findNonExceptionEventForOriginalOccurrenceDate(originalOccurrenceDate).uid
exceptionEvent.status = Status.cancelled()
val recurrenceId = RecurrenceId(ICalDate(originalOccurrenceDate.toStartOfDayDate(), false))
exceptionEvent.recurrenceId = recurrenceId
Expand Down Expand Up @@ -230,18 +239,18 @@ class RecurringExpenseEntity() : RealmObject {
}

// Create a new event starting at the date with the new properties
val exceptionEvent = VEvent()
exceptionEvent.dateStart = DateStart(newRecurringExpense.recurringDate.toStartOfDayDate(), false)
val newEvent = VEvent()
newEvent.dateStart = DateStart(newRecurringExpense.recurringDate.toStartOfDayDate(), false)
if (newEventEndDate != null) {
exceptionEvent.dateEnd = DateEnd(newEventEndDate, false)
newEvent.dateEnd = DateEnd(newEventEndDate, false)
}
exceptionEvent.summary = Summary(newRecurringExpense.title)
exceptionEvent.addExperimentalProperty(AMOUNT_KEY, newRecurringExpense.amount.getDBValue().toString())
exceptionEvent.addExperimentalProperty(CHECKED_KEY, false.toString())
exceptionEvent.status = Status.accepted()
exceptionEvent.recurrenceRule = RecurrenceRule(newRecurringExpense.type.toRecurrence())
newEvent.summary = Summary(newRecurringExpense.title)
newEvent.addExperimentalProperty(AMOUNT_KEY, newRecurringExpense.amount.getDBValue().toString())
newEvent.addExperimentalProperty(CHECKED_KEY, false.toString())
newEvent.status = Status.accepted()
newEvent.recurrenceRule = RecurrenceRule(newRecurringExpense.type.toRecurrence())

cal.addEvent(exceptionEvent)
cal.addEvent(newEvent)

iCalRepresentation = cal.write()
}
Expand Down Expand Up @@ -306,15 +315,9 @@ class RecurringExpenseEntity() : RealmObject {
val startDate = from?.toStartOfDayDate()
val endDate = to.toStartOfDayDate()

val exceptions: MutableMap<Date, VEvent> = mutableMapOf()

for (event in events) {
val recurrenceId = event.recurrenceId
if (recurrenceId != null) {
// This is an exception event, store it in the map.
exceptions[recurrenceId.value] = event
}
}
val exceptions = events
.filterNotException()
.associateBy { it.recurrenceId.value }

val eventsInRange = mutableListOf<EventInRange>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ private fun MainView(
showAccountSelectorModal = false
},
sheetState = accountSelectorModalSheetState,
windowInsets = WindowInsets(0, 0, 0, 0),
contentWindowInsets = { WindowInsets(0, 0, 0, 0) },
) {
AccountSelectorView(
onAccountSelected = { account ->
Expand Down
2 changes: 1 addition & 1 deletion Android/EasyBudget/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
<string name="premium_popup_not_premium_feature2_title">1. Monthly report</string>
<string name="premium_popup_not_premium_feature2_message">Get a sum-up of your expenses and incomes of the month and see how much you saved.</string>
<string name="premium_popup_not_premium_feature_more_expense_check">4. Tick entries</string>
<string name="premium_popup_not_premium_feature_more_expense_check_desc">Ability to tick an entry when it has reached your bank account to keep tracks of what\'s going on</string>
<string name="premium_popup_not_premium_feature_more_expense_check_desc">Ability to tick an entry when it has reached your bank account to keep track of what\'s going on</string>
<string name="premium_popup_not_premium_feature_more_dark_theme">5. Dark theme support!</string>
<string name="premium_popup_not_premium_feature_more_dark_theme_desc">Unlock dark theme for the app and activate it automatically or when you want it.</string>
<string name="premium_popup_not_premium_feature_more_backup_title">2. Backup</string>
Expand Down

0 comments on commit 2d3a764

Please sign in to comment.