Do a bit of optimization and cleanup, remove old EH startup code

This commit is contained in:
Jobobby04 2021-02-14 21:24:26 -05:00
parent f76216c038
commit 50a5ec45b3
11 changed files with 17 additions and 86 deletions

View File

@ -285,8 +285,8 @@ dependencies {
implementation ("info.debatty:java-string-similarity:2.0.0")
// Firebase (EH)
implementation("com.google.firebase:firebase-analytics-ktx:18.0.0")
implementation("com.google.firebase:firebase-crashlytics-ktx:17.3.0")
implementation("com.google.firebase:firebase-analytics-ktx:18.0.2")
implementation("com.google.firebase:firebase-crashlytics-ktx:17.3.1")
// Better logging (EH)
implementation("com.elvishew:xlog:1.7.1")

View File

@ -38,9 +38,6 @@ import exh.log.EHLogLevel
import exh.log.EnhancedFilePrinter
import exh.syDebugVersion
import io.realm.Realm
import io.realm.RealmConfiguration
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.conscrypt.Conscrypt
import timber.log.Timber
import uy.kohesive.injekt.Injekt
@ -51,7 +48,6 @@ import java.security.Security
import java.text.SimpleDateFormat
import java.util.Locale
import javax.net.ssl.SSLContext
import kotlin.concurrent.thread
import kotlin.time.ExperimentalTime
import kotlin.time.days
@ -78,7 +74,6 @@ open class App : Application(), LifecycleObserver {
setupNotificationChannels()
Realm.init(this)
GlobalScope.launch { deleteOldMetadataRealm() } // Delete old metadata DB (EH)
if ((BuildConfig.DEBUG || BuildConfig.BUILD_TYPE == "releaseTest") && DebugToggles.ENABLE_DEBUG_OVERLAY.enabled) {
setupDebugOverlay()
}
@ -137,29 +132,6 @@ open class App : Application(), LifecycleObserver {
Notifications.createChannels(this)
}
// EXH
private fun deleteOldMetadataRealm() {
val config = RealmConfiguration.Builder()
.name("gallery-metadata.realm")
.schemaVersion(3)
.deleteRealmIfMigrationNeeded()
.build()
Realm.deleteRealm(config)
// Delete old paper db files
listOf(
File(filesDir, "gallery-ex"),
File(filesDir, "gallery-perveden"),
File(filesDir, "gallery-nhentai")
).forEach {
if (it.exists()) {
thread {
it.deleteRecursively()
}
}
}
}
// EXH
private fun setupExhLogging() {
EHLogLevel.init(this)
@ -217,7 +189,7 @@ open class App : Application(), LifecycleObserver {
)
XLog.tag("Init").d("Application booting...")
XLog.tag("Init").disableStackTrace().d(
XLog.tag("Init").d(
"App version: ${BuildConfig.VERSION_NAME} (${BuildConfig.FLAVOR}, ${BuildConfig.COMMIT_SHA}, ${BuildConfig.VERSION_CODE})\n" +
"Preview build: $syDebugVersion\n" +
"Android version: ${Build.VERSION.RELEASE} (SDK ${Build.VERSION.SDK_INT}) \n" +

View File

@ -101,12 +101,12 @@ class MdList(private val context: Context, id: Int) : TrackService(id) {
}
fun createInitialTracker(dbManga: Manga, mdManga: Manga = dbManga): Track {
val track = Track.create(TrackManager.MDLIST)
track.manga_id = dbManga.id!!
track.status = FollowStatus.UNFOLLOWED.int
track.tracking_url = MdUtil.baseUrl + mdManga.url
track.title = mdManga.title
return track
return Track.create(TrackManager.MDLIST).apply {
manga_id = dbManga.id!!
status = FollowStatus.UNFOLLOWED.int
tracking_url = MdUtil.baseUrl + mdManga.url
title = mdManga.title
}
}
override suspend fun search(query: String): List<TrackSearch> {

View File

@ -713,7 +713,7 @@ class EHentai(
page++
} while (parsed.second)
return Pair(result.toList(), favNames!!)
return Pair(result.toList(), favNames.orEmpty())
}
fun spPref() = if (exh) {

View File

@ -2,8 +2,6 @@ package eu.kanade.tachiyomi.ui.browse.latest
import android.os.Bundle
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
@ -33,10 +31,6 @@ open class LatestController :
*/
protected var adapter: LatestAdapter? = null
/*init {
setHasOptionsMenu(true)
}*/
/**
* Initiate the view with [R.layout.global_search_controller].
*
@ -82,34 +76,6 @@ open class LatestController :
onMangaClick(manga)
}
/**
* Adds items to the options menu.
*
* @param menu menu containing options.
* @param inflater used to load the menu xml.
*/
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
// Inflate menu.
/*inflater.inflate(R.menu.global_search, menu)
// Initialize search menu
val searchItem = menu.findItem(R.id.action_search)
val searchView = searchItem.actionView as SearchView
searchView.maxWidth = Int.MAX_VALUE
searchItem.setOnActionExpandListener(object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
searchView.onActionViewExpanded() // Required to show the query in the view
searchView.setQuery(presenter.query, false)
return true
}
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
return true
}
})*/
}
/**
* Called when the view is created
*

View File

@ -30,7 +30,6 @@ import uy.kohesive.injekt.api.get
* @param preferences manages the preference calls.
*/
open class LatestPresenter(
private val sourcesToUse: List<CatalogueSource>? = null,
val sourceManager: SourceManager = Injekt.get(),
val db: DatabaseHelper = Injekt.get(),
val preferences: PreferencesHelper = Injekt.get()

View File

@ -11,8 +11,6 @@ import com.afollestad.materialdialogs.actions.setActionButtonEnabled
import com.afollestad.materialdialogs.customview.customView
import com.afollestad.materialdialogs.input.getInputField
import com.afollestad.materialdialogs.input.input
import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import com.tfcporciuncula.flow.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.DatabaseHelper
@ -21,6 +19,7 @@ import eu.kanade.tachiyomi.data.preference.PreferenceKeys
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
import eu.kanade.tachiyomi.databinding.EhDialogCategoriesBinding
import eu.kanade.tachiyomi.databinding.EhDialogLanguagesBinding
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
import eu.kanade.tachiyomi.util.preference.defaultValue
import eu.kanade.tachiyomi.util.preference.entriesRes
@ -111,11 +110,7 @@ class SettingsEhController : SettingsController() {
preferences.enableExhentai().set(false)
true
} else {
router.pushController(
RouterTransaction.with(LoginController())
.pushChangeHandler(FadeChangeHandler())
.popChangeHandler(FadeChangeHandler())
)
router.pushController(LoginController().withFadeTransaction())
false
}
}

View File

@ -23,7 +23,7 @@ class ConfiguringDialogController : DialogController() {
try {
EHConfigurator(activity!!).configureAll()
launchUI {
activity?.toast(activity?.getString(R.string.eh_settings_successfully_uploaded))
activity?.toast(R.string.eh_settings_successfully_uploaded)
}
} catch (e: Exception) {
launchUI {

View File

@ -111,7 +111,7 @@
android:text="@string/use_most_chapters" />
</RadioGroup>
<androidx.appcompat.widget.SwitchCompat
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/use_smart_search"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -122,7 +122,7 @@
app:layout_constraintStart_toStartOf="@+id/sourceGroup"
app:layout_constraintTop_toBottomOf="@+id/sourceGroup" />
<androidx.appcompat.widget.SwitchCompat
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/extra_search_param"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -147,7 +147,7 @@
app:layout_constraintStart_toStartOf="@+id/extra_search_param"
app:layout_constraintTop_toBottomOf="@+id/extra_search_param" />
<Switch
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/skip_step"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -33,7 +33,7 @@ buildscript {
classpath("io.realm:realm-gradle-plugin:7.0.1")
// Firebase Crashlytics
classpath("com.google.firebase:firebase-crashlytics-gradle:2.4.1")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.5.0")
}
repositories {
google()