Skip to content
Closed
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 catalogue from a file, no internet required
- 📁 **Local JSON import** — import your own wine catalog 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 |
|:-----------------------:|:----------------------------:|:-------------------------:|:--------------------------:|
| ![](imgs/dashboard.png) | ![](imgs/tasting-screen.png) | ![](imgs/wine-screen.png) | ![](imgs/stats-screen.png) |
| Dashboard | Tasting Form | Wine Detail | Statistics |
|:-:|:-:|:-:|:-:|
| *coming soon* | *coming soon* | *coming soon* | *coming soon* |

## Tech Stack

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

## Wine Catalogue
## Wine Catalog

ViNotes ships with a community-maintained wine catalogue hosted on GitHub Pages. The sync system is designed to be lightweight and bandwidth-friendly:
ViNotes ships with a community-maintained wine catalog 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 catalogue, used on first install or manual reset
- **`full.json`** — the complete catalog, 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 catalogue 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 catalog changes.

> 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!
> Want to add wines to the catalog? Contributions are welcome in the [catalog branch]()! 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](https://github.com/T0liver/ViNotes/releases/latest) |
| Source | Link |
|------------|----------------------------|
| F-Droid | *coming soon* |
| Direct APK | [Releases](../../releases) |

---

## Contributing

Contributions of all kinds are welcome!

- 🐛 **Found a bug?** Open an [issue](https://github.com/T0liver/ViNotes/issues) with steps to reproduce
- 🐛 **Found a bug?** Open an [issue](../../issues) with steps to reproduce
- 💡 **Have an idea?** Open an issue with the `enhancement` label
- 🍷 **Know your wines?** Add entries to the [wine catalog](https://github.com/T0liver/ViNotes/tree/catalogue/source)!
- 🍷 **Know your wines?** Add entries to the [wine catalog]()
- 🔧 **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: 2 additions & 9 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.0"
versionName = "1.0-alpha"

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

buildTypes {
getByName("debug") {
isDebuggable = true
}
getByName("release") {
signingConfig = if (file("release.keystore").exists()) {
signingConfigs.getByName("release")
} else {
signingConfigs.getByName("debug")
}
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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.lifecycle.compose.collectAsStateWithLifecycle
import androidx.compose.runtime.getValue
import androidx.compose.ui.tooling.preview.Preview
import androidx.core.os.LocaleListCompat
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import dagger.hilt.android.AndroidEntryPoint
import hu.toliver.vinotes.ui.screen.settings.ThemeViewModel
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.collectAsStateWithLifecycle()
val language by vm.appLanguage.collectAsStateWithLifecycle()
val theme by vm.themeMode.collectAsState()
val language by vm.appLanguage.collectAsState()

LaunchedEffect(language) {
AppCompatDelegate.setApplicationLocales(language.toLocaleListCompat())
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/hu/toliver/vinotes/ViNotesApplication.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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,14 +1,15 @@
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 @@ -21,12 +22,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("Tasting not found: $id")
dao.getById(id)?.toDomain() ?: error(R.string.tasting_not_found_id.toString() + id)
}

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

override suspend fun update(taste: Taste): Result<Unit> = runCatching {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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 @@ -21,7 +22,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("Wine not found: $id")
dao.getById(id)?.toDomain() ?: error(R.string.not_found_id.toString() + id)
}

override fun getFiltered(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package hu.toliver.vinotes.domain.usecases.taste

import hu.toliver.vinotes.domain.repository.TasteRepository
import javax.inject.Inject

class DeleteTastingUseCase @Inject constructor (
private val repository: TasteRepository
) {
suspend operator fun invoke(id: String): Result<Unit> = repository.delete(id)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package hu.toliver.vinotes.domain.usecases.taste

import hu.toliver.vinotes.domain.repository.TasteRepository
import javax.inject.Inject

class GetTasteByIDUseCase @Inject constructor(
private val repository: TasteRepository
) {
suspend operator fun invoke(id: String) = repository.getById(id)
}
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
) {
operator fun invoke(wineId: String) = repository.getByWineId(wineId)
suspend operator fun invoke(wineId: String) = repository.getByWineId(wineId)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package hu.toliver.vinotes.domain.usecases.taste

import hu.toliver.vinotes.domain.model.Taste
import hu.toliver.vinotes.domain.model.Wine
import hu.toliver.vinotes.domain.repository.TasteRepository
import hu.toliver.vinotes.domain.repository.WineRepository
import javax.inject.Inject

class SaveTastingUseCase @Inject constructor(
private val tasteRepository: TasteRepository,
private val wineRepository: WineRepository
) {
suspend operator fun invoke(taste: Taste, wine: Wine): Result<Unit> {
wineRepository.insertIfNotExists(wine)
return tasteRepository.save(taste)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package hu.toliver.vinotes.domain.usecases.taste

import hu.toliver.vinotes.domain.model.Taste
import hu.toliver.vinotes.domain.repository.TasteRepository
import javax.inject.Inject

class UpdateTasingUseCase @Inject constructor(
private val repository: TasteRepository
) {
suspend operator fun invoke(taste: Taste): Result<Unit> {
return repository.update(taste)
}
}
21 changes: 0 additions & 21 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,25 +174,4 @@ 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,10 +1,8 @@
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 @@ -21,11 +19,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 @@ -95,7 +93,7 @@ class AddTastingViewModel @Inject constructor(
AddTastingEvent.OnLocationPermissionGranted -> fetchLocation()
AddTastingEvent.OnLocationPermissionDenied -> {
viewModelScope.launch {
emitLocationError(context.getString(R.string.location_permission_missing))
emitLocationError(R.string.location_permission_missing.toString())
}
}

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