mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-12 14:03:00 +01:00
Prevent crash with null frost cookie
This commit is contained in:
parent
5393f171e4
commit
66a6657b81
@ -53,6 +53,7 @@ abstract class RecyclerFragment<T, Item : IItem<*, *>> : BaseFragment(), Recycle
|
||||
val data = try {
|
||||
reloadImpl(progress)
|
||||
} catch (e: Exception) {
|
||||
L.e(e) { "Recycler reload fail" }
|
||||
null
|
||||
}
|
||||
if (!isActive)
|
||||
|
@ -114,8 +114,10 @@ fun Activity.cookies(): ArrayList<CookieModel> {
|
||||
private inline fun <reified T : WebOverlayActivityBase> Context.launchWebOverlayImpl(url: String) {
|
||||
val argUrl = url.formattedFbUrl
|
||||
L.v { "Launch received: $url\nLaunch web overlay: $argUrl" }
|
||||
if (argUrl.isFacebookUrl && argUrl.contains("/logout.php"))
|
||||
if (argUrl.isFacebookUrl && argUrl.contains("/logout.php")) {
|
||||
L.d { "Logout php found" }
|
||||
FbCookie.logout(this)
|
||||
}
|
||||
else if (!(Prefs.linksInDefaultApp && resolveActivityForUri(Uri.parse(argUrl))))
|
||||
startActivity<T>(false, intentBuilder = {
|
||||
putExtra(ARG_URL, argUrl)
|
||||
@ -371,7 +373,12 @@ fun EmailBuilder.addFrostDetails() {
|
||||
fun frostJsoup(url: String) = frostJsoup(FbCookie.webCookie, url)
|
||||
|
||||
fun frostJsoup(cookie: String?, url: String) =
|
||||
Jsoup.connect(url).cookie(FACEBOOK_COM, cookie).userAgent(USER_AGENT_BASIC).get()!!
|
||||
Jsoup.connect(url).run {
|
||||
if (cookie != null) cookie(
|
||||
FACEBOOK_COM,
|
||||
cookie
|
||||
) else this
|
||||
}.userAgent(USER_AGENT_BASIC).get()!!
|
||||
|
||||
fun Element.first(vararg select: String): Element? {
|
||||
select.forEach {
|
||||
|
@ -102,6 +102,7 @@ class FrostJSI(val web: FrostWebView) {
|
||||
|
||||
@JavascriptInterface
|
||||
fun loadLogin() {
|
||||
L.d { "Sign up button found; load login" }
|
||||
FbCookie.logout(context)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user