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") implementation ("info.debatty:java-string-similarity:2.0.0")
// Firebase (EH) // Firebase (EH)
implementation("com.google.firebase:firebase-analytics-ktx:18.0.0") implementation("com.google.firebase:firebase-analytics-ktx:18.0.2")
implementation("com.google.firebase:firebase-crashlytics-ktx:17.3.0") implementation("com.google.firebase:firebase-crashlytics-ktx:17.3.1")
// Better logging (EH) // Better logging (EH)
implementation("com.elvishew:xlog:1.7.1") implementation("com.elvishew:xlog:1.7.1")

View File

@ -38,9 +38,6 @@ import exh.log.EHLogLevel
import exh.log.EnhancedFilePrinter import exh.log.EnhancedFilePrinter
import exh.syDebugVersion import exh.syDebugVersion
import io.realm.Realm import io.realm.Realm
import io.realm.RealmConfiguration
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.conscrypt.Conscrypt import org.conscrypt.Conscrypt
import timber.log.Timber import timber.log.Timber
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
@ -51,7 +48,6 @@ import java.security.Security
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import javax.net.ssl.SSLContext import javax.net.ssl.SSLContext
import kotlin.concurrent.thread
import kotlin.time.ExperimentalTime import kotlin.time.ExperimentalTime
import kotlin.time.days import kotlin.time.days
@ -78,7 +74,6 @@ open class App : Application(), LifecycleObserver {
setupNotificationChannels() setupNotificationChannels()
Realm.init(this) Realm.init(this)
GlobalScope.launch { deleteOldMetadataRealm() } // Delete old metadata DB (EH)
if ((BuildConfig.DEBUG || BuildConfig.BUILD_TYPE == "releaseTest") && DebugToggles.ENABLE_DEBUG_OVERLAY.enabled) { if ((BuildConfig.DEBUG || BuildConfig.BUILD_TYPE == "releaseTest") && DebugToggles.ENABLE_DEBUG_OVERLAY.enabled) {
setupDebugOverlay() setupDebugOverlay()
} }
@ -137,29 +132,6 @@ open class App : Application(), LifecycleObserver {
Notifications.createChannels(this) 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 // EXH
private fun setupExhLogging() { private fun setupExhLogging() {
EHLogLevel.init(this) EHLogLevel.init(this)
@ -217,7 +189,7 @@ open class App : Application(), LifecycleObserver {
) )
XLog.tag("Init").d("Application booting...") 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" + "App version: ${BuildConfig.VERSION_NAME} (${BuildConfig.FLAVOR}, ${BuildConfig.COMMIT_SHA}, ${BuildConfig.VERSION_CODE})\n" +
"Preview build: $syDebugVersion\n" + "Preview build: $syDebugVersion\n" +
"Android version: ${Build.VERSION.RELEASE} (SDK ${Build.VERSION.SDK_INT}) \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 { fun createInitialTracker(dbManga: Manga, mdManga: Manga = dbManga): Track {
val track = Track.create(TrackManager.MDLIST) return Track.create(TrackManager.MDLIST).apply {
track.manga_id = dbManga.id!! manga_id = dbManga.id!!
track.status = FollowStatus.UNFOLLOWED.int status = FollowStatus.UNFOLLOWED.int
track.tracking_url = MdUtil.baseUrl + mdManga.url tracking_url = MdUtil.baseUrl + mdManga.url
track.title = mdManga.title title = mdManga.title
return track }
} }
override suspend fun search(query: String): List<TrackSearch> { override suspend fun search(query: String): List<TrackSearch> {

View File

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

View File

@ -2,8 +2,6 @@ package eu.kanade.tachiyomi.ui.browse.latest
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -33,10 +31,6 @@ open class LatestController :
*/ */
protected var adapter: LatestAdapter? = null protected var adapter: LatestAdapter? = null
/*init {
setHasOptionsMenu(true)
}*/
/** /**
* Initiate the view with [R.layout.global_search_controller]. * Initiate the view with [R.layout.global_search_controller].
* *
@ -82,34 +76,6 @@ open class LatestController :
onMangaClick(manga) 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 * Called when the view is created
* *

View File

@ -30,7 +30,6 @@ import uy.kohesive.injekt.api.get
* @param preferences manages the preference calls. * @param preferences manages the preference calls.
*/ */
open class LatestPresenter( open class LatestPresenter(
private val sourcesToUse: List<CatalogueSource>? = null,
val sourceManager: SourceManager = Injekt.get(), val sourceManager: SourceManager = Injekt.get(),
val db: DatabaseHelper = Injekt.get(), val db: DatabaseHelper = Injekt.get(),
val preferences: PreferencesHelper = 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.customview.customView
import com.afollestad.materialdialogs.input.getInputField import com.afollestad.materialdialogs.input.getInputField
import com.afollestad.materialdialogs.input.input import com.afollestad.materialdialogs.input.input
import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import com.tfcporciuncula.flow.Preference import com.tfcporciuncula.flow.Preference
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.DatabaseHelper 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.data.preference.asImmediateFlow
import eu.kanade.tachiyomi.databinding.EhDialogCategoriesBinding import eu.kanade.tachiyomi.databinding.EhDialogCategoriesBinding
import eu.kanade.tachiyomi.databinding.EhDialogLanguagesBinding 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.ui.webview.WebViewActivity
import eu.kanade.tachiyomi.util.preference.defaultValue import eu.kanade.tachiyomi.util.preference.defaultValue
import eu.kanade.tachiyomi.util.preference.entriesRes import eu.kanade.tachiyomi.util.preference.entriesRes
@ -111,11 +110,7 @@ class SettingsEhController : SettingsController() {
preferences.enableExhentai().set(false) preferences.enableExhentai().set(false)
true true
} else { } else {
router.pushController( router.pushController(LoginController().withFadeTransaction())
RouterTransaction.with(LoginController())
.pushChangeHandler(FadeChangeHandler())
.popChangeHandler(FadeChangeHandler())
)
false false
} }
} }

View File

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

View File

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

View File

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

View File

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