Conversation
|
Hi, thanks for working on this. Your current version does not really clear the cookie in the saved preferences/settings. What do you think about moving this logic into I guess this is where the cookie is updated from the webview: You could try to set the cookie to null in this place (if it does not contain SAPISID). |
|
Thank you for the feedback. You are right. I will check it too. And the stuff with |
|
Hi, I have updated the code according to your suggestions. Now cookie and visitorData should be removed from preference storage by logout. |
|
Hi @zeratul47 your current code still does not set the cookie to For example what do you think about this code in This should be much simpler. It does completely remove the cookie from the settings so it is really reset and read as With this you can remove your changes in As for You could just let it generate a new InnerTune/app/src/main/java/com/zionhuang/music/App.kt Lines 86 to 89 in c5b2856 Should be easy since it already automatically re-runs if the visitorData is |
|
I have updated code, by your advice. |
oh well I forgot to think of that. idk we have to test and see what works For example in the which does automatically re-run when the cookie changes. Maybe something similar could be added to the home page. |
| innerTubeCookie = CookieManager.getInstance().getCookie(url) | ||
| val youtubeCookieString = CookieManager.getInstance().getCookie(url) | ||
| GlobalScope.launch { | ||
| if ("SAPISID" in parseCookieString(youtubeCookieString)) { // if logged in |
There was a problem hiding this comment.
Why do you use parseCookieString here?
To my understanding this should be enough:
if ("SAPISID" in youtubeCookieString) { // if logged in
since youtubeCookieString is already a string and we can simply check if it contains the substring "SAPISID".
I do not see a reason to parse the cookies here as this would only take longer.
Was there a reason why you added it?
There was a problem hiding this comment.
Well, if we do not parse the string, then how "SAPISID" in youtubeCookieString will work?
I probably can use youtubeCookieString.contains("SAPISID").
Anyway I will check it one time (and documentation too), and change if necessary.
Thank you for checking!
There was a problem hiding this comment.
how
"SAPISID" in youtubeCookieStringwill work?
it checks if youtubeCookieString contains "SAPISID"
From Kotlin docs: https://kotlinlang.org/docs/operator-overloading.html#in-operator
a in b translates into b.contains(a)
so you have both options:
youtubeCookieString.contains("SAPISID")"SAPISID" in youtubeCookieString
use whatever you think looks better - they both work
|
Notes for later:
should be replaced by null checks or if not possible by empty checks |
Fixes #1686
YouTube.cookieset tonullby logout.settings.gradle.ktsto auto download dependencies.