You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
WiFi app: improve perferences handling
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
- AppStore app: add support for BadgeHub backend
|
||||
- OSUpdate app: show download speed
|
||||
- WiFi app: new "Add network" functionality for out-of-range or hidden networks
|
||||
- WiFi app: add "Forget" button to delete networks
|
||||
- API: add TaskManager that wraps asyncio
|
||||
- API: add DownloadManager that uses TaskManager
|
||||
- API: use aiorepl to eliminate another thread
|
||||
|
||||
@@ -22,6 +22,8 @@ last_tried_result = ""
|
||||
|
||||
class WiFi(Activity):
|
||||
|
||||
prefs = None
|
||||
|
||||
scan_button_scan_text = "Rescan"
|
||||
scan_button_scanning_text = "Scanning..."
|
||||
|
||||
@@ -66,8 +68,12 @@ class WiFi(Activity):
|
||||
def onResume(self, screen):
|
||||
print("wifi.py onResume")
|
||||
super().onResume(screen)
|
||||
|
||||
if not self.prefs:
|
||||
self.prefs = mpos.config.SharedPreferences("com.micropythonos.system.wifiservice")
|
||||
|
||||
global access_points
|
||||
access_points = mpos.config.SharedPreferences("com.micropythonos.system.wifiservice").get_dict("access_points")
|
||||
access_points = self.prefs.get_dict("access_points")
|
||||
if len(self.ssids) == 0:
|
||||
if WifiService.wifi_busy == False:
|
||||
WifiService.wifi_busy = True
|
||||
@@ -172,7 +178,7 @@ class WiFi(Activity):
|
||||
if data:
|
||||
ssid = data.get("ssid")
|
||||
global access_points
|
||||
editor = mpos.config.SharedPreferences("com.micropythonos.system.wifiservice").edit()
|
||||
editor = self.prefs.edit()
|
||||
forget = data.get("forget")
|
||||
if forget:
|
||||
del access_points[ssid]
|
||||
|
||||
Reference in New Issue
Block a user