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

feat: provide a method for the user to bypass the first run dialog #344

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ctrlaltf24
Copy link
Contributor

@ctrlaltf24 ctrlaltf24 commented Feb 25, 2025

BLOCKER: This leaves non-functional installs for now since the arial font is not installed. Factbook crashes after using this. Consider fixing the arial issue before merging this.

In the case that Ou Dedetai is started with an existing user directory, we know that at some point in the past the user launched Logos for the first time and logged in. Since we know they're already logged in, they should be past the first run dialog. However in the case the dialog failed for whatever reason, the key may still be set in the database.

Provide a means for the user to easily bypass this first run dialog in the case that it failed.

While there is some risk that in the future Logos will introduce some logic into this first run dialog that's strictly required for the app to function, if that's the case the worst this can do is a break a first time install - that's already likely broken. The user needs to reinstall anyways, we're no worse than we were.

Tested:

  • Accepting and refusing using a crashed first time resource download on GUI and TUI and CLI
  • Opening Program settings after recovering, observed settings are restored from to actual contents.
  • Hitting "Continue" VERY early, didn't get the first run dialog the second time. Must have hit it so early this db entry wasn't created.
  • Hitting "Continue" at 1% (either v39.1 or v40), then using OD to skip the first run dialog - had 3 resources downloaded to start with, then the loading button downloaded the remaining. It showed "Preparing Library" for a bit, then tried to open biblical event navigator or factbook and got a crash Unhandled exception: page fault on read access to 0x000000000000007c in 64-bit code (0x006ffff63389f1). Logos was trying to index at the time. Removed the Data/Documents directories, and slowly let Logos settle, after re-downloading all of my books it still crashes the same way. Installed "arial" font and resolved the issue
  • Hitting "Continue" after everything had settled at 10%. Then waited for Logos to settle and all notifications to resolve before interacting with the application. Factbook still crashes as above. Tried re-setting 'FirstRunDialogWizardState="ResourceBundleSelection", then using the first run dialog, but it still crashes despite my library being downloaded. Perhaps there is another key we could set this to rather than removing it

It should be noted that on the TUI and GUI if the user refuses the first prompt, they'll need to restart the app in order to change their mind. However on the other hand if the user actually wants to ignore it, this behavior is less intrusive.

It should be noted that on the TUI, the user is prompted as if they were on the CLI - which is entirely fine, the user is already used to the terminal

Still to test:

  • Exit the first run dialog very early, and see if skipping it causes any issues.
  • Hitting "Continue" after a couple of seconds, but still at "0%"

…download

In the case that Ou Dedetai is started with an existing user directory,
we know that at some point in the past the user launched Logos for the first time and logged in.
Since we know they're already logged in, they should be past the first run dialog.
However in the case the dialog failed for whatever reason, the key may still be set in the database.

Provide a means for the user to easily bypass this first run dialog in the case that it failed.

While there is some risk that in the future Logos will introduce some logic into this first run dialog that's strictly required for the app to function, if that's the case the worst this can do is a break a first time install - that's already likely broken.
The user needs to reinstall anyways, we're no worse than we were.

Tested:
- Accepting and refusing using a crashed first time resource download on GUI and TUI and CLI
- Opening Program settings after recovering, observed settings are restored from <data/> to actual contents.

It should be noted that on the TUI and GUI if the user refuses the first prompt, they'll need to restart the app in order to change their mind.
However on the other hand if the user actually wants to ignore it, this behavior is less intrusive.

It should be noted that on the TUI, the user is prompted as if they were on the CLI - which is entirely fine, the user is already used to the terminal

Still to test:
- Exit the first run dialog very early, and see if skipping it causes any issues.
@ctrlaltf24 ctrlaltf24 requested review from thw26 and n8marti February 25, 2025 20:10
@ctrlaltf24 ctrlaltf24 marked this pull request as draft February 25, 2025 20:48
Copy link
Collaborator

@thw26 thw26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I or Nate need to test.

persistent_config.faithlife_product
)
except Exception:
logging.exception("Failed to check to see if installation is broken.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want this to say something like, "Unable to detect an issue." We didn't fail our check in this case; we did check, but we didn't find anything.

@@ -653,6 +653,14 @@ def parse_bool(string: str) -> bool:
return string.lower() in ['true', '1', 'y', 'yes']


def execute_sql(path: str | Path, sql_statements: list[str]) -> list[Any]:
Copy link
Collaborator

@thw26 thw26 Feb 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above; I think we should put SQL operations into a db.py module.

time.sleep(5)
return
local_user_prefrences_path = Path(logos_appdata_dir) / "Documents" / logos_user_id / "LocalUserPreferences" / "PreferencesManager.db" #noqa: E501
ou_dedetai.utils.execute_sql(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments on adding a db.py module.

We have a couple other bits of code in the works, sitting on the backburner, which also interact with the Logos sqlite DBs. It would be good to put these in their own module so that we don't have to retrieve them at a later time.

f"Recovery attempt of {app.conf.faithlife_product} complete. "
f"{app.conf.faithlife_product} should now launch directly, "
"bypassing first time resource download dialog."
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to include our instructions here telling the user to download their library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants