Added app-wide color warning when requests from everywhere are allowed

This commit is contained in:
Mark Qvist 2023-11-01 11:51:47 +01:00
parent 85f295c0c6
commit acb67dc9a2
2 changed files with 12 additions and 1 deletions

View File

@ -333,9 +333,13 @@ class SidebandApp(MDApp):
def set_ui_theme(self): def set_ui_theme(self):
self.theme_cls.material_style = "M3" self.theme_cls.material_style = "M3"
self.theme_cls.widget_style = "android" self.theme_cls.widget_style = "android"
self.theme_cls.primary_palette = "BlueGray"
self.theme_cls.accent_palette = "Orange" self.theme_cls.accent_palette = "Orange"
if self.sideband.config["telemetry_allow_requests_from_anyone"]:
self.theme_cls.primary_palette = "DeepOrange"
else:
self.theme_cls.primary_palette = "BlueGray"
if self.sideband.config["dark_ui"]: if self.sideband.config["dark_ui"]:
self.theme_cls.theme_style = "Dark" self.theme_cls.theme_style = "Dark"
else: else:

View File

@ -244,6 +244,10 @@ class Telemetry():
self.screen.ids.telemetry_collector.text = "" self.screen.ids.telemetry_collector.text = ""
self.app.sideband.config["telemetry_collector"] = None self.app.sideband.config["telemetry_collector"] = None
run_ui_update = False
if self.screen.ids.telemetry_allow_requests_from_anyone.active != self.app.sideband.config["telemetry_allow_requests_from_anyone"]:
run_ui_update = True
self.app.sideband.config["telemetry_enabled"] = self.screen.ids.telemetry_enabled.active self.app.sideband.config["telemetry_enabled"] = self.screen.ids.telemetry_enabled.active
self.app.sideband.config["telemetry_send_to_collector"] = self.screen.ids.telemetry_send_to_collector.active self.app.sideband.config["telemetry_send_to_collector"] = self.screen.ids.telemetry_send_to_collector.active
self.app.sideband.config["telemetry_send_to_trusted"] = self.screen.ids.telemetry_send_to_trusted.active self.app.sideband.config["telemetry_send_to_trusted"] = self.screen.ids.telemetry_send_to_trusted.active
@ -264,6 +268,9 @@ class Telemetry():
else: else:
self.app.sideband.setstate("app.flags.last_telemetry", time.time()) self.app.sideband.setstate("app.flags.last_telemetry", time.time())
if run_ui_update:
self.app.set_ui_theme()
def telemetry_copy(self, sender=None): def telemetry_copy(self, sender=None):
Clipboard.copy(str(self.app.sideband.get_telemetry())) Clipboard.copy(str(self.app.sideband.get_telemetry()))
self.app.sideband.update_telemetry() self.app.sideband.update_telemetry()