aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-10-11 01:51:21 -0400
committerGitHub <noreply@github.com>2017-10-11 01:51:21 -0400
commitfe1df730a180316f76c334879da88515a0150a42 (patch)
tree49ef0590dfbbb7f01347746a8d1f78e15682346a /app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
parentd12e0697ad34c02a8f16143c4bddbc2a02e7b3dc (diff)
downloadfrost-fe1df730a180316f76c334879da88515a0150a42.tar.gz
frost-fe1df730a180316f76c334879da88515a0150a42.tar.bz2
frost-fe1df730a180316f76c334879da88515a0150a42.zip
Search Parsing (#379)
* Update parser interface and add search parsing * Add custom jsoup method and search parse method * Bind new searchview * Add search view cache
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
index ac3c89dd..c4ab6161 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
@@ -10,16 +10,14 @@ import com.pitchedapps.frost.R
import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.dbflow.lastNotificationTime
import com.pitchedapps.frost.dbflow.loadFbCookiesSync
-import com.pitchedapps.frost.facebook.FACEBOOK_COM
import com.pitchedapps.frost.facebook.FbItem
-import com.pitchedapps.frost.facebook.USER_AGENT_BASIC
import com.pitchedapps.frost.facebook.formattedFbUrl
import com.pitchedapps.frost.parsers.MessageParser
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.frostAnswersCustom
+import com.pitchedapps.frost.utils.frostJsoup
import org.jetbrains.anko.doAsync
-import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import java.util.concurrent.Future
@@ -101,7 +99,7 @@ class NotificationService : JobService() {
fun fetchGeneralNotifications(data: CookieModel) {
L.d("Notif fetch", data.toString())
- val doc = Jsoup.connect(FbItem.NOTIFICATIONS.url).cookie(FACEBOOK_COM, data.cookie).userAgent(USER_AGENT_BASIC).get()
+ val doc = frostJsoup(data.cookie, FbItem.NOTIFICATIONS.url)
//aclb for unread, acw for read
val unreadNotifications = (doc.getElementById("notifications_list") ?: return L.eThrow("Notification list not found")).getElementsByClass("aclb")
var notifCount = 0
@@ -149,7 +147,7 @@ class NotificationService : JobService() {
fun fetchMessageNotifications(data: CookieModel) {
L.d("Notif IM fetch", data.toString())
- val doc = Jsoup.connect(FbItem.MESSAGES.url).cookie(FACEBOOK_COM, data.cookie).userAgent(USER_AGENT_BASIC).get()
+ val doc = frostJsoup(data.cookie, FbItem.MESSAGES.url)
val (threads, _, _) = MessageParser.parse(doc.toString()) ?: return L.e("Could not parse IM")
var notifCount = 0