Skip to content

Edits to activity in send intent action are not saved - #2221

Merged
sds100 merged 3 commits into
developfrom
claude/issue-2160-send-intent-activity-edit
Sep 7, 2026
Merged

Edits to activity in send intent action are not saved#2221
sds100 merged 3 commits into
developfrom
claude/issue-2160-send-intent-activity-edit

Conversation

@keymapper-ai

Copy link
Copy Markdown
Collaborator

Closes #2160

Summary

When editing a send intent action and changing the chosen activity, the change could be silently discarded, leaving the original activity in place after saving.

ConfigIntentFragment applies its argument by calling ConfigIntentViewModel.loadResult from onCreate. onCreate runs again whenever the screen is recreated (for example on a configuration change such as rotation, entering multi-window, or a fold) while the ViewModel survives. On that second run, loadResult re-applied the original argument and overwrote whatever the user had edited in the meantime — so a newly picked activity reverted to its original value.

The fix makes loadResult idempotent: the initial argument is applied only once, so a recreation no longer clobbers the in-progress edits held by the surviving ViewModel.

Changes

  • ConfigIntentViewModel.loadResult now applies the initial ConfigIntentResult argument only the first time it is called (guarded by an isResultLoaded flag).
  • Added ConfigIntentViewModelRecreationTest, a regression test that loads an intent, changes the activity, simulates a recreation (a second loadResult with the original argument), and asserts the edited activity is preserved in both the view-model state and the produced intent URI.
  • Added a CHANGELOG.md entry under Fixed.

How it was verified

The regression test fails against the previous behaviour (activity resets to the original) and passes with the fix. Existing ConfigIntentViewModelTest cases and ktlint continue to pass.

Notes / areas for human review

  • The guard lives in the ViewModel, which survives configuration changes but not full process death. On process death the ViewModel is recreated from scratch, isResultLoaded resets to false, and the original argument is reloaded — the same behaviour as before this change (in-progress, unsaved edits are not persisted across process death; that would require a SavedStateHandle and is out of scope here).
  • loadResult has a single caller (ConfigIntentFragment.onCreate), so making it load-once does not affect any other flow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FLMhZgAZLKvtgPGKXC9oKq


Generated by Claude Code

ConfigIntentFragment applies its argument by calling
ConfigIntentViewModel.loadResult from onCreate, which runs again when the
screen is recreated (for example on a configuration change) while the
ViewModel survives. Re-applying the original argument discarded any edits
the user had made, such as changing the chosen activity, so the activity
appeared to revert to its original value.

Apply the initial argument only once so a recreation no longer overwrites
the in-progress edits.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FLMhZgAZLKvtgPGKXC9oKq
@keymapper-ai
keymapper-ai requested a review from sds100 September 3, 2026 00:42
@sds100
sds100 merged commit 9d5fc33 into develop Sep 7, 2026
4 checks passed
@sds100
sds100 deleted the claude/issue-2160-send-intent-activity-edit branch September 7, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edits to activity in send intent action are not saved

3 participants