Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
APK_SHORT_NAME: StashAppAndroidTV-release.apk
APK_DEBUG_SHORT_NAME: StashAppAndroidTV-debug.apk
BRANCH_NAME: ${{ github.ref_name }}
BUILD_TOOLS_VERSION: 35.0.0
BUILD_TOOLS_VERSION: 36.0.0

jobs:
build:
Expand All @@ -28,13 +28,13 @@ jobs:
contents: write
steps:
- name: Checkout the code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0 # Need the tags to build
submodules: true # Need the submodules to build
# Setup the SDKs
- name: Setup JDK
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: zulu
java-version: '21'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defaults:
shell: bash

env:
BUILD_TOOLS_VERSION: 35.0.0
BUILD_TOOLS_VERSION: 36.0.0
BUILD_DIRS_ARTIFACT: build-dirs

jobs:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defaults:

env:
APK_SHORT_NAME: StashAppAndroidTV.apk
BUILD_TOOLS_VERSION: 35.0.0
BUILD_TOOLS_VERSION: 36.0.0

jobs:
publish:
Expand All @@ -20,16 +20,16 @@ jobs:
contents: write
steps:
- name: Checkout the code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0 # Need the tags to build
submodules: true # Need the submodules to build
- name: Setup Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.12'
- name: Setup JDK
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: zulu
java-version: '21'
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-xml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
rev: v2.15.0
hooks:
- id: pretty-format-kotlin
args: [ --autofix, --ktlint-version=1.4.1 ]
args: [ --autofix, --ktlint-version=1.8.0 ]
- repo: local
hooks:
- id: check-debug-enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ class StashApolloCompilerPlugin : ApolloCompilerPlugin {

val newFileSpecs =
input.fileSpecs.map { file ->
if (file.name.endsWith("FilterType") &&
file.name !in
setOf(
"FindFilterType",
"SavedFindFilterType",
if (
(
file.name.endsWith("FilterType") &&
file.name !in
setOf(
"FindFilterType",
"SavedFindFilterType",
)
) ||
file.name.endsWith("CriterionInput")
) {
Expand Down
40 changes: 13 additions & 27 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.android.build.gradle.internal.cxx.io.writeTextIfDifferent
import com.android.build.gradle.internal.tasks.factory.dependsOn
import com.google.protobuf.gradle.id
import java.io.ByteArrayOutputStream
import java.util.Base64
import java.util.Properties

Expand All @@ -20,31 +19,17 @@ plugins {
alias(libs.plugins.protobuf)
}

fun getVersionCode(): Int {
val stdout = ByteArrayOutputStream()
exec {
commandLine = listOf("git", "tag", "--list", "v*")
standardOutput = stdout
}
return stdout
.toString()
.trim()
.lines()
.size
}
val gitTags =
providers
.exec { commandLine("git", "tag", "--list", "v*") }
.standardOutput.asText
.get()

fun getAppVersion(): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine = listOf("git", "describe", "--tags", "--long", "--match=v*")
standardOutput = stdout
}
return stdout
.toString()
.trim()
.removePrefix("v")
.ifBlank { "0.0.0" }
}
val gitDescribe =
providers
.exec { commandLine("git", "describe", "--tags", "--long", "--match=v*") }
.standardOutput.asText
.getOrElse("v0.0.0")

android {
namespace = "com.github.damontecres.stashapp"
Expand All @@ -68,8 +53,8 @@ android {
minSdk = 23
targetSdk = 36
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
versionCode = getVersionCode()
versionName = getAppVersion()
versionCode = gitTags.trim().lines().size
versionName = gitDescribe.trim().removePrefix("v").ifBlank { "0.0.0" }
vectorDrawables.useSupportLibrary = true
}
signingConfigs {
Expand Down Expand Up @@ -138,6 +123,7 @@ android {
}
lint {
disable.add("MissingTranslation")
disable.add("LocalContextGetResourceValueCall") // TODO
}
room {
schemaDirectory("$projectDir/schemas")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ class DebugFragment : Fragment(R.layout.debug) {
values.forEach { value ->
val valueView = TextView(requireContext())
valueView.text =
if (isApiKey && value != null
) {
if (isApiKey && value != null) {
value.take(4) + "..." + value.takeLast(8)
} else {
value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class FilterDebugFragment : Fragment(R.layout.filter_debug) {
// table.isStretchAllColumns = true
}
}

else -> {
val titleView = TextView(requireContext())
titleView.text = "No items"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +301,25 @@ class FilterFragment :
override fun getItem(position: Int): Any {
if (createEnabled) {
return when (position) {
0 -> "Create filter"
1 -> "Create filter from current"
2 ->
0 -> {
"Create filter"
}

1 -> {
"Create filter from current"
}

2 -> {
if (filters.isEmpty()) {
"No saved filters"
} else {
"Saved filters"
}
}

else -> filters[position - 3]
else -> {
filters[position - 3]
}
}
}
return filters[position]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ class MarkerDetailsFragment : DetailsSupportFragment() {
}
}

else -> throw IllegalArgumentException("Unknown action id $sourceId")
else -> {
throw IllegalArgumentException("Unknown action id $sourceId")
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class RootActivity :
}

ServerViewModel.ServerConnection.Pending -> {}

ServerViewModel.ServerConnection.Success -> {}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ class SceneDetailsFragment : DetailsSupportFragment() {
}
}

DataType.SCENE, DataType.MARKER, DataType.IMAGE, DataType.GALLERY -> throw IllegalArgumentException()
DataType.SCENE, DataType.MARKER, DataType.IMAGE, DataType.GALLERY -> {
throw IllegalArgumentException()
}
}
}
}
Expand Down Expand Up @@ -641,7 +643,6 @@ class SceneDetailsFragment : DetailsSupportFragment() {
StashAction.ADD_GROUP -> DataType.GROUP
StashAction.SET_STUDIO -> DataType.STUDIO
StashAction.CREATE_MARKER -> DataType.TAG

else -> throw RuntimeException("Unsupported search for type $action")
}
val title =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ class SearchForFragment :
mutationEngine.createStudio(name = name)
}

else -> throw IllegalArgumentException("Unsupported datatype $dataType")
else -> {
throw IllegalArgumentException("Unsupported datatype $dataType")
}
}
if (item != null) {
Toast
Expand Down Expand Up @@ -215,7 +217,7 @@ class SearchForFragment :
)
val results =
when (dataType) {
DataType.GALLERY ->
DataType.GALLERY -> {
// Cannot add an image to a zip/folder gallery, so exclude them
queryEngine.findGalleries(
filter,
Expand All @@ -229,8 +231,11 @@ class SearchForFragment :
),
),
)
}

else -> queryEngine.find(dataType, filter)
else -> {
queryEngine.find(dataType, filter)
}
}
resultsAdapter.addAll(0, results)
adapter.set(
Expand Down Expand Up @@ -282,11 +287,26 @@ class SearchForFragment :
if (mostRecentIds.isNotEmpty()) {
val items =
when (dataType) {
DataType.PERFORMER -> queryEngine.findPerformers(performerIds = mostRecentIds)
DataType.TAG -> queryEngine.getTags(mostRecentIds)
DataType.STUDIO -> queryEngine.findStudios(studioIds = mostRecentIds)
DataType.GALLERY -> queryEngine.findGalleries(galleryIds = mostRecentIds)
DataType.GROUP -> queryEngine.findGroups(groupIds = mostRecentIds)
DataType.PERFORMER -> {
queryEngine.findPerformers(performerIds = mostRecentIds)
}

DataType.TAG -> {
queryEngine.getTags(mostRecentIds)
}

DataType.STUDIO -> {
queryEngine.findStudios(studioIds = mostRecentIds)
}

DataType.GALLERY -> {
queryEngine.findGalleries(galleryIds = mostRecentIds)
}

DataType.GROUP -> {
queryEngine.findGroups(groupIds = mostRecentIds)
}

else -> {
listOf()
}
Expand Down Expand Up @@ -358,7 +378,7 @@ class SearchForFragment :
viewLifecycleOwner.lifecycleScope.launch(exceptionHandler) {
val results =
when (dataType) {
DataType.GALLERY ->
DataType.GALLERY -> {
// Cannot add an image to a zip gallery, so exclude them
queryEngine.findGalleries(
filter,
Expand All @@ -372,8 +392,11 @@ class SearchForFragment :
),
),
)
}

else -> queryEngine.find(dataType, filter)
else -> {
queryEngine.find(dataType, filter)
}
}
val createAllowed = allowCreate(dataType, query, results)
if (createAllowed && readOnlyModeDisabled()) {
Expand Down Expand Up @@ -476,10 +499,21 @@ class SearchForFragment :
items.none { it.name.lowercase() == q || it.aliases.any { it.lowercase() == q } }
}

DataType.SCENE -> false
DataType.MARKER -> false
DataType.IMAGE -> false
DataType.GALLERY -> false
DataType.SCENE -> {
false
}

DataType.MARKER -> {
false
}

DataType.IMAGE -> {
false
}

DataType.GALLERY -> {
false
}
}
}
}
Expand Down
Loading