1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 12:02:33 +01:00

Move parsers to facebook folder (#1109)

This commit is contained in:
Allan Wang 2018-09-27 18:03:53 -04:00 committed by GitHub
parent 5db95f2451
commit 7460935f32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 30 additions and 35 deletions

View File

@ -55,8 +55,8 @@ import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.profilePictureUrl import com.pitchedapps.frost.facebook.profilePictureUrl
import com.pitchedapps.frost.fragments.BaseFragment import com.pitchedapps.frost.fragments.BaseFragment
import com.pitchedapps.frost.fragments.WebFragment import com.pitchedapps.frost.fragments.WebFragment
import com.pitchedapps.frost.parsers.FrostSearch import com.pitchedapps.frost.facebook.parsers.FrostSearch
import com.pitchedapps.frost.parsers.SearchParser import com.pitchedapps.frost.facebook.parsers.SearchParser
import com.pitchedapps.frost.utils.* import com.pitchedapps.frost.utils.*
import com.pitchedapps.frost.views.BadgedIcon import com.pitchedapps.frost.views.BadgedIcon
import com.pitchedapps.frost.views.FrostVideoViewer import com.pitchedapps.frost.views.FrostVideoViewer

View File

@ -1,4 +1,4 @@
package com.pitchedapps.frost.parsers package com.pitchedapps.frost.facebook.parsers
import com.pitchedapps.frost.dbflow.CookieModel import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.facebook.FB_CSS_URL_MATCHER import com.pitchedapps.frost.facebook.FB_CSS_URL_MATCHER

View File

@ -1,4 +1,4 @@
package com.pitchedapps.frost.parsers package com.pitchedapps.frost.facebook.parsers
import com.pitchedapps.frost.dbflow.CookieModel import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.facebook.* import com.pitchedapps.frost.facebook.*

View File

@ -1,4 +1,4 @@
package com.pitchedapps.frost.parsers package com.pitchedapps.frost.facebook.parsers
import com.pitchedapps.frost.dbflow.CookieModel import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.facebook.* import com.pitchedapps.frost.facebook.*

View File

@ -1,9 +1,9 @@
package com.pitchedapps.frost.parsers package com.pitchedapps.frost.facebook.parsers
import ca.allanwang.kau.searchview.SearchItem import ca.allanwang.kau.searchview.SearchItem
import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.formattedFbUrl import com.pitchedapps.frost.facebook.formattedFbUrl
import com.pitchedapps.frost.parsers.FrostSearch.Companion.create import com.pitchedapps.frost.facebook.parsers.FrostSearch.Companion.create
import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.L
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element

View File

@ -52,7 +52,7 @@ data class RequestAuth(val userId: Long = -1,
val cookie: String = "", val cookie: String = "",
val fb_dtsg: String = "", val fb_dtsg: String = "",
val rev: String = "") { val rev: String = "") {
val isValid val isComplete
get() = userId > 0 && cookie.isNotEmpty() && fb_dtsg.isNotEmpty() && rev.isNotEmpty() get() = userId > 0 && cookie.isNotEmpty() && fb_dtsg.isNotEmpty() && rev.isNotEmpty()
} }
@ -121,13 +121,13 @@ fun String.getAuth(): RequestAuth {
val fb_dtsg = FB_DTSG_MATCHER.find(text)[1] val fb_dtsg = FB_DTSG_MATCHER.find(text)[1]
if (fb_dtsg != null) { if (fb_dtsg != null) {
auth = auth.copy(fb_dtsg = fb_dtsg) auth = auth.copy(fb_dtsg = fb_dtsg)
if (auth.isValid) return auth if (auth.isComplete) return auth
} }
val rev = FB_REV_MATCHER.find(text)[1] val rev = FB_REV_MATCHER.find(text)[1]
if (rev != null) { if (rev != null) {
auth = auth.copy(rev = rev) auth = auth.copy(rev = rev)
if (auth.isValid) return auth if (auth.isComplete) return auth
} }
} }
} }

View File

@ -8,8 +8,8 @@ import com.mikepenz.fastadapter.adapters.ModelAdapter
import com.mikepenz.fastadapter_extensions.items.ProgressItem import com.mikepenz.fastadapter_extensions.items.ProgressItem
import com.pitchedapps.frost.R import com.pitchedapps.frost.R
import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.parsers.FrostParser import com.pitchedapps.frost.facebook.parsers.FrostParser
import com.pitchedapps.frost.parsers.ParseResponse import com.pitchedapps.frost.facebook.parsers.ParseResponse
import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.frostJsoup import com.pitchedapps.frost.utils.frostJsoup
import com.pitchedapps.frost.views.FrostRecyclerView import com.pitchedapps.frost.views.FrostRecyclerView

View File

@ -5,9 +5,9 @@ import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.requests.* import com.pitchedapps.frost.facebook.requests.*
import com.pitchedapps.frost.iitems.* import com.pitchedapps.frost.iitems.*
import com.pitchedapps.frost.parsers.FrostNotifs import com.pitchedapps.frost.facebook.parsers.FrostNotifs
import com.pitchedapps.frost.parsers.NotifParser import com.pitchedapps.frost.facebook.parsers.NotifParser
import com.pitchedapps.frost.parsers.ParseResponse import com.pitchedapps.frost.facebook.parsers.ParseResponse
import com.pitchedapps.frost.utils.frostJsoup import com.pitchedapps.frost.utils.frostJsoup
import com.pitchedapps.frost.views.FrostRecyclerView import com.pitchedapps.frost.views.FrostRecyclerView
import org.jetbrains.anko.doAsync import org.jetbrains.anko.doAsync

View File

@ -16,7 +16,7 @@ import com.mikepenz.fastadapter.commons.utils.DiffCallback
import com.pitchedapps.frost.R import com.pitchedapps.frost.R
import com.pitchedapps.frost.glide.FrostGlide import com.pitchedapps.frost.glide.FrostGlide
import com.pitchedapps.frost.glide.GlideApp import com.pitchedapps.frost.glide.GlideApp
import com.pitchedapps.frost.parsers.FrostNotif import com.pitchedapps.frost.facebook.parsers.FrostNotif
import com.pitchedapps.frost.services.FrostRunnable import com.pitchedapps.frost.services.FrostRunnable
import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.launchWebOverlay import com.pitchedapps.frost.utils.launchWebOverlay

View File

@ -21,10 +21,10 @@ import com.pitchedapps.frost.enums.OverlayContext
import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.glide.FrostGlide import com.pitchedapps.frost.glide.FrostGlide
import com.pitchedapps.frost.glide.GlideApp import com.pitchedapps.frost.glide.GlideApp
import com.pitchedapps.frost.parsers.FrostParser import com.pitchedapps.frost.facebook.parsers.FrostParser
import com.pitchedapps.frost.parsers.MessageParser import com.pitchedapps.frost.facebook.parsers.MessageParser
import com.pitchedapps.frost.parsers.NotifParser import com.pitchedapps.frost.facebook.parsers.NotifParser
import com.pitchedapps.frost.parsers.ParseNotification import com.pitchedapps.frost.facebook.parsers.ParseNotification
import com.pitchedapps.frost.utils.ARG_USER_ID import com.pitchedapps.frost.utils.ARG_USER_ID
import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.Prefs

View File

@ -12,10 +12,10 @@ import com.pitchedapps.frost.activities.SettingsActivity.Companion.ACTIVITY_REQU
import com.pitchedapps.frost.debugger.OfflineWebsite import com.pitchedapps.frost.debugger.OfflineWebsite
import com.pitchedapps.frost.facebook.FB_URL_BASE import com.pitchedapps.frost.facebook.FB_URL_BASE
import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.parsers.FrostParser import com.pitchedapps.frost.facebook.parsers.FrostParser
import com.pitchedapps.frost.parsers.MessageParser import com.pitchedapps.frost.facebook.parsers.MessageParser
import com.pitchedapps.frost.parsers.NotifParser import com.pitchedapps.frost.facebook.parsers.NotifParser
import com.pitchedapps.frost.parsers.SearchParser import com.pitchedapps.frost.facebook.parsers.SearchParser
import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.frostUriFromFile import com.pitchedapps.frost.utils.frostUriFromFile
import com.pitchedapps.frost.utils.sendFrostEmail import com.pitchedapps.frost.utils.sendFrostEmail

View File

@ -1,10 +1,9 @@
package com.pitchedapps.frost.facebook package com.pitchedapps.frost.facebook.parsers
import com.pitchedapps.frost.internal.COOKIE import com.pitchedapps.frost.internal.COOKIE
import com.pitchedapps.frost.internal.assertComponentsNotEmpty import com.pitchedapps.frost.internal.assertComponentsNotEmpty
import com.pitchedapps.frost.internal.assertDescending import com.pitchedapps.frost.internal.assertDescending
import com.pitchedapps.frost.internal.authDependent import com.pitchedapps.frost.internal.authDependent
import com.pitchedapps.frost.parsers.*
import org.junit.BeforeClass import org.junit.BeforeClass
import org.junit.Test import org.junit.Test
import kotlin.test.assertNotNull import kotlin.test.assertNotNull

View File

@ -1,4 +1,4 @@
package com.pitchedapps.frost.facebook package com.pitchedapps.frost.facebook.requests
import com.pitchedapps.frost.facebook.requests.getFullSizedImage import com.pitchedapps.frost.facebook.requests.getFullSizedImage
import com.pitchedapps.frost.facebook.requests.getFullSizedImageUrl import com.pitchedapps.frost.facebook.requests.getFullSizedImageUrl

View File

@ -1,10 +1,6 @@
package com.pitchedapps.frost.facebook package com.pitchedapps.frost.facebook.requests
import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.ObjectMapper
import com.pitchedapps.frost.facebook.requests.getAuth
import com.pitchedapps.frost.facebook.requests.getFullSizedImage
import com.pitchedapps.frost.facebook.requests.getMenuData
import com.pitchedapps.frost.facebook.requests.markNotificationRead
import com.pitchedapps.frost.internal.AUTH import com.pitchedapps.frost.internal.AUTH
import com.pitchedapps.frost.internal.COOKIE import com.pitchedapps.frost.internal.COOKIE
import com.pitchedapps.frost.internal.USER_ID import com.pitchedapps.frost.internal.USER_ID
@ -58,7 +54,7 @@ class FbRequestTest {
val fbid = 10155966932992838L // google's current cover photo val fbid = 10155966932992838L // google's current cover photo
val url = AUTH.getFullSizedImage(fbid).invoke() val url = AUTH.getFullSizedImage(fbid).invoke()
println(url) println(url)
assertTrue(url?.startsWith("https://scontent") == true) assertEquals(url?.startsWith("https://scontent"), true)
} }
@Test @Test

View File

@ -42,7 +42,7 @@ val COOKIE: String by lazy { PROPS.getProperty("COOKIE") ?: "" }
val USER_ID: Long by lazy { FB_USER_MATCHER.find(COOKIE)[1]?.toLong() ?: -1 } val USER_ID: Long by lazy { FB_USER_MATCHER.find(COOKIE)[1]?.toLong() ?: -1 }
val AUTH: RequestAuth by lazy { val AUTH: RequestAuth by lazy {
COOKIE.getAuth().apply { COOKIE.getAuth().apply {
println("Auth:\nuser:$userId\nfb_dtsg: $fb_dtsg\nrev: $rev\nvalid: $isValid") println("Auth:\nuser:$userId\nfb_dtsg: $fb_dtsg\nrev: $rev\ncomplete: $isComplete")
} }
} }
@ -56,7 +56,6 @@ fun testJsoup(url: String) = frostJsoup(COOKIE, url)
fun authDependent() { fun authDependent() {
println("Auth Dependent") println("Auth Dependent")
Assume.assumeTrue(COOKIE.isNotEmpty() && VALID_COOKIE) Assume.assumeTrue(COOKIE.isNotEmpty() && VALID_COOKIE)
Assume.assumeTrue(AUTH.isValid)
} }
/** /**

1
priv.sample.properties Normal file
View File

@ -0,0 +1 @@
COOKIE=