Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
16ece22
add the gogdl files and python support.
phobos665 Dec 2, 2025
edee90e
Initial data models and adjustments to overall managers to allow for …
phobos665 Dec 2, 2025
9b535d7
WIP understanding how the manager and app screen work
phobos665 Dec 2, 2025
a6f1137
WIP initial work and working on the automatic authentication via oAuth.
phobos665 Dec 4, 2025
5069b7d
coroutine async fix
phobos665 Dec 4, 2025
26a4c05
WIP gog integration.
phobos665 Dec 4, 2025
c26e586
updating the game screen for gog
phobos665 Dec 7, 2025
cdc34c5
Updating syncing.
phobos665 Dec 7, 2025
b0c07fd
fixed issue with library parsing and images.
phobos665 Dec 8, 2025
0dec3b1
download progress
phobos665 Dec 8, 2025
c6721a1
finished download/delete
phobos665 Dec 8, 2025
543e9fe
configuring launching exe files
phobos665 Dec 8, 2025
15ea8a7
removed experimenting the auth flow.
phobos665 Dec 9, 2025
4a1720e
removed the broken auth intent work
phobos665 Dec 9, 2025
df86782
again
phobos665 Dec 9, 2025
6728524
Merge branch 'master' of github.com-phobos665:phobos665/GameNative in…
phobos665 Dec 9, 2025
3590f9d
Icon fix
phobos665 Dec 9, 2025
87475d1
WIP
phobos665 Dec 12, 2025
92cc363
icon
phobos665 Dec 12, 2025
7775600
WIP refactor to have separation of concerns for GOG-related functiona…
phobos665 Dec 15, 2025
92c6026
WIP refactor
phobos665 Dec 15, 2025
f80e93e
removed hilt code. Not required.
phobos665 Dec 15, 2025
c67c148
revert changes on MainActivity
phobos665 Dec 15, 2025
d50f0ea
Fixed downloading and the install count.
phobos665 Dec 15, 2025
6219f88
Fixing counts for GOG based on PrefManager.
phobos665 Dec 15, 2025
c00a390
Now visually shows title is installed.
phobos665 Dec 15, 2025
67a5d70
Working through fix for install dir
phobos665 Dec 15, 2025
d65a230
Merge branch 'master' of github.com-phobos665:utkarshdalal/GameNative…
phobos665 Dec 15, 2025
a83605a
remvoed unneeded code
phobos665 Dec 15, 2025
6e08583
Removing unneeded comments
phobos665 Dec 15, 2025
7a9f730
Migrated the strings to templating and adjusted some conditional logi…
phobos665 Dec 15, 2025
f63fcd5
Making some more readable changes with early return pattern
phobos665 Dec 15, 2025
e578b4c
Adjusted logs and comments. Removed stubbed function that we can do i…
phobos665 Dec 15, 2025
fc6ae19
Added error toast when it could not start browser
phobos665 Dec 15, 2025
5e89db6
fixing conditional and some formatting mistakes
phobos665 Dec 15, 2025
8712d9b
fix(): removing some logs and bringing in some early returns to reduc…
phobos665 Dec 18, 2025
08e33fb
Updated python files and library based on critical coderabbitai feedb…
phobos665 Dec 18, 2025
2a1d6ee
Pull out deletion logic from UI and utilize the GOGManager deleteGame.
phobos665 Dec 18, 2025
2e6c6ad
Refactored out the performDownload to the GOGManager.
phobos665 Dec 18, 2025
e8fa263
removed credential logging. Whoops!
phobos665 Dec 18, 2025
429db90
remove logging username debug
phobos665 Dec 18, 2025
b4893da
removed authcode from debug log
phobos665 Dec 18, 2025
bd0ddd4
python timeouts and removed some unused functions from GOGManager.
phobos665 Dec 18, 2025
e5f8853
removed function from GOGService
phobos665 Dec 18, 2025
f52a76e
Adjusting game executable for better error handling
phobos665 Dec 18, 2025
0e868a0
fixing types for the events
phobos665 Dec 18, 2025
880ae1f
Adjusted the text strings for the GOG Login to tell them about having…
phobos665 Dec 18, 2025
232b1ec
Fixing up game details, syncing and downloading bugs.
phobos665 Dec 18, 2025
431a818
File dir fixes, detection of already installed gog games and progress…
phobos665 Dec 18, 2025
3c46957
Fixed install size when game finishes downloading.
phobos665 Dec 18, 2025
5d2b64e
Fixed issue where GOGService did not start after logging into GOG.
phobos665 Dec 18, 2025
a149486
Updated text to give better instructions
phobos665 Dec 18, 2025
7356f34
strings, memory leak fixx and reduplication of code in settings
phobos665 Dec 18, 2025
f9ad4eb
Updated the dialog to parse the code using regex if they paste the en…
phobos665 Dec 19, 2025
ba33480
Updated the strings to ensure that we can instruct user to paste in t…
phobos665 Dec 19, 2025
d99f2ea
Refactored to run a background sync if the gog service start function…
phobos665 Dec 19, 2025
d7c0a05
Added message that we will sync the library for GOG.
phobos665 Dec 19, 2025
01699fc
Fix issue where UI didn't update if the download got broken.
phobos665 Dec 19, 2025
c87d0ac
Fixed prefixing and reduced timeout on sending progress bar updates t…
phobos665 Dec 20, 2025
384e1e7
Merge branch 'master' of github.com-phobos665:utkarshdalal/GameNative…
phobos665 Dec 21, 2025
63dafe7
Updated fix regarding the Steam Service that broke the depot downlade…
phobos665 Dec 21, 2025
9c5dd46
Updated the MainViewModel to not show the feedback UI if it's not a S…
phobos665 Dec 21, 2025
764cd0f
Fetching improvements by only getting a batch of IDs. Maybe we don't …
phobos665 Dec 21, 2025
56fd623
update fetching functionality for gog
phobos665 Dec 21, 2025
360f21b
Updating the fetching of games.
phobos665 Dec 21, 2025
51e2773
Fixed refreshSingleGame just to only grab details for the specific ga…
phobos665 Dec 21, 2025
f364f36
removing comments and adjusting the logs.
phobos665 Dec 21, 2025
8b0489b
Batch procesing test.
phobos665 Dec 21, 2025
a043952
Added batch size
phobos665 Dec 21, 2025
e44830d
Removed singular as not needed.
phobos665 Dec 21, 2025
e42ebfb
reverted name for clean PR
phobos665 Dec 21, 2025
92d58ec
Merge pull request #6 from phobos665/gog-fetch-improvement
phobos665 Dec 22, 2025
5e5a5d7
Merge branch 'master' of github.com-phobos665:utkarshdalal/GameNative…
phobos665 Dec 22, 2025
3f56814
Reverting Steam hotfix now that upstream is fixed.
phobos665 Dec 22, 2025
9f2d4b2
Reduced batch size to 10 and removed parseGamesfromJson as we no long…
phobos665 Dec 22, 2025
f33168c
Updated the check to be more simplistic to reduce CPU overhead.
phobos665 Dec 22, 2025
aff6cef
Updated Login UI to point out success url pasting
phobos665 Dec 22, 2025
d990f27
Removed manual sync and reduced CPU overhead for gog lib filtering.
phobos665 Dec 22, 2025
f610154
Fixed issue where the libViewmodel was siezing up. This is the final …
phobos665 Dec 22, 2025
14d74a7
Now ignores invalid games from GOG. Should eliminate the weird issue …
phobos665 Dec 22, 2025
f93f265
Reverted the downloadClick default as we don't need to change this.
phobos665 Dec 22, 2025
1650508
Reverting some changes that aren't required.
phobos665 Dec 22, 2025
70ef1be
Fixed whitespacing
phobos665 Dec 22, 2025
89fdaa4
revert whitespace
phobos665 Dec 22, 2025
8cdaec2
Update to avoid using runBlocking for GOG function on ContainerUtils
phobos665 Dec 22, 2025
b6c5c6b
Removed unneeded GOG bit
phobos665 Dec 22, 2025
4a090c0
Updated translations
phobos665 Dec 22, 2025
cc7b7c2
reverted the runBlocking.
phobos665 Dec 22, 2025
bcca5ac
Updated the GOG images to just use the iconHash. The other is not wor…
phobos665 Dec 22, 2025
afacff6
Removed unused image-related code from GOGGame.
phobos665 Dec 22, 2025
146c54a
Fixed issue where Steam games weren't populating on load.
phobos665 Dec 22, 2025
7435974
Performance fix for the LibraryViewModel to reduce blocking
phobos665 Dec 23, 2025
04dd102
Added fix for gradle duplication
phobos665 Dec 23, 2025
844dd5a
Fixed issue where I was forcing the GOG .exe instead of using the sel…
phobos665 Dec 23, 2025
65bae51
GOGManager now automatically downloads all the DLC for the game. Comp…
phobos665 Dec 23, 2025
5efe930
Fixed issue where the path wasn't configured correctly for GOG games.
phobos665 Dec 25, 2025
2d8c8a7
Merge branch 'master' into gog-integration
Dec 31, 2025
4040eec
Merge branch 'master' into gog-integration
Dec 31, 2025
d9a8f4b
added cloud saves to GOG (not tested)
Dec 31, 2025
02a0911
Updated GOG manager to correctly find save file location
Dec 31, 2025
b09618d
Cleaned up cloud save location fetching
Dec 31, 2025
1e8966f
Merge pull request #8 from utkarshdalal/gog-integration-cloud-saves
phobos665 Dec 31, 2025
60b2c41
Small change for GOGManager, not assuming infoFile exists
Jan 1, 2026
78c8506
Added functionality to stop service when the app is destroyed.
phobos665 Jan 1, 2026
b761f84
Merge pull request #9 from utkarshdalal/gog-integration-cloud-saves
phobos665 Jan 1, 2026
c6b6cb4
Small tweaks
phobos665 Jan 1, 2026
fb15366
Merge branch 'gog-integration' of github.com-phobos665:phobos665/Game…
phobos665 Jan 1, 2026
644cd1f
Various fixes including login view.
phobos665 Jan 1, 2026
e274284
Update to re-use the install dialog and remove install size for gog a…
phobos665 Jan 1, 2026
b348e8c
Update non-english strings
phobos665 Jan 1, 2026
2993a30
Merge branch 'master' of github.com-phobos665:utkarshdalal/GameNative…
phobos665 Jan 1, 2026
b295637
Small fix for verifying installation
phobos665 Jan 1, 2026
8b485c6
initial logout WIP
phobos665 Jan 1, 2026
3512cdc
Adjusting the sync library work so that we don't pull game details fo…
phobos665 Jan 1, 2026
dafd9eb
Updating issues regarding paths.
phobos665 Jan 1, 2026
c037170
Will now properly cancel downloads instead of thinking it can pause it.
phobos665 Jan 1, 2026
691281d
WIP cloudsave fixes.
phobos665 Jan 1, 2026
1dd8a48
Fixed issue where we were using hard-coded paths which broke some dev…
phobos665 Jan 2, 2026
3f3de1a
WIP cloud saves own Kotlin implementation.
phobos665 Jan 2, 2026
0eda569
Slowly working, but still no saves found.
phobos665 Jan 2, 2026
3998e15
Parsing the cloud saves properly.
phobos665 Jan 2, 2026
f2033be
Removing logs.
phobos665 Jan 2, 2026
fae6c42
Removed comment
phobos665 Jan 2, 2026
00ab906
Removed debug option for cloud saves.
phobos665 Jan 2, 2026
3cde782
WIP coderabbitAI fixes.
phobos665 Jan 2, 2026
fddb5f8
Merge branch 'master' of github.com-phobos665:utkarshdalal/GameNative…
phobos665 Jan 2, 2026
bcffecb
Fixed a small bug with the downloading bar not updating correctly.
phobos665 Jan 2, 2026
91b576c
Fixed issue where the ownership check was not working correctly in go…
phobos665 Jan 2, 2026
bc129bb
Fixed issue with race condition when downloading.
phobos665 Jan 2, 2026
72f10df
Now the GOGService will restart if it was not started onResume. Also …
phobos665 Jan 3, 2026
4786d82
Merge branch 'master' of github.com-phobos665:utkarshdalal/GameNative…
phobos665 Jan 5, 2026
a64448c
Fixed issue where context was missing from winStartCommand.
phobos665 Jan 5, 2026
48752c5
Added fix for the conflict syncAction. Will need to test more thoroug…
phobos665 Jan 5, 2026
5b8b682
Adjusted preferredAction for pluviamain so it doesn't ALWAYS download.
phobos665 Jan 5, 2026
9ab946d
Confirmed that we download/upload only the latest files.
phobos665 Jan 5, 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
22 changes: 20 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ plugins {
alias(libs.plugins.kotlinter)
alias(libs.plugins.ksp)
alias(libs.plugins.secrets.gradle)
id("com.chaquo.python") version "16.0.0"
}

val keystorePropertiesFile = rootProject.file("app/keystores/keystore.properties")
Expand Down Expand Up @@ -159,8 +160,6 @@ android {
excludes += "/DebugProbesKt.bin"
excludes += "/junit/runner/smalllogo.gif"
excludes += "/junit/runner/logo.gif"

// Other excludes
excludes += "/META-INF/versions/9/OSGI-INF/MANIFEST.MF"
}
jniLibs {
Expand Down Expand Up @@ -204,8 +203,27 @@ android {
// }
}

chaquopy {
defaultConfig {
version = "3.11" // Last Python version supporting armeabi-v7a (32-bit ARM)
pip {
// Install GOGDL dependencies
install("requests")
}
}
sourceSets {
getByName("main") {
srcDir("src/main/python")
}
}
}

dependencies {
implementation(libs.material)

// Chrome Custom Tabs for GOG OAuth
implementation("androidx.browser:browser:1.8.0")

// JavaSteam
val localBuild = false // Change to 'true' needed when building JavaSteam manually
if (localBuild) {
Expand Down
12 changes: 9 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
<action android:name="app.gamenative.LAUNCH_GAME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

<!--Allows app window to be resized on Oculus Quest VR headsets-->
<meta-data
android:name="com.oculus.vrshell.supports_free_resizing"
android:value="true" />

</activity>
<!-- Launcher icon aliases to allow switching app icon at runtime -->
<activity-alias
Expand Down Expand Up @@ -92,7 +92,13 @@
android:enabled="true"
android:exported="false"
android:foregroundServiceType="dataSync" />


<service
android:name=".service.gog.GOGService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="dataSync" />

<!-- FileProvider for secure file sharing (for APK installation) -->
<provider
android:name="androidx.core.content.FileProvider"
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/app/gamenative/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import coil.memory.MemoryCache
import coil.request.CachePolicy
import app.gamenative.events.AndroidEvent
import app.gamenative.service.SteamService
import app.gamenative.service.gog.GOGService
import app.gamenative.ui.PluviaMain
import app.gamenative.ui.enums.Orientation
import app.gamenative.utils.AnimatedPngDecoder
Expand Down Expand Up @@ -250,6 +251,11 @@ class MainActivity : ComponentActivity() {
Timber.i("Stopping Steam Service")
SteamService.stop()
}

if(GOGService.isRunning) {
Timber.i("Stopping GOG Service")
GOGService.stop()
}
}

override fun onResume() {
Expand All @@ -262,6 +268,13 @@ class MainActivity : ComponentActivity() {
PluviaApp.xEnvironment?.onResume()
Timber.d("Game resumed")
}

// Restart GOG service if it went down
if (GOGService.hasStoredCredentials(this) && !GOGService.isRunning) {
Timber.i("GOG service was down on resume - restarting")
GOGService.start(this)
}

PostHog.capture(event = "app_foregrounded")
}

Expand Down
16 changes: 16 additions & 0 deletions app/src/main/java/app/gamenative/PluviaApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class PluviaApp : SplitCompatApplication() {
// Init our datastore preferences.
PrefManager.init(this)

// Initialize GOGConstants
app.gamenative.service.gog.GOGConstants.init(this)

DownloadService.populateDownloadService(this)

appScope.launch {
Expand Down Expand Up @@ -100,6 +103,19 @@ class PluviaApp : SplitCompatApplication() {
Timber.e(e, "Failed to initialize Supabase client: ${e.message}")
e.printStackTrace()
}

// Initialize GOG service
appScope.launch {
try {
if (app.gamenative.service.gog.GOGService.initialize(applicationContext)) {
Timber.d("GOGService initialized successfully")
} else {
Timber.w("GOGService initialization returned false")
}
} catch (e: Exception) {
Timber.e(e, "Failed to initialize GOGService: ${e.message}")
}
}
}

companion object {
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/java/app/gamenative/PrefManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,13 @@ object PrefManager {
setPref(SHOW_CUSTOM_GAMES_IN_LIBRARY, value)
}

private val SHOW_GOG_IN_LIBRARY = booleanPreferencesKey("show_gog_in_library")
var showGOGInLibrary: Boolean
get() = getPref(SHOW_GOG_IN_LIBRARY, true)
set(value) {
setPref(SHOW_GOG_IN_LIBRARY, value)
}

// Game counts for skeleton loaders
private val CUSTOM_GAMES_COUNT = intPreferencesKey("custom_games_count")
var customGamesCount: Int
Expand All @@ -720,6 +727,20 @@ object PrefManager {
setPref(STEAM_GAMES_COUNT, value)
}

private val GOG_GAMES_COUNT = intPreferencesKey("gog_games_count")
var gogGamesCount: Int
get() = getPref(GOG_GAMES_COUNT, 0)
set(value) {
setPref(GOG_GAMES_COUNT, value)
}

private val GOG_INSTALLED_GAMES_COUNT = intPreferencesKey("gog_installed_games_count")
var gogInstalledGamesCount: Int
get() = getPref(GOG_INSTALLED_GAMES_COUNT, 0)
set(value) {
setPref(GOG_INSTALLED_GAMES_COUNT, value)
}

// Show dialog when adding custom game folder
private val SHOW_ADD_CUSTOM_GAME_DIALOG = booleanPreferencesKey("show_add_custom_game_dialog")
var showAddCustomGameDialog: Boolean
Expand Down
26 changes: 26 additions & 0 deletions app/src/main/java/app/gamenative/data/GOGCloudSavesLocation.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package app.gamenative.data

/**
* Save location template from GOG API (before path resolution)
* @param name The name/identifier of the location (e.g., "__default", "saves", "configs")
* @param location The path template with GOG variables (e.g., "<?INSTALL?>/saves")
*/
data class GOGCloudSavesLocationTemplate(
val name: String,
val location: String
)

/**
* Resolved GOG cloud save location (after path resolution)
* @param name The name/identifier of the save location
* @param location The absolute path to the save directory on the device
* @param clientId The game's GOG client ID used for cloud storage API
* @param clientSecret The game's GOG client secret for authentication
*/
data class GOGCloudSavesLocation(
val name: String,
val location: String,
val clientId: String,
val clientSecret: String = "" // Default empty for backward compatibility
)

89 changes: 89 additions & 0 deletions app/src/main/java/app/gamenative/data/GOGGame.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package app.gamenative.data

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import app.gamenative.enums.AppType

/**
* GOG Game entity for Room database
* Represents a game from the GOG platform
*/
@Entity(tableName = "gog_games")
data class GOGGame(
@PrimaryKey
@ColumnInfo("id")
val id: String,

@ColumnInfo("title")
val title: String = "",

@ColumnInfo("slug")
val slug: String = "",

@ColumnInfo("download_size")
val downloadSize: Long = 0,

@ColumnInfo("install_size")
val installSize: Long = 0,

@ColumnInfo("is_installed")
val isInstalled: Boolean = false,

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

@ColumnInfo("image_url")
val imageUrl: String = "",

@ColumnInfo("icon_url")
val iconUrl: String = "",

@ColumnInfo("description")
val description: String = "",

@ColumnInfo("release_date")
val releaseDate: String = "",

@ColumnInfo("developer")
val developer: String = "",

@ColumnInfo("publisher")
val publisher: String = "",

@ColumnInfo("genres")
val genres: List<String> = emptyList(),

@ColumnInfo("languages")
val languages: List<String> = emptyList(),

@ColumnInfo("last_played")
val lastPlayed: Long = 0,

@ColumnInfo("play_time")
val playTime: Long = 0,

@ColumnInfo("type")
val type: AppType = AppType.game,
) {
companion object {
const val GOG_IMAGE_BASE_URL = "https://images.gog.com/images"
}
}

data class GOGCredentials(
val accessToken: String,
val refreshToken: String,
val userId: String,
val username: String,
)

data class GOGDownloadInfo(
val gameId: String,
val totalSize: Long,
val downloadedSize: Long = 0,
val progress: Float = 0f,
val isActive: Boolean = false,
val isPaused: Boolean = false,
val error: String? = null,
)
15 changes: 13 additions & 2 deletions app/src/main/java/app/gamenative/data/LibraryItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import app.gamenative.utils.CustomGameScanner
enum class GameSource {
STEAM,
CUSTOM_GAME,
GOG,
// Add other platforms here..
}

Expand Down Expand Up @@ -44,12 +45,22 @@ data class LibraryItem(
""
}
}
GameSource.GOG -> {
// GoG Images are typically the full URL, but have fallback just in case.
if (iconHash.isEmpty()) {
""
} else if (iconHash.startsWith("http")) {
iconHash
} else {
"${GOGGame.GOG_IMAGE_BASE_URL}/$iconHash"
}
}
}

/**
* Helper property to get the game ID as an integer
* Extracts the numeric part by removing the gameSource prefix
* For all game sources, extract the numeric part after the prefix
*/
val gameId: Int
get() = appId.removePrefix("${gameSource.name}_").toInt()
get() = appId.removePrefix("${gameSource.name}_").toIntOrNull() ?: 0
}
9 changes: 8 additions & 1 deletion app/src/main/java/app/gamenative/db/PluviaDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ import app.gamenative.data.SteamApp
import app.gamenative.data.SteamLicense
import app.gamenative.data.CachedLicense
import app.gamenative.data.EncryptedAppTicket
import app.gamenative.data.GOGGame
import app.gamenative.db.converters.AppConverter
import app.gamenative.db.converters.ByteArrayConverter
import app.gamenative.db.converters.FriendConverter
import app.gamenative.db.converters.LicenseConverter
import app.gamenative.db.converters.PathTypeConverter
import app.gamenative.db.converters.UserFileInfoListConverter
import app.gamenative.db.converters.GOGConverter
import app.gamenative.db.dao.ChangeNumbersDao
import app.gamenative.db.dao.FileChangeListsDao
import app.gamenative.db.dao.SteamAppDao
import app.gamenative.db.dao.SteamLicenseDao
import app.gamenative.db.dao.AppInfoDao
import app.gamenative.db.dao.CachedLicenseDao
import app.gamenative.db.dao.EncryptedAppTicketDao
import app.gamenative.db.dao.GOGGameDao

const val DATABASE_NAME = "pluvia.db"

Expand All @@ -35,8 +38,9 @@ const val DATABASE_NAME = "pluvia.db"
FileChangeLists::class,
SteamApp::class,
SteamLicense::class,
GOGGame::class,
],
version = 8,
version = 9,
exportSchema = false, // Should export once stable.
)
@TypeConverters(
Expand All @@ -46,6 +50,7 @@ const val DATABASE_NAME = "pluvia.db"
LicenseConverter::class,
PathTypeConverter::class,
UserFileInfoListConverter::class,
GOGConverter::class,
)
abstract class PluviaDatabase : RoomDatabase() {

Expand All @@ -62,4 +67,6 @@ abstract class PluviaDatabase : RoomDatabase() {
abstract fun cachedLicenseDao(): CachedLicenseDao

abstract fun encryptedAppTicketDao(): EncryptedAppTicketDao

abstract fun gogGameDao(): GOGGameDao
}
25 changes: 25 additions & 0 deletions app/src/main/java/app/gamenative/db/converters/GOGConverter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package app.gamenative.db.converters

import androidx.room.TypeConverter
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json

/**
* Room TypeConverter for GOG-specific data types
*/
class GOGConverter {

@TypeConverter
fun fromStringList(value: List<String>): String {
return Json.encodeToString(value)
}

@TypeConverter
fun toStringList(value: String): List<String> {

if (value.isEmpty()) {
return emptyList()
}
return Json.decodeFromString<List<String>>(value)
}
}
Loading
Loading