Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Update wallet delegate status on refresh #77

Conversation

Nasicus
Copy link
Contributor

@Nasicus Nasicus commented Feb 19, 2018

  • use accountLabel pipe consistently (don't user label if wallet is a delegate)

Note:
I wrote the ensureWalletDelegateProperties so that the wallet is only saved when the delegate state actually changed, i.e. you became a delegate.
Also what's different now is, that the wallet can actually be saved after a "walletRefresh" (method is called) happens, before we never saved it - hope that's not a problem.

- use accountLabel pipe consistently (don't user label if wallet is a delegate)
if (response.success) {
this.wallet.deserialize(response.account);
if (save) { this.saveWallet(); }
this.arkApiProvider
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we can avoid unnecessary requests: if (!wallet.isDelegate)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right... it's not possible to unbecome a delegate then right? If so should I also remove the corresponding logic in the ensureWalletDelegateProperties method?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, please. To make it more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -217,33 +213,15 @@ export class MyApp implements OnInit, OnDestroy {
});
}

// Verify if any account registered is a delegate
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a good reason to remove this, the purpose is to save mobile data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm I think I don't understand you? I removed this, because the only thing which it did was set isDelegate to true on the wallets. However the isDelegate state is now set when creating / importing a wallet and also if the user has become a delegate (refresh method). So this method shouldn't be required anymore?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, if you register a delegate in the desktop wallet will only be displayed when you open the wallet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well this only fetches the 102 delegates anyway I think. But you're still right and it probably doesn't hurt to have it. I will readd it again.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right, this change to only 102 delegates was made by a PR after I deployed. So this method may not make more sense 😥

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 see. Should i do anything there or leave it like it is?
Another alternative would be to check the delegate status for all wallets in the WalletsListPage (if they are not already a delegate) in the OnInit method. However this would mean potentially unneeded requests. What do you thik?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah, your solution is good, just add the refresh condition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry: Which refresh condition are you talking about? 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

=> that means I did not change anything here (see 4ffa368)

- simplify set method (it's not possible to unbecome a delegate)
@luciorubeens luciorubeens merged commit c416f64 into ArkEcosystem:master Feb 27, 2018
@Nasicus Nasicus deleted the feat/update-wallet-delegate-status-on-refresh branch February 27, 2018 20:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants