Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove code from Main.brs - create App class to handle init, login flow, and main loop #1319

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

cewert
Copy link
Member

@cewert cewert commented Jun 26, 2023

Restructure Main.brs to use the least amount of code as possible because nothing in Main.brs can be unit tested and also because roku-log won't work in Main.brs. I did keep some of the global stuff in Main.brs because it needs to be run as early as possible and also because there's only so much we can do while the "splashscreen" is up.

To do this I created a new class called App.bs which is used to initialize the app, handle the login flow, and the main loop(with m.port). roku-log is saved to the log var and can be accessed with m.log when running code inside the class (when inside a class m refers to the class members and methods).

I've also updated the LoginFlow() function to use roku-log. To do this I imported the roku-log file at the top of ShowScenes.brs and setup a logger inside the function. This isn't ideal since every function would have to setup a logger but was needed because of all the debug statements inside LoginFlow().

Changes

  • Update bsconfig.json - don't remove roku-log statements for dev builds (I thought these were false by default but apparently not. This is why I wasn't able to get this working originally)
  • Move roku-log setup from JFScreen.brs to JFScene.brs
  • Remove as much code from Main.brs as possible
  • Create App class to handle init, login flow, and main app loop
  • Setup roku-log inside the App class
  • Update code to work inside class
  • Update all current print statements to use roku-log(within reason. I didn't import roku-log into source files that only had one print statement)
  • Add some log statements where needed

NOTE: I did NOT convert the print statement that spits out the array of user settings because when roku-log prints associative arrays they are very ugly. using print looks much better 😄

Issues

Fixes #1245

Still working on a few things so marking this as draft for now

@jellyfin-bot jellyfin-bot added this to In progress in Ongoing development Jun 26, 2023
@jellyfin-bot
Copy link
Contributor

This pull request has merge conflicts. Please resolve the conflicts so the PR can be reviewed. Thanks!

@jellyfin-bot jellyfin-bot added the merge-conflict This PR has a merge conflict label Jun 29, 2023
@jellyfin-bot jellyfin-bot removed the merge-conflict This PR has a merge conflict label Jun 30, 2023
@candry7731
Copy link
Contributor

Let me know if you need help testing any of this.

@jellyfin-bot jellyfin-bot added the merge-conflict This PR has a merge conflict label Sep 11, 2023
@jellyfin-bot
Copy link
Contributor

This pull request has merge conflicts. Please resolve the conflicts so the PR can be reviewed. Thanks!

1 similar comment
@jellyfin-bot
Copy link
Contributor

This pull request has merge conflicts. Please resolve the conflicts so the PR can be reviewed. Thanks!

@jellyfin-bot
Copy link
Contributor

This pull request has merge conflicts. Please resolve the conflicts so the PR can be reviewed. Thanks!

@cewert cewert added dev-improvement This improves the dev experience in some way. and removed merge conflict labels Nov 5, 2023
@cewert cewert changed the base branch from unstable to master December 14, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-improvement This improves the dev experience in some way. merge conflict merge-conflict This PR has a merge conflict
Projects
Development

Successfully merging this pull request may close these issues.

Make roku-log work with files in source/
3 participants