Skip to content

Conversation

@ben-kaufman
Copy link
Contributor

@ben-kaufman ben-kaufman commented Nov 13, 2025

This PR integrates pre-activity metadata from Bitkit Core.

Fixes #197

The pre-activity metadata is created before the send/ receive activities are created, and allow Bitkit Core to automatically add tags to an activity once created (for sent txs, the previous logic to apply tags was removed). Also for sent txs, it let's Bitkit Core auto fill the address for the activity, and for receive txs it helps in a more efficient lookup for the address the activity belongs to.

This PR also extracts certain UI components related to tags and reuses them across the app.
It also fixes the VSS backup to correctly backup and restore activities tags and pre-activity metadata.

Screen.Recording.2025-11-13.at.7.31.57.AM.mov

@jvsena42 jvsena42 requested a review from Copilot November 13, 2025 13:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates pre-activity metadata from Bitkit Core to automatically assign tags and addresses to activities. The implementation replaces manual tag application after sends with a pre-activity metadata system that creates metadata before activities are generated, enabling automatic tag assignment by Bitkit Core. The PR also refactors tag-related UI components into reusable views and fixes VSS backup to correctly handle activity tags and pre-activity metadata.

Key changes:

  • Refactored tag-related UI into reusable components (TagsListView, TagSelectionView, TagInputForm, PreviouslyUsedTagsView)
  • Implemented pre-activity metadata creation for send and receive flows
  • Added efficient address lookup for received transactions using pre-activity metadata
  • Updated VSS backup to properly backup/restore both activity tags and pre-activity metadata

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
AddTagSheet.swift Refactored to use new reusable tag components
SendTagScreen.swift Simplified by using shared tag input components
SendConfirmationView.swift Creates pre-activity metadata instead of applying tags post-send
ReceiveTag.swift Stores tags in pre-activity metadata for future activity creation
ReceiveSheet.swift Initializes tag manager and creates pre-activity metadata on appear
ReceiveEdit.swift Uses TagSelectionView component and manages pre-activity metadata tags
ActivityItemView.swift Refactored to use TagsListView component
TagSettingsView.swift Simplified using TagsListView component
TagsListView.swift New reusable component for displaying tag lists
TagSelectionView.swift Refactored to accept callbacks instead of navigation binding
TagInputForm.swift New reusable component for tag text input
PreviouslyUsedTagsView.swift New component for displaying previously used tags
WalletViewModel.swift Added methods to retrieve payment IDs and persist pre-activity metadata
ActivityListViewModel.swift Removed obsolete findActivityAndAddTags method
CoreService.swift Added pre-activity metadata methods and improved address finding for received transactions
BackupService.swift Fixed to backup/restore activity tags and pre-activity metadata correctly
BackupPayloads.swift Updated backup structures to use PreActivityMetadata and ActivityTags
Package.resolved Updated bitkit-core dependency revision

@ben-kaufman ben-kaufman self-assigned this Nov 13, 2025
@jvsena42
Copy link
Member

@ovitrif
Copy link
Collaborator

ovitrif commented Nov 14, 2025

@ben-kaufman Is this ready for review?

I noticed review was requested early but then there was more commits, so now it's not certain 🤷🏻 :)

@jvsena42 jvsena42 requested a review from Copilot November 14, 2025 09:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

@jvsena42
Copy link
Member

Next time it would be good to add suggestions of test flows

@jvsena42
Copy link
Member

Tests:

Lightning

  • Create invoice -> add tags and description -> receive -> check if tags and description were added ❌
lightning_receive_tags.mp4
  • scan invoice -> add tags -> send -> check tags ✅

On-chain

  • Create BIP 21 invoice -> add tags -> receive -> activity details -> check tags ✅

  • Scan BIP 21 invoice -> add tags -> send -> activity details -> check address, fee, federate and tags ✅

Copy link
Member

@jvsena42 jvsena42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found just an issue in the tests

@ovitrif
Copy link
Collaborator

ovitrif commented Nov 14, 2025

Next time it would be good to add suggestions of test flows

Yes please 🙏🏻
Helps reviewers AND testers.

Also for docs' purposes and tests blueprints.

@ben-kaufman
Copy link
Contributor Author

Issue should now be fixed @jvsena42

Testing instructions are as you did + click in savings balance -> transfer to spending -> make sure the resulting activity is shown as transfer.

@jvsena42
Copy link
Member

Waiting E2E tests finish to check again

@jvsena42
Copy link
Member

jvsena42 commented Nov 14, 2025

@ben-kaufman could you confirm if this solves #197 ? If yes, please, add it to the description to the issue get closed automatically

@ben-kaufman
Copy link
Contributor Author

@jvsena42 yes, add to the description.

@ovitrif
Copy link
Collaborator

ovitrif commented Nov 14, 2025

@ben-kaufman could you confirm if this solves #197 ? If yesterday, please, add it to the description to the issue get closed automatically

For How To, see: Using keywords in issues and pull requests

@ben-kaufman ben-kaufman requested a review from jvsena42 November 14, 2025 13:15
@jvsena42
Copy link
Member

@ben-kaufman I guess the test tag TagInputReceive was deleted in the refactor
https://github.com/synonymdev/bitkit-ios/actions/runs/19365035716/job/55406829516?pr=219

@ben-kaufman
Copy link
Contributor Author

Readded the test identifier

@ovitrif
Copy link
Collaborator

ovitrif commented Nov 14, 2025

Issue should now be fixed @jvsena42

Testing instructions are as you did + click in savings balance -> transfer to spending -> make sure the resulting activity is shown as transfer.

You mean on the previous PR that was closed in favour of this?!

@ben-kaufman
Copy link
Contributor Author

You mean on the previous PR that was closed in favour of this?!

Referring to the steps here #219 (comment)

@jvsena42
Copy link
Member

Testing...

Copy link
Member

@jvsena42 jvsena42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lightning

  • Create invoice -> add tags and description -> receive -> check if tags and description were added ✅
  • scan invoice -> add tags -> send -> check tags ✅

On-chain

  • Create BIP 21 invoice -> add tags -> receive -> activity details -> check tags ✅
  • Scan BIP 21 invoice -> add tags -> send -> activity details -> check address, fee, federate and tags ✅
  • Transfer to spending ✅
  • Reset and restore ✅

OBS: On transfer to spending, the pending transfer activities are not being displayed. They are only displayed after confirmed. (can be fixed in #226 )

transfer.mp4

@jvsena42 jvsena42 merged commit 3ed23cc into master Nov 14, 2025
6 checks passed
@jvsena42 jvsena42 deleted the feat/receive-tags branch November 14, 2025 17:31
@jvsena42
Copy link
Member

@ovitrif Merged because this branch was getting too complicated to maintain. If you find some issue, we can fix in other PR

@ovitrif
Copy link
Collaborator

ovitrif commented Nov 14, 2025

@ovitrif Merged because this branch was getting too complicated to maintain. If you find some issue, we can fix in other PR

No worries, I tested myself and was about to approve, I was just writing my PR review comment 🙃

Had no requests for changes in THIS PR, but I randomly found another issue related to receive that needs fixing.

Copy link
Collaborator

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests

  1. Receive Tags: all tests ok 🟢
  2. Transfer: test ok 🟢
  3. Send Tags: all tests ok 🟢

While testing receive tags, In found an issue not added in these changes, but related to the feature.

Receive > Edit > Tap Note textfield > Can't add tags anymore
Really need to show QR code and then edit again.

let version: Int
let createdAt: UInt64
let tagMetadata: [ActivityTagsMetadata]
let tagMetadata: [PreActivityMetadata]
Copy link
Collaborator

@ovitrif ovitrif Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we name it preActivityMetadata? I can do the same in Android ;)

Or even activityMetadata, since we won't likely have a different activity metadata soon 🤷🏻

@ovitrif
Copy link
Collaborator

ovitrif commented Nov 14, 2025

While testing receive tags, In found an issue not added in these changes, but related to the feature.

Receive > Edit > Tap Note textfield > Can't add tags anymore Really need to show QR code and then edit again.

Added issue for it:

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.

Cannot add tag on editing receive invoice

4 participants