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 db49d9942..9ed51652f 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 similarity index 98% rename from app/src/main/kotlin/com/pitchedapps/frost/parsers/FrostParser.kt rename to app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt index 03e6209e2..5d0230237 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 similarity index 99% rename from app/src/main/kotlin/com/pitchedapps/frost/parsers/MessageParser.kt rename to app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt index 697cbbe8c..f32c34524 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 similarity index 98% rename from app/src/main/kotlin/com/pitchedapps/frost/parsers/NotifParser.kt rename to app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt index 812f12e3e..03b913c7e 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 similarity index 95% rename from app/src/main/kotlin/com/pitchedapps/frost/parsers/SearchParser.kt rename to app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/SearchParser.kt index 5300bf11e..d33675143 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 692312a1e..a4b0a347b 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 51df4606a..e3b8f3d30 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 ca2912e86..512ea82c6 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 e5dcd8a48..185da4fdf 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 bc2e66a55..279b40272 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 7ca7d778a..91dac2427 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 similarity index 95% rename from app/src/test/kotlin/com/pitchedapps/frost/facebook/FbParseTest.kt rename to app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt index 8c568279d..3307c72e6 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 similarity index 94% rename from app/src/test/kotlin/com/pitchedapps/frost/facebook/FbFullImageTest.kt rename to app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbFullImageTest.kt index 98dc7ddaa..291637c67 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 similarity index 84% rename from app/src/test/kotlin/com/pitchedapps/frost/facebook/FbRequestTest.kt rename to app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt index 07e022495..9899a0183 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 e3beabd28..81175b193 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) } /** diff --git a/priv.sample.properties b/priv.sample.properties new file mode 100644 index 000000000..893ca6218 --- /dev/null +++ b/priv.sample.properties @@ -0,0 +1 @@ +COOKIE= \ No newline at end of file