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

If no addon is selected just reboot to OS at installation time #148

Merged
merged 1 commit into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions openandroidinstaller/app_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
# placeholders
self.advanced = False
self.install_addons = False
self.addon_paths = None
self.config = None
self.image_path = None
self.recovery_path = None
Expand Down
30 changes: 18 additions & 12 deletions openandroidinstaller/views/install_addons_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

from views import BaseView
from app_state import AppState
from tooling import adb_twrp_install_addons
from tooling import adb_twrp_install_addons, adb_reboot
from widgets import (
confirm_button,
get_title,
Expand Down Expand Up @@ -158,16 +158,22 @@ def run_install_addons(self, e):
self.right_view.update()

# run the install script
for line in adb_twrp_install_addons(
addons=self.state.addon_paths,
bin_path=self.state.bin_path,
is_ab=self.state.config.is_ab,
):
# write the line to advanced output terminal
self.terminal_box.write_line(line)
# in case the install command is run, we want to update the progress bar
self.progress_indicator.display_progress_bar(line)
self.progress_indicator.update()
if self.state.addon_paths:
for line in adb_twrp_install_addons(
addons=self.state.addon_paths,
bin_path=self.state.bin_path,
is_ab=self.state.config.is_ab,
):
# write the line to advanced output terminal
self.terminal_box.write_line(line)
# in case the install command is run, we want to update the progress bar
self.progress_indicator.display_progress_bar(line)
self.progress_indicator.update()
else:
logger.info("No addons selected. Rebooting to OS.")
for line in adb_reboot(bin_path=self.state.bin_path):
# write the line to advanced output terminal
self.terminal_box.write_line(line)
success = line # the last element of the iterable is a boolean encoding success/failure

# update the view accordingly
Expand All @@ -177,7 +183,7 @@ def run_install_addons(self, e):
# also remove the last error text if it happened
self.error_text.value = "Installation failed! Try again or make sure everything is setup correctly."
else:
sleep(5) # wait to make sure everything is fine
sleep(4) # wait to make sure everything is fine
logger.success("Installation process was successful. Allow to continue.")
# enable the confirm button and disable the call button
self.confirm_button.disabled = False
Expand Down