refactors out the usage of 'ui.showNavigation' and replaces with using appState. Adds unit tests for appState.