Skip to content

Commit

Permalink
lots of background work for manga extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed Oct 19, 2023
1 parent dbe5731 commit 57a584a
Show file tree
Hide file tree
Showing 123 changed files with 2,676 additions and 553 deletions.
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29"
tools:ignore="ScopedStorage" />
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<!-- For background jobs -->
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/ani/dantotsu/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import androidx.multidex.MultiDex
import androidx.multidex.MultiDexApplication
import ani.dantotsu.aniyomi.anime.custom.AppModule
import ani.dantotsu.aniyomi.anime.custom.PreferenceModule
import ani.dantotsu.aniyomi.data.Notifications
import ani.dantotsu.aniyomi.util.logcat
import eu.kanade.tachiyomi.data.notification.Notifications
import tachiyomi.core.util.system.logcat
import ani.dantotsu.others.DisabledReports
import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
Expand Down
18 changes: 14 additions & 4 deletions app/src/main/java/ani/dantotsu/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.viewpager2.adapter.FragmentStateAdapter
import ani.dantotsu.aniyomi.anime.AnimeExtensionManager
import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager
import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.connections.anilist.AnilistHomeViewModel
import ani.dantotsu.databinding.ActivityMainBinding
Expand All @@ -37,13 +37,16 @@ import ani.dantotsu.home.NoInternet
import ani.dantotsu.media.MediaDetailsActivity
import ani.dantotsu.others.CustomBottomDialog
import ani.dantotsu.parsers.AnimeSources
import ani.dantotsu.parsers.MangaSources
import ani.dantotsu.settings.UserInterfaceSettings
import ani.dantotsu.subcriptions.Subscription.Companion.startSubscription
import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager
import io.noties.markwon.Markwon
import io.noties.markwon.SoftBreakAddsNewLinePlugin
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import nl.joery.animatedbottombar.AnimatedBottomBar
Expand All @@ -58,18 +61,25 @@ class MainActivity : AppCompatActivity() {

private var uiSettings = UserInterfaceSettings()
private val animeExtensionManager: AnimeExtensionManager by injectLazy()
private val mangaExtensionManager: MangaExtensionManager by injectLazy()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

val myScope = CoroutineScope(Dispatchers.Default)
myScope.launch {
val animeScope = CoroutineScope(Dispatchers.Default)
animeScope.launch {
animeExtensionManager.findAvailableExtensions()
logger("Anime Extensions: ${animeExtensionManager.installedExtensionsFlow.first()}")
AnimeSources.init(animeExtensionManager.installedExtensionsFlow)

}
val mangaScope = CoroutineScope(Dispatchers.Default)
mangaScope.launch {
mangaExtensionManager.findAvailableExtensions()
logger("Manga Extensions: ${mangaExtensionManager.installedExtensionsFlow.first()}")
MangaSources.init(mangaExtensionManager.installedExtensionsFlow)
}

var doubleBackToExitPressedOnce = false
Expand Down
176 changes: 0 additions & 176 deletions app/src/main/java/ani/dantotsu/aniyomi/LICENSE

This file was deleted.

3 changes: 0 additions & 3 deletions app/src/main/java/ani/dantotsu/aniyomi/NOTICE.md

This file was deleted.

30 changes: 0 additions & 30 deletions app/src/main/java/ani/dantotsu/aniyomi/anime/custom/App.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package ani.dantotsu.aniyomi.anime.custom

import android.app.Application
import ani.dantotsu.aniyomi.anime.AnimeExtensionManager
import ani.dantotsu.aniyomi.core.preference.PreferenceStore
import ani.dantotsu.aniyomi.domain.base.BasePreferences
import ani.dantotsu.aniyomi.domain.source.service.SourcePreferences
import ani.dantotsu.aniyomi.core.preference.AndroidPreferenceStore
import eu.kanade.tachiyomi.extension.anime.AnimeExtensionManager
import tachiyomi.core.preference.PreferenceStore
import eu.kanade.domain.base.BasePreferences
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.core.preference.AndroidPreferenceStore
import eu.kanade.tachiyomi.extension.manga.MangaExtensionManager
import eu.kanade.tachiyomi.network.NetworkHelper
import kotlinx.serialization.json.Json
import uy.kohesive.injekt.api.InjektModule
Expand All @@ -22,6 +23,8 @@ class AppModule(val app: Application) : InjektModule {

addSingletonFactory { AnimeExtensionManager(app) }

addSingletonFactory { MangaExtensionManager(app) }

addSingletonFactory {
Json {
ignoreUnknownKeys = true
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class MediaDetailsViewModel : ViewModel() {
suspend fun loadMangaChapterImages(chapter: MangaChapter, selected: Selected, post: Boolean = true): Boolean {
return tryWithSuspend(true) {
chapter.addImages(
mangaReadSources?.get(selected.source)?.loadImages(chapter.link) ?: return@tryWithSuspend false
mangaReadSources?.get(selected.source)?.loadImages(chapter.link, chapter.sChapter) ?: return@tryWithSuspend false
)
if (post) mangaChapter.postValue(chapter)
true
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/ani/dantotsu/media/manga/MangaChapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ani.dantotsu.media.manga

import ani.dantotsu.parsers.MangaChapter
import ani.dantotsu.parsers.MangaImage
import eu.kanade.tachiyomi.source.model.SChapter
import java.io.Serializable
import kotlin.math.floor

Expand All @@ -10,8 +11,9 @@ data class MangaChapter(
var link: String,
var title: String? = null,
var description: String? = null,
var sChapter: SChapter
) : Serializable {
constructor(chapter: MangaChapter) : this(chapter.number, chapter.link, chapter.title, chapter.description)
constructor(chapter: MangaChapter) : this(chapter.number, chapter.link, chapter.title, chapter.description, chapter.sChapter)

private val images = mutableListOf<MangaImage>()
fun images(): List<MangaImage> = images
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/ani/dantotsu/others/Jikan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object Jikan {
val ep = it.malID.toString()
eps[ep] = Episode(ep, title = it.title,
//Personal revenge with 34566 :prayge:
filler = if(malId!=34566) it.filler else true
filler = if(malId!=34566) it.filler else true,
)
}
hasNextPage = res?.pagination?.hasNextPage == true
Expand Down
Loading

0 comments on commit 57a584a

Please sign in to comment.