Skip to content
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

New/downloads #2

Merged
merged 22 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
91846a4
refactor(MediaDownloadService): simplify query logic
urFate Oct 15, 2024
3252ff1
build: AGP upgrade to 8.7.1
urFate Oct 15, 2024
de8b639
feat(MediaDownloadsService): pausing
urFate Oct 15, 2024
a17633e
build: remove unused libs
urFate Oct 15, 2024
c0fd02f
feat: download manager
urFate Nov 9, 2024
5577985
feat: proper pausing
urFate Dec 5, 2024
ae13a1b
feat: localize strings
urFate Dec 5, 2024
792a421
build: move to jvm target 17
urFate Dec 5, 2024
51bd633
feat: pause tasks on exception thrown
urFate Dec 6, 2024
76fe2dc
refactor(DownloadsServiceHelper): change byte buffer size
urFate Dec 6, 2024
dee740c
feat(MediaDownloadsService): progress percentage in notification
urFate Dec 6, 2024
0fd519c
feat(ResourceSheetScreen): download progress percentage
urFate Dec 7, 2024
fe8f951
fix: exceeding the download percentage
urFate Dec 21, 2024
6eb7c81
refactor(strings): downloads_stop_all
urFate Dec 21, 2024
baed993
fix(DownloadsManager): `cancel all` button function
urFate Dec 21, 2024
eb0a0ac
feat(DownloadsActivity): saved episodes search filter
urFate Dec 21, 2024
8e63b4b
fix(ResourceSheetScreens): hide download button if task paused
urFate Dec 21, 2024
fb81fb2
fix(db): version 4 migration
urFate Dec 21, 2024
d187f42
fix(DownloadsServiceHelper): catch exceptions inside `use` block of B…
urFate Dec 22, 2024
2d099b2
fix(DownloadsSavedScreen): prevent fill of acting team name by anime …
urFate Dec 22, 2024
7cdc99c
refactor(downloads): code clean up
urFate Dec 22, 2024
18d224d
refactor(downloads): episodes removal dialog localization
urFate Dec 22, 2024
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
7 changes: 3 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}

buildFeatures {
Expand Down Expand Up @@ -101,7 +101,6 @@ dependencies {
debugImplementation(libs.androidx.compose.ui.test.manifest)

// Compose UI
implementation(libs.de.mr.pine.utils.zoomables)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.material.icons.extended)
Expand Down
19 changes: 10 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" >
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -19,8 +19,11 @@
android:label="@string/app_name"
android:supportsRtl="false"
android:theme="@style/Theme.App.Starting"
tools:targetApi="34" >

tools:targetApi="34">
<activity
android:name=".ui.activity.downloads.DownloadsActivity"
android:exported="false"
android:theme="@style/Theme.ShiraBox" />
<activity
android:name=".ui.activity.update.AppUpdateActivity"
android:exported="false"
Expand Down Expand Up @@ -56,7 +59,7 @@
android:name=".ui.activity.MainActivity"
android:exported="true"
android:hardwareAccelerated="true"
android:theme="@style/Theme.App.Starting" >
android:theme="@style/Theme.App.Starting">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -68,7 +71,7 @@
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true" >
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
Expand All @@ -77,17 +80,15 @@
<service
android:name=".service.NotificationService"
android:enabled="true"
android:exported="false" >
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<service
android:name=".service.media.MediaDownloadsService"
android:enabled="true"
android:exported="false" >
</service>
android:exported="false"/>

<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/org/shirabox/app/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class App : Application(), ImageLoaderFactory {
private val job = SupervisorJob()
private val scope = CoroutineScope(Dispatchers.IO + job)

companion object {
lateinit var appDatabase: AppDatabase
}

override fun newImageLoader(): ImageLoader {
return ImageLoader.Builder(this)
.diskCache {
Expand All @@ -37,11 +41,11 @@ class App : Application(), ImageLoaderFactory {
super.onCreate()

FirebaseApp.initializeApp(this)
val db = AppDatabase.getAppDataBase(this)!!
appDatabase = AppDatabase.getAppDataBase(this)!!

// Subscribe to notifications
scope.launch {
db.contentDao().getFavourites().collectLatest { list ->
appDatabase.contentDao().getFavourites().collectLatest { list ->
list.forEach { favouriteAnime ->
if (favouriteAnime.shiraboxId != null) {
val topic = "id-${favouriteAnime.shiraboxId}"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/org/shirabox/app/ValuesHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.shirabox.app
import android.content.Context
import org.shirabox.app.ui.screen.favourites.SortType
import org.shirabox.core.model.ContentKind
import org.shirabox.core.model.Quality
import org.shirabox.core.model.ReleaseStatus

object ValuesHelper {
Expand Down Expand Up @@ -32,4 +33,7 @@ object ValuesHelper {
SortType.RECENT -> context.getString(R.string.recent_order)
SortType.STATUS -> context.getString(R.string.status_order)
}

fun buildOfflineMediaPath(contentUid: Long, quality: Quality, fileName: String) =
"/$contentUid/$quality/$fileName.mp4"
}
Loading
Loading