Repository navigation
Conversation
UpdateEntryThenCloseTask finds the entry by a key field of the caller's choice holding a value the caller generated, typically a random string, so the user may change the title, URL or anything else. The entry opens in the editor with the new field values filled in and the changed fields named. Nothing is written until the user saves. A field passed as JSON null is removed. If no entry has the key, the user is told, or, with UpdateEntry_CreateIfMissing, the entry is created with the fields and the key field as with CreateEntryThenCloseTask. Kp2aControl.getUpdateEntryIntent builds the intent.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
A plugin or another app can already create an entry (
CreateEntryThenCloseTask,Kp2aControl.getAddEntryIntent) and open or query one, but it cannot change an entry it created before. An app that keeps its credentials in KP2A therefore has two options when a secret changes: create a second entry next to the old one, or ask the user to find the entry and retype the new value. Both are error prone for values such as API tokens, which are long and get rotated.This adds
UpdateEntryThenCloseTask:MyApp id) holding a value the app generated when it created the entry, typically a random string. The match is exact, outside the recycle bin, in any open database. Title, URL and the other fields are not used for the lookup, so the user may freely rename or move the entry, and several entries may share a URL.nullis removed (a standard field is emptied instead).UpdateEntry_CreateIfMissingset totrue, the entry is created as withCreateEntryThenCloseTask, including the key field, so one call covers both the first run and later updates.Kp2aControl.getUpdateEntryIntentbuilds the intent. Two virtual hooks are added toAppTask(PrepareEditEntry,AfterUpdateEntry), with empty defaults, so other tasks are not affected.EntryEditActivitycalls them for existing entries only.Usage example
An app that talks to a server stores the server address and an API token in one entry. On the first run it generates a random id and keeps it in its own preferences. When the token is rotated, or on the first run when there is no entry yet:
KP2A opens the entry (after unlocking the database if needed), shows "Fields changed by the request (saved only when you save): API token, Old endpoint", and the user taps Save. The existing entry keeps its group, history, attachments and all other fields. On the first run the new entry gets the field
MyApp idwith the generated value.🔗 Related Issue
None found.
🛠️ Type of Change
✅ Checklist