RavenProject / ravenwallet-ios

MIT License
25 stars 21 forks source link

Whitelist/blacklist assets #148

Closed a2hill closed 4 years ago

a2hill commented 4 years ago

For #141

From the same menu that was previously used to hide assets the user can now choose whitelist or blacklist filtering. I think the UI for adding/removing assets from the whitelist/blacklist is pretty straightforward but I welcome any feedback. Unlike before, assets that have been filtered out are also assets are hidden from the asset list AND the transaction list. This seemed logical for me, but I can change that behavior if need be. Additionally I've removed the hide/display button functionality as it is no longer necessary (it is essentially a blacklist).

Upgrade considerations

Any assets that were previously hidden using the 'hide button' functionality will be added to the blacklist on first run, however their "hidden" property in the DB will remain unchanged as the whitelist/blacklist functionality does not use that property. This will also maintain the state of hidden/shown assets should the whitelist/blacklist functionality be reverted.

Tests

I don't have a great way of testing different wallets with different assets, but I've added unit tests for the added "CoreDatabase" functionality as well as the new "AssetManager" functionality. I've tested upgrading my wallet with hidden assets and they do get placed on the blacklist upon upgrade.

Future Work

It would be pretty straightforward to use this whitelist/blacklist functionality to create white labeled wallets in the future, I'm more than happy to tackle that next if someone has requirements for it!