From 24ba2c5da0ff5d1c8232d202f602ba065ac4d082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=9C=88=E6=AE=8B=E7=83=9B?= <61369261+fengyuecanzhu@users.noreply.github.com> Date: Wed, 4 May 2022 08:48:18 +0800 Subject: [PATCH] add getKey function to CookieStore --- .../xyz/fycz/myreader/greendao/service/CookieStore.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/xyz/fycz/myreader/greendao/service/CookieStore.kt b/app/src/main/java/xyz/fycz/myreader/greendao/service/CookieStore.kt index 84e917a..82f5cdf 100644 --- a/app/src/main/java/xyz/fycz/myreader/greendao/service/CookieStore.kt +++ b/app/src/main/java/xyz/fycz/myreader/greendao/service/CookieStore.kt @@ -53,6 +53,12 @@ object CookieStore : CookieManager { return cookieBean?.cookie ?: "" } + fun getKey(url: String, key: String): String { + val cookie = getCookie(url) + val cookieMap = cookieToMap(cookie) + return cookieMap[key] ?: "" + } + override fun removeCookie(url: String) { DbManager.getDaoSession().cookieBeanDao.deleteByKey(NetworkUtils.getSubDomain(url)) } @@ -93,4 +99,4 @@ object CookieStore : CookieManager { } return builder.deleteCharAt(builder.lastIndexOf(";")).toString() } -} \ No newline at end of file +}