aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-09-07 18:15:53 -0700
committerAllan Wang <me@allanwang.ca>2019-09-07 18:15:53 -0700
commit9363d4bc987cb7b4886ffb6a863b5d14c602e402 (patch)
tree3da405d9012b8a8f0fb58899cd670e60471bf015 /app/src/main/kotlin/com/pitchedapps/frost/utils
parente736b53094629c4250c536170e938c625f5dc03c (diff)
downloadfrost-9363d4bc987cb7b4886ffb6a863b5d14c602e402.tar.gz
frost-9363d4bc987cb7b4886ffb6a863b5d14c602e402.tar.bz2
frost-9363d4bc987cb7b4886ffb6a863b5d14c602e402.zip
Remove desktop and mobile user agent def
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt9
2 files changed, 8 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt
index b0012b0d..5e909b03 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt
@@ -31,7 +31,7 @@ import ca.allanwang.kau.utils.string
import ca.allanwang.kau.utils.toast
import com.pitchedapps.frost.R
import com.pitchedapps.frost.db.CookieEntity
-import com.pitchedapps.frost.facebook.USER_AGENT_DESKTOP
+import com.pitchedapps.frost.facebook.USER_AGENT
/**
* Created by Allan Wang on 2017-08-04.
@@ -41,7 +41,7 @@ import com.pitchedapps.frost.facebook.USER_AGENT_DESKTOP
fun Context.frostDownload(
cookie: CookieEntity,
url: String?,
- userAgent: String = USER_AGENT_DESKTOP,
+ userAgent: String = USER_AGENT,
contentDisposition: String? = null,
mimeType: String? = null,
contentLength: Long = 0L
@@ -53,7 +53,7 @@ fun Context.frostDownload(
fun Context.frostDownload(
cookie: CookieEntity,
uri: Uri?,
- userAgent: String = USER_AGENT_DESKTOP,
+ userAgent: String = USER_AGENT,
contentDisposition: String? = null,
mimeType: String? = null,
contentLength: Long = 0L
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index 9022d51f..c2f28a4b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -63,7 +63,7 @@ import com.pitchedapps.frost.facebook.FBCDN_NET
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.FbUrlFormatter.Companion.VIDEO_REDIRECT
-import com.pitchedapps.frost.facebook.USER_AGENT_DESKTOP
+import com.pitchedapps.frost.facebook.USER_AGENT
import com.pitchedapps.frost.facebook.formattedFbUri
import com.pitchedapps.frost.facebook.formattedFbUrl
import com.pitchedapps.frost.injectors.CssAssets
@@ -74,6 +74,7 @@ import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import org.apache.commons.text.StringEscapeUtils
import org.jsoup.Jsoup
+import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.io.File
import java.io.IOException
@@ -388,13 +389,13 @@ fun EmailBuilder.addFrostDetails() {
addItem("Locale", Locale.getDefault().displayName)
}
-fun frostJsoup(url: String) = frostJsoup(FbCookie.webCookie, url)
+fun frostJsoup(url: String): Document = frostJsoup(FbCookie.webCookie, url)
-fun frostJsoup(cookie: String?, url: String) =
+fun frostJsoup(cookie: String?, url: String): Document =
Jsoup.connect(url).run {
if (cookie.isNullOrBlank()) this
else cookie(FACEBOOK_COM, cookie)
- }.userAgent(USER_AGENT_DESKTOP).get()!!
+ }.userAgent(USER_AGENT).get()
fun Element.first(vararg select: String): Element? {
select.forEach {