mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-13 20:48:56 +01:00
Release v6.8.1
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user