feat(itch): update detection and safe updates for installed games (#1665)

## Summary

Adds update detection for installed itch.io games. This is PR4 of the
itch.io store rework (browse, filters, game page and collections are
merged; Linux support is #1589). Butler patching comes later as an
add-on pack. Updates here download the full build.

## What changed

- `ItchUpdates` (new): compares each installed itch game with the
uploads itch lists for it (`GET /games/{id}/uploads`), using what the
install already saves: `installVersion` (the upload's `updated_at`) plus
`gameId`, `downloadKeyId` and `uploadId` in `extra`.
- The installed upload is still listed and has a later `updated_at`: an
update.
- The installed upload is gone: the newest Windows upload is offered as
a replaced build.
- An install without an `uploadId` compares the newest Windows upload's
date.
- An unknown installed version, or no answer from itch, never reports an
update.
- The check walks installed games one at a time, one second apart, and
logs `itch.io: checked <n> installed games, <m> with updates`. It runs
when the itch tab opens (at most every 6 hours) and from the new button.
A game itch did not answer for keeps its last result. Results are cached
in the itch preferences until the update is installed or the account
signs out.
- Library: games with an update show an "Update" label on their tile and
row. A Check for updates button in the Library header (itch tab only)
runs the check on demand, shows progress, and ends with a toast:
"Updates available: N" or "Up to date".
- Game page: an Update button appears for installed itch games with an
update. A replaced build asks first and names the new file. A plain
newer build updates directly.
- Safe updates: an update never extracts into the live game. The archive
is unpacked into `.droiddeck-update` inside the game folder, and the new
build must contain an executable before any game file is touched. A
failed or cancelled download or extraction removes the staging folder
and leaves the game as it was. Then `ItchStaging.merge` moves the staged
files into place with renames inside one folder. A staged file replaces
the file with the same path, directories are merged, and anything the
new build doesn't contain (saves, settings, install record, launcher,
art) stays. The install record is marked updating just before the move,
so an interruption there is resumable.
- New strings `stores_itch_updates_found` and
`stores_itch_update_replaced` in all 33 locales. The button label, toast
and dialog buttons reuse existing strings.
- `docs/development/itch-updates.md` describes the feature.

## Notes

- One extra copy of the build's size must be free while an update runs.
- Files the developer removed in the new version stay in the game
folder, because everything the new build doesn't contain is kept.
- The final rename step is not an all-or-nothing swap. A crash or power
loss inside it leaves the game marked updating and resumable.
- The update reruns the normal install over the game's own folder and
storage location.

## Tests

- `ItchUpdatesTest` (Robolectric, like the other itch tests): newer,
same and older stamps, replaced upload falling back to the newest
Windows build, unknown installed version, no answer, an install without
an upload id, and the cache round trip.
- `ItchStagingTest`: new files replace old ones, other files stay, and a
file replacing a directory and the other way round.
- Not run on a device or compiled locally; relying on CI. The controller
focus behaviour of the new buttons is untested.
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-28 09:36:19 -04:00
commit 8f6b2a4123
46 files changed
+656 -26

No files matched your search

+2
View File
@@ -3219,6 +3219,8 @@
<string name="library_in">في المكتبة</string>
<string name="xbox_filter_show">عرض</string>
<string name="itch_collections">المجموعات</string>
<string name="stores_itch_updates_found">التحديثات المتاحة: %1$d</string>
<string name="stores_itch_update_replaced">استبدل المطوّر هذا الإصدار بـ %1$s. هل تريد التحديث إليه؟</string>
<string name="xbox_filter_cloud">سحابية</string>
<string name="stores_xbox_cloud_settings">إعدادات السحابة</string>
<string name="apps_search_hint">البحث في التطبيقات</string>
@@ -3069,6 +3069,8 @@
<string name="library_in">En Biblioteca</string>
<string name="xbox_filter_show">Mostrar</string>
<string name="itch_collections">Colecciones</string>
<string name="stores_itch_updates_found">Actualizaciones disponibles: %1$d</string>
<string name="stores_itch_update_replaced">El desarrollador reemplazó esta versión por %1$s. ¿Actualizar a ella?</string>
<string name="xbox_filter_cloud">Nube</string>
<string name="stores_xbox_cloud_settings">Configuración de nube</string>
<string name="apps_search_hint">Buscar apps</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">В Библиотека</string>
<string name="xbox_filter_show">Показване</string>
<string name="itch_collections">Колекции</string>
<string name="stores_itch_updates_found">Налични актуализации: %1$d</string>
<string name="stores_itch_update_replaced">Разработчикът замени тази версия с %1$s. Да се актуализира ли до нея?</string>
<string name="xbox_filter_cloud">Облак</string>
<string name="stores_xbox_cloud_settings">Настройки на облака</string>
<string name="apps_search_hint">Търсене на приложения</string>
+2
View File
@@ -3151,6 +3151,8 @@
<string name="library_in">V knihovně</string>
<string name="xbox_filter_show">Zobrazit</string>
<string name="itch_collections">Kolekce</string>
<string name="stores_itch_updates_found">Dostupné aktualizace: %1$d</string>
<string name="stores_itch_update_replaced">Vývojář nahradil tuto verzi souborem %1$s. Aktualizovat na ni?</string>
<string name="xbox_filter_cloud">Cloud</string>
<string name="stores_xbox_cloud_settings">Nastavení cloudu</string>
<string name="apps_search_hint">Hledat aplikace</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">I Bibliotek</string>
<string name="xbox_filter_show">Vis</string>
<string name="itch_collections">Samlinger</string>
<string name="stores_itch_updates_found">Opdateringer tilgængelige: %1$d</string>
<string name="stores_itch_update_replaced">Udvikleren har erstattet denne version med %1$s. Opdater til den?</string>
<string name="xbox_filter_cloud">Sky</string>
<string name="stores_xbox_cloud_settings">Skyindstillinger</string>
<string name="apps_search_hint">Søg i apps</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">In der Bibliothek</string>
<string name="xbox_filter_show">Anzeigen</string>
<string name="itch_collections">Sammlungen</string>
<string name="stores_itch_updates_found">Verfügbare Updates: %1$d</string>
<string name="stores_itch_update_replaced">Der Entwickler hat diesen Build durch %1$s ersetzt. Darauf aktualisieren?</string>
<string name="xbox_filter_cloud">Cloud</string>
<string name="stores_xbox_cloud_settings">Cloud-Einstellungen</string>
<string name="apps_search_hint">Apps durchsuchen</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">Στη Βιβλιοθήκη</string>
<string name="xbox_filter_show">Εμφάνιση</string>
<string name="itch_collections">Συλλογές</string>
<string name="stores_itch_updates_found">Διαθέσιμες ενημερώσεις: %1$d</string>
<string name="stores_itch_update_replaced">Ο προγραμματιστής αντικατέστησε αυτήν την έκδοση με %1$s. Να γίνει ενημέρωση σε αυτήν;</string>
<string name="xbox_filter_cloud">Cloud</string>
<string name="stores_xbox_cloud_settings">Ρυθμίσεις cloud</string>
<string name="apps_search_hint">Αναζήτηση εφαρμογών</string>
+2
View File
@@ -3119,6 +3119,8 @@
<string name="library_in">En la Biblioteca</string>
<string name="xbox_filter_show">Mostrar</string>
<string name="itch_collections">Colecciones</string>
<string name="stores_itch_updates_found">Actualizaciones disponibles: %1$d</string>
<string name="stores_itch_update_replaced">El desarrollador reemplazó esta versión por %1$s. ¿Actualizar a ella?</string>
<string name="xbox_filter_cloud">Nube</string>
<string name="stores_xbox_cloud_settings">Ajustes de nube</string>
<string name="apps_search_hint">Buscar aplicaciones</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">Kirjastossa</string>
<string name="xbox_filter_show">Näytä</string>
<string name="itch_collections">Kokoelmat</string>
<string name="stores_itch_updates_found">Päivityksiä saatavilla: %1$d</string>
<string name="stores_itch_update_replaced">Kehittäjä korvasi tämän version tiedostolla %1$s. Päivitetäänkö siihen?</string>
<string name="xbox_filter_cloud">Pilvi</string>
<string name="stores_xbox_cloud_settings">Pilviasetukset</string>
<string name="apps_search_hint">Hae sovelluksia</string>
+2
View File
@@ -3119,6 +3119,8 @@
<string name="library_in">Dans la Bibliothèque</string>
<string name="xbox_filter_show">Afficher</string>
<string name="itch_collections">Collections</string>
<string name="stores_itch_updates_found">Mises à jour disponibles : %1$d</string>
<string name="stores_itch_update_replaced">Le développeur a remplacé cette version par %1$s. Mettre à jour vers celle-ci ?</string>
<string name="xbox_filter_cloud">Cloud</string>
<string name="stores_xbox_cloud_settings">Paramètres cloud</string>
<string name="apps_search_hint">Rechercher des applications</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">लाइब्रेरी में</string>
<string name="xbox_filter_show">दिखाएँ</string>
<string name="itch_collections">संग्रह</string>
<string name="stores_itch_updates_found">उपलब्ध अपडेट: %1$d</string>
<string name="stores_itch_update_replaced">डेवलपर ने इस बिल्ड को %1$s से बदल दिया है। क्या उस पर अपडेट करें?</string>
<string name="xbox_filter_cloud">क्लाउड</string>
<string name="stores_xbox_cloud_settings">क्लाउड सेटिंग्स</string>
<string name="apps_search_hint">ऐप खोजें</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">A könyvtárban</string>
<string name="xbox_filter_show">Megjelenítés</string>
<string name="itch_collections">Gyűjtemények</string>
<string name="stores_itch_updates_found">Elérhető frissítések: %1$d</string>
<string name="stores_itch_update_replaced">A fejlesztő lecserélte ezt a buildet erre: %1$s. Frissít rá?</string>
<string name="xbox_filter_cloud">Felhő</string>
<string name="stores_xbox_cloud_settings">Felhőbeállítások</string>
<string name="apps_search_hint">Alkalmazások keresése</string>
+2
View File
@@ -3073,6 +3073,8 @@
<string name="library_in">Di Pustaka</string>
<string name="xbox_filter_show">Tampilkan</string>
<string name="itch_collections">Koleksi</string>
<string name="stores_itch_updates_found">Pembaruan tersedia: %1$d</string>
<string name="stores_itch_update_replaced">Pengembang mengganti build ini dengan %1$s. Perbarui ke build itu?</string>
<string name="xbox_filter_cloud">Cloud</string>
<string name="stores_xbox_cloud_settings">Pengaturan cloud</string>
<string name="apps_search_hint">Cari aplikasi</string>
+2
View File
@@ -3117,6 +3117,8 @@
<string name="library_in">Nella Libreria</string>
<string name="xbox_filter_show">Mostra</string>
<string name="itch_collections">Raccolte</string>
<string name="stores_itch_updates_found">Aggiornamenti disponibili: %1$d</string>
<string name="stores_itch_update_replaced">Lo sviluppatore ha sostituito questa build con %1$s. Aggiornare a quella?</string>
<string name="xbox_filter_cloud">Cloud</string>
<string name="stores_xbox_cloud_settings">Impostazioni cloud</string>
<string name="apps_search_hint">Cerca app</string>
+2
View File
@@ -3060,6 +3060,8 @@
<string name="library_in">ライブラリにあります</string>
<string name="xbox_filter_show">表示</string>
<string name="itch_collections">コレクション</string>
<string name="stores_itch_updates_found">利用可能なアップデート: %1$d</string>
<string name="stores_itch_update_replaced">開発者がこのビルドを %1$s に置き換えました。更新しますか?</string>
<string name="xbox_filter_cloud">クラウド</string>
<string name="stores_xbox_cloud_settings">クラウド設定</string>
<string name="apps_search_hint">アプリを検索</string>
+2
View File
@@ -3060,6 +3060,8 @@
<string name="library_in">라이브러리에 있음</string>
<string name="xbox_filter_show">표시</string>
<string name="itch_collections">컬렉션</string>
<string name="stores_itch_updates_found">사용 가능한 업데이트: %1$d</string>
<string name="stores_itch_update_replaced">개발자가 이 빌드를 %1$s(으)로 교체했습니다. 업데이트할까요?</string>
<string name="xbox_filter_cloud">클라우드</string>
<string name="stores_xbox_cloud_settings">클라우드 설정</string>
<string name="apps_search_hint">앱 검색</string>
+2
View File
@@ -3058,6 +3058,8 @@
<string name="library_in">Dalam Pustaka</string>
<string name="xbox_filter_show">Tunjukkan</string>
<string name="itch_collections">Koleksi</string>
<string name="stores_itch_updates_found">Kemas kini tersedia: %1$d</string>
<string name="stores_itch_update_replaced">Pembangun telah menggantikan binaan ini dengan %1$s. Kemas kini kepadanya?</string>
<string name="xbox_filter_cloud">Awan</string>
<string name="stores_xbox_cloud_settings">Tetapan awan</string>
<string name="apps_search_hint">Cari apl</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">I Bibliotek</string>
<string name="xbox_filter_show">Vis</string>
<string name="itch_collections">Samlinger</string>
<string name="stores_itch_updates_found">Oppdateringer tilgjengelig: %1$d</string>
<string name="stores_itch_update_replaced">Utvikleren har erstattet denne versjonen med %1$s. Oppdatere til den?</string>
<string name="xbox_filter_cloud">Sky</string>
<string name="stores_xbox_cloud_settings">Skyinnstillinger</string>
<string name="apps_search_hint">Søk i apper</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">In Bibliotheek</string>
<string name="xbox_filter_show">Weergeven</string>
<string name="itch_collections">Collecties</string>
<string name="stores_itch_updates_found">Beschikbare updates: %1$d</string>
<string name="stores_itch_update_replaced">De ontwikkelaar heeft deze build vervangen door %1$s. Bijwerken naar die build?</string>
<string name="xbox_filter_cloud">Cloud</string>
<string name="stores_xbox_cloud_settings">Cloudinstellingen</string>
<string name="apps_search_hint">Apps zoeken</string>
+2
View File
@@ -3154,6 +3154,8 @@
<string name="library_in">W bibliotece</string>
<string name="xbox_filter_show">Pokaż</string>
<string name="itch_collections">Kolekcje</string>
<string name="stores_itch_updates_found">Dostępne aktualizacje: %1$d</string>
<string name="stores_itch_update_replaced">Deweloper zastąpił tę wersję plikiem %1$s. Zaktualizować do niej?</string>
<string name="xbox_filter_cloud">Chmura</string>
<string name="stores_xbox_cloud_settings">Ustawienia chmury</string>
<string name="apps_search_hint">Szukaj aplikacji</string>
@@ -3117,6 +3117,8 @@
<string name="library_in">Na Biblioteca</string>
<string name="xbox_filter_show">Mostrar</string>
<string name="itch_collections">Coleções</string>
<string name="stores_itch_updates_found">Atualizações disponíveis: %1$d</string>
<string name="stores_itch_update_replaced">O programador substituiu esta versão por %1$s. Atualizar para ela?</string>
<string name="xbox_filter_cloud">Nuvem</string>
<string name="stores_xbox_cloud_settings">Definições da nuvem</string>
<string name="apps_search_hint">Pesquisar aplicações</string>
+2
View File
@@ -3117,6 +3117,8 @@
<string name="library_in">Na Biblioteca</string>
<string name="xbox_filter_show">Mostrar</string>
<string name="itch_collections">Coleções</string>
<string name="stores_itch_updates_found">Atualizações disponíveis: %1$d</string>
<string name="stores_itch_update_replaced">O desenvolvedor substituiu esta versão por %1$s. Atualizar para ela?</string>
<string name="xbox_filter_cloud">Nuvem</string>
<string name="stores_xbox_cloud_settings">Configurações da nuvem</string>
<string name="apps_search_hint">Pesquisar apps</string>
+2
View File
@@ -3117,6 +3117,8 @@
<string name="library_in">În Bibliotecă</string>
<string name="xbox_filter_show">Afișează</string>
<string name="itch_collections">Colecții</string>
<string name="stores_itch_updates_found">Actualizări disponibile: %1$d</string>
<string name="stores_itch_update_replaced">Dezvoltatorul a înlocuit această versiune cu %1$s. Actualizezi la ea?</string>
<string name="xbox_filter_cloud">Cloud</string>
<string name="stores_xbox_cloud_settings">Setări cloud</string>
<string name="apps_search_hint">Caută aplicații</string>
+2
View File
@@ -3153,6 +3153,8 @@
<string name="library_in">В библиотеке</string>
<string name="xbox_filter_show">Показать</string>
<string name="itch_collections">Коллекции</string>
<string name="stores_itch_updates_found">Доступные обновления: %1$d</string>
<string name="stores_itch_update_replaced">Разработчик заменил эту сборку на %1$s. Обновиться до неё?</string>
<string name="xbox_filter_cloud">Облако</string>
<string name="stores_xbox_cloud_settings">Настройки облака</string>
<string name="apps_search_hint">Поиск приложений</string>
+2
View File
@@ -3083,6 +3083,8 @@
<string name="library_in">I Bibliotek</string>
<string name="xbox_filter_show">Visa</string>
<string name="itch_collections">Samlingar</string>
<string name="stores_itch_updates_found">Uppdateringar tillgängliga: %1$d</string>
<string name="stores_itch_update_replaced">Utvecklaren har ersatt den här versionen med %1$s. Uppdatera till den?</string>
<string name="xbox_filter_cloud">Moln</string>
<string name="stores_xbox_cloud_settings">Molninställningar</string>
<string name="apps_search_hint">Sök appar</string>
+2
View File
@@ -3058,6 +3058,8 @@
<string name="library_in">อยู่ในไลบรารี</string>
<string name="xbox_filter_show">แสดง</string>
<string name="itch_collections">คอลเลกชัน</string>
<string name="stores_itch_updates_found">มีอัปเดตพร้อมใช้งาน: %1$d</string>
<string name="stores_itch_update_replaced">ผู้พัฒนาได้แทนที่บิลด์นี้ด้วย %1$s ต้องการอัปเดตเป็นบิลด์นั้นไหม</string>
<string name="xbox_filter_cloud">คลาวด์</string>
<string name="stores_xbox_cloud_settings">การตั้งค่าคลาวด์</string>
<string name="apps_search_hint">ค้นหาแอป</string>
+2
View File
@@ -3085,6 +3085,8 @@
<string name="library_in">Kütüphane içinde</string>
<string name="xbox_filter_show">Göster</string>
<string name="itch_collections">Koleksiyonlar</string>
<string name="stores_itch_updates_found">Mevcut güncellemeler: %1$d</string>
<string name="stores_itch_update_replaced">Geliştirici bu sürümü %1$s ile değiştirdi. Ona güncellensin mi?</string>
<string name="xbox_filter_cloud">Bulut</string>
<string name="stores_xbox_cloud_settings">Bulut ayarları</string>
<string name="apps_search_hint">Uygulama ara</string>
+2
View File
@@ -3151,6 +3151,8 @@
<string name="library_in">У бібліотеці</string>
<string name="xbox_filter_show">Показати</string>
<string name="itch_collections">Колекції</string>
<string name="stores_itch_updates_found">Доступні оновлення: %1$d</string>
<string name="stores_itch_update_replaced">Розробник замінив цю збірку на %1$s. Оновити до неї?</string>
<string name="xbox_filter_cloud">Хмара</string>
<string name="stores_xbox_cloud_settings">Налаштування хмари</string>
<string name="apps_search_hint">Пошук застосунків</string>
+2
View File
@@ -3058,6 +3058,8 @@
<string name="library_in">Trong Thư viện</string>
<string name="xbox_filter_show">Hiển thị</string>
<string name="itch_collections">Bộ sưu tập</string>
<string name="stores_itch_updates_found">Có bản cập nhật: %1$d</string>
<string name="stores_itch_update_replaced">Nhà phát triển đã thay bản dựng này bằng %1$s. Cập nhật lên bản đó?</string>
<string name="xbox_filter_cloud">Đám mây</string>
<string name="stores_xbox_cloud_settings">Cài đặt đám mây</string>
<string name="apps_search_hint">Tìm ứng dụng</string>
@@ -3066,6 +3066,8 @@
<string name="library_in">已在游戏库</string>
<string name="xbox_filter_show">显示</string>
<string name="itch_collections">收藏集</string>
<string name="stores_itch_updates_found">可用更新:%1$d</string>
<string name="stores_itch_update_replaced">开发者已将此版本替换为 %1$s。要更新到该版本吗?</string>
<string name="xbox_filter_cloud">云</string>
<string name="stores_xbox_cloud_settings">云设置</string>
<string name="apps_search_hint">搜索应用</string>
@@ -3065,6 +3065,8 @@
<string name="library_in">已在收藏庫</string>
<string name="xbox_filter_show">顯示</string>
<string name="itch_collections">收藏集</string>
<string name="stores_itch_updates_found">可用更新:%1$d</string>
<string name="stores_itch_update_replaced">開發者已將此版本替換為 %1$s。要更新到該版本嗎?</string>
<string name="xbox_filter_cloud">雲端</string>
<string name="stores_xbox_cloud_settings">雲端設定</string>
<string name="apps_search_hint">搜尋應用程式</string>
@@ -3065,6 +3065,8 @@
<string name="library_in">已在收藏庫</string>
<string name="xbox_filter_show">顯示</string>
<string name="itch_collections">收藏集</string>
<string name="stores_itch_updates_found">可用更新:%1$d</string>
<string name="stores_itch_update_replaced">開發者已將此版本替換為 %1$s。要更新到該版本嗎?</string>
<string name="xbox_filter_cloud">雲端</string>
<string name="stores_xbox_cloud_settings">雲端設定</string>
<string name="apps_search_hint">搜尋應用程式</string>
+2
View File
@@ -3291,6 +3291,8 @@
<string name="library_in">In Library</string>
<string name="xbox_filter_show">Show</string>
<string name="itch_collections">Collections</string>
<string name="stores_itch_updates_found">Updates available: %1$d</string>
<string name="stores_itch_update_replaced">The developer replaced this build with %1$s. Update to it?</string>
<string name="xbox_filter_cloud">Cloud</string>
<string name="stores_xbox_cloud_settings">Cloud settings</string>
<string name="xbox_cloud_gaming" translatable="false">Xbox Cloud Gaming</string>