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
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,22 @@ app/release/*
# Ignore kotlin 2.0 compiler files (.salive: session-is-alive)
# https://github.com/JetBrains/kotlin/blob/ca34e5d2fd255ed0501bae4fae3d3691dc40d375/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt#L458
/.kotlin

# Claude
# Personal Claude Code settings
.claude/settings.local.json
.claude/CLAUDE.local.md

# Sensitive data and generated files within skills
.claude/skills/*/.venv/
.claude/skills/*/venv/
.claude/skills/*/node_modules/
.claude/skills/*/data/
.claude/skills/*/auth_info.json
.claude/skills/*/__pycache__/

# Logs and temporary files
.claude/logs/
.claude/tmp/
.claude/*.log

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

All notable changes to this project will be documented in this file.

## [2.0.1] - 2025-06-24

### Changed
- Updated libraries and dependencies.

## [2.0.0] - 2025-03-10

### Added
- NFC features for Number Tags (ItemTags): Write Application Info to a Tag, Read a Tag, Background Tag Reading.
- Generate QR Code Image for Number Tags (ItemTags) with a Centered Number.
- Onboarding screen with background tag reading support when not signed in.

### Changed
- Updated navigation to use the Now in Android approach with type-safe navigation.
- Updated onboarding flow.

### Fixed
- Fixed login flow.
- Fixed bottom navigation tab color not changing.
- Fixed test failures.

## [1.0.0] - 2024-12-07

### Added
- Initial release.
- 100% Kotlin and 100% Jetpack Compose.
- User authentication: Sign Up, Sign In, Sign Out, Email Confirmation, Forgot Password.
- Input validation.
- CRUD operations for Shops.
- CRUD operations for Number Tags (ItemTags).
- Hilt dependency injection.
- Retrofit2 networking with Sandwich API response handling.
- Proto DataStore for user preferences.
- Dark mode support.
- Repository tests with Robolectric.
66 changes: 66 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

NativeAppTemplate-Free-Android is a native Android app (100% Kotlin, 100% Jetpack Compose) for managing walk-in customer waitlists using NFC tags and QR codes. It connects to a Rails backend API at `api.nativeapptemplate.com`. Inspired by [nowinandroid](https://github.com/android/nowinandroid).

## Build & Run Commands

```bash
# Build debug APK
./gradlew assembleDebug

# Run all unit tests
./gradlew test

# Run a single test class
./gradlew testDebugUnitTest --tests "com.nativeapptemplate.nativeapptemplatefree.ui.shops.ShopListViewModelTest"

# Run a single test method
./gradlew testDebugUnitTest --tests "com.nativeapptemplate.nativeapptemplatefree.ui.shops.ShopListViewModelTest.stateIsInitiallyLoading"

# Dependency analysis
./gradlew buildHealth
```

## Modules

- **`:app`** — Main application module. Contains all UI, data, DI, networking, and navigation code.
- **`:model`** — Shared data model classes (serializable with kotlinx.serialization). No Android framework dependencies beyond the library plugin.

## Architecture

MVVM layered architecture following [Android Modern App Architecture](https://developer.android.com/topic/architecture#modern-app-architecture):

- **UI Layer** (`ui/`): Jetpack Compose screens + Hilt-injected ViewModels. Each feature has its own `navigation/` subpackage defining routes and `NavGraphBuilder` extensions.
- **Data Layer** (`data/`): Repository interfaces + `*Impl` classes backed by Retrofit API interfaces. Each domain (shop, item_tag, login) has its own `*Api.kt`, `*Repository.kt`, and `*RepositoryImpl.kt`.
- **Network Layer** (`network/`): `AuthInterceptor` for token injection, `RequestHelper` for request construction.
- **DI** (`di/modules/`): Hilt modules — `NetModule` (Retrofit/OkHttp), `DataModule` (repository bindings), `DataStoreModule`, `DispatchersModule`, `CoroutineScopesModule`.
- **DataStore** (`datastore/`): Proto DataStore for user preferences. Proto definitions live in `app/src/main/proto/`.
- **Navigation**: `NatNavHost.kt` is the top-level nav graph. Three bottom-nav sections: Shops, Scan, Settings. Each section uses nested navigation graphs via `*BaseRoute`.

## Key Patterns

- **API response handling**: Uses [Sandwich](https://github.com/skydoves/sandwich) library (`ApiResponse` type) for Retrofit call adaptation.
- **Dependency injection**: Hilt with `@InstallIn(SingletonComponent::class)`. Repositories are bound via `@Binds` in `DataModule`.
- **Navigation routes**: Defined as extension functions on `NavGraphBuilder` (e.g., `shopListView()`, `navigateToShopDetail()`). Routes use type-safe navigation.
- **Proto DataStore**: User preferences and NFC scan state are persisted via Protocol Buffers (lite).

## Testing

- Tests use JUnit 4 with `kotlinx.coroutines.test` and Robolectric.
- `MainDispatcherRule` (in `testing/util/`) replaces the main dispatcher for coroutine tests.
- Test doubles: `Test*Repository` classes (in `testing/repository/`) implement repository interfaces for ViewModel testing.
- Demo data: `demo/` package contains `DemoAssetManager` and `Demo*Repository` classes that load JSON fixtures from `app/src/test/assets/`.
- JVM toolchain: Java 17.

## Connecting to Local API

In `app/build.gradle.kts`, swap the debug `buildConfigField` values:
```kotlin
buildConfigField("String", "DOMAIN","\"192.168.1.21\"")
buildConfigField("String", "PORT","\"3000\"")
buildConfigField("String", "SCHEME","\"http\"")
```
Loading