@@ -138,6 +138,40 @@ def splash_resources_check():
138
138
return True
139
139
return False
140
140
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
+
141
175
142
176
# About
143
177
@@ -293,7 +327,7 @@ def splash_timer_callback(tmr):
293
327
elif setupState == 1 : # Second boot: Show sponsors
294
328
print ("[SPLASH] Second boot..." )
295
329
badge .nvs_set_u8 ('badge' , 'setup.state' , 2 )
296
- appglue . start_app ( "sponsors" )
330
+ splash_sponsors_show ( )
297
331
elif setupState == 2 : # Third boot: force OTA check
298
332
print ("[SPLASH] Third boot..." )
299
333
badge .nvs_set_u8 ('badge' , 'setup.state' , 3 )
@@ -310,6 +344,10 @@ def splash_timer_callback(tmr):
310
344
# Download resources to fatfs
311
345
splash_resources_check ()
312
346
347
+ # Show updated sponsors if not yet shown
348
+ if badge .nvs_get_u8 ('sponsors' , 'shown' , 0 )< 1 :
349
+ splash_sponsors_show ()
350
+
313
351
# Initialize services
314
352
services .setup ()
315
353
0 commit comments