Skip to content

Commit 1735a97

Browse files
committed
Force new sponsors app to be shown
1 parent cc4b333 commit 1735a97

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

esp32/modules/splash.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,40 @@ def splash_resources_check():
138138
return True
139139
return False
140140

141+
# Sponsors
142+
143+
def splash_sponsors_install():
144+
if not easywifi.status():
145+
if not easywifi.enable():
146+
return False
147+
print("[SPLASH] Installing sponsors...")
148+
easydraw.msg("Installing sponsors...",True)
149+
import woezel
150+
woezel.install("sponsors")
151+
easydraw.msg("Done.")
152+
153+
def splash_sponsors_show():
154+
needToInstall = True
155+
version = 0
156+
try:
157+
fp = open("/lib/sponsors/version", "r")
158+
version = int(fp.read(99))
159+
print("[SPLASH] Current sponsors version: "+str(version))
160+
except:
161+
print("[SPLASH] Sponsors not installed.")
162+
if version>=14:
163+
needToInstall = False
164+
if needToInstall:
165+
splash_sponsors_install()
166+
try:
167+
fp = open("/lib/sponsors/version", "r")
168+
version = int(fp.read(99))
169+
# Now we know for sure that a version of the sponsors app has been installed
170+
badge.nvs_set_u8('sponsors', 'shown', 1)
171+
appglue.start_app("sponsors")
172+
except:
173+
pass
174+
141175

142176
# About
143177

@@ -293,7 +327,7 @@ def splash_timer_callback(tmr):
293327
elif setupState == 1: # Second boot: Show sponsors
294328
print("[SPLASH] Second boot...")
295329
badge.nvs_set_u8('badge', 'setup.state', 2)
296-
appglue.start_app("sponsors")
330+
splash_sponsors_show()
297331
elif setupState == 2: # Third boot: force OTA check
298332
print("[SPLASH] Third boot...")
299333
badge.nvs_set_u8('badge', 'setup.state', 3)
@@ -310,6 +344,10 @@ def splash_timer_callback(tmr):
310344
# Download resources to fatfs
311345
splash_resources_check()
312346

347+
# Show updated sponsors if not yet shown
348+
if badge.nvs_get_u8('sponsors', 'shown', 0)<1:
349+
splash_sponsors_show()
350+
313351
# Initialize services
314352
services.setup()
315353

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy