refactor app view context creation
Merge pull request #1796 from dimagi/appview-context

refactor app view context creation