Skip to content

Commit

Permalink
refactor: rename all variable names that override to end with overrid…
Browse files Browse the repository at this point in the history
…e for consistency
  • Loading branch information
Ellet committed Jun 23, 2024
1 parent d78fe75 commit e124556
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions admin/src/main/kotlin/gui/tabs/ModsConverterTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private class ConversionInputDialog(
),
JButton("Continue").onClick {
convertMods(
overrideCurseForgeApiKey = null,
curseForgeApiKeyOverride = null,
isCurseForgeForStudiosTermsOfServiceAccepted = false,
)
},
Expand All @@ -198,7 +198,7 @@ private class ConversionInputDialog(
}

private fun convertMods(
overrideCurseForgeApiKey: String?,
curseForgeApiKeyOverride: String?,
isCurseForgeForStudiosTermsOfServiceAccepted: Boolean,
) {
coroutineScope.launch {
Expand All @@ -208,7 +208,7 @@ private class ConversionInputDialog(
launcherInstanceDirectoryPath = launcherInstanceDirectoryTextField.text,
convertMode = modsConvertModeComboBox.getSelectedItemOrThrow(),
prettyFormat = prettyFormatCheckBox.isSelected,
overrideCurseForgeApiKey = overrideCurseForgeApiKey,
curseForgeApiKeyOverride = curseForgeApiKeyOverride,
isCurseForgeForStudiosTermsOfServiceAccepted = isCurseForgeForStudiosTermsOfServiceAccepted,
)
when (result) {
Expand Down Expand Up @@ -330,7 +330,7 @@ private class ConversionInputDialog(
return@launch
}
convertMods(
overrideCurseForgeApiKey = userCurseForgeApiKey,
curseForgeApiKeyOverride = userCurseForgeApiKey,
isCurseForgeForStudiosTermsOfServiceAccepted = true,
)
}
Expand Down
2 changes: 1 addition & 1 deletion admin/src/main/kotlin/launchers/LauncherDataSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ interface LauncherDataSource {
* */
suspend fun getMods(
launcherInstanceDirectory: File,
overrideCurseForgeApiKey: String?,
curseForgeApiKeyOverride: String?,
): Result<List<Mod>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ATLauncherDataSource : LauncherDataSource {

override suspend fun getMods(
launcherInstanceDirectory: File,
overrideCurseForgeApiKey: String?,
curseForgeApiKeyOverride: String?,
): Result<List<Mod>> =
try {
val instance = getInstance(launcherInstanceDirectory = launcherInstanceDirectory).getOrThrow()
Expand All @@ -92,7 +92,7 @@ class ATLauncherDataSource : LauncherDataSource {
.getModFile(
modId = atLauncherMod.curseForgeProjectId.toString(),
fileId = atLauncherMod.curseForgeFileId.toString(),
overrideApiKey = overrideCurseForgeApiKey,
overrideApiKey = curseForgeApiKeyOverride,
).getOrThrow()
downloadUrl = curseForgeModFile.data.downloadUrl
fileIntegrityInfo = curseForgeModFile.data.getFileIntegrityInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ModrinthLauncherDataSource : LauncherDataSource {

override suspend fun getMods(
launcherInstanceDirectory: File,
overrideCurseForgeApiKey: String?,
curseForgeApiKeyOverride: String?,
): Result<List<Mod>> =
try {
val instance = getInstance(launcherInstanceDirectory = launcherInstanceDirectory).getOrThrow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class PrismLauncherDataSource : LauncherDataSource {

override suspend fun getMods(
launcherInstanceDirectory: File,
overrideCurseForgeApiKey: String?,
curseForgeApiKeyOverride: String?,
): Result<List<Mod>> =
try {
// TODO: use File.exist(), check of File.exist() might need to be shared to avoid duplications
Expand Down Expand Up @@ -108,7 +108,7 @@ class PrismLauncherDataSource : LauncherDataSource {
modId =
prismLauncherModMetadata.update.curseForge.projectId
.toString(),
overrideApiKey = overrideCurseForgeApiKey,
overrideApiKey = curseForgeApiKeyOverride,
).getOrThrow()
.data
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface ModsConverter {
launcherInstanceDirectoryPath: String,
convertMode: ModsConvertMode,
prettyFormat: Boolean,
overrideCurseForgeApiKey: String?,
curseForgeApiKeyOverride: String?,
isCurseForgeForStudiosTermsOfServiceAccepted: Boolean,
): ModsConvertResult
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ModsConverterImpl : ModsConverter {
launcherInstanceDirectoryPath: String,
convertMode: ModsConvertMode,
prettyFormat: Boolean,
overrideCurseForgeApiKey: String?,
curseForgeApiKeyOverride: String?,
isCurseForgeForStudiosTermsOfServiceAccepted: Boolean,
): ModsConvertResult {
return try {
Expand Down Expand Up @@ -64,7 +64,7 @@ class ModsConverterImpl : ModsConverter {
launcherDataSource
.getMods(
launcherInstanceDirectory = launcherInstanceDirectory,
overrideCurseForgeApiKey = overrideCurseForgeApiKey?.ifBlank { null },
curseForgeApiKeyOverride = curseForgeApiKeyOverride?.ifBlank { null },
).getOrElse {
return ModsConvertResult.Failure(
error =
Expand Down

0 comments on commit e124556

Please sign in to comment.