-
Notifications
You must be signed in to change notification settings - Fork 17
feat: display login workarounds in a pop up #449
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
Open
ctrlaltf24
wants to merge
3
commits into
FaithLife-Community:main
Choose a base branch
from
ctrlaltf24:feat-display-login-workarounds-in-a-pop-up
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,9 @@ | |
| import psutil | ||
| import threading | ||
|
|
||
| from ou_dedetai import database | ||
| from ou_dedetai import constants, database | ||
| from ou_dedetai.app import App | ||
| from ou_dedetai.config import get_logos_user_id | ||
|
|
||
| from . import system | ||
| from . import utils | ||
|
|
@@ -100,6 +101,57 @@ def monitor(self): | |
| # Useful if the install directory got deleted while executing | ||
| self.logos_state = State.STOPPED | ||
|
|
||
| def monitor_for_potential_issues(self): | ||
| """A function to be run in parallel with running Logos to detect common issues and suggest workarounds""" | ||
| # Make sure we have a logos appdata, without it we can't reliably do any checks | ||
| logos_appdata_dir = self.app.conf._logos_appdata_dir | ||
| if logos_appdata_dir is None: | ||
| logging.warning("The user should have installed the Logos application by now and have this populated." | ||
| " Waiting until that is resolved...") | ||
| while logos_appdata_dir is None: | ||
| time.sleep(1) | ||
| logos_appdata_dir = self.app.conf._logos_appdata_dir | ||
|
|
||
| # See if the user is logged in, this may change which things we look for | ||
| is_user_logged_in: bool = False | ||
| if get_logos_user_id(logos_appdata_dir) is not None: | ||
| is_user_logged_in = True | ||
|
|
||
| sent_trouble_singing_in_message: bool = False | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct var name "sent_trouble_singing_in_message" to "sent_trouble_signing_in_message" |
||
|
|
||
| time_logos_started = time.time() | ||
|
|
||
| while True: | ||
| # Now we wait... | ||
| time.sleep(10) | ||
|
|
||
| if not is_user_logged_in: | ||
| if get_logos_user_id(logos_appdata_dir) is not None: | ||
| # User's now logged in - no fuss. | ||
| is_user_logged_in = True | ||
| else: | ||
| # Took me about ~1.5 minutes to sign on while simulating a little dilly-dallying and a couple | ||
| # incorrect password attempts. Should still be longer than most people take to sign on, but not SO | ||
| # long that people close OD in frustration to try again - fine line of balance. | ||
| if not sent_trouble_singing_in_message and time.time() - time_logos_started > 60 * 1.75: | ||
| # It's been five minutes since the user launched Logos and yet they haven't logged in yet. | ||
| # Are they having trouble? | ||
| self.app.pop_up( | ||
| "Trouble Signing In?", | ||
| "If you're having trouble signing in, try these workarounds:\n\n" \ | ||
| "If the browser isn't launching after you hit \"Sign In\" in the Logos application " | ||
| "consider installing firefox from your system's package manager and temporarily setting " | ||
| "that as your default browser.\n\n" | ||
| "If the browser opens and entering your credentials is successful but nothing happens: " | ||
| "on the Logos browser page try hitting the button for not being redirected automatically " | ||
| "then click on the link that shows up that suggests to click it if you're still having " | ||
| "trouble. That should cause you to sign in on the Logos application.\n\n" | ||
| f"If you still need help use \"Get Support\" on the main page of {constants.APP_NAME}" | ||
| ) | ||
| # We only want to send this message once | ||
| sent_trouble_singing_in_message = True | ||
|
|
||
|
|
||
| def start(self): | ||
| self.logos_state = State.STARTING | ||
| wine_release, _ = wine.get_wine_release(self.app.conf.wine_binary) | ||
|
|
@@ -132,6 +184,7 @@ def run_logos(): | |
| wine.wineserver_kill(self.app) | ||
| # Don't send "Running" message to GUI b/c it never clears. | ||
| logging.info(f"Running {self.app.conf.faithlife_product}…") | ||
| self.app.start_thread(self.monitor_for_potential_issues, daemon_bool=False) | ||
| self.app.start_thread(run_logos, daemon_bool=False) | ||
| # NOTE: The following code would keep the CLI open while running | ||
| # Logos, but since wine logging is sent directly to wine.log, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: change "..." to "…"