Skip to content
Snippets Groups Projects
Commit 447c36f1 authored by ave's avatar ave Committed by ave
Browse files

make apps setting wifi state configurable

parent 4905f188
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ from st3m.input import InputState ...@@ -8,6 +8,7 @@ from st3m.input import InputState
import st3m.wifi import st3m.wifi
from st3m.goose import Optional, List, Dict from st3m.goose import Optional, List, Dict
from st3m.logging import Log from st3m.logging import Log
from st3m import settings
from ctx import Context from ctx import Context
import toml import toml
...@@ -47,7 +48,7 @@ class ApplicationContext: ...@@ -47,7 +48,7 @@ class ApplicationContext:
class Application(BaseView): class Application(BaseView):
def __init__(self, app_ctx: ApplicationContext) -> None: def __init__(self, app_ctx: ApplicationContext) -> None:
self._app_ctx = app_ctx self._app_ctx = app_ctx
if app_ctx and app_ctx.bundle_metadata: if app_ctx and app_ctx.bundle_metadata and settings.onoff_wifi_preference.value:
self._wifi_preference = app_ctx.bundle_metadata["app"].get( self._wifi_preference = app_ctx.bundle_metadata["app"].get(
"wifi_preference" "wifi_preference"
) )
......
...@@ -384,6 +384,9 @@ onoff_debug = OnOffTunable("Debug Overlay", "system.debug", False) ...@@ -384,6 +384,9 @@ onoff_debug = OnOffTunable("Debug Overlay", "system.debug", False)
onoff_debug_touch = OnOffTunable("Touch Overlay", "system.debug_touch", False) onoff_debug_touch = OnOffTunable("Touch Overlay", "system.debug_touch", False)
onoff_show_tray = OnOffTunable("Show Icons", "system.show_icons", True) onoff_show_tray = OnOffTunable("Show Icons", "system.show_icons", True)
onoff_wifi = OnOffTunable("Enable WiFi on Boot", "system.wifi.enabled", False) onoff_wifi = OnOffTunable("Enable WiFi on Boot", "system.wifi.enabled", False)
onoff_wifi_preference = OnOffTunable(
"Let apps change WiFi", "system.wifi.allow_apps_to_change_wifi", True
)
str_wifi_ssid = StringTunable("WiFi SSID", "system.wifi.ssid", "Camp2023-open") str_wifi_ssid = StringTunable("WiFi SSID", "system.wifi.ssid", "Camp2023-open")
str_wifi_psk = ObfuscatedStringTunable("WiFi Password", "system.wifi.psk", None) str_wifi_psk = ObfuscatedStringTunable("WiFi Password", "system.wifi.psk", None)
str_hostname = StringTunable("Hostname", "system.hostname", "flow3r") str_hostname = StringTunable("Hostname", "system.hostname", "flow3r")
...@@ -395,6 +398,7 @@ load_save_settings: List[UnaryTunable] = [ ...@@ -395,6 +398,7 @@ load_save_settings: List[UnaryTunable] = [
onoff_debug, onoff_debug,
onoff_debug_touch, onoff_debug_touch,
onoff_wifi, onoff_wifi,
onoff_wifi_preference,
str_wifi_ssid, str_wifi_ssid,
str_wifi_psk, str_wifi_psk,
str_hostname, str_hostname,
...@@ -411,6 +415,7 @@ settings_menu_structure: "MenuStructure" = [ ...@@ -411,6 +415,7 @@ settings_menu_structure: "MenuStructure" = [
onoff_debug, onoff_debug,
onoff_debug_touch, onoff_debug_touch,
onoff_wifi, onoff_wifi,
onoff_wifi_preference,
MenuItemAppLaunch(BundleMetadata("/flash/sys/apps/w1f1")), MenuItemAppLaunch(BundleMetadata("/flash/sys/apps/w1f1")),
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment