Exh login menu supports custom igneous cookies. Supports translation now as well
This commit is contained in:
parent
2629b3420b
commit
e500d0bebf
@ -13,6 +13,8 @@ import android.widget.Toast
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.input.input
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
@ -34,7 +36,6 @@ import java.util.Locale
|
||||
/**
|
||||
* LoginController
|
||||
*/
|
||||
|
||||
class EhLoginActivity : BaseViewBindingActivity<EhActivityLoginBinding>() {
|
||||
val preferenceManager: PreferencesHelper by injectLazy()
|
||||
|
||||
@ -42,6 +43,8 @@ class EhLoginActivity : BaseViewBindingActivity<EhActivityLoginBinding>() {
|
||||
|
||||
private var bundle: Bundle? = null
|
||||
|
||||
private var igneous: String? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@ -128,6 +131,11 @@ class EhLoginActivity : BaseViewBindingActivity<EhActivityLoginBinding>() {
|
||||
binding.webview.loadUrl("https://forums.e-hentai.org/index.php?act=Login&$PARAM_SKIP_INJECT=true")
|
||||
}
|
||||
|
||||
binding.btnIgneousCookie.setOnClickListener {
|
||||
hideAdvancedOptions()
|
||||
openIgneousDialog()
|
||||
}
|
||||
|
||||
CookieManager.getInstance().removeAllCookies {
|
||||
launchUI {
|
||||
if (bundle == null) {
|
||||
@ -137,6 +145,23 @@ class EhLoginActivity : BaseViewBindingActivity<EhActivityLoginBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun openIgneousDialog() {
|
||||
var igneous: CharSequence? = null
|
||||
MaterialDialog(this)
|
||||
.title(R.string.custom_igneous_cookie)
|
||||
.message(R.string.custom_igneous_cookie_message)
|
||||
.input { _, charSequence ->
|
||||
igneous = charSequence
|
||||
}
|
||||
.positiveButton(android.R.string.ok) {
|
||||
if (!igneous.isNullOrBlank()) {
|
||||
this.igneous = igneous?.toString()?.trim()
|
||||
}
|
||||
}
|
||||
.negativeButton(android.R.string.cancel)
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun hideAdvancedOptions() {
|
||||
binding.advancedOptions.isVisible = false
|
||||
binding.webview.isVisible = true
|
||||
@ -211,7 +236,7 @@ class EhLoginActivity : BaseViewBindingActivity<EhActivityLoginBinding>() {
|
||||
when (it.name.toLowerCase(Locale.getDefault())) {
|
||||
MEMBER_ID_COOKIE -> memberId = it.value
|
||||
PASS_HASH_COOKIE -> passHash = it.value
|
||||
IGNEOUS_COOKIE -> igneous = it.value
|
||||
IGNEOUS_COOKIE -> igneous = this.igneous ?: it.value
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,28 +66,35 @@
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Recheck login status" />
|
||||
android:text="@string/recheck_login_status" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_alt_login"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Alternative login page" />
|
||||
android:text="@string/alternative_login_page" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_skip_restyle"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Skip page restyling" />
|
||||
android:text="@string/skip_page_restyling" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_igneous_cookie"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/custom_igneous_cookie" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_close"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Close" />
|
||||
android:text="@android:string/cancel" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
@ -131,7 +138,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Advanced" />
|
||||
android:text="@string/pref_category_advanced" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -116,6 +116,13 @@
|
||||
<string name="eh_settings_uploading_to_server_message">Please wait, this may take some time…</string>
|
||||
<string name="eh_settings_out_of_slots_error">You are out of profile slots on %1$s, please delete a profile!</string>
|
||||
|
||||
<!-- EH Settings Login Activity -->
|
||||
<string name="recheck_login_status">Recheck login status</string>
|
||||
<string name="alternative_login_page">Alternative login page</string>
|
||||
<string name="skip_page_restyling">Skip page restyling</string>
|
||||
<string name="custom_igneous_cookie">Custom igneous cookie</string>
|
||||
<string name="custom_igneous_cookie_message">Some users cannot access ExHentai the normal way, and have to pass in a specific igneous cookie value, this option is for those users.</string>
|
||||
|
||||
<!-- Advanced Settings -->
|
||||
<string name="developer_tools">Developer tools</string>
|
||||
<string name="toggle_hentai_features">Enable integrated hentai features</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user