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: 6 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
paths:
.github/workflows/**/*.{yml,yaml}:
ignore:
- '"inputs" section is alias node but mapping node is expected'
- '"paths" section must be sequence node but got alias node with "" tag'
- '"paths-ignore" section must be sequence node but got alias node with "" tag'
2 changes: 1 addition & 1 deletion .github/workflows/draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: "Draft Release Action"
id: draft
Expand Down
52 changes: 28 additions & 24 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: "Debug event.json"
if: ${{ !cancelled() }}
continue-on-error: true
run: |
cat "${GITHUB_EVENT_PATH}"
run: cat "${GITHUB_EVENT_PATH}"
- name: "Debug CTX github"
continue-on-error: true
env:
GITHUB_CTX: ${{ toJSON(github) }}
run: echo "$GITHUB_CTX"
- name: "Debug Environment"
continue-on-error: true
run: env

- name: "Kotlin Lint"
- name: "ktlint"
if: ${{ !cancelled() }}
continue-on-error: true # TODO: Resolve KTLint Issues
env:
Expand All @@ -41,36 +47,34 @@ jobs:
${{ env.klint }} --version
${{ env.klint }} --color 'app/src/main/java/**'

- name: "Prettier"
- name: "prettier"
if: ${{ !cancelled() }}
run: |
echo "::group::Install"
npm install prettier
echo "::endgroup::"
npx prettier --check .

- name: "Yamllint"
- name: "yamllint"
if: ${{ !cancelled() }}
env:
CONFIG: "{extends: relaxed, ignore: [node_modules/,.github/disabled/], rules: {line-length: {max: 119}}}"
CONFIG: .github/yamllint.yaml
run: |
echo "::group::List Files"
yamllint -d '${{ env.CONFIG }}' --list-files .
yamllint -c "${{ env.CONFIG }}" --list-files .
echo "::endgroup::"
yamllint -d '${{ env.CONFIG }}' .
yamllint -c "${{ env.CONFIG }}" .

- name: "Actionlint"
- name: "actionlint"
if: ${{ !cancelled() }}
run: |
echo "::group::Download"
loc=$(curl -sI https://github.com/rhysd/actionlint/releases/latest | grep -i '^location:')
echo "loc: ${loc}"
tag=$(echo "${loc}" | sed -E 's|.*/tag/v?(.*)|\1|' | tr -d '\t\r\n')
echo "tag: ${tag}"
url="https://github.com/rhysd/actionlint/releases/latest/download/actionlint_${tag}_linux_amd64.tar.gz"
echo "url: ${url}"
curl -sL "${url}" | tar xz -C "${RUNNER_TEMP}" actionlint
file "${RUNNER_TEMP}/actionlint"
"${RUNNER_TEMP}/actionlint" --version
echo "::endgroup::"
"${RUNNER_TEMP}/actionlint" -color -verbose -shellcheck= -pyflakes=
uses: cssnr/actionlint-action@v1
with:
shellcheck_opts: -e SC2129

- name: "shellcheck"
if: ${{ !cancelled() }}
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -x
with:
scandir: .github/scripts
64 changes: 35 additions & 29 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: "Checkout"
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: "Debug Event"
continue-on-error: true
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
echo "::endgroup::"

- name: "Update Version"
uses: chkfung/android-version-actions@v1.2.2
uses: chkfung/android-version-actions@fcf89abef1c7afba2083146dcca0c6da4705ba4b # v1.2.3
id: version
with:
gradlePath: ${{ env.gradle_file }}
Expand Down Expand Up @@ -97,10 +97,10 @@ jobs:

echo ${{ secrets.ANDROID_KEYSTORE_PASS }} | keytool -list -keystore ${{ env.key_file }}

- name: "Setup Node 22"
uses: actions/setup-node@v4
- name: "Setup Node 24"
uses: actions/setup-node@v6
with:
node-version: 22
node-version: 24

- name: "Prepare Build"
working-directory: ".github/scripts"
Expand All @@ -114,7 +114,7 @@ jobs:
ls -lAh app

- name: "Setup Java"
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: "17"
Expand Down Expand Up @@ -152,20 +152,17 @@ jobs:
mv "${{ env.apk_path }}/${{ env.apk_file }}" "${{ env.apk_path }}/${{ env.signed_apk }}"

- name: "Upload APK to Artifacts"
if: ${{ !github.event.act }}
uses: actions/upload-artifact@v4
with:
name: release
path: ${{ env.apk_path }}

- name: "Upload APK to Release"
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
uses: cssnr/upload-release-action@v1
with:
file: ${{ env.apk_path }}/${{ env.signed_apk }}
tag: ${{ github.ref }}
files: ${{ env.apk_path }}/${{ env.signed_apk }}
overwrite: true
file_glob: true

#- name: "Gradle Bundle AAB"
# if: ${{ !github.event.release.prerelease }}
Expand All @@ -178,11 +175,11 @@ jobs:
# continue-on-error: true
# run: |
# echo "env.aab_path: ${{ env.aab_path }}"
# ls -lAh ${{ env.aab_path }} ||:
# ls -lAh "${{ env.aab_path }}" ||:
# echo "env.debug_symbols: ${{ env.debug_symbols }}"
# ls -lAh ${{ env.debug_symbols }} ||:
# ls -lAh "${{ env.debug_symbols }}" ||:
# echo "env.mapping_file: ${{ env.mapping_file }}"
# ls -lAh $(dirname ${{ env.debug_symbols }}) ||:
# ls -lAh "$(dirname "${{ env.debug_symbols }}")" ||:

#- name: "Sign Bundle"
# if: ${{ !github.event.release.prerelease }}
Expand All @@ -197,21 +194,30 @@ jobs:

#- name: "Upload Bundle to Artifacts"
# if: ${{ !github.event.release.prerelease }}
# uses: actions/upload-artifact@v4
# uses: actions/upload-artifact@v6
# with:
# name: bundle
# path: ${{ env.aab_path }}

#- name: "Parse Release Notes"
# if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
# id: notes
# run: |
# body="${{ github.event.release.body }}"
# summary="$(echo "${body%%#*}" | tr -d '\r' | sed ':a;N;$!ba;s/\n*$//')"
# echo "summary<<EOF" >> "$GITHUB_OUTPUT"
# echo "$summary" >> "$GITHUB_OUTPUT"
# echo "EOF" >> "$GITHUB_OUTPUT"

#- name: "Generate Whats New"
# if: ${{ !github.event.release.prerelease }}
# if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
# run: |
# mkdir -p whatsNew
# echo "GitHub Actions Build" > whatsNew/whatsnew-en-US
# cat whatsNew/whatsnew-en-US
# echo -n "${{ steps.notes.outputs.summary }}" > whatsNew/whatsnew-en-US

#- name: "Upload Google Play"
# if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
# uses: r0adkll/upload-google-play@v1
# uses: r0adkll/upload-google-play@935ef9c68bb393a8e6116b1575626a7f5be3a7fb # v1.1.3
# with:
# serviceAccountJsonPlainText: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}
# packageName: ${{ env.package_name }}
Expand Down Expand Up @@ -240,24 +246,24 @@ jobs:
if: ${{ !github.event.act }}
continue-on-error: true
run: |
echo -e "## Android Release\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "## Android Release\n\n" >> "$GITHUB_STEP_SUMMARY"

echo -e "Final APK: \`${{ env.signed_apk }}\`\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "Final APK: \`${{ env.signed_apk }}\`\n\n" >> "$GITHUB_STEP_SUMMARY"

echo -e "<details><summary>Build Artifacts</summary>\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "\`\`\`text\n$(ls -lAh ${{ env.apk_path }})\n\`\`\`\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "</details>\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "<details><summary>Build Artifacts</summary>\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "\`\`\`text\n$(ls -lAh ${{ env.apk_path }})\n\`\`\`\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "</details>\n\n" >> "$GITHUB_STEP_SUMMARY"

if [ -f "${{ env.apk_path }}/output-metadata.json" ];then
echo -e "<details><summary>File: output-metadata.json</summary>\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "\`\`\`json\n$(cat ${{ env.apk_path }}/output-metadata.json)\n\`\`\`\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "</details>\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "<details><summary>File: output-metadata.json</summary>\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "\`\`\`json\n$(cat ${{ env.apk_path }}/output-metadata.json)\n\`\`\`\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "</details>\n\n" >> "$GITHUB_STEP_SUMMARY"
fi

echo -e "\n\n---" >> $GITHUB_STEP_SUMMARY
echo -e "\n\n---" >> "$GITHUB_STEP_SUMMARY"

- name: "Send Failure Notification"
if: ${{ failure() && github.event_name == 'release' }}
uses: sarisia/actions-status-discord@v1
uses: sarisia/actions-status-discord@eb045afee445dc055c18d3d90bd0f244fd062708 # v1.16.0
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
7 changes: 7 additions & 0 deletions .github/yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: relaxed

ignore-from-file: .gitignore

rules:
line-length:
max: 119
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
[![Lint](https://img.shields.io/github/actions/workflow/status/django-files/android-client/lint.yaml?logo=github&logoColor=white&label=lint)](https://github.com/django-files/android-client/actions/workflows/lint.yaml)
[![Release](https://img.shields.io/github/actions/workflow/status/django-files/android-client/release.yaml?logo=github&logoColor=white&label=release)](https://github.com/django-files/android-client/actions/workflows/release.yaml)
[![AGP Version](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fdjango-files%2Fandroid-client%2Frefs%2Fheads%2Fmaster%2Fgradle%2Flibs.versions.toml&query=%24.versions.agp&logo=gradle&label=AGP)](https://github.com/django-files/android-client/blob/master/gradle/libs.versions.toml#L2)
[![GitHub Repo Size](https://img.shields.io/github/repo-size/django-files/android-client?logo=bookstack&logoColor=white&label=repo%20size)](https://github.com/django-files/android-client)
[![GitHub Top Language](https://img.shields.io/github/languages/top/django-files/android-client?logo=htmx)](https://github.com/django-files/android-client)
[![GitHub Discussions](https://img.shields.io/github/discussions/django-files/android-client?logo=github)](https://github.com/django-files/android-client/discussions)
[![GitHub Forks](https://img.shields.io/github/forks/django-files/android-client?style=flat&logo=github)](https://github.com/django-files/android-client/forks)
[![GitHub Repo Stars](https://img.shields.io/github/stars/django-files/android-client?style=flat&logo=github)](https://github.com/django-files/android-client/stargazers)
[![GitHub Org Stars](https://img.shields.io/github/stars/django-files?style=flat&logo=github&label=org%20stars)](https://django-files.github.io/)
[![GitHub Last Commit](https://img.shields.io/github/last-commit/django-files/android-client?logo=listenhub&label=updated)](https://github.com/django-files/android-client/pulse)
[![GitHub Repo Size](https://img.shields.io/github/repo-size/django-files/android-client?logo=buffer&label=repo%20size)](https://github.com/django-files/android-client?tab=readme-ov-file#readme)
[![GitHub Top Language](https://img.shields.io/github/languages/top/django-files/android-client?logo=devbox)](https://github.com/django-files/android-client?tab=readme-ov-file#readme)
[![GitHub Contributors](https://img.shields.io/github/contributors-anon/django-files/android-client?logo=southwestairlines)](https://github.com/django-files/android-client/graphs/contributors)
[![GitHub Issues](https://img.shields.io/github/issues/django-files/android-client?logo=codeforces&logoColor=white)](https://github.com/django-files/android-client/issues)
[![GitHub Discussions](https://img.shields.io/github/discussions/django-files/android-client?logo=theconversation)](https://github.com/django-files/android-client/discussions)
[![GitHub Forks](https://img.shields.io/github/forks/django-files/android-client?style=flat&logo=forgejo&logoColor=white)](https://github.com/django-files/android-client/forks)
[![GitHub Repo Stars](https://img.shields.io/github/stars/django-files/android-client?style=flat&logo=gleam&logoColor=white)](https://github.com/django-files/android-client/stargazers)
[![GitHub Org Stars](https://img.shields.io/github/stars/django-files?style=flat&logo=apachespark&logoColor=white&label=org%20stars)](https://django-files.github.io/)
[![Discord](https://img.shields.io/discord/899171661457293343?logo=discord&logoColor=white&label=discord&color=7289da)](https://discord.gg/wXy6m2X8wY)

# Django Files Android App
Expand Down Expand Up @@ -338,3 +341,11 @@ You can also support other related projects:
- [Django Files iOS App](https://github.com/django-files/ios-client)
- [Django Files Android App](https://github.com/django-files/android-client)
- [Django Files Web Extension](https://github.com/django-files/web-extension)

<a href="https://github.com/django-files/android-client/stargazers">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=django-files/android-client&type=date&legend=bottom-right&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=django-files/android-client&type=date&legend=bottom-right" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=django-files/android-client&type=date&legend=bottom-right" />
</picture>
</a>
24 changes: 24 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"

tasks:
lint:
desc: Lint
cmds:
- prettier --check .
- yamllint -c .github/yamllint.yaml .
- actionlint -shellcheck="-e SC2129"
- shellcheck .github/scripts/prepare.sh

format:
desc: Format
aliases: [fmt]
cmd: |
prettier --write .

build:
desc: Build (recommended android studio)
vars:
GRADLEW: 'gradlew{{if eq OS "windows"}}.bat{{end}}'
cmd: |
./{{.GRADLEW}} assemble {{.CLI_ARGS}}
18 changes: 10 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import com.android.build.api.dsl.ApplicationExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import java.util.Properties

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
//alias(libs.plugins.kotlin.android)
//alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.ksp)
alias(libs.plugins.google.services)
Expand All @@ -15,7 +15,7 @@ plugins {
//id("androidx.navigation.safeargs.kotlin") version "2.8.9" // Use the correct version
}

android {
configure<ApplicationExtension> {
namespace = "com.djangofiles.djangofiles"
compileSdk = 36

Expand Down Expand Up @@ -66,11 +66,11 @@ android {
//kotlinOptions {
// jvmTarget = "17"
//}
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
//tasks.withType<KotlinJvmCompile>().configureEach {
// compilerOptions {
// jvmTarget.set(JvmTarget.JVM_17)
// }
//}

buildFeatures {
viewBinding = true
Expand All @@ -79,6 +79,8 @@ android {
}
}

kotlin { compilerOptions { jvmTarget.set(JvmTarget.JVM_17) } }

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ data class AlbumEntity(
)


@Database(entities = [AlbumEntity::class], version = 1)
@Database(entities = [AlbumEntity::class], version = 1, exportSchema = false)
abstract class AlbumDatabase : RoomDatabase() {
abstract fun albumDao(): AlbumDao

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ data class Server(
)


@Database(entities = [Server::class], version = 3)
@Database(entities = [Server::class], version = 3, exportSchema = false)
abstract class ServerDatabase : RoomDatabase() {
abstract fun serverDao(): ServerDao

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class FilesPreviewFragment : Fragment() {
Log.d("FilesPreviewFragment", "OTHER - NO PREVIEW")

binding.previewImageView.visibility = View.VISIBLE
binding.previewImageView.setImageResource(getGenericIcon(mimeType.toString()))
binding.previewImageView.setImageResource(getGenericIcon(mimeType))
binding.previewImageView.setOnClickListener {
//findNavController().popBackStack()
findNavController().navigateUp()
Expand Down Expand Up @@ -329,7 +329,7 @@ class FilesPreviewFragment : Fragment() {
client.newCall(request).execute().use { response ->
Log.d("getContent", "response.code: ${response.code}")
if (response.isSuccessful) {
return response.body?.string()
return response.body.string()
}
null
}
Expand Down
Loading
Loading