Skip to content

import export function for discovered contacts#373

Closed
ericszimmermann wants to merge 2 commits into
zjs81:devfrom
ericszimmermann:ez_import_export_4
Closed

import export function for discovered contacts#373
ericszimmermann wants to merge 2 commits into
zjs81:devfrom
ericszimmermann:ez_import_export_4

Conversation

@ericszimmermann
Copy link
Copy Markdown
Contributor

Made the changes for importing and exporting Discovered contacts as JSON files.

This is according to Issue #352 (and based on now obsolete #298).

I also cleaned up the code a bit, and this is the isolated import/export functionality.

There was just on thing. there was a contactfield "wasPulled" which seemed to should have the same functionality as the existing "isActive" flag, but was not used anywhere, therefore I removed it. (I hope thats ok.)

Tested it on Android, needs Testing on other Platforms.

Best Regards Eric

Copy link
Copy Markdown
Collaborator

@446564 446564 left a comment

Choose a reason for hiding this comment

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

I will test today on a few devices

Comment thread lib/connector/meshcore_connector.dart Outdated
return List.unmodifiable(_discoveredContacts);
}

String exportDiscoveredContactsJson() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think discovered contacts are part of the connector as they are persisted in app only

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would opt for a discovered contacts service or just part of the discovered contacts storage

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted to write as less change as possible and the there was already the connection for "import" newly discovered messages from companion into the store.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

these are not on the companion however, but in the app. so I think the discovered contacts storage is a better location.

@446564
Copy link
Copy Markdown
Collaborator

446564 commented Apr 21, 2026

after the changes feel free to amend your previous commit and force push

@446564 446564 self-assigned this Apr 21, 2026
@446564 446564 added the In Progress The issue or PR is being investigated or implemented. label Apr 21, 2026
@446564
Copy link
Copy Markdown
Collaborator

446564 commented Apr 21, 2026

seems to be working well on linux and android, the only issue which is possibly unrelated is that on android you can't save the file. only share to apps.

@ericszimmermann
Copy link
Copy Markdown
Contributor Author

seems to be working well on linux and android, the only issue which is possibly unrelated is that on android you can't save the file. only share to apps.

Yes you would have to share to a file manager. I tried to make it to save as file on android, but I always ended up with only storing it in the not accessible app storage, where it also will be deleted on app uninstall.
Im a C Firmware programmer and am not that familiar with dart and android. If you have a better way to save a file, please let me know.

@446564
Copy link
Copy Markdown
Collaborator

446564 commented Apr 21, 2026

seems to be working well on linux and android, the only issue which is possibly unrelated is that on android you can't save the file. only share to apps.

Yes you would have to share to a file manager. I tried to make it to save as file on android, but I always ended up with only storing it in the not accessible app storage, where it also will be deleted on app uninstall. Im a C Firmware programmer and am not that familiar with dart and android. If you have a better way to save a file, please let me know.

I think this is the same behavior with contacts export so we can always add other options later for both.

@446564
Copy link
Copy Markdown
Collaborator

446564 commented Apr 21, 2026

sorry what I meant was, instead of adding the import and export for discovered contacts into the meshcore_connector, that it should just have been added to the existing contact_discovery_store.

@ericszimmermann
Copy link
Copy Markdown
Contributor Author

ericszimmermann commented Apr 22, 2026

sorry what I meant was, instead of adding the import and export for discovered contacts into the meshcore_connector, that it should just have been added to the existing contact_discovery_store.

I don't know how to make this going to work, because I need the instantiated object, which is only available in the connector.
I have tried to keep the import/export functions small and to transfer all functions into the contact_discovery_store in the first commit, but I need the reference to the instantiated _discoveredContacts store. (For import _knownContactKeys is also directly available in connector, as are the Listeners.)

We have now two implementation my first commit, which has the least impact and the one where it is as its own service.
I still prefer the first variant.

Sincerely Eric

@446564 446564 requested a review from zjs81 April 22, 2026 15:12
@446564 446564 added the Feedback Requested Issues or pull requests needed feedback label Apr 22, 2026
@ericszimmermann
Copy link
Copy Markdown
Contributor Author

Should I make a new Pull-Request with a Cherry-Pick of the first commit onto the current dev branch?

@446564
Copy link
Copy Markdown
Collaborator

446564 commented May 5, 2026

Should I make a new Pull-Request with a Cherry-Pick of the first commit onto the current dev branch?

whatever is easier for you is fine.

@ericszimmermann
Copy link
Copy Markdown
Contributor Author

See PR #436 for cherrypick of first variant.

@ericszimmermann ericszimmermann deleted the ez_import_export_4 branch May 12, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feedback Requested Issues or pull requests needed feedback In Progress The issue or PR is being investigated or implemented.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants