Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a5dfbb1
added initial download view w/steam support
eredisg Mar 12, 2026
d05ce1e
Merge branch 'master' of https://github.com/eredisg/GameNative
eredisg Mar 12, 2026
cb6e979
added initial epic games support
eredisg Mar 13, 2026
aa9e92a
added initial GOG support
eredisg Mar 13, 2026
3a8a03e
added initial amazon games support
eredisg Mar 13, 2026
f62d3e0
updated DownloadsViewModel.kt
eredisg Mar 13, 2026
11a80c4
added partial_install column to db and updated amazon, gog, and epic
eredisg Mar 14, 2026
94aa7b1
moved downloads screen to sidebar
eredisg Mar 14, 2026
d579277
added the ability to resume downloading
eredisg Mar 14, 2026
3bca522
removed duplicative code
eredisg Mar 14, 2026
fa86c33
Add global container storage manager
xXJSONDeruloXx Mar 11, 2026
9ecbfd2
Refine container manager UI and logging
xXJSONDeruloXx Mar 11, 2026
ea6c9fd
fix: add edge cases for container without install, install without co…
xXJSONDeruloXx Mar 11, 2026
cac5164
feat: allow move to ext or int if enabled
xXJSONDeruloXx Mar 12, 2026
800d134
feat: move storage manager into downloads tab
xXJSONDeruloXx Mar 14, 2026
0b65053
Refine downloads and storage manager sidebar UI
xXJSONDeruloXx Mar 14, 2026
c4d58d4
Merge remote-tracking branch 'upstream/master' into feat/downloads-st…
xXJSONDeruloXx Mar 14, 2026
23749c3
Merge remote-tracking branch 'upstream/master' into feat/downloads-st…
xXJSONDeruloXx Mar 15, 2026
9833f61
Merge remote-tracking branch 'origin/feat/downloads-storage-manager-t…
xXJSONDeruloXx Mar 15, 2026
646fd66
Fixed portrait mode issue with download view
eredisg Mar 17, 2026
7fc4416
Merge pull request #12 from eredisg/feat/downloads-storage-manager-tab
xXJSONDeruloXx Mar 17, 2026
7ebc53e
Merge remote-tracking branch 'upstream/master' into feat/downloads-st…
xXJSONDeruloXx Mar 20, 2026
81341c3
feat: improve downloads manager
xXJSONDeruloXx Mar 20, 2026
83dde8d
chore: make focus colors consistent purple, update header names and t…
xXJSONDeruloXx Mar 22, 2026
ee1c6f2
Refine downloads and storage manager UI
xXJSONDeruloXx Mar 22, 2026
274240d
Merge remote-tracking branch 'upstream/master' into feat/downloads-st…
xXJSONDeruloXx Mar 22, 2026
b320045
fix: move downloads pause cancel off main thread
xXJSONDeruloXx Mar 22, 2026
fe422a8
Fix manifest driver id for CI
xXJSONDeruloXx Mar 22, 2026
780bb31
Merge remote-tracking branch 'upstream/master' into feat/downloads-st…
xXJSONDeruloXx Mar 25, 2026
193c451
fix: restore inbound moves and amazon download details
xXJSONDeruloXx Mar 25, 2026
fd3d2ed
fix: remove stale friends home destination
xXJSONDeruloXx Mar 25, 2026
0ec73b7
fix: drop download speed from downloads manager
xXJSONDeruloXx Mar 25, 2026
79841f9
refactor: dedupe partial download detection
xXJSONDeruloXx Mar 25, 2026
1525e13
fix: add translations for downloads and storage
xXJSONDeruloXx Mar 25, 2026
611c1b2
fix(downloads): remove manager polling and reuse known sizes
xXJSONDeruloXx Mar 27, 2026
96ff5ae
fix(downloads): avoid full library partial-download scans
xXJSONDeruloXx Mar 27, 2026
a1c6ea3
fix(downloads): address cubic follow-up findings
xXJSONDeruloXx Mar 27, 2026
d43a6d9
fix(downloads): coalesce refreshes and estimate Steam sizes
xXJSONDeruloXx Mar 27, 2026
508333b
fix(downloads): preserve initial refresh and filter Steam size estimates
xXJSONDeruloXx Mar 27, 2026
8a067ac
fix(storage): use lightweight Steam depot size estimates
xXJSONDeruloXx Mar 27, 2026
f5e607e
fix(storage): estimate Steam sizes from installed depots
xXJSONDeruloXx Mar 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,194 changes: 1,194 additions & 0 deletions app/schemas/app.gamenative.db.PluviaDatabase/14.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions app/src/main/java/app/gamenative/data/AmazonGame.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ data class AmazonGame(
@ColumnInfo("is_installed")
val isInstalled: Boolean = false,

@ColumnInfo(name = "partial_install", defaultValue = "0")
val partialInstall: Boolean = false,

@ColumnInfo("install_path")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this? doesn't seem like we should be adding this, we should track partial installs the same way we do for GOG, Epic, Steam. No need to add a new column.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, I just saw that we're adding this column for GOG and Epic also. Are you sure this is necessary? We can already track partial installs by looking for the .DOWNLOAD_COMPLETED marker. We already do it in several places. I understand that it might be needed as a quick query, but this DB marker seems like something that will get out of sync

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we can just use download completed in marker utils and that lets us remove the room increment and db changes. Done

val installPath: String = "",

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/app/gamenative/data/EpicGame.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ data class EpicGame(
@ColumnInfo("is_installed")
val isInstalled: Boolean = false,

@ColumnInfo(name = "partial_install", defaultValue = "0")
val partialInstall: Boolean = false,

@ColumnInfo("install_path")
val installPath: String = "",

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/app/gamenative/data/GOGGame.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ data class GOGGame(
@ColumnInfo("is_installed")
val isInstalled: Boolean = false,

@ColumnInfo(name = "partial_install", defaultValue = "0")
val partialInstall: Boolean = false,

@ColumnInfo("install_path")
val installPath: String = "",

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/app/gamenative/db/PluviaDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const val DATABASE_NAME = "pluvia.db"
AmazonGame::class,
DownloadingAppInfo::class
],
version = 13,
version = 14,
// For db migration, visit https://developer.android.com/training/data-storage/room/migrating-db-versions for more information
exportSchema = true, // It is better to handle db changes carefully, as GN is getting much more users.
autoMigrations = [
Expand All @@ -60,6 +60,7 @@ const val DATABASE_NAME = "pluvia.db"
AutoMigration(from = 10, to = 11),
AutoMigration(from = 11, to = 12),
AutoMigration(from = 12, to = 13), // Added amazon_games table
AutoMigration(from = 13, to = 14), // Added partial_install column to epic_games, gog_games, amazon_games
]
)
@TypeConverters(
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/java/app/gamenative/db/dao/AmazonGameDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,21 @@ interface AmazonGameDao {
@Query("SELECT * FROM amazon_games ORDER BY title ASC")
suspend fun getAllAsList(): List<AmazonGame>

@Query("SELECT * FROM amazon_games WHERE is_installed = 0")
suspend fun getNonInstalledGames(): List<AmazonGame>

@Query("SELECT * FROM amazon_games WHERE partial_install = 1")
suspend fun getPartialDownloads(): List<AmazonGame>

@Query("UPDATE amazon_games SET partial_install = 1 WHERE product_id = :productId")
suspend fun markAsPartialInstall(productId: String)

@Query(
"UPDATE amazon_games SET is_installed = 1, install_path = :path, install_size = :size, version_id = :versionId WHERE product_id = :productId",
"UPDATE amazon_games SET is_installed = 1, partial_install = 0, install_path = :path, install_size = :size, version_id = :versionId WHERE product_id = :productId",
)
suspend fun markAsInstalled(productId: String, path: String, size: Long, versionId: String)

@Query("UPDATE amazon_games SET is_installed = 0, install_path = '', install_size = 0, version_id = '' WHERE product_id = :productId")
@Query("UPDATE amazon_games SET is_installed = 0, partial_install = 0, install_path = '', install_size = 0, version_id = '' WHERE product_id = :productId")
suspend fun markAsUninstalled(productId: String)

@Query("UPDATE amazon_games SET download_size = :size WHERE product_id = :productId")
Expand Down Expand Up @@ -71,6 +80,7 @@ interface AmazonGameDao {
newGame.copy(
appId = existing.appId, // Keep the existing appId
isInstalled = existing.isInstalled,
partialInstall = existing.partialInstall,
installPath = existing.installPath,
installSize = existing.installSize,
versionId = existing.versionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ interface DownloadingAppInfoDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(appInfo: DownloadingAppInfo)

@Query("SELECT * FROM downloading_app_info")
suspend fun getAll(): List<DownloadingAppInfo>

@Query("SELECT * FROM downloading_app_info WHERE appId = :appId")
suspend fun getDownloadingApp(appId: Int): DownloadingAppInfo?

Expand Down
9 changes: 8 additions & 1 deletion app/src/main/java/app/gamenative/db/dao/EpicGameDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface EpicGameDao {
@Delete
suspend fun delete(game: EpicGame)

@Query("UPDATE epic_games SET is_installed = 0, install_path='',install_size = 0 WHERE id = :appId")
@Query("UPDATE epic_games SET is_installed = 0, partial_install = 0, install_path='',install_size = 0 WHERE id = :appId")
suspend fun uninstall(appId: Int)

@Query("DELETE FROM epic_games WHERE id = :appId")
Expand All @@ -53,9 +53,15 @@ interface EpicGameDao {
@Query("SELECT * FROM epic_games WHERE is_dlc = 0 AND namespace != 'ue' AND namespace != '89efe5924d3d467c839449ab6ab52e7f' ORDER BY title ASC")
fun getAll(): Flow<List<EpicGame>>

@Query("SELECT * FROM epic_games WHERE is_dlc = 0 AND namespace != 'ue' AND namespace != '89efe5924d3d467c839449ab6ab52e7f' ORDER BY title ASC")
suspend fun getAllAsList(): List<EpicGame>

@Query("SELECT * FROM epic_games WHERE is_installed = :isInstalled ORDER BY title ASC")
fun getByInstallStatus(isInstalled: Boolean): Flow<List<EpicGame>>

@Query("SELECT * FROM epic_games WHERE partial_install = 1")
suspend fun getPartialDownloads(): List<EpicGame>

@Query("SELECT * FROM epic_games WHERE base_game_app_name = (SELECT catalog_id FROM epic_games WHERE id = :appId)")
fun getDLCForTitle(appId: Int): Flow<List<EpicGame>>

Expand Down Expand Up @@ -92,6 +98,7 @@ interface EpicGameDao {
newGame.copy(
id = existingGame.id,
isInstalled = existingGame.isInstalled,
partialInstall = existingGame.partialInstall,
installPath = existingGame.installPath,
installSize = existingGame.installSize,
lastPlayed = existingGame.lastPlayed,
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/app/gamenative/db/dao/GOGGameDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ interface GOGGameDao {
@Query("SELECT * FROM gog_games WHERE is_installed = :isInstalled AND exclude = 0 ORDER BY title ASC")
fun getByInstallStatus(isInstalled: Boolean): Flow<List<GOGGame>>

@Query("SELECT * FROM gog_games WHERE is_installed = 0 AND exclude = 0")
suspend fun getNonInstalledGames(): List<GOGGame>

@Query("SELECT * FROM gog_games WHERE partial_install = 1")
suspend fun getPartialDownloads(): List<GOGGame>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

@Query("SELECT * FROM gog_games WHERE exclude = 0 AND title LIKE '%' || :searchQuery || '%' ORDER BY title ASC")
fun searchByTitle(searchQuery: String): Flow<List<GOGGame>>

Expand All @@ -67,6 +73,7 @@ interface GOGGameDao {
// Preserve installation status, path, and size from existing game
val gameToInsert = newGame.copy(
isInstalled = existingGame.isInstalled,
partialInstall = existingGame.partialInstall,
installPath = existingGame.installPath,
installSize = existingGame.installSize,
lastPlayed = existingGame.lastPlayed,
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/app/gamenative/db/dao/SteamAppDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ interface SteamAppDao {
// borrowedCode: Int = ELicenseFlags.Borrowed.code(),
): Flow<List<SteamApp>>

@Query(
"SELECT * FROM steam_app " +
"WHERE id != 480 " +
Comment thread
xXJSONDeruloXx marked this conversation as resolved.
"AND package_id != :invalidPkgId " +
"AND type != 0 " +
"ORDER BY LOWER(name)",
)
suspend fun getAllOwnedAppsAsList(
invalidPkgId: Int = INVALID_PKG_ID,
): List<SteamApp>

@Query("SELECT * FROM steam_app WHERE received_pics = 0 AND package_id != :invalidPkgId AND owner_account_id = :ownerId")
fun getAllOwnedAppsWithoutPICS(
ownerId: Int,
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/app/gamenative/service/SteamService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,15 @@ class SteamService : Service(), IChallengeUrlChanged {
return downloadJobs[appId]
}

fun getActiveDownloads(): Map<Int, DownloadInfo> = HashMap(downloadJobs)

suspend fun getPartialDownloads(): List<Int> {
return instance?.downloadingAppInfoDao?.getAll()
Comment thread
xXJSONDeruloXx marked this conversation as resolved.
?.map { it.appId }
?.filter { appId -> !downloadJobs.containsKey(appId) }
?: emptyList()
}
Comment thread
xXJSONDeruloXx marked this conversation as resolved.

fun isAppInstalled(appId: Int): Boolean {
return MarkerUtils.hasMarker(getAppDirPath(appId), Marker.DOWNLOAD_COMPLETE_MARKER)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,26 @@ object AmazonConstants {
// ── SDK / Launcher channel ──────────────────────────────────────────────
const val LAUNCHER_CHANNEL_ID = "87d38116-4cbf-4af0-a371-a5b498975346"

fun internalAmazonGamesPath(context: Context): String {
val path = Paths.get(context.dataDir.path, "Amazon").toString()
File(path).mkdirs()
return path
}

fun externalAmazonGamesPath(): String {
val path = Paths.get(PrefManager.externalStoragePath, "Amazon", "games").toString()
File(path).mkdirs()
return path
}

fun defaultAmazonGamesPath(context: Context): String {
return if (PrefManager.useExternalStorage && File(PrefManager.externalStoragePath).exists()) {
val path = Paths.get(PrefManager.externalStoragePath, "Amazon", "games").toString()
val path = externalAmazonGamesPath()
Timber.i("Amazon using external storage: $path")
File(path).mkdirs()
path
} else {
val path = Paths.get(context.dataDir.path, "Amazon").toString()
val path = internalAmazonGamesPath(context)
Timber.i("Amazon using internal storage: $path")
File(path).mkdirs()
path
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class AmazonDownloadManager @Inject constructor(
File(installPath).mkdirs()
MarkerUtils.addMarker(installPath, Marker.DOWNLOAD_IN_PROGRESS_MARKER)

// Mark as partial install in DB so Downloads screen can detect it
amazonManager.markAsPartialInstall(productId)
Comment thread
xXJSONDeruloXx marked this conversation as resolved.
Outdated

// Helper to cleanup marker on early failure
fun cleanupOnFailure() {
MarkerUtils.removeMarker(installPath, Marker.DOWNLOAD_IN_PROGRESS_MARKER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ class AmazonManager @Inject constructor(
amazonGameDao.getAllAsList()
}

/** Return non-installed Amazon games from DB. */
suspend fun getNonInstalledGames(): List<AmazonGame> = withContext(Dispatchers.IO) {
amazonGameDao.getNonInstalledGames()
}

/** Return games with partial_install = true from DB. */
suspend fun getPartialDownloads(): List<AmazonGame> = withContext(Dispatchers.IO) {
amazonGameDao.getPartialDownloads()
}

/** Mark a game as partially installed (download started but not complete). */
suspend fun markAsPartialInstall(productId: String) = withContext(Dispatchers.IO) {
amazonGameDao.markAsPartialInstall(productId)
}

/** Mark a game as installed and persist install metadata. */
suspend fun markInstalled(productId: String, installPath: String, installSize: Long, versionId: String = "") =
withContext(Dispatchers.IO) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,16 @@ class AmazonService : Service() {
fun getDownloadInfo(productId: String): DownloadInfo? =
getInstance()?.activeDownloads?.get(productId)

fun getActiveDownloads(): Map<String, DownloadInfo> =
getInstance()?.activeDownloads?.let { HashMap(it) } ?: emptyMap()

suspend fun getPartialDownloads(context: Context): List<String> {
val instance = getInstance() ?: return emptyList()
Comment thread
xXJSONDeruloXx marked this conversation as resolved.
return instance.amazonManager.getPartialDownloads()
.map { it.productId }
.filter { !instance.activeDownloads.containsKey(it) }
}

/** Returns the active [DownloadInfo] for [appId], or null if not downloading. */
fun getDownloadInfoByAppId(appId: Int): DownloadInfo? {
val productId = getProductIdByAppId(appId) ?: return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ class EpicDownloadManager @Inject constructor(
File(installPath).mkdirs()
MarkerUtils.addMarker(installPath, Marker.DOWNLOAD_IN_PROGRESS_MARKER)

// Mark as partial install in DB so Downloads screen can detect it
epicManager.updateGame(game.copy(partialInstall = true))
Comment thread
xXJSONDeruloXx marked this conversation as resolved.
Outdated

// Emit download started event so UI can attach progress listeners
val gameId = game.id
app.gamenative.PluviaApp.events.emitJava(
Expand Down Expand Up @@ -345,6 +348,7 @@ class EpicDownloadManager @Inject constructor(
try {
val updatedGame = game.copy(
isInstalled = true,
partialInstall = false,
installPath = installPath,
installSize = totalInstalledSize,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class EpicManager @Inject constructor(
}

// Skip invalid platform (such as Android versions)
if(platforms.isNotEmpty() && !platforms.contains("Win32") && !platforms.contains("Windows")){
if(platforms.isNotEmpty() && !platforms.contains("Win32") && !platforms.contains("Windows")){
Timber.tag("Epic").d("Skipping due to invalid platform: $appName (namespace=$namespace, sandbox=$sandboxType)")
continue
}
Expand Down Expand Up @@ -718,6 +718,12 @@ class EpicManager @Inject constructor(
}
}

suspend fun getPartialDownloads(): List<EpicGame> {
return withContext(Dispatchers.IO) {
epicGameDao.getPartialDownloads()
}
}

/**
* Start background sync (called after login)
*/
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/app/gamenative/service/epic/EpicService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ class EpicService : Service() {
return getInstance()?.activeDownloads?.get(appId)
}

fun getActiveDownloads(): Map<Int, DownloadInfo> =
getInstance()?.activeDownloads?.let { HashMap(it) } ?: emptyMap()

suspend fun getPartialDownloads(): List<Int> {
val instance = getInstance() ?: return emptyList()
return instance.epicManager.getPartialDownloads()
.map { it.id }
.filter { appId -> !instance.activeDownloads.containsKey(appId) }
}

suspend fun deleteGame(context: Context, appId: Int): Result<Unit> {
val instance = getInstance()
if (instance == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ class GOGDownloadManager @Inject constructor(
installPath.mkdirs()
MarkerUtils.addMarker(installPath.absolutePath, Marker.DOWNLOAD_IN_PROGRESS_MARKER)

// Mark as partial install in DB so Downloads screen can detect it
val currentGame = gogManager.getGameFromDbById(gameId)
if (currentGame != null) {
gogManager.updateGame(currentGame.copy(partialInstall = true))
Comment thread
xXJSONDeruloXx marked this conversation as resolved.
Outdated
Comment thread
xXJSONDeruloXx marked this conversation as resolved.
Outdated
}
Comment thread
xXJSONDeruloXx marked this conversation as resolved.
Outdated

downloadInfo.updateStatusMessage("Downloading chunks...")

val chunkCacheDir = File(installPath, ".gog_chunks")
Expand Down Expand Up @@ -500,7 +506,7 @@ class GOGDownloadManager @Inject constructor(
val game = gogManager.getGameFromDbById(gameId)
if (game != null) {
val installSize = calculateDirectorySize(installPath)
gogManager.updateGame(game.copy(isInstalled = true, installPath = installPath.absolutePath, installSize = installSize))
gogManager.updateGame(game.copy(isInstalled = true, partialInstall = false, installPath = installPath.absolutePath, installSize = installSize))
Timber.tag("GOG").i("Updated database: game marked as installed, size: ${installSize / 1_000_000} MB")
} else {
Timber.tag("GOG").w("Game $gameId not found in database, skipping DB update")
Expand Down
16 changes: 9 additions & 7 deletions app/src/main/java/app/gamenative/service/gog/GOGManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ class GOGManager @Inject constructor(
}
}

suspend fun getPartialDownloads(): List<GOGGame> {
return withContext(Dispatchers.IO) { gogGameDao.getPartialDownloads() }
}

suspend fun insertGame(game: GOGGame) {
withContext(Dispatchers.IO) {
gogGameDao.insert(game)
Expand Down Expand Up @@ -492,13 +496,11 @@ class GOGManager @Inject constructor(
MarkerUtils.removeMarker(installPath, Marker.DOWNLOAD_COMPLETE_MARKER)
MarkerUtils.removeMarker(installPath, Marker.DOWNLOAD_IN_PROGRESS_MARKER)

if (wasInstalled) {
val game = getGameFromDbById(gameId)
if (game != null) {
val updatedGame = game.copy(isInstalled = false, installPath = "")
gogGameDao.update(updatedGame)
Timber.d("Updated database: game marked as not installed")
}
val game = getGameFromDbById(gameId)
if (game != null && (wasInstalled || game.partialInstall)) {
Comment thread
xXJSONDeruloXx marked this conversation as resolved.
Outdated
val updatedGame = game.copy(isInstalled = false, partialInstall = false, installPath = "")
gogGameDao.update(updatedGame)
Timber.d("Updated database: game marked as not installed")
}

withContext(Dispatchers.Main) {
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/app/gamenative/service/gog/GOGService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ class GOGService : Service() {
return getInstance()?.activeDownloads?.get(gameId)
}

fun getActiveDownloads(): Map<String, DownloadInfo> =
getInstance()?.activeDownloads?.let { HashMap(it) } ?: emptyMap()

suspend fun getPartialDownloads(): List<String> {
val instance = getInstance() ?: return emptyList()
return instance.gogManager.getPartialDownloads()
.map { it.id }
.filter { gameId -> !instance.activeDownloads.containsKey(gameId) }
}

fun cleanupDownload(gameId: String) {
getInstance()?.activeDownloads?.remove(gameId)
}
Expand Down
Loading
Loading