Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0f5174e
Fix catalogue re-import cascading tastings and overwriting edits
cursoragent Nov 21, 2026
09b0166
Fix catalogue colour parsing for ROSÉ and unknown values
cursoragent Nov 21, 2026
2d26016
Fix dashboard loading spinner after delete all data
cursoragent Nov 21, 2026
8e7be73
Fix accidental dismissal of unsaved wine and filter sheets
cursoragent Nov 21, 2026
fbe6ecd
Fix colour filter chips clipping on narrow screens
cursoragent Nov 21, 2026
72216bc
Declare location hardware optional via uses-feature
cursoragent Nov 21, 2026
4afabdd
Fix issue #22: localize Stats UI and minor UX fixes
cursoragent Nov 21, 2026
9f851e7
Fix rating arc wrap when dragging past arc ends (#23)
cursoragent Nov 21, 2026
70a14c0
Merge pull request #27 from T0liver/c-fix-bottom-sheet-dismiss-3809
T0liver Nov 21, 2026
66201ef
Merge pull request #28 from T0liver/c-fix-colour-filter-chips-0966
T0liver Nov 21, 2026
0a75d36
Merge pull request #30 from T0liver/c-fix-issue-22-stats-i18n-ba2f
T0liver Nov 21, 2026
23d33fb
Merge pull request #24 from T0liver/c-catalog-import-ignore-fb6c
T0liver Nov 21, 2026
5fb5752
Merge pull request #25 from T0liver/c-rose-colour-import-cd1b
T0liver Nov 21, 2026
2095602
Merge pull request #26 from T0liver/c-fix-dashboard-spinner-after-cle…
T0liver Nov 21, 2026
bd986ae
Merge pull request #29 from T0liver/c-gps-optional-uses-feature-439c
T0liver Nov 21, 2026
e01e892
Merge pull request #31 from T0liver/c-fix-rating-arc-clamp-34a0
T0liver Nov 21, 2026
a8a290e
Release 1.1.0: bump version and changelog
cursoragent Nov 26, 2026
0025f04
Release workflow: plain v{versionName} tag, build-N fallback from 2
cursoragent Nov 26, 2026
e7ecd3a
Merge pull request #32 from T0liver/c-release-1-1-0-bump-2acf
T0liver Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,21 @@ jobs:
run: |
VERSION=$(grep "versionName" app/build.gradle.kts | awk '{print $3}' | tr -d \")
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

- name: Check if Tag Exists and Modify
id: f_tag
run: |
VERSION="${{ steps.get_version.outputs.VERSION }}"
git fetch --tags --prune
if git rev-parse "v${VERSION}" >/dev/null 2>&1; then
echo "TAG_EXISTS=true" >> $GITHUB_OUTPUT
new_version="${VERSION}-build-${{ github.run_number }}"
echo "VERSION=$new_version" >> $GITHUB_OUTPUT
N=2
while git rev-parse "v${VERSION}-build-${N}" >/dev/null 2>&1; do
N=$((N + 1))
done
echo "VERSION=${VERSION}-build-${N}" >> $GITHUB_OUTPUT
else
echo "TAG_EXISTS=false" >> $GITHUB_OUTPUT
# keep original version
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
fi

Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to ViNotes are documented in this file.

## [1.1.0] — 2026-11-26

Bug-fix and polish release merging PRs #24–#31.

### Fixed

- **#10** — Prevent accidental dismissal of add/edit wine and filter bottom sheets when the form has unsaved changes (#27).
- **#17** — Catalogue re-import no longer deletes tastings or overwrites user-edited wine fields (#24).
- **#18** — Wine colour filter chips wrap on narrow screens instead of being clipped (#28).
- **#19** — Accept `ROSÉ` and accent-insensitive catalogue colour values on file and web import (#25).
- **#20** — Dashboard loading spinner clears after “Delete all data” (#26).
- **#21** — Declare location hardware optional via `uses-feature` for correct Play Store filtering (#29).
- **#22** — Hungarian Stats strings, localized period chips and heatmap weekdays, and assorted UX fixes (#30).
- **#23** — Rating arc slider no longer jumps to 100 when dragging below the left end (#31).
6 changes: 4 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
minSdk = 24
//noinspection OldTargetApi ... like why. the andorid 17 (sdk level 37) is still not out, why do you want to target it? also, the compile sdk is 36, so you can't target 37. just stop.
targetSdk = 36
versionCode = 2
versionName = "1.0.1"
versionCode = 3
versionName = "1.1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -69,6 +69,8 @@ dependencies {
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.material3)
testImplementation(libs.junit)
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2")
testImplementation("io.mockk:mockk:1.14.4")
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
package hu.toliver.vinotes.data.dao

import android.content.Context
import androidx.room.Room
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import hu.toliver.vinotes.data.WineDatabase
import hu.toliver.vinotes.data.local.entity.TasteEntity
import hu.toliver.vinotes.data.local.entity.WineEntity
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class CatalogImportPreservesDataTest {

private lateinit var database: WineDatabase
private lateinit var wineDao: WineDao
private lateinit var tasteDao: TasteDao

@Before
fun setUp() {
val context = ApplicationProvider.getApplicationContext<Context>()
database = Room.inMemoryDatabaseBuilder(context, WineDatabase::class.java)
.allowMainThreadQueries()
.build()
wineDao = database.wineDao()
tasteDao = database.tasteDao()
}

@After
fun tearDown() {
database.close()
}

@Test
fun catalogReimportPreservesTastingsAndUserEdits() = runBlocking {
val wineId = "catalog-wine-1"
val original = sampleCatalogWine(id = wineId, producer = "Original Producer", year = 2020)
wineDao.insertAll(listOf(original))

val tasting = sampleTasting(wineId = wineId, id = "taste-1")
tasteDao.insert(tasting)

val userEdited = original.copy(producer = "User Producer", year = 2019)
wineDao.update(userEdited)

val reimportFromCatalog = sampleCatalogWine(
id = wineId,
producer = "Catalog Producer",
year = 2022,
isFromCatalog = true
)
wineDao.insertAll(listOf(reimportFromCatalog))

val storedWine = wineDao.getById(wineId)
assertNotNull(storedWine)
assertEquals("User Producer", storedWine!!.producer)
assertEquals(2019, storedWine.year)

val tastings = tasteDao.getByWineId(wineId).first()
assertEquals(1, tastings.size)
assertEquals("taste-1", tastings.first().id)
}

private fun sampleCatalogWine(
id: String,
producer: String,
year: Int,
isFromCatalog: Boolean = true
) = WineEntity(
id = id,
name = "Test Wine",
producer = producer,
year = year,
grape = "Test Grape",
isCuvee = false,
cuveeComponents = "",
country = "HU",
region = "Test Region",
colour = "WHITE",
sweetness = "DRY",
sugar = 0f,
alcoholPercentage = 12.0,
volume = 750,
description = "",
imageUrl = "",
isFromCatalog = isFromCatalog
)

private fun sampleTasting(wineId: String, id: String) = TasteEntity(
id = id,
wineId = wineId,
clarity = "CLEAR",
colourIntensity = "MEDIUM",
colour = "WHITE",
otherVisual = "",
noseIntensity = "MEDIUM",
noseAroma = "",
noseDevelopment = "DEVELOPED",
otherNose = "",
sweetness = "DRY",
acidity = "MEDIUM",
tannin = "LOW",
body = "MEDIUM",
alcohol = "MEDIUM",
flavourIntensity = "MEDIUM",
flavourCharacteristics = "",
finish = "MEDIUM",
otherPalate = "",
rating = 4,
overallImpression = "",
bestWith = "",
wouldDrinkAgain = true,
date = 1_700_000_000_000L,
place = "Home",
latitude = null,
longitude = null
)
}
10 changes: 7 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" android:required="false" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:required="false" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:required="false" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />

<application
android:name=".ViNotesApplication"
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/hu/toliver/vinotes/data/dao/WineDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ interface WineDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertOrReplace(wine: WineEntity)

@Insert(onConflict = OnConflictStrategy.REPLACE)
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun insertAll(wines: List<WineEntity>)

@Update
suspend fun update(wine: WineEntity)

@Update
suspend fun updateAll(wines: List<WineEntity>)

@Query("DELETE FROM wines WHERE id = :id")
suspend fun deleteById(id: String)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ import hu.toliver.vinotes.data.remote.dto.WineDto
import hu.toliver.vinotes.domain.model.Wine
import hu.toliver.vinotes.domain.model.enums.WineColour
import hu.toliver.vinotes.domain.model.enums.WineSweetness
import java.text.Normalizer
import java.util.Locale

fun parseWineColour(raw: String): WineColour? {
val canonical = Normalizer.normalize(raw.trim(), Normalizer.Form.NFD)
.replace(Regex("\\p{M}+"), "")
.uppercase(Locale.ROOT)
return WineColour.entries.firstOrNull { it.name == canonical }
}

fun String.toWineColour(): WineColour =
runCatching { WineColour.valueOf(this) }.getOrDefault(WineColour.RED)
parseWineColour(this)
?: throw IllegalArgumentException("Unknown wine colour: $this")

fun String.toWineSweetness(): WineSweetness =
runCatching { WineSweetness.valueOf(this) }.getOrDefault(WineSweetness.DRY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import hu.toliver.vinotes.data.local.entity.toEntity
import hu.toliver.vinotes.data.remote.api.CatalogApi
import hu.toliver.vinotes.domain.repository.AppPreferencesRepository
import hu.toliver.vinotes.data.remote.dto.FullCatalogDto
import hu.toliver.vinotes.data.remote.mapper.parseWineColour
import hu.toliver.vinotes.data.remote.mapper.toDomain
import hu.toliver.vinotes.domain.model.Wine
import hu.toliver.vinotes.domain.model.enums.WineColour
import hu.toliver.vinotes.domain.model.enums.WineSweetness
import hu.toliver.vinotes.domain.model.sync.CatalogDelta
import hu.toliver.vinotes.domain.model.sync.CatalogManifest
Expand Down Expand Up @@ -184,7 +184,7 @@ class CatalogSyncRepositoryImpl @Inject constructor(
}
if (wine.volume <= 0) invalidCatalog("$wineLabel has an invalid volume")

if (WineColour.entries.none { it.name == wine.colour }) {
if (parseWineColour(wine.colour) == null) {
invalidCatalog("$wineLabel has an invalid colour value")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class WineRepositoryImpl @Inject constructor(
dao.insertAll(wines.map { it.toEntity(isFromCatalog = fromCatalog) })
}

override suspend fun updateAll(wines: List<Wine>, fromCatalog: Boolean): Result<Unit> = runCatching {
dao.updateAll(wines.map { it.toEntity(isFromCatalog = fromCatalog) })
}

override suspend fun update(wine: Wine): Result<Unit> = runCatching {
dao.update(wine.toEntity())
}
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/hu/toliver/vinotes/domain/WineYears.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package hu.toliver.vinotes.domain

import java.util.Calendar

object WineYears {
const val MIN_YEAR = 1900

fun maxYear(): Int = Calendar.getInstance().get(Calendar.YEAR) + 1

fun isValid(year: Int): Boolean = year in MIN_YEAR..maxYear()
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface WineRepository {
): Flow<List<Wine>>
suspend fun insert(wine: Wine): Result<Unit>
suspend fun insertAll(wines: List<Wine>, fromCatalog: Boolean): Result<Unit>
suspend fun updateAll(wines: List<Wine>, fromCatalog: Boolean): Result<Unit>
suspend fun insertIfNotExists(wine: Wine): Result<Unit>
suspend fun update(wine: Wine): Result<Unit>
suspend fun delete(id: String): Result<Unit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PerformDeltaSyncUseCase @Inject constructor(
}

if (delta.updated.isNotEmpty()) {
wineRepository.insertAll(delta.updated, fromCatalog = true).getOrThrow()
wineRepository.updateAll(delta.updated, fromCatalog = true).getOrThrow()
}

if (delta.removedIds.isNotEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,5 @@ enum class StatPeriod {
ALL_TIME -> null
}
}

val label: String
get() = when (this) {
LAST_30_DAYS -> "30 days"
LAST_3_MONTHS -> "3 months"
THIS_YEAR -> "This year"
ALL_TIME -> "All time"
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.qualifiers.ApplicationContext
import hu.toliver.vinotes.R
import hu.toliver.vinotes.ui.util.userFacingErrorMessage
import hu.toliver.vinotes.domain.model.Taste
import hu.toliver.vinotes.domain.usecases.location.GetCurrentLocationUseCase
import hu.toliver.vinotes.domain.usecases.location.ReverseGeocodeUseCase
Expand Down Expand Up @@ -131,7 +132,12 @@ class AddTastingViewModel @Inject constructor(
longitude = longitude,
)
}
emitLocationError(error.message ?: context.getString(R.string.reverse_geocoding_failed))
emitLocationError(
userFacingErrorMessage(
context,
error.message ?: context.getString(R.string.reverse_geocoding_failed),
),
)
}
}
.onFailure { error ->
Expand All @@ -147,8 +153,9 @@ class AddTastingViewModel @Inject constructor(
}

private suspend fun emitLocationError(message: String) {
_state.update { it.copy(locationError = message, isLoadingLocation = false) }
_effect.send(AddTastingEffect.ShowLocationError(message))
val friendly = userFacingErrorMessage(context, message)
_state.update { it.copy(locationError = friendly, isLoadingLocation = false) }
_effect.send(AddTastingEffect.ShowLocationError(friendly))
}

private fun loadForEdit(tasteId: String) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package hu.toliver.vinotes.ui.screen.addtasting.components

import kotlin.math.atan2
import kotlin.math.roundToInt

/**
* Maps a drag position on the rating arc canvas to a 0–100 value.
* Valid arc angles are 0° (right, rating 100) through 180° (left, rating 0).
* Pointer positions below the arc (negative angle) clamp by horizontal side.
*/
fun ratingFromPointer(
pointerX: Float,
pointerY: Float,
centerX: Float,
centerY: Float,
): Int {
val degrees = Math.toDegrees(
atan2(
(centerY - pointerY).toDouble(),
(pointerX - centerX).toDouble(),
),
)
if (degrees < 0.0) {
return if (pointerX < centerX) 0 else 100
}
return (100.0 - degrees / 180.0 * 100.0).roundToInt().coerceIn(0, 100)
}
Loading
Loading