Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Whether you're casually curious or a seasoned enthusiast, ViNotes helps you reme
- 📊 **Statistics** — visualise your ratings by year and region with interactive charts
- 📍 **One-tap location** — autofill the venue field using your GPS position with reverse geocoding via OpenStreetMap
- 🔄 **Catalog sync** — download a curated wine database and keep it up to date with delta syncing
- 📁 **Local JSON import** — import your own wine catalog from a file, no internet required
- 📁 **Local JSON import** — import your own wine catalogue from a file, no internet required
- 🌙 **Dark & light theme** — fully themed UI with a warm, elegant wine-inspired palette
- 🔒 **Privacy-first** — works completely offline, no account needed, no tracking

Expand All @@ -44,9 +44,9 @@ Whether you're casually curious or a seasoned enthusiast, ViNotes helps you reme
<!-- Add your own screenshots here -->
<!-- Use the Android Device Art Generator for framing: https://developer.android.com/distribute/marketing-tools/device-art-generator -->

| Dashboard | Tasting Form | Wine Detail | Statistics |
|:-:|:-:|:-:|:-:|
| *coming soon* | *coming soon* | *coming soon* | *coming soon* |
| Dashboard | Tasting Form | Wine Detail | Statistics |
|:-----------------------:|:----------------------------:|:-------------------------:|:--------------------------:|
| ![](imgs/dashboard.png) | ![](imgs/tasting-screen.png) | ![](imgs/wine-screen.png) | ![](imgs/stats-screen.png) |

## Tech Stack

Expand Down Expand Up @@ -81,17 +81,17 @@ Repositories Abstract data sources behind interfaces
Room Retrofit
```

## Wine Catalog
## Wine Catalogue

ViNotes ships with a community-maintained wine catalog hosted on GitHub Pages. The sync system is designed to be lightweight and bandwidth-friendly:
ViNotes ships with a community-maintained wine catalogue hosted on GitHub Pages. The sync system is designed to be lightweight and bandwidth-friendly:

- **`manifest.json`** — fetched first; lists all available files with checksums
- **`full.json`** — the complete catalog, used on first install or manual reset
- **`full.json`** — the complete catalogue, used on first install or manual reset
- **`delta-YYYY-MM-DD.json`** — incremental updates with only added, changed, or removed wines

The app tracks the last applied delta date in Room and only downloads what it hasn't seen yet. A GitHub Action automatically regenerates the delta files and updates the manifest whenever the source catalog changes.
The app tracks the last applied delta date in Room and only downloads what it hasn't seen yet. A GitHub Action automatically regenerates the delta files and updates the manifest whenever the source catalogue changes.

> Want to add wines to the catalog? Contributions are welcome in the [catalog branch]()! Add your own issue/pull request!
> Want to add wines to the catalogue? Contributions are welcome in the [catalog branch](https://github.com/T0liver/ViNotes/tree/catalogue)! Add your own issue/pull request!

## Getting Started

Expand All @@ -115,20 +115,20 @@ adb install app/build/outputs/apk/debug/app-debug.apk

### Download

| Source | Link |
|------------|----------------------------|
| F-Droid | *coming soon* |
| Direct APK | [Releases](../../releases) |
| Source | Link |
|------------|----------------------------------------------------------------|
| F-Droid | *coming soon* |
| Direct APK | [Releases](https://github.com/T0liver/ViNotes/releases/latest) |

---

## Contributing

Contributions of all kinds are welcome!

- 🐛 **Found a bug?** Open an [issue](../../issues) with steps to reproduce
- 🐛 **Found a bug?** Open an [issue](https://github.com/T0liver/ViNotes/issues) with steps to reproduce
- 💡 **Have an idea?** Open an issue with the `enhancement` label
- 🍷 **Know your wines?** Add entries to the [wine catalog]()
- 🍷 **Know your wines?** Add entries to the [wine catalog](https://github.com/T0liver/ViNotes/tree/catalogue/source)!
- 🔧 **Want to code?** Fork the repo and open a pull request — please discuss larger changes in an issue first

### A few guidelines
Expand Down
11 changes: 9 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
//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 = 1
versionName = "1.0-alpha"
versionName = "1.0.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -36,8 +36,15 @@ android {
}

buildTypes {
getByName("debug") {
isDebuggable = true
}
getByName("release") {
signingConfig = signingConfigs.getByName("release")
signingConfig = if (file("release.keystore").exists()) {
signingConfigs.getByName("release")
} else {
signingConfigs.getByName("debug")
}
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:localeConfig="@xml/locales_config"
android:icon="@drawable/vinotes"
android:label="@string/app_name"
android:roundIcon="@drawable/vinotes"
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/hu/toliver/vinotes/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.os.LocaleListCompat
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.runtime.collectAsState
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.compose.runtime.getValue
import androidx.compose.ui.tooling.preview.Preview
import androidx.core.os.LocaleListCompat
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import hu.toliver.vinotes.ui.screen.settings.ThemeViewModel
import dagger.hilt.android.AndroidEntryPoint
import hu.toliver.vinotes.domain.model.enums.AppLanguage
import hu.toliver.vinotes.domain.model.enums.ThemeMode
import dagger.hilt.android.AndroidEntryPoint
import hu.toliver.vinotes.ui.navigation.VinNoteNavGraph
import hu.toliver.vinotes.ui.screen.settings.ThemeViewModel
import hu.toliver.vinotes.ui.theme.ViNotesTheme

@AndroidEntryPoint
Expand All @@ -35,8 +35,8 @@ class MainActivity : ComponentActivity() {
@Composable
private fun MainActivityContent() {
val vm: ThemeViewModel = hiltViewModel()
val theme by vm.themeMode.collectAsState()
val language by vm.appLanguage.collectAsState()
val theme by vm.themeMode.collectAsStateWithLifecycle()
val language by vm.appLanguage.collectAsStateWithLifecycle()

LaunchedEffect(language) {
AppCompatDelegate.setApplicationLocales(language.toLocaleListCompat())
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/hu/toliver/vinotes/ViNotesApplication.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package hu.toliver.vinotes

import android.app.Activity
import android.app.Application
import dagger.hilt.android.HiltAndroidApp

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package hu.toliver.vinotes.data.repository

import hu.toliver.vinotes.R
import hu.toliver.vinotes.data.dao.TasteDao
import hu.toliver.vinotes.data.local.entity.toDomain
import hu.toliver.vinotes.data.local.entity.toEntity
import hu.toliver.vinotes.domain.model.Taste
import hu.toliver.vinotes.domain.repository.TasteRepository
import java.util.UUID
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import java.util.UUID

class TasteRepositoryImpl @Inject constructor(
private val dao: TasteDao
Expand All @@ -22,12 +21,12 @@ class TasteRepositoryImpl @Inject constructor(
dao.getByWineId(wineId).map { entities -> entities.map { it.toDomain() } }

override suspend fun getById(id: String): Result<Taste> = runCatching {
dao.getById(id)?.toDomain() ?: error(R.string.tasting_not_found_id.toString() + id)
dao.getById(id)?.toDomain() ?: error("Tasting not found: $id")
}

override suspend fun save(taste: Taste): Result<Unit> = runCatching {
val id = UUID.randomUUID().toString()
dao.insert(taste.toEntity(id = id))
val idToUse = taste.id.ifBlank { UUID.randomUUID().toString() }
dao.insert(taste.toEntity(id = idToUse))
}

override suspend fun update(taste: Taste): Result<Unit> = runCatching {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package hu.toliver.vinotes.data.repository

import hu.toliver.vinotes.R
import hu.toliver.vinotes.data.dao.WineDao
import hu.toliver.vinotes.data.local.entity.toDomain
import hu.toliver.vinotes.data.local.entity.toEntity
Expand All @@ -22,7 +21,7 @@ class WineRepositoryImpl @Inject constructor(
dao.searchWines(query).map { entities -> entities.map { it.toDomain() } }

override suspend fun getById(id: String): Result<Wine> = runCatching {
dao.getById(id)?.toDomain() ?: error(R.string.not_found_id.toString() + id)
dao.getById(id)?.toDomain() ?: error("Wine not found: $id")
}

override fun getFiltered(
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import javax.inject.Inject
class GetTastingByWineUseCase @Inject constructor(
private val repository: TasteRepository
) {
suspend operator fun invoke(wineId: String) = repository.getByWineId(wineId)
operator fun invoke(wineId: String) = repository.getByWineId(wineId)
}

This file was deleted.

This file was deleted.

21 changes: 21 additions & 0 deletions app/src/main/java/hu/toliver/vinotes/ui/screen/UIConverter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,25 @@ object UIConverter {
TasteWineColour.TAWNY -> Color(0xFF8B4513)
TasteWineColour.REDBROWN -> Color(0xFF8B3A3A)
}

fun TasteWineColour.toDisplayName(context: Context): String = when (this) {
TasteWineColour.WHITE -> context.getString(R.string.white)
TasteWineColour.LEMONGREEN -> context.getString(R.string.lemongreen)
TasteWineColour.LEMON -> context.getString(R.string.lemon)
TasteWineColour.GOLD -> context.getString(R.string.gold)
TasteWineColour.AMBER -> context.getString(R.string.amber)
TasteWineColour.WHITEBROWN -> context.getString(R.string.whitebrown)

TasteWineColour.ROSE -> context.getString(R.string.rose)
TasteWineColour.PINK -> context.getString(R.string.pink)
TasteWineColour.SALMON -> context.getString(R.string.salmon)
TasteWineColour.ORANGE -> context.getString(R.string.orange)

TasteWineColour.RED -> context.getString(R.string.red)
TasteWineColour.PURPLE -> context.getString(R.string.purple)
TasteWineColour.RUBY -> context.getString(R.string.ruby)
TasteWineColour.GARNET -> context.getString(R.string.garnet)
TasteWineColour.TAWNY -> context.getString(R.string.tawny)
TasteWineColour.REDBROWN -> context.getString(R.string.redbrown)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package hu.toliver.vinotes.ui.screen.addtasting

import android.content.Context
import androidx.lifecycle.ViewModel
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.domain.model.Taste
import hu.toliver.vinotes.domain.usecases.location.GetCurrentLocationUseCase
Expand All @@ -19,11 +21,11 @@ import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.coroutines.withTimeout
import java.util.UUID
import javax.inject.Inject

@HiltViewModel
class AddTastingViewModel @Inject constructor(
@param:ApplicationContext private val context: Context,
private val addTaste: AddTasteUseCase,
private val updateTaste: UpdateTasteUseCase,
private val getTasteById: GetTasteByIdUseCase,
Expand Down Expand Up @@ -93,7 +95,7 @@ class AddTastingViewModel @Inject constructor(
AddTastingEvent.OnLocationPermissionGranted -> fetchLocation()
AddTastingEvent.OnLocationPermissionDenied -> {
viewModelScope.launch {
emitLocationError(R.string.location_permission_missing.toString())
emitLocationError(context.getString(R.string.location_permission_missing))
}
}

Expand Down Expand Up @@ -129,17 +131,17 @@ class AddTastingViewModel @Inject constructor(
longitude = longitude,
)
}
emitLocationError(error.message ?: R.string.reverse_geocoding_failed.toString())
emitLocationError(error.message ?: context.getString(R.string.reverse_geocoding_failed))
}
}
.onFailure { error ->
_state.update { it.copy(isLoadingLocation = false) }
emitLocationError(error.message ?: R.string.failed_to_fetch_location.toString())
emitLocationError(error.message ?: context.getString(R.string.failed_to_fetch_location))
}
}
} catch (_: TimeoutCancellationException) {
_state.update { it.copy(isLoadingLocation = false) }
emitLocationError(R.string.location_fetch_timed_out.toString())
emitLocationError(context.getString(R.string.location_fetch_timed_out))
}
}
}
Expand Down Expand Up @@ -197,11 +199,11 @@ class AddTastingViewModel @Inject constructor(
val s = _state.value
if (s.wineId.isBlank()) {
_state.value = _state.value.copy(isSaving = false)
_effect.send(AddTastingEffect.ShowSnackbar(R.string.please_select_a_wine_first.toString()))
_effect.send(AddTastingEffect.ShowSnackbar(context.getString(R.string.please_select_a_wine_first)))
return@launch
}
val taste = Taste(
id = s.editingTasteId ?: UUID.randomUUID().toString(),
id = s.editingTasteId ?: "",
clarity = s.clarity,
colourIntensity = s.colourIntensity,
colour = s.colour,
Expand Down Expand Up @@ -237,8 +239,13 @@ class AddTastingViewModel @Inject constructor(
}
.onFailure { e ->
_state.value = _state.value.copy(isSaving = false)
viewModelScope.launch { _effect.send(AddTastingEffect.ShowSnackbar(e.message ?:
R.string.error_on_save.toString())) }
viewModelScope.launch {
_effect.send(
AddTastingEffect.ShowSnackbar(
e.message ?: context.getString(R.string.error_on_save)
)
)
}
}
}
}
Expand Down
Loading
Loading