diff --git a/AGENTS.md b/AGENTS.md index 1331c54..e5612ae 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,6 +29,7 @@ When you (or another AI agent) are asked to implement a change, prefer working t Every change — no matter how small — must follow this exact sequence: +0. **Pull the latest `master`** (`git checkout master && git pull`) before creating any branch — this ensures the version bump targets the correct base and avoids version conflicts in CI. 1. **Create a new branch** off `master` (never commit directly to `master`) 2. **Make your changes** and commit them to the branch 3. **Bump the version** (`npm run bump:patch/minor/major`) and commit the version files diff --git a/android/app/build.gradle b/android/app/build.gradle index fb76bda..afd37fd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -92,8 +92,8 @@ android { applicationId 'com.pgarr.simplenotepad' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 22 - versionName "1.5.0" + versionCode 23 + versionName "1.6.0" buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\"" } diff --git a/android/app/src/main/java/com/pgarr/simplenotepad/widget/NoteListRemoteViewsFactory.kt b/android/app/src/main/java/com/pgarr/simplenotepad/widget/NoteListRemoteViewsFactory.kt index a474989..208cd8f 100644 --- a/android/app/src/main/java/com/pgarr/simplenotepad/widget/NoteListRemoteViewsFactory.kt +++ b/android/app/src/main/java/com/pgarr/simplenotepad/widget/NoteListRemoteViewsFactory.kt @@ -28,7 +28,7 @@ class NoteListRemoteViewsFactory( boundListId = -1 return } - items = list.items + items = list.items.filter { !it.checked } listTitle = list.title boundListId = list.id } @@ -62,7 +62,7 @@ class NoteListRemoteViewsFactory( // Fill-in intent carries position and listId to the broadcast receiver val fillIntent = Intent().apply { - putExtra("item_index", position) + putExtra("item_index", item.originalIndex) putExtra("list_id", boundListId) } rv.setOnClickFillInIntent(R.id.item_checkbox, fillIntent) diff --git a/android/app/src/main/java/com/pgarr/simplenotepad/widget/WidgetDbHelper.kt b/android/app/src/main/java/com/pgarr/simplenotepad/widget/WidgetDbHelper.kt index 402d1eb..fc45070 100644 --- a/android/app/src/main/java/com/pgarr/simplenotepad/widget/WidgetDbHelper.kt +++ b/android/app/src/main/java/com/pgarr/simplenotepad/widget/WidgetDbHelper.kt @@ -6,7 +6,7 @@ import org.json.JSONArray import java.io.File // Mirrors your expo-sqlite DB schema exactly -data class WidgetListItem(val text: String, val checked: Boolean) +data class WidgetListItem(val text: String, val checked: Boolean, val originalIndex: Int = 0) data class WidgetList(val id: Int, val title: String, val items: List) object WidgetDbHelper { @@ -161,7 +161,7 @@ object WidgetDbHelper { val obj = arr.optJSONObject(i) ?: return@mapNotNull null val text = obj.optString("text", "") val checked = obj.optBoolean("checked", false) - WidgetListItem(text = text, checked = checked) + WidgetListItem(text = text, checked = checked, originalIndex = i) } } catch (_: Exception) { emptyList() diff --git a/app.json b/app.json index aeaea35..2f7ad43 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,7 @@ "expo": { "name": "simple-notepad", "slug": "simple-notepad", - "version": "1.5.0", + "version": "1.6.0", "orientation": "portrait", "icon": "./assets/images/icon.png", "scheme": "simple-notepad", @@ -24,7 +24,7 @@ "backgroundColor": "#ffffff" }, "package": "com.pgarr.simplenotepad", - "versionCode": 22 + "versionCode": 23 }, "web": { "bundler": "metro", @@ -43,7 +43,7 @@ "projectId": "9e3820b7-558b-4bd2-a1b2-e49561e741e6" } }, - "runtimeVersion": "1.5.0", + "runtimeVersion": "1.6.0", "updates": { "url": "https://u.expo.dev/9e3820b7-558b-4bd2-a1b2-e49561e741e6" } diff --git a/components/ListForm.tsx b/components/ListForm.tsx index 052d8db..af57236 100644 --- a/components/ListForm.tsx +++ b/components/ListForm.tsx @@ -1,8 +1,10 @@ import { Button } from '@/components/ui/button'; +import { Icon } from '@/components/ui/icon'; import { Input } from '@/components/ui/input'; import { Text } from '@/components/ui/text'; import { useKeyboardOffset } from '@/hooks/useKeyboardOffset'; import { ListItem } from '@/lib/dataStorage'; +import { Trash2Icon } from 'lucide-react-native'; import { useCallback, useState } from 'react'; import { KeyboardAvoidingView, Platform, ScrollView, View } from 'react-native'; @@ -35,6 +37,10 @@ export function ListForm({ ); }, []); + const handleDeleteRow = useCallback((index: number) => { + setItems((current) => current.filter((_, i) => i !== index)); + }, []); + const handleSave = useCallback(async () => { const trimmedTitle = title.trim(); if (!trimmedTitle) return; @@ -70,14 +76,23 @@ export function ListForm({ showsVerticalScrollIndicator={false}> {items.map((item, index) => ( - handleUpdateRow(index, text)} - editable={!saving} - /> + + handleUpdateRow(index, text)} + editable={!saving} + /> + + ))}