Release v6.8.1
This commit is contained in:
parent
2b7c0e8e80
commit
5447bd098b
@ -40,8 +40,8 @@ android {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 26
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
versionCode 6800
|
||||
versionName "v6.8.0-EH"
|
||||
versionCode 6801
|
||||
versionName "v6.8.1-EH"
|
||||
|
||||
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
|
||||
buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
|
||||
|
@ -131,5 +131,9 @@ object PreferenceKeys {
|
||||
|
||||
const val eh_exhSettingsProfile = "eh_exhSettingsProfile"
|
||||
|
||||
const val eh_settingsKey = "eh_settingsKey"
|
||||
|
||||
const val eh_enableExHentai = "enable_exhentai"
|
||||
|
||||
const val eh_showSettingsUploadWarning = "eh_showSettingsUploadWarning"
|
||||
}
|
||||
|
@ -199,6 +199,7 @@ class PreferencesHelper(val context: Context) {
|
||||
fun igneousVal() = rxPrefs.getString("eh_igneous", null)
|
||||
fun eh_ehSettingsProfile() = rxPrefs.getInteger(Keys.eh_ehSettingsProfile, -1)
|
||||
fun eh_exhSettingsProfile() = rxPrefs.getInteger(Keys.eh_exhSettingsProfile, -1)
|
||||
fun eh_settingsKey() = rxPrefs.getString(Keys.eh_settingsKey, "")
|
||||
|
||||
//Lock
|
||||
fun lockHash() = rxPrefs.getString("lock_hash", null)
|
||||
@ -214,5 +215,7 @@ class PreferencesHelper(val context: Context) {
|
||||
fun eh_showSyncIntro() = rxPrefs.getBoolean(Keys.eh_showSyncIntro, true)
|
||||
|
||||
fun eh_readOnlySync() = rxPrefs.getBoolean(Keys.eh_readOnlySync, false)
|
||||
|
||||
fun eh_showSettingsUploadWarning() = rxPrefs.getBoolean(Keys.eh_showSettingsUploadWarning, true)
|
||||
// <-- EH
|
||||
}
|
||||
|
@ -341,6 +341,10 @@ class EHentai(override val id: Long,
|
||||
cookies[LoginController.PASS_HASH_COOKIE] = prefs.passHashVal().get()!!
|
||||
cookies[LoginController.IGNEOUS_COOKIE] = prefs.igneousVal().get()!!
|
||||
cookies["sp"] = sp.toString()
|
||||
|
||||
val sessionKey = prefs.eh_settingsKey().getOrDefault()
|
||||
if(sessionKey != null)
|
||||
cookies["sk"] = sessionKey
|
||||
}
|
||||
|
||||
//Session-less list display mode (for users without ExHentai)
|
||||
@ -443,7 +447,7 @@ class EHentai(override val id: Long,
|
||||
val TR_SUFFIX = "TR"
|
||||
|
||||
fun buildCookies(cookies: Map<String, String>)
|
||||
= cookies.entries.joinToString(separator = "; ", postfix = ";") {
|
||||
= cookies.entries.joinToString(separator = "; ") {
|
||||
"${URLEncoder.encode(it.key, "UTF-8")}=${URLEncoder.encode(it.value, "UTF-8")}"
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import android.animation.ObjectAnimator
|
||||
import android.app.ActivityManager
|
||||
import android.app.Service
|
||||
import android.app.usage.UsageStatsManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
@ -27,6 +28,7 @@ import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController
|
||||
import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
|
||||
import exh.metadata.loadAllMetadata
|
||||
import exh.uconfig.WarnConfigureDialogController
|
||||
import exh.ui.batchadd.BatchAddController
|
||||
import exh.ui.lock.LockChangeHandler
|
||||
import exh.ui.lock.LockController
|
||||
@ -167,6 +169,11 @@ class MainActivity : BaseActivity() {
|
||||
it.value.isNotEmpty()
|
||||
}
|
||||
}) MetadataFetchDialog().askMigration(this, false)
|
||||
|
||||
// Upload settings
|
||||
if(preferences.enableExhentai().getOrDefault()
|
||||
&& preferences.eh_showSettingsUploadWarning().getOrDefault())
|
||||
WarnConfigureDialogController.uploadSettings(router)
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +304,7 @@ class MainActivity : BaseActivity() {
|
||||
return
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
val mUsageStatsManager = getSystemService("usagestats") as UsageStatsManager
|
||||
val mUsageStatsManager = getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
|
||||
val time = System.currentTimeMillis()
|
||||
// We get usage stats for the last 20 seconds
|
||||
val sortedStats =
|
||||
|
@ -10,7 +10,7 @@ import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import exh.favorites.FavoritesIntroDialog
|
||||
import exh.favorites.LocalFavoritesStorage
|
||||
import exh.uconfig.ConfiguringDialogController
|
||||
import exh.uconfig.WarnConfigureDialogController
|
||||
import exh.ui.login.LoginController
|
||||
import exh.util.trans
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
@ -21,13 +21,19 @@ import rx.schedulers.Schedulers
|
||||
*/
|
||||
|
||||
class SettingsEhController : SettingsController() {
|
||||
private fun Preference<*>.reconfigureOnChange() {
|
||||
private fun Preference<*>.reconfigure(): Boolean {
|
||||
//Listen for change commit
|
||||
asObservable()
|
||||
.skip(1) //Skip first as it is emitted immediately
|
||||
.take(1) //Only listen for first commit
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeUntilDestroy {
|
||||
ConfiguringDialogController().showDialog(router)
|
||||
}
|
||||
//Only listen for first change commit
|
||||
WarnConfigureDialogController.uploadSettings(router)
|
||||
}
|
||||
|
||||
//Always return true to save changes
|
||||
return true
|
||||
}
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||
@ -67,7 +73,7 @@ class SettingsEhController : SettingsController() {
|
||||
key = "enable_hah"
|
||||
defaultValue = true
|
||||
|
||||
preferences.useHentaiAtHome().reconfigureOnChange()
|
||||
onChange { preferences.useHentaiAtHome().reconfigure() }
|
||||
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||
|
||||
switchPreference {
|
||||
@ -77,7 +83,7 @@ class SettingsEhController : SettingsController() {
|
||||
key = "use_jp_title"
|
||||
defaultValue = false
|
||||
|
||||
preferences.useJapaneseTitle().reconfigureOnChange()
|
||||
onChange { preferences.useJapaneseTitle().reconfigure() }
|
||||
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||
|
||||
switchPreference {
|
||||
@ -87,7 +93,7 @@ class SettingsEhController : SettingsController() {
|
||||
key = PreferenceKeys.eh_useOrigImages
|
||||
defaultValue = false
|
||||
|
||||
preferences.eh_useOriginalImages().reconfigureOnChange()
|
||||
onChange { preferences.eh_useOriginalImages().reconfigure() }
|
||||
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||
|
||||
switchPreference {
|
||||
@ -119,7 +125,7 @@ class SettingsEhController : SettingsController() {
|
||||
"low"
|
||||
)
|
||||
|
||||
preferences.imageQuality().reconfigureOnChange()
|
||||
onChange { preferences.imageQuality().reconfigure() }
|
||||
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||
|
||||
preferenceCategory {
|
||||
|
@ -7,12 +7,37 @@ import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.util.launchUI
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import timber.log.Timber
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class ConfiguringDialogController : DialogController() {
|
||||
private var materialDialog: MaterialDialog? = null
|
||||
|
||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||
if(savedViewState == null)
|
||||
thread {
|
||||
try {
|
||||
EHConfigurator().configureAll()
|
||||
launchUI {
|
||||
activity?.toast("Settings successfully uploaded!")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
activity?.let {
|
||||
it.runOnUiThread {
|
||||
MaterialDialog.Builder(it)
|
||||
.title("Configuration failed!")
|
||||
.content("An error occurred during the configuration process: " + e.message)
|
||||
.positiveText("Ok")
|
||||
.show()
|
||||
}
|
||||
}
|
||||
Timber.e(e, "Configuration error!")
|
||||
}
|
||||
launchUI {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
return MaterialDialog.Builder(activity!!)
|
||||
.title("Uploading settings to server")
|
||||
.content("Please wait, this may take some time...")
|
||||
@ -23,31 +48,6 @@ class ConfiguringDialogController : DialogController() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttach(view: View) {
|
||||
super.onAttach(view)
|
||||
thread {
|
||||
try {
|
||||
EHConfigurator().configureAll()
|
||||
launchUI {
|
||||
activity?.toast("Settings successfully uploaded!")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
activity?.let {
|
||||
it.runOnUiThread {
|
||||
MaterialDialog.Builder(it)
|
||||
.title("Configuration failed!")
|
||||
.content("An error occurred during the configuration process: " + e.message)
|
||||
.positiveText("Ok")
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
launchUI {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView(view: View) {
|
||||
super.onDestroyView(view)
|
||||
materialDialog = null
|
||||
|
@ -33,7 +33,7 @@ class EHConfigurator {
|
||||
.add("profile_set", set)
|
||||
.build())
|
||||
.build())
|
||||
.execute().asJsoup()
|
||||
.execute()
|
||||
|
||||
private val EHentai.uconfigUrl get() = baseUrl + UCONFIG_URL
|
||||
|
||||
@ -81,7 +81,7 @@ class EHConfigurator {
|
||||
if(it.text() == PROFILE_NAME) {
|
||||
val id = it.attr("value")
|
||||
//Delete old profile
|
||||
lastDoc = source.execProfileActions("delete", "", id, id.toInt())
|
||||
lastDoc = source.execProfileActions("delete", "", id, id.toInt()).asJsoup()
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ class EHConfigurator {
|
||||
|
||||
//Create profile in available slot
|
||||
val slot = availableProfiles.first()
|
||||
source.execProfileActions("create",
|
||||
val response = source.execProfileActions("create",
|
||||
PROFILE_NAME,
|
||||
slot.toString(),
|
||||
1)
|
||||
@ -111,8 +111,15 @@ class EHConfigurator {
|
||||
.post(form)
|
||||
.build()).execute()
|
||||
|
||||
//Persist slot
|
||||
//Persist slot + sk
|
||||
source.spPref().set(slot)
|
||||
|
||||
val keyCookie = response.headers().toMultimap()["Set-Cookie"]?.find {
|
||||
it.startsWith("sk=")
|
||||
}?.removePrefix("sk=")?.substringBefore(';')
|
||||
|
||||
if(keyCookie != null)
|
||||
prefs.eh_settingsKey().set(keyCookie)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -0,0 +1,41 @@
|
||||
package exh.uconfig
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.bluelinelabs.conductor.Router
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class WarnConfigureDialogController : DialogController() {
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
override fun onCreateDialog(savedState: Bundle?): Dialog {
|
||||
return MaterialDialog.Builder(activity!!)
|
||||
.title("Settings profile note")
|
||||
.content("""
|
||||
The app will now add a new settings profile on E-Hentai and ExHentai to optimize app performance. Please ensure that you have less than three profiles on both sites.
|
||||
|
||||
If you have no idea what settings profiles are, then it probably doesn't matter, just hit 'OK'.
|
||||
""".trimIndent())
|
||||
.positiveText(android.R.string.ok)
|
||||
.onPositive { _, _ ->
|
||||
prefs.eh_showSettingsUploadWarning().set(false)
|
||||
ConfiguringDialogController().showDialog(router)
|
||||
}
|
||||
.cancelable(false)
|
||||
.build()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun uploadSettings(router: Router) {
|
||||
if(Injekt.get<PreferencesHelper>().eh_showSettingsUploadWarning().getOrDefault())
|
||||
WarnConfigureDialogController().showDialog(router)
|
||||
else
|
||||
ConfiguringDialogController().showDialog(router)
|
||||
}
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.online.all.EHentai
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
import exh.EXH_SOURCE_ID
|
||||
import exh.uconfig.WarnConfigureDialogController
|
||||
import kotlinx.android.synthetic.main.eh_activity_login.view.*
|
||||
import rx.Observable
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
@ -102,6 +103,7 @@ class LoginController : NucleusController<LoginPresenter>() {
|
||||
val eh = sourceManager
|
||||
.getOnlineSources()
|
||||
.find { it.id == EXH_SOURCE_ID } as EHentai
|
||||
|
||||
Observable.fromCallable {
|
||||
//I honestly have no idea why we need to call this twice, but it works, so whatever
|
||||
try {
|
||||
@ -115,6 +117,9 @@ class LoginController : NucleusController<LoginPresenter>() {
|
||||
.subscribe {
|
||||
progressDialog.dismiss()
|
||||
router.popCurrentController()
|
||||
|
||||
//Upload settings
|
||||
WarnConfigureDialogController.uploadSettings(router)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<changelog bulletedList="true">
|
||||
<changelogversion versionName="v6.8.1-EH" changeDate="">
|
||||
<changelogtext>Various performance improvements</changelogtext>
|
||||
<changelogtext>Fix app not working at all for some users</changelogtext>
|
||||
</changelogversion>
|
||||
<changelogversion versionName="v6.8.0-EH" changeDate="">
|
||||
<changelogtext>Various performance improvements</changelogtext>
|
||||
<changelogtext>Fix library search query being lost</changelogtext>
|
||||
|
Loading…
x
Reference in New Issue
Block a user