[Sprint/FunnyFrog](feat): Preferred hashtag remember local storage 1302
Works fine by my testing. Removed this.lastPreferredEmission
so that the system just uses localStorage to determine its value, rather than storing the last state of it when navigating away and back.
2/3 discussions resolved
- Resolved by Ben Hayward
changed the description 2 times within 1 minute
resolved all discussions
- Resolved by Ben Hayward
46 44 } 47 45 48 46 ngOnInit() { 49 this.lastPreferredEmission = this.preferred; 47 this.preferred = this.storage.get('preferred_hashtag_state') === 'true'; - Developer
Instead of casting a boolean and comparing to a string I would just do something like:
this.preferred = Boolean(this.storage.get('preferred_hashtag_state'));
And on Line 128:
this.storage.set('preferred_hashtag_state', this.preferred ? '1' : '');
Or you can also use JSON.stringify and JSON.parse to serialize/unserialize.