add getKey function to CookieStore

pull/22/head
风月残烛 3 years ago committed by GitHub
parent c7578f8ba5
commit 24ba2c5da0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/src/main/java/xyz/fycz/myreader/greendao/service/CookieStore.kt

@ -53,6 +53,12 @@ object CookieStore : CookieManager {
return cookieBean?.cookie ?: "" 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) { override fun removeCookie(url: String) {
DbManager.getDaoSession().cookieBeanDao.deleteByKey(NetworkUtils.getSubDomain(url)) DbManager.getDaoSession().cookieBeanDao.deleteByKey(NetworkUtils.getSubDomain(url))
} }
@ -93,4 +99,4 @@ object CookieStore : CookieManager {
} }
return builder.deleteCharAt(builder.lastIndexOf(";")).toString() return builder.deleteCharAt(builder.lastIndexOf(";")).toString()
} }
} }

Loading…
Cancel
Save