Skip to content

Commit 1cfc293

Browse files
committed
Fix bug where the validation still required some additional images even if non are required; hide the additional button to bypass additional images if non are necessary
1 parent 83dbd7a commit 1cfc293

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

openandroidinstaller/installer_config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(
6363
self.requirements = requirements
6464
self.device_code = metadata.get("device_code")
6565
self.is_ab = metadata.get("is_ab_device", False)
66-
self.additional_steps = metadata.get("additional_steps")
66+
self.additional_steps = metadata.get("additional_steps", [])
6767
self.supported_device_codes = metadata.get("supported_device_codes")
6868
self.twrp_link = metadata.get("twrp-link")
6969

@@ -136,8 +136,6 @@ def _load_config(device_code: str, config_path: Path) -> Optional[InstallerConfi
136136
config = InstallerConfig.from_file(path)
137137
logger.info(f"Loaded device config from {path}.")
138138
if config:
139-
if "additional_steps" not in config.metadata:
140-
config.metadata.update({"additional_steps": "[]"})
141139
logger.info(f"Config metadata: {config.metadata}.")
142140
return config
143141
else:

openandroidinstaller/views/select_view.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,19 @@ def build(self):
289289
)
290290

291291
# attach the bottom buttons
292+
if self.state.config.additional_steps:
293+
bottom_buttons = [
294+
self.back_button,
295+
self.continue_eitherway_button,
296+
self.confirm_button,
297+
]
298+
299+
else:
300+
bottom_buttons = [self.back_button, self.confirm_button]
292301
self.right_view.controls.extend(
293302
[
294303
self.info_field,
295-
Row(
296-
[
297-
self.back_button,
298-
self.continue_eitherway_button,
299-
self.confirm_button,
300-
]
301-
),
304+
Row(bottom_buttons),
302305
]
303306
)
304307
return self.view
@@ -379,7 +382,7 @@ def toggle_additional_image_selection(self):
379382

380383
# attach the controls for uploading others partitions, like dtbo, vbmeta & super_empty
381384
additional_image_selection = []
382-
if self.state.config.metadata["additional_steps"]:
385+
if self.state.config.additional_steps:
383386
additional_image_selection.extend(
384387
[
385388
Row(
@@ -398,7 +401,7 @@ def toggle_additional_image_selection(self):
398401
),
399402
]
400403
)
401-
if "dtbo" in self.state.config.metadata["additional_steps"]:
404+
if "dtbo" in self.state.config.additional_steps:
402405
self.selected_dtbo.value = False
403406
additional_image_selection.extend(
404407
[
@@ -419,7 +422,7 @@ def toggle_additional_image_selection(self):
419422
),
420423
]
421424
)
422-
if "vbmeta" in self.state.config.metadata["additional_steps"]:
425+
if "vbmeta" in self.state.config.additional_steps:
423426
self.selected_vbmeta.value = False
424427
additional_image_selection.extend(
425428
[
@@ -440,7 +443,7 @@ def toggle_additional_image_selection(self):
440443
),
441444
]
442445
)
443-
if "super_empty" in self.state.config.metadata["additional_steps"]:
446+
if "super_empty" in self.state.config.additional_steps:
444447
self.selected_super_empty.value = False
445448
additional_image_selection.extend(
446449
[
@@ -631,7 +634,7 @@ def enable_button_if_ready(self, e):
631634
self.continue_eitherway_button.disabled = False
632635

633636
# check if the additional images are there
634-
if not all(
637+
if self.state.config.additional_steps and not all(
635638
[
636639
self.selected_dtbo.value,
637640
self.selected_vbmeta.value,
@@ -686,4 +689,4 @@ def enable_button_if_ready(self, e):
686689
self.right_view.update()
687690
else:
688691
self.confirm_button.disabled = True
689-
self.continue_eitherway_button.disabled = True
692+
# self.continue_eitherway_button.disabled = True

0 commit comments

Comments
 (0)