diff options
author | Allan Wang <me@allanwang.ca> | 2018-09-27 18:03:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-27 18:03:53 -0400 |
commit | 7460935f32748b10f6b3fedf9e77a373a9010d05 (patch) | |
tree | eeaa5c880679198ee1a9dff885a1c7fc6c84207e /app/src | |
parent | 5db95f245101b221ca5669c4e4b5e526d941d68f (diff) | |
download | frost-7460935f32748b10f6b3fedf9e77a373a9010d05.tar.gz frost-7460935f32748b10f6b3fedf9e77a373a9010d05.tar.bz2 frost-7460935f32748b10f6b3fedf9e77a373a9010d05.zip |
Move parsers to facebook folder (#1109)
Diffstat (limited to 'app/src')
15 files changed, 29 insertions, 35 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt index db49d994..9ed51652 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -55,8 +55,8 @@ import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.facebook.profilePictureUrl import com.pitchedapps.frost.fragments.BaseFragment import com.pitchedapps.frost.fragments.WebFragment -import com.pitchedapps.frost.parsers.FrostSearch -import com.pitchedapps.frost.parsers.SearchParser +import com.pitchedapps.frost.facebook.parsers.FrostSearch +import com.pitchedapps.frost.facebook.parsers.SearchParser import com.pitchedapps.frost.utils.* import com.pitchedapps.frost.views.BadgedIcon import com.pitchedapps.frost.views.FrostVideoViewer diff --git a/app/src/main/kotlin/com/pitchedapps/frost/parsers/FrostParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt index 03e6209e..5d023023 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/parsers/FrostParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt @@ -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.facebook.FB_CSS_URL_MATCHER diff --git a/app/src/main/kotlin/com/pitchedapps/frost/parsers/MessageParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt index 697cbbe8..f32c3452 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/parsers/MessageParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt @@ -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.facebook.* diff --git a/app/src/main/kotlin/com/pitchedapps/frost/parsers/NotifParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt index 812f12e3..03b913c7 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/parsers/NotifParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt @@ -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.facebook.* diff --git a/app/src/main/kotlin/com/pitchedapps/frost/parsers/SearchParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/SearchParser.kt index 5300bf11..d3367514 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/parsers/SearchParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/SearchParser.kt @@ -1,9 +1,9 @@ -package com.pitchedapps.frost.parsers +package com.pitchedapps.frost.facebook.parsers import ca.allanwang.kau.searchview.SearchItem import com.pitchedapps.frost.facebook.FbItem 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 org.jsoup.nodes.Document import org.jsoup.nodes.Element diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt index 692312a1..a4b0a347 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt @@ -52,7 +52,7 @@ data class RequestAuth(val userId: Long = -1, val cookie: String = "", val fb_dtsg: String = "", val rev: String = "") { - val isValid + val isComplete 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] if (fb_dtsg != null) { 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] if (rev != null) { auth = auth.copy(rev = rev) - if (auth.isValid) return auth + if (auth.isComplete) return auth } } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt index 51df4606..e3b8f3d3 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragmentBase.kt @@ -8,8 +8,8 @@ import com.mikepenz.fastadapter.adapters.ModelAdapter import com.mikepenz.fastadapter_extensions.items.ProgressItem import com.pitchedapps.frost.R import com.pitchedapps.frost.facebook.FbCookie -import com.pitchedapps.frost.parsers.FrostParser -import com.pitchedapps.frost.parsers.ParseResponse +import com.pitchedapps.frost.facebook.parsers.FrostParser +import com.pitchedapps.frost.facebook.parsers.ParseResponse import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.frostJsoup import com.pitchedapps.frost.views.FrostRecyclerView diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt index ca2912e8..512ea82c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/RecyclerFragments.kt @@ -5,9 +5,9 @@ import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.facebook.requests.* import com.pitchedapps.frost.iitems.* -import com.pitchedapps.frost.parsers.FrostNotifs -import com.pitchedapps.frost.parsers.NotifParser -import com.pitchedapps.frost.parsers.ParseResponse +import com.pitchedapps.frost.facebook.parsers.FrostNotifs +import com.pitchedapps.frost.facebook.parsers.NotifParser +import com.pitchedapps.frost.facebook.parsers.ParseResponse import com.pitchedapps.frost.utils.frostJsoup import com.pitchedapps.frost.views.FrostRecyclerView import org.jetbrains.anko.doAsync diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt index e5dcd8a4..185da4fd 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt @@ -16,7 +16,7 @@ import com.mikepenz.fastadapter.commons.utils.DiffCallback import com.pitchedapps.frost.R import com.pitchedapps.frost.glide.FrostGlide 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.utils.Prefs import com.pitchedapps.frost.utils.launchWebOverlay diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt index bc2e66a5..279b4027 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt @@ -21,10 +21,10 @@ import com.pitchedapps.frost.enums.OverlayContext import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.glide.FrostGlide import com.pitchedapps.frost.glide.GlideApp -import com.pitchedapps.frost.parsers.FrostParser -import com.pitchedapps.frost.parsers.MessageParser -import com.pitchedapps.frost.parsers.NotifParser -import com.pitchedapps.frost.parsers.ParseNotification +import com.pitchedapps.frost.facebook.parsers.FrostParser +import com.pitchedapps.frost.facebook.parsers.MessageParser +import com.pitchedapps.frost.facebook.parsers.NotifParser +import com.pitchedapps.frost.facebook.parsers.ParseNotification import com.pitchedapps.frost.utils.ARG_USER_ID import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt index 7ca7d778..91dac242 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt @@ -12,10 +12,10 @@ import com.pitchedapps.frost.activities.SettingsActivity.Companion.ACTIVITY_REQU import com.pitchedapps.frost.debugger.OfflineWebsite import com.pitchedapps.frost.facebook.FB_URL_BASE import com.pitchedapps.frost.facebook.FbCookie -import com.pitchedapps.frost.parsers.FrostParser -import com.pitchedapps.frost.parsers.MessageParser -import com.pitchedapps.frost.parsers.NotifParser -import com.pitchedapps.frost.parsers.SearchParser +import com.pitchedapps.frost.facebook.parsers.FrostParser +import com.pitchedapps.frost.facebook.parsers.MessageParser +import com.pitchedapps.frost.facebook.parsers.NotifParser +import com.pitchedapps.frost.facebook.parsers.SearchParser import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.frostUriFromFile import com.pitchedapps.frost.utils.sendFrostEmail diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbParseTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt index 8c568279..3307c72e 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbParseTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt @@ -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.assertComponentsNotEmpty import com.pitchedapps.frost.internal.assertDescending import com.pitchedapps.frost.internal.authDependent -import com.pitchedapps.frost.parsers.* import org.junit.BeforeClass import org.junit.Test import kotlin.test.assertNotNull diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbFullImageTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbFullImageTest.kt index 98dc7dda..291637c6 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbFullImageTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbFullImageTest.kt @@ -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.getFullSizedImageUrl diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbRequestTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt index 07e02249..9899a018 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbRequestTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt @@ -1,10 +1,6 @@ -package com.pitchedapps.frost.facebook +package com.pitchedapps.frost.facebook.requests 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.COOKIE import com.pitchedapps.frost.internal.USER_ID @@ -58,7 +54,7 @@ class FbRequestTest { val fbid = 10155966932992838L // google's current cover photo val url = AUTH.getFullSizedImage(fbid).invoke() println(url) - assertTrue(url?.startsWith("https://scontent") == true) + assertEquals(url?.startsWith("https://scontent"), true) } @Test diff --git a/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt b/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt index e3beabd2..81175b19 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt @@ -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 AUTH: RequestAuth by lazy { 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() { println("Auth Dependent") Assume.assumeTrue(COOKIE.isNotEmpty() && VALID_COOKIE) - Assume.assumeTrue(AUTH.isValid) } /** |