Release v6.8.1
This commit is contained in:
parent
2b7c0e8e80
commit
5447bd098b
@ -40,8 +40,8 @@ android {
|
|||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
versionCode 6800
|
versionCode 6801
|
||||||
versionName "v6.8.0-EH"
|
versionName "v6.8.1-EH"
|
||||||
|
|
||||||
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
|
buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
|
||||||
buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
|
buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
|
||||||
|
@ -131,5 +131,9 @@ object PreferenceKeys {
|
|||||||
|
|
||||||
const val eh_exhSettingsProfile = "eh_exhSettingsProfile"
|
const val eh_exhSettingsProfile = "eh_exhSettingsProfile"
|
||||||
|
|
||||||
|
const val eh_settingsKey = "eh_settingsKey"
|
||||||
|
|
||||||
const val eh_enableExHentai = "enable_exhentai"
|
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 igneousVal() = rxPrefs.getString("eh_igneous", null)
|
||||||
fun eh_ehSettingsProfile() = rxPrefs.getInteger(Keys.eh_ehSettingsProfile, -1)
|
fun eh_ehSettingsProfile() = rxPrefs.getInteger(Keys.eh_ehSettingsProfile, -1)
|
||||||
fun eh_exhSettingsProfile() = rxPrefs.getInteger(Keys.eh_exhSettingsProfile, -1)
|
fun eh_exhSettingsProfile() = rxPrefs.getInteger(Keys.eh_exhSettingsProfile, -1)
|
||||||
|
fun eh_settingsKey() = rxPrefs.getString(Keys.eh_settingsKey, "")
|
||||||
|
|
||||||
//Lock
|
//Lock
|
||||||
fun lockHash() = rxPrefs.getString("lock_hash", null)
|
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_showSyncIntro() = rxPrefs.getBoolean(Keys.eh_showSyncIntro, true)
|
||||||
|
|
||||||
fun eh_readOnlySync() = rxPrefs.getBoolean(Keys.eh_readOnlySync, false)
|
fun eh_readOnlySync() = rxPrefs.getBoolean(Keys.eh_readOnlySync, false)
|
||||||
|
|
||||||
|
fun eh_showSettingsUploadWarning() = rxPrefs.getBoolean(Keys.eh_showSettingsUploadWarning, true)
|
||||||
// <-- EH
|
// <-- EH
|
||||||
}
|
}
|
||||||
|
@ -341,6 +341,10 @@ class EHentai(override val id: Long,
|
|||||||
cookies[LoginController.PASS_HASH_COOKIE] = prefs.passHashVal().get()!!
|
cookies[LoginController.PASS_HASH_COOKIE] = prefs.passHashVal().get()!!
|
||||||
cookies[LoginController.IGNEOUS_COOKIE] = prefs.igneousVal().get()!!
|
cookies[LoginController.IGNEOUS_COOKIE] = prefs.igneousVal().get()!!
|
||||||
cookies["sp"] = sp.toString()
|
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)
|
//Session-less list display mode (for users without ExHentai)
|
||||||
@ -443,7 +447,7 @@ class EHentai(override val id: Long,
|
|||||||
val TR_SUFFIX = "TR"
|
val TR_SUFFIX = "TR"
|
||||||
|
|
||||||
fun buildCookies(cookies: Map<String, String>)
|
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")}"
|
"${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.ActivityManager
|
||||||
import android.app.Service
|
import android.app.Service
|
||||||
import android.app.usage.UsageStatsManager
|
import android.app.usage.UsageStatsManager
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Build
|
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.recently_read.RecentlyReadController
|
||||||
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
|
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
|
||||||
import exh.metadata.loadAllMetadata
|
import exh.metadata.loadAllMetadata
|
||||||
|
import exh.uconfig.WarnConfigureDialogController
|
||||||
import exh.ui.batchadd.BatchAddController
|
import exh.ui.batchadd.BatchAddController
|
||||||
import exh.ui.lock.LockChangeHandler
|
import exh.ui.lock.LockChangeHandler
|
||||||
import exh.ui.lock.LockController
|
import exh.ui.lock.LockController
|
||||||
@ -167,6 +169,11 @@ class MainActivity : BaseActivity() {
|
|||||||
it.value.isNotEmpty()
|
it.value.isNotEmpty()
|
||||||
}
|
}
|
||||||
}) MetadataFetchDialog().askMigration(this, false)
|
}) 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
|
return
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
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()
|
val time = System.currentTimeMillis()
|
||||||
// We get usage stats for the last 20 seconds
|
// We get usage stats for the last 20 seconds
|
||||||
val sortedStats =
|
val sortedStats =
|
||||||
|
@ -10,7 +10,7 @@ import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
|||||||
import eu.kanade.tachiyomi.util.toast
|
import eu.kanade.tachiyomi.util.toast
|
||||||
import exh.favorites.FavoritesIntroDialog
|
import exh.favorites.FavoritesIntroDialog
|
||||||
import exh.favorites.LocalFavoritesStorage
|
import exh.favorites.LocalFavoritesStorage
|
||||||
import exh.uconfig.ConfiguringDialogController
|
import exh.uconfig.WarnConfigureDialogController
|
||||||
import exh.ui.login.LoginController
|
import exh.ui.login.LoginController
|
||||||
import exh.util.trans
|
import exh.util.trans
|
||||||
import rx.android.schedulers.AndroidSchedulers
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
@ -21,13 +21,19 @@ import rx.schedulers.Schedulers
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class SettingsEhController : SettingsController() {
|
class SettingsEhController : SettingsController() {
|
||||||
private fun Preference<*>.reconfigureOnChange() {
|
private fun Preference<*>.reconfigure(): Boolean {
|
||||||
|
//Listen for change commit
|
||||||
asObservable()
|
asObservable()
|
||||||
.skip(1) //Skip first as it is emitted immediately
|
.skip(1) //Skip first as it is emitted immediately
|
||||||
|
.take(1) //Only listen for first commit
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribeUntilDestroy {
|
.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) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||||
@ -67,7 +73,7 @@ class SettingsEhController : SettingsController() {
|
|||||||
key = "enable_hah"
|
key = "enable_hah"
|
||||||
defaultValue = true
|
defaultValue = true
|
||||||
|
|
||||||
preferences.useHentaiAtHome().reconfigureOnChange()
|
onChange { preferences.useHentaiAtHome().reconfigure() }
|
||||||
}.dependency = PreferenceKeys.eh_enableExHentai
|
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||||
|
|
||||||
switchPreference {
|
switchPreference {
|
||||||
@ -77,7 +83,7 @@ class SettingsEhController : SettingsController() {
|
|||||||
key = "use_jp_title"
|
key = "use_jp_title"
|
||||||
defaultValue = false
|
defaultValue = false
|
||||||
|
|
||||||
preferences.useJapaneseTitle().reconfigureOnChange()
|
onChange { preferences.useJapaneseTitle().reconfigure() }
|
||||||
}.dependency = PreferenceKeys.eh_enableExHentai
|
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||||
|
|
||||||
switchPreference {
|
switchPreference {
|
||||||
@ -87,7 +93,7 @@ class SettingsEhController : SettingsController() {
|
|||||||
key = PreferenceKeys.eh_useOrigImages
|
key = PreferenceKeys.eh_useOrigImages
|
||||||
defaultValue = false
|
defaultValue = false
|
||||||
|
|
||||||
preferences.eh_useOriginalImages().reconfigureOnChange()
|
onChange { preferences.eh_useOriginalImages().reconfigure() }
|
||||||
}.dependency = PreferenceKeys.eh_enableExHentai
|
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||||
|
|
||||||
switchPreference {
|
switchPreference {
|
||||||
@ -119,7 +125,7 @@ class SettingsEhController : SettingsController() {
|
|||||||
"low"
|
"low"
|
||||||
)
|
)
|
||||||
|
|
||||||
preferences.imageQuality().reconfigureOnChange()
|
onChange { preferences.imageQuality().reconfigure() }
|
||||||
}.dependency = PreferenceKeys.eh_enableExHentai
|
}.dependency = PreferenceKeys.eh_enableExHentai
|
||||||
|
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
|
@ -7,24 +7,14 @@ import com.afollestad.materialdialogs.MaterialDialog
|
|||||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||||
import eu.kanade.tachiyomi.util.launchUI
|
import eu.kanade.tachiyomi.util.launchUI
|
||||||
import eu.kanade.tachiyomi.util.toast
|
import eu.kanade.tachiyomi.util.toast
|
||||||
|
import timber.log.Timber
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
|
|
||||||
class ConfiguringDialogController : DialogController() {
|
class ConfiguringDialogController : DialogController() {
|
||||||
private var materialDialog: MaterialDialog? = null
|
private var materialDialog: MaterialDialog? = null
|
||||||
|
|
||||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||||
return MaterialDialog.Builder(activity!!)
|
if(savedViewState == null)
|
||||||
.title("Uploading settings to server")
|
|
||||||
.content("Please wait, this may take some time...")
|
|
||||||
.progress(true, 0)
|
|
||||||
.cancelable(false)
|
|
||||||
.build().also {
|
|
||||||
materialDialog = it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAttach(view: View) {
|
|
||||||
super.onAttach(view)
|
|
||||||
thread {
|
thread {
|
||||||
try {
|
try {
|
||||||
EHConfigurator().configureAll()
|
EHConfigurator().configureAll()
|
||||||
@ -41,11 +31,21 @@ class ConfiguringDialogController : DialogController() {
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Timber.e(e, "Configuration error!")
|
||||||
}
|
}
|
||||||
launchUI {
|
launchUI {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return MaterialDialog.Builder(activity!!)
|
||||||
|
.title("Uploading settings to server")
|
||||||
|
.content("Please wait, this may take some time...")
|
||||||
|
.progress(true, 0)
|
||||||
|
.cancelable(false)
|
||||||
|
.build().also {
|
||||||
|
materialDialog = it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView(view: View) {
|
override fun onDestroyView(view: View) {
|
||||||
|
@ -33,7 +33,7 @@ class EHConfigurator {
|
|||||||
.add("profile_set", set)
|
.add("profile_set", set)
|
||||||
.build())
|
.build())
|
||||||
.build())
|
.build())
|
||||||
.execute().asJsoup()
|
.execute()
|
||||||
|
|
||||||
private val EHentai.uconfigUrl get() = baseUrl + UCONFIG_URL
|
private val EHentai.uconfigUrl get() = baseUrl + UCONFIG_URL
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ class EHConfigurator {
|
|||||||
if(it.text() == PROFILE_NAME) {
|
if(it.text() == PROFILE_NAME) {
|
||||||
val id = it.attr("value")
|
val id = it.attr("value")
|
||||||
//Delete old profile
|
//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
|
//Create profile in available slot
|
||||||
val slot = availableProfiles.first()
|
val slot = availableProfiles.first()
|
||||||
source.execProfileActions("create",
|
val response = source.execProfileActions("create",
|
||||||
PROFILE_NAME,
|
PROFILE_NAME,
|
||||||
slot.toString(),
|
slot.toString(),
|
||||||
1)
|
1)
|
||||||
@ -111,8 +111,15 @@ class EHConfigurator {
|
|||||||
.post(form)
|
.post(form)
|
||||||
.build()).execute()
|
.build()).execute()
|
||||||
|
|
||||||
//Persist slot
|
//Persist slot + sk
|
||||||
source.spPref().set(slot)
|
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 {
|
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.source.online.all.EHentai
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||||
import exh.EXH_SOURCE_ID
|
import exh.EXH_SOURCE_ID
|
||||||
|
import exh.uconfig.WarnConfigureDialogController
|
||||||
import kotlinx.android.synthetic.main.eh_activity_login.view.*
|
import kotlinx.android.synthetic.main.eh_activity_login.view.*
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.android.schedulers.AndroidSchedulers
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
@ -102,6 +103,7 @@ class LoginController : NucleusController<LoginPresenter>() {
|
|||||||
val eh = sourceManager
|
val eh = sourceManager
|
||||||
.getOnlineSources()
|
.getOnlineSources()
|
||||||
.find { it.id == EXH_SOURCE_ID } as EHentai
|
.find { it.id == EXH_SOURCE_ID } as EHentai
|
||||||
|
|
||||||
Observable.fromCallable {
|
Observable.fromCallable {
|
||||||
//I honestly have no idea why we need to call this twice, but it works, so whatever
|
//I honestly have no idea why we need to call this twice, but it works, so whatever
|
||||||
try {
|
try {
|
||||||
@ -115,6 +117,9 @@ class LoginController : NucleusController<LoginPresenter>() {
|
|||||||
.subscribe {
|
.subscribe {
|
||||||
progressDialog.dismiss()
|
progressDialog.dismiss()
|
||||||
router.popCurrentController()
|
router.popCurrentController()
|
||||||
|
|
||||||
|
//Upload settings
|
||||||
|
WarnConfigureDialogController.uploadSettings(router)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<changelog bulletedList="true">
|
<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="">
|
<changelogversion versionName="v6.8.0-EH" changeDate="">
|
||||||
<changelogtext>Various performance improvements</changelogtext>
|
<changelogtext>Various performance improvements</changelogtext>
|
||||||
<changelogtext>Fix library search query being lost</changelogtext>
|
<changelogtext>Fix library search query being lost</changelogtext>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user