mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-24 15:26:04 +00:00
feat(onboarding): background first-run downloads, one setup card, no wait for Steam (#3091)
* feat(onboarding): one setup card, Steam client and Proton downloaded in the background, no component toast * feat(onboarding): an optional Bluetooth controllers row in the setup card asks for the permission up front * feat(onboarding): prefetch Steam's whole package cache, one foreground notification, child-process setup while downloads run * test(steam): the cache pass keeps packages under Steam's names and is not repeated * feat(onboarding): unpack the whole Steam client ahead of time and record it as installed, downloads no longer wait for a cool device * feat(onboarding): setup progress on the Steam home page, Bluetooth asked only from the setup card, Steam unpacks its own files * fix(onboarding): review fixes: removal does not report setup progress, cancel stops the whole prefetch, cache files are verified, no resume toast * fix(onboarding): a cancelled prefetch is never a setup failure * fix(onboarding): the Steam fact is updated atomically * feat(onboarding): Bluetooth controllers moves into the Steam integration list
This commit is contained in:
1 parent
15b1e196af
commit
59e98afae7
22 files changed
+590
-37
No files matched your search
@@ -314,6 +314,46 @@ done(28 if end < len(data) else 0)
|
||||
def download(self):
|
||||
return self.steam / 'package/droiddeck-download'
|
||||
|
||||
def cache_manifest(self):
|
||||
plain = b'plain-package'
|
||||
packed = b'packed-package'
|
||||
(self.cdn / 'a.zip.1111').write_bytes(plain)
|
||||
(self.cdn / 'b.zip.vz.2222_14').write_bytes(packed)
|
||||
(self.cdn / 'steam_client_steamdeck_publicbeta_linuxarm64').write_text(
|
||||
'"linuxarm64"\n{\n\t"version" "123456"\n'
|
||||
'\t"a_all"\n\t{\n'
|
||||
f'\t\t"file" "a.zip.1111"\n\t\t"size" "{len(plain)}"\n\t\t"sha2" "{hashlib.sha256(plain).hexdigest()}"\n'
|
||||
'\t}\n'
|
||||
'\t"b_all"\n\t{\n'
|
||||
'\t\t"file" "b.zip.9999"\n\t\t"size" "99"\n\t\t"sha2" "00"\n'
|
||||
'\t\t"zipvz" "b.zip.vz.2222_14"\n'
|
||||
f'\t\t"sha2vz" "{hashlib.sha256(packed).hexdigest()}"\n'
|
||||
'\t}\n}\n')
|
||||
|
||||
def test_the_cache_pass_keeps_every_package_under_the_names_steam_looks_for(self):
|
||||
self.cache_manifest()
|
||||
result = self.install(None, '--cache')
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
package = self.steam / 'package'
|
||||
self.assertEqual(b'plain-package', (package / 'a.zip.1111').read_bytes())
|
||||
self.assertEqual(b'packed-package', (package / 'b.zip.vz.2222_14').read_bytes())
|
||||
self.assertFalse((package / 'b.zip.9999').exists())
|
||||
self.assertEqual('123456\n', (package / 'droiddeck-cached').read_text())
|
||||
|
||||
def test_the_cache_pass_is_not_repeated_for_the_same_client_version(self):
|
||||
self.cache_manifest()
|
||||
self.assertEqual(0, self.install(None, '--cache').returncode)
|
||||
requests = len(self.requests.read_text().splitlines())
|
||||
self.assertEqual(0, self.install(None, '--cache').returncode)
|
||||
self.assertEqual(requests + 1, len(self.requests.read_text().splitlines()))
|
||||
|
||||
def test_a_cached_package_is_not_fetched_again(self):
|
||||
self.cache_manifest()
|
||||
(self.steam / 'package').mkdir(parents=True)
|
||||
(self.steam / 'package/a.zip.1111').write_bytes(b'plain-package')
|
||||
self.assertEqual(0, self.install(None, '--cache').returncode)
|
||||
self.assertNotIn('a.zip.1111', self.requests.read_text())
|
||||
|
||||
def test_progress_is_counted_in_megabytes_across_parts(self):
|
||||
self.two_parts()
|
||||
result = self.install()
|
||||
|
||||
Reference in new issue
Block a user