Skip to content

Commit

Permalink
Added device specific notes
Browse files Browse the repository at this point in the history
  • Loading branch information
anon1892 committed Aug 1, 2023
1 parent f656346 commit 62be5c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ Every config file should have `metadata` with the following fields:
- `device_code`: str; The official device code.
- `supported_device_codes`: List[str]; A list of supported device codes for the config. The config will be loaded based on this field.
- `twrp-link`: [OPTIONAL] str; name of the corresponding twrp page.
- `notes`: [OPTIONAL] str; specific phone information, showed before choosing ROM / recovery

In addition to these metadata, every config can have optional `requirements`. If these are set, the user is asked to check if they are meet.
- `android`: [OPTIONAL] int|str; Android version to install prior to installing a custom ROM.
Expand Down
1 change: 1 addition & 0 deletions openandroidinstaller/installer_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def validate_config(config: str) -> bool:
"device_code": str,
"supported_device_codes": [str],
schema.Optional("twrp-link"): str,
schema.Optional("notes"): str,
},
schema.Optional("requirements"): {
schema.Optional("android"): schema.Or(str, int),
Expand Down
14 changes: 14 additions & 0 deletions openandroidinstaller/views/select_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ def build(self):

# text row to show infos during the process
self.info_field = Row()

# Device specific notes
if "notes" in self.state.config.metadata:
self.right_view.controls.extend(
[
Text(
"Important notes for your device",
style="titleSmall",
color=colors.RED,
weight="bold",
),
Markdown(f"""{self.state.config.metadata['notes']}"""),
]
)
# if there is an available download, show the button to the page
if self.download_link:
twrp_download_link = f"https://dl.twrp.me/{self.state.config.twrp_link if self.state.config.twrp_link else self.state.config.device_code}"
Expand Down

0 comments on commit 62be5c3

Please sign in to comment.