-
-
Notifications
You must be signed in to change notification settings - Fork 158
Feat: Game Manager #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feat: Game Manager #366
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
267e150
Implements game content management dialog
joshuatam 30b0aa6
fix gog compatibility
joshuatam 9fddd01
Updates JavaSteam dependency and persists progress
joshuatam 109ef51
Removed runBlocking call for completeAppDownload
8872e05
Cache to reduce blocking database hits, only show install size for ne…
6531224
Removed debug = true for DepotDownloader
c72e032
Request storage permissions when opening game manager dialog
1906ee2
Merge pull request #2 from utkarshdalal/feat/game-manager-utkarsh2
joshuatam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
app/src/main/java/app/gamenative/data/DownloadingAppInfo.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package app.gamenative.data | ||
|
|
||
| import androidx.room.ColumnInfo | ||
| import androidx.room.Entity | ||
| import androidx.room.PrimaryKey | ||
|
|
||
| @Entity("downloading_app_info") | ||
| data class DownloadingAppInfo ( | ||
| @PrimaryKey | ||
| val appId: Int, | ||
|
|
||
| @ColumnInfo("dlcAppIds") | ||
| val dlcAppIds: List<Int> = emptyList<Int>() | ||
| ){} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/src/main/java/app/gamenative/db/dao/DownloadingAppInfoDao.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package app.gamenative.db.dao | ||
|
|
||
| import androidx.room.Dao | ||
| import androidx.room.Insert | ||
| import androidx.room.OnConflictStrategy | ||
| import androidx.room.Query | ||
| import app.gamenative.data.DownloadingAppInfo | ||
|
|
||
| @Dao | ||
| interface DownloadingAppInfoDao { | ||
| @Insert(onConflict = OnConflictStrategy.REPLACE) | ||
| suspend fun insert(appInfo: DownloadingAppInfo) | ||
|
|
||
| @Query("SELECT * FROM downloading_app_info WHERE appId = :appId") | ||
| suspend fun getDownloadingApp(appId: Int): DownloadingAppInfo? | ||
|
|
||
| @Query("DELETE from downloading_app_info WHERE appId = :appId") | ||
| suspend fun deleteApp(appId: Int) | ||
|
|
||
| @Query("DELETE from downloading_app_info") | ||
| suspend fun deleteAll() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,11 +44,20 @@ interface SteamAppDao { | |
| @Query("SELECT * FROM steam_app WHERE id = :appId") | ||
| suspend fun findApp(appId: Int): SteamApp? | ||
|
|
||
| @Query("SELECT * FROM steam_app AS app WHERE dlc_for_app_id = :appId AND " + | ||
| @Query("SELECT * FROM steam_app AS app WHERE dlc_for_app_id = :appId AND depots <> '{}' AND " + | ||
| " EXISTS (" + | ||
| " SELECT * FROM steam_license AS license " + | ||
| " WHERE license.license_type <> 0 AND " + | ||
| " REPLACE(REPLACE(app_ids, '[', ','), ']', ',') LIKE ('%,' || app.id || ',%') " + | ||
| " REPLACE(REPLACE(license.app_ids, '[', ','), ']', ',') LIKE ('%,' || app.id || ',%') " + | ||
| ")" | ||
| ) | ||
| suspend fun findDownloadableDLCApps(appId: Int): List<SteamApp>? | ||
|
|
||
| @Query("SELECT * FROM steam_app AS app WHERE dlc_for_app_id = :appId AND depots = '{}' AND " + | ||
| " EXISTS (" + | ||
| " SELECT * FROM steam_license AS license " + | ||
| " WHERE license.license_type <> 0 AND " + | ||
| " REPLACE(REPLACE(license.app_ids, '[', ','), ']', ',') LIKE ('%,' || app.id || ',%') " + | ||
|
Comment on lines
+47
to
+60
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question - why did we need to split this into two different queries, one with Why not leave out the depots clause entirely? |
||
| ")" | ||
| ) | ||
| suspend fun findHiddenDLCApps(appId: Int): List<SteamApp>? | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Encapsulate the mutable collection to prevent external modification.
Exposing
downloadingAppIdsas a public mutablevarallows external code to reassign or modify the list, which could lead to inconsistent state or unexpected behavior. Consider exposing it as a read-onlyListwith controlled mutation methods, or at minimum make itvalto prevent reassignment.🔎 Proposed fix to expose as read-only
If callers need to replace the entire list, retain the current design but change
vartoval:🤖 Prompt for AI Agents