commit 1477e2426dd21369d175b12d48cd2f4aab04cf9e Author: Incido Developer Date: Fri Aug 14 22:51:59 2026 +1200 Initial v0.1.1 scaffold - Multi-module Android project: app/ (entry point), composeApp/ (UI), core/domain/ (pure-Kotlin interfaces), core/data/ (ObjectBox-backed repository). - Privacy-first: no INTERNET permission, no analytics, auto-backup disabled (data_extraction_rules.xml excludes all domains). - AGPL-3.0 licensed with full LICENSE + NOTICE files. - Material 3 UI with dynamic color on Android 12+, dark/light theme follows system. - v0.1.1 polish: * Editor text field shrinks above the soft keyboard (Scaffold contentWindowInsets union(systemBars, ime) + windowSoftInputMode adjustResize). * List cards now render title (first non-empty line, titleMedium) plus abbreviated body preview (max 2 lines, ellipsised). Empty notes display as 'Untitled'. * versionCode 1 -> 2, versionName 0.1.0 -> 0.1.1. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba081d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +# Gradle +.gradle/ +build/ +!**/src/**/build/ +!**/test/**/build/ + +# Android Studio / IntelliJ +.idea/ +*.iml +*.iws +*.ipr +local.properties +captures/ +.externalNativeBuild/ +.cxx/ + +# Kotlin +.kotlin/ + +# ObjectBox generated models (kept under build, but ignore if moved out) +**/objectbox-models/ +**/objectbox-models/default.json + +# VS Code +.vscode/ + +# OS +.DS_Store +Thumbs.db diff --git a/Incido Development Plan.txt b/Incido Development Plan.txt new file mode 100644 index 0000000..d81b114 --- /dev/null +++ b/Incido Development Plan.txt @@ -0,0 +1,387 @@ +# Incido — Development Plan + +## 0. Project Overview + +**Name:** Incido (Latin, pronounced "een-chi-do" — *incido* = "I cut into / I inscribe") + +**Mission:** A privacy-first, on-device note-taking application. All data stays on the user's device by default. Built to be free, offline-capable, and never lock user content behind a vendor. + +**Target Audience:** Privacy-conscious users, anyone wanting a Google Keep alternative without cloud dependency, users who want to avoid paid subscriptions for basic note-taking. + +**v0.1 Scope (this plan):** Android-only proof-of-concept / Minimum Viable Product. Demonstrates the core architecture, data layer, and UI shell. Sets the technical foundation for all future features without requiring rewrites. + +**Tagline (suggested):** *Your notes. Your device. Your terms.* + +--- + +## 1. Licensing + +### 1.1 FOSS Flavor — License: AGPL-3.0 + +- Anyone may use, modify, and redistribute the code. +- Anyone who runs a modified version (even as a network service) **must publish their source code changes**. +- This enforces the "contribute back" requirement for downstream users while still allowing them to profit from their own derivative applications. +- Full license text: https://www.gnu.org/licenses/agpl-3.0.en.html +- A `LICENSE` file containing the full AGPL-3.0 text must be committed to the repository root. +- A `NOTICE` file should credit contributors and reference the license. + +### 1.2 Commercial Flavor — Future Feature +A separate commercial build under a proprietary license, intended for users/organizations who want the commercial sync service, premium support, or integration features. Not in v0.1 scope. + +--- + +## 2. Repository & Project Setup + +### 2.1 Hosting +- **Host:** Self-hosted Gitea +- **Visibility:** Public (for FOSS community contribution) +- **Repository name suggestion:** `incido` + +### 2.2 Package & Identity +- **Application ID:** `org.incido.app` +- **Display name:** Incido +- **License file:** `LICENSE` (AGPL-3.0) +- **Notice file:** `NOTICE` + +### 2.3 Local Toolchain Requirements +The following must be installed on the development machine before any build will succeed: + +| Tool | Version (recommended) | Purpose | +|------|----------------------|---------| +| JDK | 17 (LTS) | Kotlin/Java compilation | +| Android Studio | Ladybug (2024.2.1) or newer | IDE, SDK management, device deployment | +| Android SDK Platform | API 35 | Compile target | +| Android SDK Build-Tools | 35.0.0 | Build pipeline | +| Android SDK Platform-Tools | Latest | `adb` for device install | +| Kotlin | 2.0.21+ | Language (bundled with Android Studio) | +| Gradle | 8.10+ | Build system (wrapper handles this) | + +For a non-developer: Android Studio bundles JDK, Kotlin, Gradle, and the SDK. **Install Android Studio first; everything else follows.** + +### 2.4 SDK Levels +- `minSdk = 26` (Android 8.0 Oreo — covers ~95% of active devices) +- `targetSdk = 35` (Android 15) +- `compileSdk = 35` + +--- + +## 3. Architecture & Technology Choices + +### 3.1 Language & UI Framework +- **Kotlin** 2.0.21+ as the primary language +- **Jetpack Compose** as the UI framework (Android-recommended; maps cleanly to Compose Multiplatform for future ports) +- **Kotlin Multiplatform (KMP)** with the UI in the **shared module** from day one. This is the core future-proofing decision: when iOS/Desktop ports come later, no UI rewrite is needed. + +### 3.2 Build System +- **Gradle 8.10+** with **Kotlin DSL** (`.kts` build files) +- **Version catalog** (`gradle/libs.versions.toml`) — a single source of truth for all library versions. Critical for AI-assisted workflows to avoid version drift. + +### 3.3 Module Structure (Multi-Module) +The project is split into the following Gradle modules: + +``` +incido/ +├── app/ # Android application module (entry point, manifest, MainActivity) +├── composeApp/ # KMP shared module — UI lives here from day 1 +│ └── src/ +│ ├── commonMain/ # Shared Kotlin + Compose UI (works on Android, iOS, Desktop) +│ └── androidMain/ # Android-specific glue (Activity host, resources) +├── core/ +│ ├── data/ # KMP shared module — ObjectBox wrapper, repository, models +│ └── domain/ # KMP shared module — use cases, business logic interfaces +├── gradle/ +│ └── libs.versions.toml # Version catalog (single source of truth) +└── settings.gradle.kts +``` + +**Why this structure:** +- `core/data` and `core/domain` are pure Kotlin and reusable on iOS/Desktop later. +- `composeApp` is the KMP UI module that all platforms consume. +- `app` is just the Android wrapper (manifest, MainActivity, app icon). +- Adding iOS later = create `iosApp/` module pointing at `composeApp`. Adding Desktop = add `desktopMain` source set. + +### 3.4 Data Layer +- **ObjectBox** for persistence + - Supports KMP shared modules + - Native blob support for images/audio (future-proofing media storage) + - Built-in encryption support (for future feature) + - Vector search capability (future-proofing semantic search) +- **Data model for v0.1:** Single `NoteEntity` with fields: + - `id: Long` (ObjectBox-managed) + - `content: String` (the note text) + - `createdAt: Long` (epoch millis) + - `updatedAt: Long` (epoch millis) +- **Repository pattern:** `NoteRepository` interface in `core/domain`, ObjectBox-backed implementation in `core/data`. ViewModels consume the interface, not the implementation. + +### 3.5 State Management +- **ViewModel + StateFlow** (standard Jetpack pattern) +- Each screen has a single ViewModel exposing immutable UI state as a `StateFlow` +- No third-party state management library in v0.1 (Redux/MVI/Compose-Runtime can come later if needed) + +### 3.6 Navigation +- **Navigation Compose** (`androidx.navigation:navigation-compose`) +- Two screens in v0.1: + 1. `NoteListScreen` — shows all notes as cards + 2. `NoteEditorScreen` — add/edit a single note + +--- + +## 4. v0.1 Feature Specification + +### 4.1 Functional Requirements + +| ID | Requirement | Acceptance Criteria | +|----|-------------|---------------------| +| F1 | **List of currently saved notes** | On app launch (and at all times when on the home screen), the user sees a scrollable list of all notes currently stored in the database. Each note is represented as a card showing a preview of its content and its last-updated timestamp. | +| F2 | Create a new note | Tapping "+" opens an empty editor; saving adds the note to the list and database. | +| F3 | Edit an existing note | Tapping a note card opens the editor pre-filled with its content; saving updates the note in place and reflects the change on the list. | +| F4 | Delete a note | A delete action on a note card (or in the editor) removes the note from both the list and the database. | +| F5 | Data persists across restarts | Notes created in one session are visible in the list after force-closing and reopening the app. | +| F6 | Empty state | When the list is empty (no notes saved), show a friendly empty-state message instead of an empty list. | +| F7 | List refreshes automatically | The list of saved notes updates immediately after creating, editing, or deleting a note — no manual reload required. | + +### 4.2 Non-Functional Requirements + +| ID | Requirement | +|----|-------------| +| N1 | App launches in under 2 seconds on a mid-range device | +| N2 | No network permission required (offline-first) | +| N3 | No analytics, telemetry, or third-party trackers | +| N4 | Single APK, no dynamic feature modules | +| N5 | Dark mode follows system setting (light/dark theming scaffolded for future customization) | + +### 4.3 Out of Scope for v0.1 (deferred to future features) +All features listed in §6. + +--- + +## 5. UI/UX Skeleton + +### 5.1 Screen 1 — Note List (Home) +- **Purpose:** Display the list of currently saved notes. +- **Top bar:** App title "Incido" +- **Body:** + - If empty: centered text "No notes yet. Tap + to start." + - If populated: vertical scroll of `NoteCard` items, newest first +- **Floating Action Button (FAB):** "+" icon, bottom-right, navigates to editor for a new note +- **`NoteCard` design:** + - Displays the note content (first ~3 lines, truncated) + - Shows relative timestamp ("2 min ago", "Yesterday", etc.) + - Whole card is tappable → opens editor for that note + - Long-press or swipe reveals delete action + +### 5.2 Screen 2 — Note Editor +- **Top bar:** Back arrow + Save action +- **Body:** Single multi-line `TextField` filling the screen, auto-focused +- **Behavior:** + - Back arrow without save = discard (no confirmation in v0.1; v0.2 should confirm if content changed) + - Save action persists and returns to the list; the updated/created note is visible immediately on the list + - Delete button (only when editing existing note) at bottom or in top bar overflow + +### 5.3 Theming +- **Material 3** (Material You) design system +- **Dynamic color** on Android 12+ (system-derived accent) +- **Light/Dark mode** automatic via system setting +- Brand-neutral palette in v0.1 (custom theming in future) + +--- + +## 6. Future Features (Backlog) + +This list is the canonical backlog. Items can be promoted into future versions as the project matures. + +### 6.1 Keep Parity +- Rich text formatting (bold, italic, lists, headings) +- Checklists / to-do items within notes +- Color-coded notes and labels +- Pinning notes to top +- Archive (vs. delete) with archive view +- Trash with soft-delete and recovery window +- Full-text search across note content +- Tag / hashtag system with dedicated tag browser +- Search by color, tag, or content +- Reminders / time-based notifications on notes +- Home screen widgets (list widget, quick-capture widget) +- Share-into: receive text/images from other apps +- Drawing / handwritten notes +- Image attachments from camera and gallery +- Audio attachments / voice notes + +### 6.2 On-Device Machine Learning +- **OCR (Optical Character Recognition):** + - Extract text from images attached to notes + - Handwriting recognition + - Document scanning with perspective correction + - Table extraction +- **Speech-to-Text:** + - Transcription of audio note attachments + - Live dictation while composing notes + - Translation + - Speaker diarization +- **Search index:** automatically index extracted OCR text for full-text search +- ML inference runs entirely on-device (ML Kit, Gemini Nano, or Whisper-tiny) + +### 6.3 Cross-Platform Ports +- **iOS** — via Compose Multiplatform (UI already shared) +- **Linux** — Compose Multiplatform Desktop (JVM) +- **Windows** — Compose Multiplatform Desktop (JVM) +- **macOS** — Compose Multiplatform Desktop (JVM) +- Each platform shares `core/data`, `core/domain`, and `composeApp` + +### 6.4 Security & Privacy +- ObjectBox database encryption (AES-256 at rest) +- App-lock with PIN +- App-lock with biometric (fingerprint / face) +- Auto-lock timeout +- Encrypted exports +- Secure clipboard handling + +### 6.5 Sync & Cloud (Optional, Future) +- Self-hosted sync server (open source, user-runs) +- E2E-encrypted sync protocol +- Multi-device sync +- Optional premium/hosted sync service (Commercial flavor) + +### 6.6 Commercial Flavor +- Separate proprietary build under commercial license +- Bundled sync service subscription +- Premium support tier +- Integration APIs for enterprise + +### 6.7 Quality of Life +- Markdown rendering and editing +- Import from Google Keep, Evernote, plain text, Markdown files +- Export to plain text, Markdown, PDF, HTML +- Custom themes and color schemes +- Note linking / wiki-style cross-references +- Folders / notebooks in addition to tags +- Versioning / note history +- Undo/redo + +### 6.8 Developer / Community +- Continuous Integration via Gitea Actions +- Automated APK builds on commit +- Translation infrastructure (Weblate or Crowdin) +- Contribution guidelines (`CONTRIBUTING.md`) +- Code of conduct +- Issue and PR templates +- Documentation site (public) +- Release/signing infrastructure for Play Store distribution + +--- + +## 7. Build & Verification Plan for v0.1 + +### 7.1 "Done" Definition for v0.1 +v0.1 is considered complete when **all** of the following are true: + +1. `./gradlew assembleDebug` succeeds on a clean clone of the repository +2. The generated APK installs on a real Android device via Android Studio's Run button +3. Manual test pass on a real device: + - App launch shows the list of currently saved notes (empty state on first run) + - Create 3 notes with different content → all 3 are visible on the list + - Edit one note → change appears on its card on the list + - Delete one note → it disappears from the list + - Force-stop the app, reopen → all remaining notes still appear on the list +4. `README.md` contains: + - Project description + - Build instructions + - Install/run instructions + - License notice +5. `LICENSE` (AGPL-3.0) is committed +6. `NOTICE` is committed + +### 7.2 Manual Smoke Test Script (run before tagging v0.1) +``` +[ ] Launch app — see empty state message ("No notes yet. Tap + to start.") +[ ] Tap FAB — editor opens, cursor in text field +[ ] Type "Test note 1" — tap save — returns to list, "Test note 1" card visible +[ ] Repeat for "Test note 2" and "Test note 3" +[ ] Confirm all 3 notes visible on the list, newest at top +[ ] Tap "Test note 2" card — editor opens with existing content +[ ] Change to "Test note 2 (edited)" — tap save +[ ] Confirm updated text appears on the card on the list +[ ] Long-press "Test note 3" — delete option appears +[ ] Confirm delete — note removed from the list +[ ] Force-stop app from system settings +[ ] Reopen app — "Test note 1" and "Test note 2 (edited)" both visible on the list +[ ] Pass — v0.1 verified +``` + +--- + +## 8. Development Workflow (for AI-Assisted Building) + +Because the developer is not a coder, the following workflow is recommended: + +### 8.1 Iteration Loop +1. **State the task in plain English** to the AI coding assistant (e.g., "create the NoteEditorScreen Composable with a single TextField and a save button"). +2. **AI writes code** into the appropriate module/file. +3. **AI reports what files were created/modified.** +4. **Developer reviews the diff** in Android Studio or VS Code. +5. **Build via Android Studio** (green Run button) or terminal `./gradlew assembleDebug`. +6. **Install on real device** (Android Studio handles this). +7. **Manual smoke test.** +8. **Commit to Gitea** with a meaningful message. + +### 8.2 Recommended Commit Cadence +- Commit after each working milestone (e.g., "scaffold multi-module project", "implement NoteRepository", "build NoteListScreen"). +- Use Conventional Commits: `feat:`, `fix:`, `chore:`, `docs:`, `refactor:`. + +### 8.3 Where AI Helpers Should Place Code +A short reference for AI assistants: + +| What you're building | Where it goes | +|----------------------|---------------| +| Activity / Application class | `app/src/main/kotlin/...` | +| Composables (UI screens) | `composeApp/src/commonMain/kotlin/...` | +| ViewModels | `composeApp/src/commonMain/kotlin/.../viewmodel/` | +| ObjectBox entities | `core/data/src/commonMain/kotlin/.../entity/` | +| Repositories | `core/data/src/commonMain/kotlin/.../repository/` | +| Use cases | `core/domain/src/commonMain/kotlin/.../usecase/` | +| Android-specific resources | `app/src/main/res/` | +| Dependencies | `gradle/libs.versions.toml` (never hardcode versions elsewhere) | + +--- + +## 9. Risks & Open Questions + +### 9.1 Known Risks +- **ObjectBox KMP setup is non-trivial** — first-time KMP+ObjectBox configuration may require debugging. Allow extra time for initial build configuration. +- **Compose Multiplatform is mature but Android-first** — minor adjustments may be needed when iOS/Desktop ports happen. Not a v0.1 concern. +- **AGPL-3.0 is strict** — some potential contributors or downstream users may prefer MIT/Apache. This is intentional per requirements; document clearly in README. + +### 9.2 Open Questions (to resolve during v0.1 development) +- App icon design — placeholder for v0.1; designed icon in v0.2. +- Splash screen design — Android 12+ splash API; minimal in v0.1. +- ObjectBox license — verify ObjectBox's own license terms are compatible with AGPL-3.0 distribution. +- Play Store distribution — not in v0.1; F-Droid distribution should be evaluated for FOSS flavor. + +--- + +## 10. Document History + +| Version | Date | Notes | +|---------|------|-------| +| 0.1 | 2026-08-14 | Initial plan drafted via interview | +| 0.1.1 | 2026-08-14 | Added F1 explicit "list of currently saved notes" requirement + F7 auto-refresh + clarified UI section | +| 0.1.1 | 2026-08-14 | Editor IME fix (Scaffold contentWindowInsets + adjustResize) + title/body display on list cards | + +--- + +## Appendix A — Key Library Versions (for the version catalog) + +These versions are current as of plan drafting. The AI assistant should verify and pin them in `gradle/libs.versions.toml` at project scaffold time: + +| Library | Version | Purpose | +|---------|---------|---------| +| Kotlin | 2.0.21 | Language | +| Compose Multiplatform | 1.7.0 | Cross-platform UI | +| Jetpack Compose BOM | 2024.10.00 | Android UI | +| AndroidX Lifecycle | 2.8.7 | ViewModels, lifecycle | +| AndroidX Navigation Compose | 2.8.4 | Screen navigation | +| AndroidX Activity Compose | 1.9.3 | Activity integration | +| ObjectBox | 4.0.3 | Database | +| Coroutines | 1.9.0 | Async | + +(AIs: confirm latest stable versions before scaffolding.) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..da96ce8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,666 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies of this + license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains +free software for all its users. When we speak of free software, we +are referring to freedom, not price. Our General Public Licenses are +designed to make sure that you have the freedom to distribute copies +of free software (and charge for them if you wish), that you receive +source code or can get it if you want it, that you can change the +software or use pieces of it in new free programs, and that you know +you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made by alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This +is a different license, not a version of the Affero GPL, but Affero +has released a new version of the Affero GPL which permits relicensing +under this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public +License. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of +an exact copy. The resulting work is called a "modified version" of +the earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user +through a computer network, with no transfer of a copy, is not +conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users can +regenerate automatically from other parts of the Corresponding Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures under such laws, and you +agree that you may not use any covered work to do so, to the extent +that your reliance on that covered work would conflict with this +waiver. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice +and disclaimer of warranty; keep intact all the notices that refer to +this License and to the absence of any warranty; and give any other +recipients of the Program a copy of this License along with the +Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these +conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in section 4 + to "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional permissions, to the whole of the work, and all its + parts, regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the Corresponding + Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in + accord with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the general + public at no charge under subsection 6d. + + A separable portion of the object code, whose source code is +excluded from the Corresponding Source as a System Library, need not +be included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, +family, or household purposes, or (2) anything designed or sold for +incorporation into a dwelling. In determining whether a product is +a consumer product, doubtful cases shall be resolved in favor of +coverage. For a particular product received by a particular user, +"normally used" refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected +to use, the product. A product is a consumer product regardless of +whether the product or its substantial use is industrial in nature, +except that such a product will not be considered a consumer product +if it is designed or sold for incorporation into a dwelling, as +defined in (2) above. + + For a User Product, "Installation Information" means any methods, +procedures, authorization keys, or other information required to +install and execute modified versions of a covered work in that User +Product from a modified version of its Corresponding Source. The +information must suffice to ensure that the continued functioning of +the modified object code is in no case prevented or interfered with +solely because modification has been made. + + If you convey an object code work under this section in, with, or +specifically for use in a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include +a requirement to continue to provide support service, warranty, or +updates for a work that has been modified or installed by the +recipient, or for the User Product in which it has been modified or +installed. Access to a network may be denied when the modification +itself materially and adversely affects the operation of the network +or violates the rules and protocols for communication across the +network. + + Corresponding Source conveyed, and Installation Information +provided, in accord with this section must be in a format that is +publicly documented (and with an implementation available to the +public in source code form), and must require no special password or +key for unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written so that they require +removal, in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders +of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from + the terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors + or authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions + of it) with contractual assumptions of liability to the recipient, + for any liability that these contractual assumptions directly + impose on those licensors or authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; the +above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise is void, and will +automatically terminate your rights under this License (including any +patent licenses granted under the third paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this License does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, an indication of this fact must be reflected in the +records of the copyright holder; the recipients of copies or rights +from you under this License may continue to enjoy those rights under +this License. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all its assets, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, and import the contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(but not limited to patent licenses that require payment of a patent +royalty or patent litigation) against a party that make use of, sell, +or import the work, solely where the patent license is granted to +make, use, sell, or import the work, solely where the patent license +is granted to make, use, sell, or import a specific work, solely for +the purpose of making, using, selling, or importing the work, solely +for the purpose of making, using, selling, or importing a specific +work. A "patent license" includes any kind of patent grant, such as +an express permission to advance or avoid infringement, or a covenant +not to sue for patent infringement. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or or your use of the covered work in a +country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it excludes or limits the +exercise of, or is conditioned on the exercise of, one or more of the +rights that are specifically granted under this License. You may not +convey a covered work if you are a party to a party to a +discriminatory patent license agreement (as defined in this section) +with a third party that is a party to the covered work. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement +or otherwise) that contradict the conditions of this License, they do +not excuse you from the conditions of this License. If you cannot +convey a covered work so as to satisfy simultaneously your obligations +under this License and any other pertinent obligations, then as a +consequence you may not convey it at all. For example, if you agree +to terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could +satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public + License. + + Notwithstanding any other provision of this License, if you modify +the Program, your modified version must prominently offer all +users interacting with it remotely through a computer network (if +your version supports such interaction) an opportunity to receive +the Corresponding Source of your version by providing access to the +Corresponding Source from a network server, at no charge, by some +standard or customary means of facilitating downloading of a +source distribution. + + This License is not intended to limit the rights you have under any +other license. If you apply the terms of another license to the +Program, or any portion of it, that license supersedes this License +with respect to the that portion of the Program. In the event of a +conflict between the terms of this license and another license, this +License prevails. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised or new versions of +the GNU Affero General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain version of the GNU Affero General +Public License "or any later version" applies to it, you may choose +to follow the terms and conditions either of that specified version +or of any later version published by the Free Software Foundation. If +the Program does not specify a version number of the GNU Affero +General Public License, you may choose any version ever published by +the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that +proxy's public statement of acceptance of a version permanently +authorizes you to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE +COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE +RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. +SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL +NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES +AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR +DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL +DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM +(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE +OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH +HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, +its interface could display a "Source" link that leads the users to an +archive of the code. There are many ways you could satisfy this +requirement; consult the GNU GPL FAQ for details. + + You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU AGPL, see . + + The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use +the GNU Lesser General Public License instead of this License. But +first, please read . diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..577baa8 --- /dev/null +++ b/NOTICE @@ -0,0 +1,33 @@ +Incido +Copyright (C) 2026 The Incido contributors + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +================================================================================ + +Third-Party Components + +This project includes or depends on the following third-party libraries. +Each is used in accordance with its own license terms; full license +texts are available in the respective upstream repositories. + +- Kotlin (Apache License 2.0) — Copyright JetBrains s.r.o. and respective contributors +- Jetpack Compose & Compose Multiplatform (Apache License 2.0) — Copyright The Android Open Source Project / JetBrains s.r.o. +- AndroidX libraries (Apache License 2.0) — Copyright The Android Open Source Project +- kotlinx.coroutines (Apache License 2.0) — Copyright JetBrains s.r.o. +- ObjectBox (Apache License 2.0 for the sync component; see https://objectbox.io/legal) +- Gradle (Apache License 2.0) — Copyright Gradle Inc. + +A full machine-readable bill of materials will be added in a future +release. diff --git a/README.md b/README.md new file mode 100644 index 0000000..30ea224 --- /dev/null +++ b/README.md @@ -0,0 +1,158 @@ +# Incido + +> **Your notes. Your device. Your terms.** + +Incido is a privacy-first, on-device note-taking application for Android. +All data stays on your device by default — no accounts, no cloud, no +trackers. + +This repository contains the **v0.1 Minimum Viable Product**: a +single-user, offline note app demonstrating the core architecture, data +layer, and Compose UI shell that future versions will build on. + +**Current release:** v0.1.1 (patch — see [Changelog](#changelog) below). + +--- + +## Features (v0.1) + +### v0.1.1 additions + +- **Editor respects the soft keyboard.** With edge-to-edge enabled, the + editor's `Scaffold` now unions `WindowInsets.systemBars` with + `WindowInsets.ime`, so the text field automatically shrinks above the + keyboard instead of being hidden behind it. `adjustResize` is also set + on `MainActivity` as a pre-Android-15 fallback. +- **List cards now show a title + body preview.** The first non-empty line + of a note is treated as its title and rendered in a larger / bolder + style; the remainder is shown as an abbreviated preview below it + (max 2 lines, ellipsised). Empty notes display as "Untitled". + +### v0.1.0 (original MVP) + + +- Create, edit, and delete plain-text notes +- All notes persisted locally with [ObjectBox](https://objectbox.io/) +- Material 3 UI with dynamic color (Android 12+) and dark/light themes +- Fully offline — no `INTERNET` permission required +- Multi-module Kotlin Multiplatform project (Android today, iOS/Desktop-ready for tomorrow) + +## Roadmap + +See `Incido Development Plan.txt` at the repository root for the +canonical roadmap, including on-device ML, cross-platform ports, +end-to-end sync, and security features. + +--- + +## License + +Incido is released under the **GNU Affero General Public License v3.0** +(AGPL-3.0). See [`LICENSE`](./LICENSE) for the full text and +[`NOTICE`](./NOTICE) for attributions. + +Any user who runs a modified version as a network service must publish +their source code changes. This is intentional — it preserves the +"contribute back" guarantee for all downstream users. + +--- + +## Project Layout + +``` +incido/ +├── app/ # Android entry point (manifest, MainActivity) +├── composeApp/ # Shared Compose UI (KMP commonMain + androidMain) +├── core/ +│ ├── domain/ # Pure-Kotlin domain models & repository interfaces +│ └── data/ # ObjectBox-backed repository implementation +├── gradle/ # Version catalog (libs.versions.toml) +├── settings.gradle.kts +└── build.gradle.kts +``` + +--- + +## Build Instructions + +### Prerequisites + +| Tool | Version | Notes | +|------|---------|-------| +| JDK | 17 (LTS) | `java -version` | +| Android SDK | API 35 + build-tools 35.0.0 | Install via `sdkmanager` | +| Gradle | 8.10.2 | Wrapped — `./gradlew` downloads it on first run | +| Kotlin | 2.0.21 | Bundled with the Gradle build | + +You do **not** need Android Studio. The CLI build works. + +### 1. Configure `local.properties` + +Create `local.properties` at the project root (already gitignored): + +``` +sdk.dir=/path/to/your/Android/sdk +``` + +On Linux this is typically `~/Android/sdk`. + +### 2. Accept SDK licenses (one-time) + +```bash +yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses +``` + +### 3. Build the debug APK + +```bash +./gradlew assembleDebug +``` + +The APK is written to `app/build/outputs/apk/debug/app-debug.apk`. + +### 4. Install on a device + +```bash +adb install -r app/build/outputs/apk/debug/app-debug.apk +``` + +Or open the project in Android Studio and click **Run**. + +--- + +## Manual Smoke Test (from the Development Plan §7.2) + +``` +[ ] Launch app — see empty state message ("No notes yet. Tap + to start.") +[ ] Tap FAB — editor opens, cursor in text field +[ ] Type "Test note 1" — tap save — returns to list, "Test note 1" card visible +[ ] Repeat for "Test note 2" and "Test note 3" +[ ] Confirm all 3 notes visible on the list, newest at top +[ ] Tap "Test note 2" card — editor opens with existing content +[ ] Change to "Test note 2 (edited)" — tap save +[ ] Confirm updated text appears on the card on the list +[ ] Long-press "Test note 3" — delete option appears +[ ] Confirm delete — note removed from the list +[ ] Force-stop app from system settings +[ ] Reopen app — "Test note 1" and "Test note 2 (edited)" both visible on the list +``` + +--- + +## Architecture (brief) + +- **UI**: 100% Jetpack Compose / Compose Multiplatform in `composeApp/`. + ViewModels expose immutable `StateFlow` per screen; no + third-party state management library. +- **Domain**: Pure Kotlin interfaces in `core/domain/` — the only thing + the UI sees. +- **Data**: `core/data/` provides the ObjectBox implementation. ViewModels + depend on the interface, so the data layer can be swapped (e.g., for + tests) without touching UI code. + +## Contributing + +Issues and PRs are welcome on the Gitea mirror. AGPL-3.0 means any +contributions you submit must be under a compatible license. By +submitting a contribution, you affirm you have the right to do so +under these terms. diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..b2af556 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,64 @@ +// :app — Android application entry point. Hosts MainActivity and the +// application manifest, including the launcher icon and theme. +plugins { + alias(libs.plugins.androidApplication) + alias(libs.plugins.kotlinAndroid) + alias(libs.plugins.kotlinCompose) +} + +android { + namespace = "org.incido.app" + compileSdk = 35 + + defaultConfig { + applicationId = "org.incido.app" + minSdk = 26 + targetSdk = 35 + versionCode = 2 + versionName = "0.1.1" + } + + buildTypes { + debug { + isMinifyEnabled = false + } + release { + isMinifyEnabled = false + // Release signing config is intentionally absent for v0.1 — + // we'll set up a proper key in a follow-up. + } + } + + buildFeatures { + compose = true + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlin { + jvmToolchain(17) + } + + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + implementation(project(":composeApp")) + implementation(libs.androidx.core.ktx) + implementation(libs.kotlinx.coroutines.android) + + // Compose BOM keeps all Compose artefact versions aligned + val composeBom = platform(libs.composeBom) + implementation(composeBom) + + implementation(libs.androidx.activity.compose) + implementation(libs.compose.ui) + implementation(libs.compose.material3) +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..7cecfcd --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + diff --git a/app/src/main/kotlin/org/incido/app/MainActivity.kt b/app/src/main/kotlin/org/incido/app/MainActivity.kt new file mode 100644 index 0000000..b7e6ee3 --- /dev/null +++ b/app/src/main/kotlin/org/incido/app/MainActivity.kt @@ -0,0 +1,22 @@ +package org.incido.app + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import org.incido.compose.IncidoApp + +/** + * The single Activity hosting the Compose UI. All real work — navigation, + * ViewModels, data — lives in the `:composeApp` module so it stays + * portable when iOS / Desktop ports happen. + */ +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContent { + IncidoApp() + } + } +} diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..9e688a1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..5c84730 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..5c84730 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..bbd9192 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ + + + + #6650A4 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..19d85b1 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Incido + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..5c7a3ea --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,14 @@ + + + + diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 0000000..2edda6d --- /dev/null +++ b/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..caa6b7f --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,11 @@ +// Root build file. Plugin aliases are declared here so all subprojects can apply them. +// NOTE: The ObjectBox Gradle plugin is NOT available via the standard plugin marker, +// so it's wired through a buildscript classpath in :core:data instead. +plugins { + alias(libs.plugins.androidApplication) apply false + alias(libs.plugins.androidLibrary) apply false + alias(libs.plugins.kotlinAndroid) apply false + alias(libs.plugins.kotlinJvm) apply false + alias(libs.plugins.kotlinCompose) apply false + alias(libs.plugins.ksp) apply false +} diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts new file mode 100644 index 0000000..dae6cd8 --- /dev/null +++ b/composeApp/build.gradle.kts @@ -0,0 +1,67 @@ +// composeApp — Android UI module hosting all screens, ViewModels, theme, +// navigation, and the manual DI container. Regular Android Compose (not +// Compose Multiplatform) is used in v0.1 to keep the build simple; the +// migration path to Multiplatform in v0.2 is a module-level refactor. + +plugins { + alias(libs.plugins.androidLibrary) + alias(libs.plugins.kotlinAndroid) + alias(libs.plugins.kotlinCompose) +} + +android { + namespace = "org.incido.compose" + compileSdk = 35 + + defaultConfig { + minSdk = 26 + } + + buildFeatures { + compose = true + buildConfig = true + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlin { + jvmToolchain(17) + } + + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + implementation(project(":core:domain")) + implementation(project(":core:data")) + + // Core / lifecycle + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.lifecycle.viewmodel) + implementation(libs.androidx.lifecycle.viewmodel.compose) + implementation(libs.androidx.lifecycle.runtime) + implementation(libs.kotlinx.coroutines.android) + + // Compose BOM keeps all Compose artefact versions aligned + val composeBom = platform(libs.composeBom) + implementation(composeBom) + androidTestImplementation(composeBom) + + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.navigation.compose) + + // Compose + implementation(libs.compose.ui) + implementation(libs.compose.ui.tooling.preview) + implementation(libs.compose.foundation) + implementation(libs.compose.material3) + implementation(libs.compose.material.icons.extended) + debugImplementation(libs.compose.ui.tooling) +} diff --git a/composeApp/src/main/AndroidManifest.xml b/composeApp/src/main/AndroidManifest.xml new file mode 100644 index 0000000..b2d3ea1 --- /dev/null +++ b/composeApp/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/composeApp/src/main/kotlin/org/incido/compose/App.kt b/composeApp/src/main/kotlin/org/incido/compose/App.kt new file mode 100644 index 0000000..8174370 --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/App.kt @@ -0,0 +1,49 @@ +package org.incido.compose + +import androidx.compose.runtime.Composable +import androidx.navigation.NavType +import androidx.navigation.compose.NavHost +import androidx.navigation.compose.composable +import androidx.navigation.compose.rememberNavController +import androidx.navigation.navArgument +import org.incido.compose.ui.editor.NoteEditorScreen +import org.incido.compose.ui.notelist.NoteListScreen +import org.incido.compose.ui.theme.IncidoTheme + +/** Top-level navigation destinations. */ +private object Routes { + const val LIST = "list" + const val EDITOR = "editor/{noteId}" + fun editor(noteId: Long?): String = + "editor/${noteId ?: -1L}" +} + +@Composable +fun IncidoApp() { + IncidoTheme { + val navController = rememberNavController() + NavHost(navController = navController, startDestination = Routes.LIST) { + composable(Routes.LIST) { + NoteListScreen( + onOpenEditor = { id -> navController.navigate(Routes.editor(id)) }, + ) + } + composable( + route = Routes.EDITOR, + arguments = listOf( + navArgument("noteId") { + type = NavType.LongType + defaultValue = -1L + }, + ), + ) { entry -> + val raw = entry.arguments?.getLong("noteId") ?: -1L + val id = if (raw <= 0L) null else raw + NoteEditorScreen( + noteId = id, + onClose = { navController.popBackStack() }, + ) + } + } + } +} diff --git a/composeApp/src/main/kotlin/org/incido/compose/IncidoApplication.kt b/composeApp/src/main/kotlin/org/incido/compose/IncidoApplication.kt new file mode 100644 index 0000000..2f73ea3 --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/IncidoApplication.kt @@ -0,0 +1,21 @@ +package org.incido.compose + +import android.app.Application +import org.incido.compose.di.AppContainer + +/** + * Application class. Constructs the singleton [AppContainer] holding the + * ObjectBox store and the note repository. + * + * ViewModels reach the container via `(application as IncidoApplication).container` + * (see `NoteListViewModel.Factory` and `NoteEditorViewModel.factory`). + */ +class IncidoApplication : Application() { + lateinit var container: AppContainer + private set + + override fun onCreate() { + super.onCreate() + container = AppContainer(this) + } +} diff --git a/composeApp/src/main/kotlin/org/incido/compose/di/AppContainer.kt b/composeApp/src/main/kotlin/org/incido/compose/di/AppContainer.kt new file mode 100644 index 0000000..424626b --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/di/AppContainer.kt @@ -0,0 +1,17 @@ +package org.incido.compose.di + +import android.content.Context +import io.objectbox.BoxStore +import org.incido.data.ObjectBoxStore +import org.incido.data.repository.NoteRepositoryImpl +import org.incido.domain.repository.NoteRepository + +/** + * Hand-rolled DI container. Replaces Hilt/Dagger for v0.1 — keeps the + * build simple. Constructed once from `Application.onCreate()` and + * stored as a singleton (see `IncidoApp` in the `:app` module). + */ +class AppContainer(context: Context) { + val boxStore: BoxStore = ObjectBoxStore.init(context) + val noteRepository: NoteRepository = NoteRepositoryImpl(boxStore) +} diff --git a/composeApp/src/main/kotlin/org/incido/compose/ui/editor/NoteEditorScreen.kt b/composeApp/src/main/kotlin/org/incido/compose/ui/editor/NoteEditorScreen.kt new file mode 100644 index 0000000..4f371ec --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/ui/editor/NoteEditorScreen.kt @@ -0,0 +1,129 @@ +package org.incido.compose.ui.editor + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.ime +import androidx.compose.foundation.layout.systemBars +import androidx.compose.foundation.layout.union +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material.icons.filled.Delete +import androidx.compose.material.icons.filled.Done +import androidx.compose.material.icons.filled.MoreVert +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.DropdownMenuItem +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.KeyboardCapitalization +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.viewmodel.compose.viewModel + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun NoteEditorScreen( + noteId: Long?, + onClose: () -> Unit, + viewModel: NoteEditorViewModel = viewModel( + factory = NoteEditorViewModel.factory(noteId), + key = "editor-$noteId", + ), +) { + val state by viewModel.state.collectAsStateWithLifecycle() + val focusRequester = remember { FocusRequester() } + var menuExpanded by remember { mutableStateOf(false) } + + LaunchedEffect(state.isLoading) { + if (!state.isLoading && state.existing != null) { + // Focus the field so the user can immediately edit existing notes. + focusRequester.requestFocus() + } + } + LaunchedEffect(Unit) { + if (noteId == null) focusRequester.requestFocus() + } + + Scaffold( + // Union systemBars + IME insets so the Scaffold's contentPadding + // shrinks the available area when the soft keyboard opens. With + // edge-to-edge enabled (MainActivity.enableEdgeToEdge), the IME + // inset is NOT applied by default, which previously caused the + // OutlinedTextField to extend behind the keyboard. + contentWindowInsets = WindowInsets.systemBars.union(WindowInsets.ime), + topBar = { + TopAppBar( + title = { Text(if (state.isEditing) "Edit note" else "New note") }, + navigationIcon = { + IconButton(onClick = onClose) { + Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") + } + }, + actions = { + IconButton( + onClick = { viewModel.save(onClose) }, + enabled = state.canSave, + ) { + Icon(Icons.Default.Done, contentDescription = "Save") + } + if (state.isEditing) { + IconButton(onClick = { menuExpanded = true }) { + Icon(Icons.Default.MoreVert, contentDescription = "More") + } + DropdownMenu( + expanded = menuExpanded, + onDismissRequest = { menuExpanded = false }, + ) { + DropdownMenuItem( + text = { Text("Delete") }, + onClick = { + menuExpanded = false + viewModel.delete(onClose) + }, + leadingIcon = { + Icon(Icons.Default.Delete, contentDescription = null) + }, + ) + } + } + }, + ) + }, + ) { padding -> + Box( + modifier = Modifier + .fillMaxSize() + .padding(padding), + ) { + OutlinedTextField( + value = state.content, + onValueChange = viewModel::onContentChange, + modifier = Modifier + .fillMaxSize() + .padding(16.dp) + .focusRequester(focusRequester), + placeholder = { Text("Write something…") }, + keyboardOptions = KeyboardOptions( + capitalization = KeyboardCapitalization.Sentences, + imeAction = ImeAction.Default, + ), + ) + } + } +} diff --git a/composeApp/src/main/kotlin/org/incido/compose/ui/editor/NoteEditorViewModel.kt b/composeApp/src/main/kotlin/org/incido/compose/ui/editor/NoteEditorViewModel.kt new file mode 100644 index 0000000..bbb2d5b --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/ui/editor/NoteEditorViewModel.kt @@ -0,0 +1,100 @@ +package org.incido.compose.ui.editor + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.CreationExtras +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch +import org.incido.compose.IncidoApplication +import org.incido.domain.model.Note +import org.incido.domain.repository.NoteRepository + +/** + * Immutable UI state for [NoteEditorScreen]. The editor is in "new" + * mode when [existing] is null, otherwise it edits an existing note. + */ +data class NoteEditorUiState( + val existing: Note? = null, + val content: String = "", + val isLoading: Boolean = true, + val isSaving: Boolean = false, + val isDeleted: Boolean = false, +) { + val canSave: Boolean get() = content.isNotBlank() && !isSaving + val isEditing: Boolean get() = existing != null +} + +class NoteEditorViewModel( + private val repository: NoteRepository, + private val noteId: Long?, +) : ViewModel() { + + private val _state = MutableStateFlow(NoteEditorUiState()) + val state: StateFlow = _state.asStateFlow() + + init { + if (noteId == null || noteId == 0L) { + // New note + _state.update { it.copy(isLoading = false) } + } else { + viewModelScope.launch { + repository.observeById(noteId).collect { note -> + _state.update { + it.copy( + existing = note, + content = note?.content ?: it.content, + isLoading = false, + ) + } + } + } + } + } + + fun onContentChange(newContent: String) { + _state.update { it.copy(content = newContent) } + } + + fun save(onDone: () -> Unit) { + val current = _state.value + if (!current.canSave) return + _state.update { it.copy(isSaving = true) } + viewModelScope.launch { + val toPersist = current.existing?.copy(content = current.content) + ?: Note( + content = current.content, + createdAt = System.currentTimeMillis(), + updatedAt = System.currentTimeMillis(), + ) + repository.upsert(toPersist) + _state.update { it.copy(isSaving = false) } + onDone() + } + } + + fun delete(onDone: () -> Unit) { + val id = _state.value.existing?.id ?: return + _state.update { it.copy(isSaving = true) } + viewModelScope.launch { + repository.delete(id) + _state.update { it.copy(isSaving = false, isDeleted = true) } + onDone() + } + } + + companion object { + fun factory(noteId: Long?): ViewModelProvider.Factory = viewModelFactory { + initializer { + val app = this[APPLICATION_KEY] as IncidoApplication + NoteEditorViewModel(app.container.noteRepository, noteId) + } + } + } +} diff --git a/composeApp/src/main/kotlin/org/incido/compose/ui/notelist/NoteListScreen.kt b/composeApp/src/main/kotlin/org/incido/compose/ui/notelist/NoteListScreen.kt new file mode 100644 index 0000000..0c89d5d --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/ui/notelist/NoteListScreen.kt @@ -0,0 +1,165 @@ +package org.incido.compose.ui.notelist + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Add +import androidx.compose.material.icons.filled.Delete +import androidx.compose.material3.Card +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.FloatingActionButton +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.viewmodel.compose.viewModel +import org.incido.compose.util.rememberRelativeTimestamp +import org.incido.domain.model.Note + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun NoteListScreen( + onOpenEditor: (Long?) -> Unit, + viewModel: NoteListViewModel = viewModel(factory = NoteListViewModel.Factory), +) { + val state by viewModel.uiState.collectAsStateWithLifecycle() + + Scaffold( + topBar = { + TopAppBar(title = { Text("Incido") }) + }, + floatingActionButton = { + FloatingActionButton(onClick = { onOpenEditor(null) }) { + Icon(Icons.Default.Add, contentDescription = "New note") + } + }, + ) { padding -> + when { + state.isLoading -> Unit // briefly blank on first composition + state.isEmpty -> EmptyState(padding) + else -> NoteList( + notes = state.notes, + contentPadding = padding, + onClick = { onOpenEditor(it.id) }, + onDelete = viewModel::delete, + ) + } + } +} + +@Composable +private fun EmptyState(padding: PaddingValues) { + Box( + modifier = Modifier + .fillMaxSize() + .padding(padding) + .padding(24.dp), + contentAlignment = Alignment.Center, + ) { + Text( + text = "No notes yet. Tap + to start.", + style = MaterialTheme.typography.bodyLarge, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } +} + +@Composable +private fun NoteList( + notes: List, + contentPadding: PaddingValues, + onClick: (Note) -> Unit, + onDelete: (Long) -> Unit, +) { + LazyColumn( + modifier = Modifier.fillMaxSize(), + contentPadding = PaddingValues( + top = contentPadding.calculateTopPadding() + 8.dp, + bottom = contentPadding.calculateBottomPadding() + 88.dp, // FAB clearance + start = 16.dp, + end = 16.dp, + ), + verticalArrangement = Arrangement.spacedBy(12.dp), + ) { + items(items = notes, key = { it.id }) { note -> + NoteCard( + note = note, + onClick = { onClick(note) }, + onDelete = { onDelete(note.id) }, + ) + } + } +} + +@Composable +private fun NoteCard( + note: Note, + onClick: () -> Unit, + onDelete: () -> Unit, +) { + val (title, body) = Note.titleAndBody(note.content) + val bodyPreview = Note.bodyPreview(body) + + Card( + onClick = onClick, + modifier = Modifier.fillMaxWidth(), + ) { + Column( + modifier = Modifier.padding(16.dp), + ) { + Text( + text = title, + style = MaterialTheme.typography.titleMedium, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + ) + if (bodyPreview.isNotEmpty()) { + Spacer(modifier = Modifier.padding(top = 4.dp)) + Text( + text = bodyPreview, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant, + maxLines = 2, + overflow = TextOverflow.Ellipsis, + ) + } + Spacer(modifier = Modifier.padding(top = 8.dp)) + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween, + ) { + Text( + text = rememberRelativeTimestamp(note.updatedAt), + style = MaterialTheme.typography.labelSmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + IconButton(onClick = onDelete) { + Icon( + Icons.Default.Delete, + contentDescription = "Delete note", + tint = MaterialTheme.colorScheme.onSurfaceVariant, + ) + } + } + } + } +} diff --git a/composeApp/src/main/kotlin/org/incido/compose/ui/notelist/NoteListViewModel.kt b/composeApp/src/main/kotlin/org/incido/compose/ui/notelist/NoteListViewModel.kt new file mode 100644 index 0000000..eb62ff8 --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/ui/notelist/NoteListViewModel.kt @@ -0,0 +1,55 @@ +package org.incido.compose.ui.notelist + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory +import kotlinx.coroutines.flow.SharingStarted +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.stateIn +import kotlinx.coroutines.launch +import org.incido.compose.IncidoApplication +import org.incido.domain.model.Note +import org.incido.domain.repository.NoteRepository + +/** + * Immutable UI state for [NoteListScreen]. A loading flag plus the + * current snapshot of notes; an empty list with [isLoading] == false + * indicates the empty-state UI should be shown (F6). + */ +data class NoteListUiState( + val notes: List = emptyList(), + val isLoading: Boolean = true, +) { + val isEmpty: Boolean get() = !isLoading && notes.isEmpty() +} + +class NoteListViewModel( + private val repository: NoteRepository, +) : ViewModel() { + + val uiState: StateFlow = + repository.observeAll() + .map { NoteListUiState(notes = it, isLoading = false) } + .stateIn( + scope = viewModelScope, + started = SharingStarted.WhileSubscribed(5_000), + initialValue = NoteListUiState(), + ) + + fun delete(id: Long) { + viewModelScope.launch { repository.delete(id) } + } + + companion object { + val Factory: ViewModelProvider.Factory = viewModelFactory { + initializer { + val app = this[APPLICATION_KEY] as IncidoApplication + NoteListViewModel(app.container.noteRepository) + } + } + } +} diff --git a/composeApp/src/main/kotlin/org/incido/compose/ui/theme/Color.kt b/composeApp/src/main/kotlin/org/incido/compose/ui/theme/Color.kt new file mode 100644 index 0000000..0a761bf --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/ui/theme/Color.kt @@ -0,0 +1,15 @@ +package org.incido.compose.ui.theme + +import androidx.compose.ui.graphics.Color + +// Brand-neutral palette in v0.1 (per Development Plan §5.3). All colors +// here are fallbacks for devices that don't support Material You dynamic +// color (i.e. Android < 12 or pre-Tiramisu). + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650A4) +val PurpleGrey40 = Color(0xFF625B71) +val Pink40 = Color(0xFF7D5260) diff --git a/composeApp/src/main/kotlin/org/incido/compose/ui/theme/Theme.kt b/composeApp/src/main/kotlin/org/incido/compose/ui/theme/Theme.kt new file mode 100644 index 0000000..635ed61 --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/ui/theme/Theme.kt @@ -0,0 +1,51 @@ +package org.incido.compose.ui.theme + +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80, +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40, +) + +/** + * Root theme. Uses Material You dynamic color on Android 12+, falls back + * to a brand-neutral palette elsewhere. Dark mode follows the system + * setting (N5). + */ +@Composable +fun IncidoTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + dynamicColor: Boolean = true, + content: @Composable () -> Unit, +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) + else dynamicLightColorScheme(context) + } + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + MaterialTheme( + colorScheme = colorScheme, + typography = IncidoTypography, + content = content, + ) +} diff --git a/composeApp/src/main/kotlin/org/incido/compose/ui/theme/Type.kt b/composeApp/src/main/kotlin/org/incido/compose/ui/theme/Type.kt new file mode 100644 index 0000000..91682a0 --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/ui/theme/Type.kt @@ -0,0 +1,33 @@ +package org.incido.compose.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Default Material 3 typography. Custom fonts can be added in a future +// version when brand decisions are made. +val IncidoTypography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp, + ), + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp, + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp, + ), +) diff --git a/composeApp/src/main/kotlin/org/incido/compose/util/RelativeTime.kt b/composeApp/src/main/kotlin/org/incido/compose/util/RelativeTime.kt new file mode 100644 index 0000000..56398bd --- /dev/null +++ b/composeApp/src/main/kotlin/org/incido/compose/util/RelativeTime.kt @@ -0,0 +1,22 @@ +package org.incido.compose.util + +import android.text.format.DateUtils +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember + +/** + * Returns a localised "X ago" style timestamp for the given epoch millis. + * Uses Android's [DateUtils.getRelativeTimeSpanString] which handles all + * the edge cases (Today / Yesterday / N days ago / N weeks ago / …) and + * is automatically localised to the device language. + */ +@Composable +fun rememberRelativeTimestamp(epochMillis: Long): String { + val now = remember { System.currentTimeMillis() } + return DateUtils.getRelativeTimeSpanString( + epochMillis, + now, + DateUtils.MINUTE_IN_MILLIS, + DateUtils.FORMAT_ABBREV_RELATIVE, + ).toString() +} diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts new file mode 100644 index 0000000..f7bbec7 --- /dev/null +++ b/core/data/build.gradle.kts @@ -0,0 +1,58 @@ +// core/data — ObjectBox-backed implementation of the domain repository. +// The ObjectBox Gradle plugin isn't published with a plugin marker, so we +// wire it through a buildscript classpath here. + +buildscript { + repositories { + google() + mavenCentral() + } + dependencies { + // ObjectBox plugin classpath. Version is pinned via libs.versions.toml + // through a generated accessor; here we hard-code for clarity. + classpath("io.objectbox:objectbox-gradle-plugin:${libs.versions.objectbox.get()}") + } +} + +plugins { + alias(libs.plugins.androidLibrary) + alias(libs.plugins.kotlinAndroid) +} + +// Apply the ObjectBox plugin AFTER the classpath is on the buildscript. +apply(plugin = "io.objectbox") + +android { + namespace = "org.incido.data" + compileSdk = 35 + + defaultConfig { + minSdk = 26 + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlin { + jvmToolchain(17) + } + + sourceSets { + getByName("main") { + // ObjectBox generates a MyObjectBox class at build time; expose + // the generated sources directory. + kotlin.srcDirs("build/generated/source/objectbox") + } + } +} + +dependencies { + implementation(project(":core:domain")) + implementation(libs.kotlinx.coroutines.core) + + // ObjectBox runtime + implementation(libs.objectbox.android) + implementation(libs.objectbox.kotlin) +} diff --git a/core/data/src/main/AndroidManifest.xml b/core/data/src/main/AndroidManifest.xml new file mode 100644 index 0000000..b2d3ea1 --- /dev/null +++ b/core/data/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/core/data/src/main/kotlin/org/incido/data/ObjectBoxStore.kt b/core/data/src/main/kotlin/org/incido/data/ObjectBoxStore.kt new file mode 100644 index 0000000..37b7ebc --- /dev/null +++ b/core/data/src/main/kotlin/org/incido/data/ObjectBoxStore.kt @@ -0,0 +1,25 @@ +package org.incido.data + +import android.content.Context +import io.objectbox.BoxStore +import org.incido.data.entity.MyObjectBox + +/** + * Singleton holder for the process-wide [BoxStore]. Initialised once from + * the Application/Activity context. + */ +object ObjectBoxStore { + @Volatile + private var instance: BoxStore? = null + + fun init(context: Context): BoxStore = + instance ?: synchronized(this) { + instance ?: MyObjectBox.builder() + .androidContext(context.applicationContext) + .build() + .also { instance = it } + } + + fun get(): BoxStore = + instance ?: error("ObjectBoxStore not initialised — call init(context) first") +} diff --git a/core/data/src/main/kotlin/org/incido/data/entity/NoteEntity.kt b/core/data/src/main/kotlin/org/incido/data/entity/NoteEntity.kt new file mode 100644 index 0000000..d677825 --- /dev/null +++ b/core/data/src/main/kotlin/org/incido/data/entity/NoteEntity.kt @@ -0,0 +1,32 @@ +package org.incido.data.entity + +import io.objectbox.annotation.Entity +import io.objectbox.annotation.Id +import io.objectbox.annotation.Index +import org.incido.domain.model.Note + +/** + * ObjectBox entity. The plugin generates a corresponding property mirror + * class (`NoteEntity_`) at build time, plus the [MyObjectBox] container. + */ +@Entity +data class NoteEntity( + @Id var id: Long = 0, + var content: String = "", + @Index var createdAt: Long = 0, + var updatedAt: Long = 0, +) + +internal fun NoteEntity.toDomain(): Note = Note( + id = id, + content = content, + createdAt = createdAt, + updatedAt = updatedAt, +) + +internal fun Note.toEntity(): NoteEntity = NoteEntity( + id = id, + content = content, + createdAt = createdAt, + updatedAt = updatedAt, +) diff --git a/core/data/src/main/kotlin/org/incido/data/repository/NoteRepositoryImpl.kt b/core/data/src/main/kotlin/org/incido/data/repository/NoteRepositoryImpl.kt new file mode 100644 index 0000000..1df819d --- /dev/null +++ b/core/data/src/main/kotlin/org/incido/data/repository/NoteRepositoryImpl.kt @@ -0,0 +1,72 @@ +package org.incido.data.repository + +import io.objectbox.BoxStore +import io.objectbox.kotlin.boxFor +import io.objectbox.reactive.DataSubscription +import kotlinx.coroutines.channels.awaitClose +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.callbackFlow +import kotlinx.coroutines.flow.flowOn +import kotlinx.coroutines.Dispatchers +import org.incido.data.entity.NoteEntity +import org.incido.data.entity.toDomain +import org.incido.data.entity.toEntity +import org.incido.domain.model.Note +import org.incido.domain.repository.NoteRepository + +/** + * ObjectBox-backed implementation of [NoteRepository]. All writes are + * dispatched to `Default`; reads use ObjectBox's reactive subscription so + * the UI auto-refreshes whenever a row changes (F7). + */ +class NoteRepositoryImpl( + private val boxStore: BoxStore, +) : NoteRepository { + + private val box = boxStore.boxFor() + + override fun observeAll(): Flow> = callbackFlow { + // Emit the current snapshot first so the UI renders without waiting + // for the first change. + trySend(currentSnapshot()) + + val subscription: DataSubscription = box + .query() + .build() + .subscribe() + .observer { trySend(currentSnapshot()) } + + awaitClose { subscription.cancel() } + }.flowOn(Dispatchers.Default) + + override fun observeById(id: Long): Flow = callbackFlow { + trySend(box.get(id)?.toDomain()) + + val subscription = box + .query() + .build() + .subscribe() + .observer { trySend(box.get(id)?.toDomain()) } + + awaitClose { subscription.cancel() } + }.flowOn(Dispatchers.Default) + + override suspend fun upsert(note: Note): Note { + val now = System.currentTimeMillis() + val toPersist = if (note.id == 0L) { + note.copy(createdAt = now, updatedAt = now).toEntity() + } else { + note.copy(updatedAt = now).toEntity() + } + val assignedId = box.put(toPersist) + val existing = box.get(assignedId) + return existing?.toDomain() ?: note.copy(id = assignedId) + } + + override suspend fun delete(id: Long) { + box.remove(id) + } + + private fun currentSnapshot(): List = + box.all.sortedByDescending { it.updatedAt }.map { it.toDomain() } +} diff --git a/core/domain/build.gradle.kts b/core/domain/build.gradle.kts new file mode 100644 index 0000000..c09a8ef --- /dev/null +++ b/core/domain/build.gradle.kts @@ -0,0 +1,19 @@ +// core/domain — pure-Kotlin domain module (no Android dependencies). +// Contains business types and repository interfaces only. +// Implementation lives in :core:data. +plugins { + alias(libs.plugins.kotlinJvm) +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +kotlin { + jvmToolchain(17) +} + +dependencies { + implementation(libs.kotlinx.coroutines.core) +} diff --git a/core/domain/src/main/kotlin/org/incido/domain/model/Note.kt b/core/domain/src/main/kotlin/org/incido/domain/model/Note.kt new file mode 100644 index 0000000..bb431bc --- /dev/null +++ b/core/domain/src/main/kotlin/org/incido/domain/model/Note.kt @@ -0,0 +1,64 @@ +package org.incido.domain.model + +/** + * Domain representation of a note. This is the only [Note] type the UI layer + * should depend on. The ObjectBox-backed implementation in `:core:data` maps + * to/from its own entity type. + */ +data class Note( + val id: Long = 0L, + val content: String, + val createdAt: Long, + val updatedAt: Long, +) { + companion object { + private const val UNTITLED = "Untitled" + + /** + * Splits [content] into a (title, body) pair. The title is the first + * non-empty line (trimmed); the body is everything after the first + * newline, with leading blank lines stripped. + * + * If the content is empty or has no non-empty line, the title is + * `"Untitled"` and the body is empty. + */ + fun titleAndBody(content: String): Pair { + val lines = content.split('\n') + val title = lines.firstOrNull { it.isNotBlank() }?.trim() ?: UNTITLED + val firstTitleIdx = lines.indexOfFirst { it.isNotBlank() } + val bodyLines = if (firstTitleIdx >= 0) lines.drop(firstTitleIdx + 1) else emptyList() + // Strip leading blank lines from the body. + val bodyStart = bodyLines.indexOfFirst { it.isNotBlank() } + val body = if (bodyStart >= 0) { + bodyLines.drop(bodyStart).joinToString("\n").trimEnd() + } else { + "" + } + return title to body + } + + /** + * Returns a single-line preview of [content] for places that don't + * care about title vs. body (e.g. share previews, toasts). + * + * For the list-card title+body split, prefer [titleAndBody]. + */ + fun preview(content: String, maxChars: Int = 240): String { + val collapsed = content.replace('\n', ' ').trim() + if (collapsed.length <= maxChars) return collapsed + return collapsed.take(maxChars).trimEnd() + "…" + } + + /** + * Returns a multi-line preview of [body] for list-card body display. + * Whitespace runs are collapsed to single spaces, then truncated to + * [maxChars]. An ellipsis is appended when truncated. + */ + fun bodyPreview(body: String, maxChars: Int = 160): String { + if (body.isBlank()) return "" + val collapsed = body.replace(Regex("\\s+"), " ").trim() + if (collapsed.length <= maxChars) return collapsed + return collapsed.take(maxChars).trimEnd() + "…" + } + } +} diff --git a/core/domain/src/main/kotlin/org/incido/domain/repository/NoteRepository.kt b/core/domain/src/main/kotlin/org/incido/domain/repository/NoteRepository.kt new file mode 100644 index 0000000..3b5161f --- /dev/null +++ b/core/domain/src/main/kotlin/org/incido/domain/repository/NoteRepository.kt @@ -0,0 +1,28 @@ +package org.incido.domain.repository + +import kotlinx.coroutines.flow.Flow +import org.incido.domain.model.Note + +/** + * Persistence boundary for [Note]s. The UI layer depends on this interface + * only — never on the ObjectBox-backed implementation in `:core:data`. + * + * Implementations are expected to: + * - Return a [Flow] that emits whenever the underlying data changes, + * so the list screen satisfies F7 (auto-refresh). + * - Assign a fresh id (0 or 0L on construction) for new notes and use the + * ObjectBox-managed id once persisted. + */ +interface NoteRepository { + /** Stream of all notes, newest-first. */ + fun observeAll(): Flow> + + /** Stream of a single note by id, or `null` if it has been deleted. */ + fun observeById(id: Long): Flow + + /** Persist a new note or update an existing one. Returns the persisted [Note]. */ + suspend fun upsert(note: Note): Note + + /** Delete a note by id. No-op if it doesn't exist. */ + suspend fun delete(id: Long) +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..c6158be --- /dev/null +++ b/gradle.properties @@ -0,0 +1,18 @@ +# Gradle / Kotlin settings +org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8 -XX:+UseParallelGC +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.configureondemand=false + +# AndroidX +android.useAndroidX=true +android.nonTransitiveRClass=true +android.nonFinalResIds=true + +# Kotlin +kotlin.code.style=official +kotlin.incremental=true + +# KMP +kotlin.mpp.stability.nowarn=true +kotlin.mpp.applyDefaultHierarchyTemplate=false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..205b8b5 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,63 @@ +[versions] +# Tooling +agp = "8.7.2" +kotlin = "2.0.21" +ksp = "2.0.21-1.0.28" + +# Build +gradleWrapper = "8.10.2" + +# Compose Multiplatform +composeMultiplatform = "1.7.3" + +# AndroidX +androidxActivityCompose = "1.9.3" +androidxLifecycle = "2.8.7" +androidxNavigationCompose = "2.8.4" +composeBom = "2024.10.01" + +# Kotlin / Coroutines +coroutines = "1.9.0" + +# Data +objectbox = "4.0.3" + +[libraries] +# Compose Multiplatform +compose-multiplatform = { module = "org.jetbrains.compose:compose-bom", version.ref = "composeMultiplatform" } +compose-ui = { module = "org.jetbrains.compose.ui:ui", version.ref = "composeMultiplatform" } +compose-ui-tooling = { module = "org.jetbrains.compose.ui:ui-tooling", version.ref = "composeMultiplatform" } +compose-ui-tooling-preview = { module = "org.jetbrains.compose.ui:ui-tooling-preview", version.ref = "composeMultiplatform" } +compose-foundation = { module = "org.jetbrains.compose.foundation:foundation", version.ref = "composeMultiplatform" } +compose-material3 = { module = "org.jetbrains.compose.material3:material3", version.ref = "composeMultiplatform" } +compose-material-icons-extended = { module = "org.jetbrains.compose.material:material-icons-extended", version.ref = "composeMultiplatform" } + +# AndroidX Compose BOM +composeBom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" } + +# AndroidX +androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidxActivityCompose" } +androidx-lifecycle-viewmodel = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel", version = "2.8.4" } +androidx-lifecycle-viewmodel-compose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version = "2.8.4" } +androidx-lifecycle-runtime = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime", version = "2.8.4" } +androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidxNavigationCompose" } +androidx-core-ktx = { module = "androidx.core:core-ktx", version = "1.13.1" } + +# Coroutines +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" } + +# Data +objectbox-android = { module = "io.objectbox:objectbox-android", version.ref = "objectbox" } +objectbox-kotlin = { module = "io.objectbox:objectbox-kotlin", version.ref = "objectbox" } + +[plugins] +androidApplication = { id = "com.android.application", version.ref = "agp" } +androidLibrary = { id = "com.android.library", version.ref = "agp" } +kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlinCompose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +objectbox = { id = "io.objectbox", version.ref = "objectbox" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..a4b76b9 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..94913af --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +networkTimeout=120000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..2678577 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,28 @@ +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "incido" + +include(":app") +include(":composeApp") +include(":core:domain") +include(":core:data")