Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update+notifications for console wallet #3284

Merged
merged 2 commits into from
Sep 3, 2021

Conversation

Cifko
Copy link
Contributor

@Cifko Cifko commented Sep 2, 2021

Add general notifications support for console wallet.
Add update notification to the wallet.

Description

The wallet now supports notifications. In case of notification the notification tab will change color and show number of notifications so the users knows there is something. Once you sees them the counters goes to zero and the color to white.

Motivation and Context

It's the preparation for the auto update feature. Currently it's just notification for the update availability.

How Has This Been Tested?

The general notifications was tested by adding notification from the base node change.
The auto update was not tested yet.

@Cifko Cifko force-pushed the auto-update-wallet branch 6 times, most recently from c5364b4 to 868c249 Compare September 2, 2021 07:33
@delta1
Copy link
Contributor

delta1 commented Sep 2, 2021

Testing

Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

Looks good (utAck) - few clippys

@Cifko Cifko force-pushed the auto-update-wallet branch 2 times, most recently from 39e6fc0 to 939e15f Compare September 2, 2021 09:17
delta1
delta1 previously approved these changes Sep 2, 2021
Copy link
Contributor

@delta1 delta1 left a comment

Choose a reason for hiding this comment

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

Happy in general, left a few minor comments, I also created some TXT records to test with and saw an available update in the logs, but it did not get written to the notification screen - presumably because I didn't do the whole signature verification part.

2021-09-02 11:00:53.817714000 [p2p::auto_update::dns] [Thread:123145565605888] DEBUG Checking [redacted] for updates...
2021-09-02 11:00:53.817700000 [p2p::auto_update::dns] [Thread:123145565605888] DEBUG Checking [redacted] for updates...
2021-09-02 11:00:53.825693000 [p2p::auto_update::dns] [Thread:123145552949248] DEBUG Update found! app = Tari Console Wallet, arch = macos-x86_64, version = 99.8.12, hash = 6e77da12535e0ed7851761ae6c6729f2dd3ae8050840e8c08e10e279dadfde8a
2021-09-02 11:00:53.825740000 [p2p::auto_update] [Thread:123145552949248] DEBUG New unverified update found (app = Tari Console Wallet, arch = macos-x86_64, version = 99.8.12, hash = 6e77da12535e0ed7851761ae6c6729f2dd3ae8050840e8c08e10e279dadfde8a). Verifying...
2021-09-02 11:00:53.825721000 [p2p::auto_update::dns] [Thread:123145552949248] DEBUG Update found! app = Tari Console Wallet, arch = macos-x86_64, version = 99.8.12, hash = 6e77da12535e0ed7851761ae6c6729f2dd3ae8050840e8c08e10e279dadfde8a
2021-09-02 11:00:53.825753000 [p2p::auto_update] [Thread:123145552949248] DEBUG New unverified update found (app = Tari Console Wallet, arch = macos-x86_64, version = 99.8.12, hash = 6e77da12535e0ed7851761ae6c6729f2dd3ae8050840e8c08e10e279dadfde8a). Verifying...


fn draw_notifications<B>(&mut self, f: &mut Frame<B>, area: Rect, app_state: &AppState)
where B: Backend {
let block = Block::default().borders(Borders::ALL).title(Span::styled(
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: I think it would be good to have some kind of explanation above the block but that could be added later if we implement notifications for other things too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added some explanation at the top of the file. So that everyone can easily see the proper file where the add_notification is called. Let me know if you think it's ok, or should change it.
I also added some TODOs (from top of my head) that we can implement in the future. If you have any ideas for other TODOs let me know, or you can create PR after this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I meant in the UI above the notifications block, info for the user - but it's not critical

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see. To me the "notifications" is self-explanatory, but as a programmer I'm biased. But we should definitely be very careful with the message that we added. We can add the explanatory on the top later when will have more types of notification, not just update :-)

@@ -360,6 +361,15 @@ pub async fn init_wallet(
config.base_node_event_channel_size,
);

let updater_config = AutoUpdateConfig {
name_server: config.dns_seeds_name_server,
update_uris: config.autoupdate_dns_hosts.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check that all the config options are noted in tari_config_example.toml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose so, because it's used in base node :-) But I will double check.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some of them were missing, @sdbondi can you please review the tari_config_example.toml changes?

@delta1
Copy link
Contributor

delta1 commented Sep 2, 2021

A nice followup would be to add notifications for sent transaction, received transaction, coinbase output won, coinbase output matured, etc.

Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

Lightly tested - looks good - not sure what UX discussions were had around this feature, but feels like a whole tab for updates is overkill. Something like Version: 0.9.6 (New version: 0.9.7) in the footer should be enough?

EDIT: A general purpose notifications area as @delta1 says also sounds good - will wait for tests to pass to approve because I think there will still be updates due to the changed fn signature on Wallet::new

@Cifko Cifko force-pushed the auto-update-wallet branch 2 times, most recently from f9d5378 to 1f0d85d Compare September 2, 2021 09:51
@Cifko
Copy link
Contributor Author

Cifko commented Sep 2, 2021

Lightly tested - looks good - not sure what UX discussions were had around this feature, but feels like a whole tab for updates is overkill. Something like Version: 0.9.6 (New version: 0.9.7) in the footer should be enough?

EDIT: A general purpose notifications area as @delta1 says also sounds good - will wait for tests to pass to approve because I think there will still be updates due to the changed fn signature on Wallet::new

Yes, it's currently used only for updates. But the purpose is general. You can add add_notifcation in the wallet_event_monitors to any events you like. I did test the notification behavior by adding the state of the base node. Yeah, I suppose the tests will reveal some issues.

@Cifko
Copy link
Contributor Author

Cifko commented Sep 2, 2021

A nice followup would be to add notifications for sent transaction, received transaction, coinbase output won, coinbase output matured, etc.

That would be nice. Maybe we can discuss this today.

@delta1
Copy link
Contributor

delta1 commented Sep 2, 2021

Some test failures

@Cifko
Copy link
Contributor Author

Cifko commented Sep 3, 2021

Some test failures

Changed the updater_service to Option, because not all wallets will use the auto update feature (e.g. ffi wallet will not).
All cargo tests now pass.

@stringhandler
Copy link
Collaborator

Just needs clippy

Add update notification to the wallet.
@Cifko
Copy link
Contributor Author

Cifko commented Sep 3, 2021

Just needs clippy

Done.

@aviator-app aviator-app bot merged commit faa27fc into tari-project:development Sep 3, 2021
@Cifko Cifko deleted the auto-update-wallet branch September 8, 2021 09:08
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.

None yet

4 participants