aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/activities
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/activities')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt18
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt2
6 files changed, 16 insertions, 12 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt
index 3c2ad844..af49cb33 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt
@@ -21,6 +21,7 @@ import android.os.Bundle
import ca.allanwang.kau.internal.KauBaseActivity
import ca.allanwang.kau.searchview.SearchViewHolder
import com.pitchedapps.frost.contracts.VideoViewHolder
+import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.setFrostTheme
import org.koin.android.ext.android.inject
@@ -30,6 +31,7 @@ import org.koin.android.ext.android.inject
*/
abstract class BaseActivity : KauBaseActivity() {
+ val fbCookie: FbCookie by inject()
val prefs: Prefs by inject()
/**
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 b3d4001f..ab6f41ca 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
@@ -314,7 +314,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
val item = FbItem.values[it.itemId]
frostEvent("Drawer Tab", "name" to item.name)
drawer.closeDrawer(navigation)
- launchWebOverlay(item.url)
+ launchWebOverlay(item.url, fbCookie)
false
}
val navBg = prefs.bgColor.withMinAlpha(200)
@@ -468,7 +468,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
val currentCookie = cookieDao.currentCookie()
if (currentCookie == null) {
toast(R.string.account_not_found)
- FbCookie.reset()
+ fbCookie.reset()
launchLogin(cookies(), true)
} else {
materialDialog {
@@ -482,7 +482,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
)
positiveButton(R.string.kau_yes) {
this@BaseMainActivity.launch {
- FbCookie.logout(this@BaseMainActivity)
+ fbCookie.logout(this@BaseMainActivity)
}
}
negativeButton(R.string.kau_no)
@@ -597,7 +597,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
.into(this)
setOnClickListener {
if (primary) {
- launchWebOverlay(FbItem.PROFILE.url)
+ launchWebOverlay(FbItem.PROFILE.url, fbCookie)
} else {
switchAccount(cookie.id)
}
@@ -612,7 +612,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
pendingUpdate = true
closeDrawer()
launch {
- FbCookie.switchUser(id)
+ fbCookie.switchUser(id)
tabsForEachView { _, view -> view.badgeText = null }
refreshAll()
}
@@ -644,7 +644,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
if (results != null)
searchView.results = results
else {
- val data = SearchParser.query(FbCookie.webCookie, query)?.data?.results
+ val data = SearchParser.query(fbCookie.webCookie, query)?.data?.results
if (data != null) {
val items = data.mapTo(mutableListOf(), FrostSearch::toSearchItem)
if (items.isNotEmpty())
@@ -662,11 +662,11 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
}
textDebounceInterval = 300
searchCallback =
- { query, _ -> launchWebOverlay("${FbItem._SEARCH.url}/?q=$query"); true }
+ { query, _ -> launchWebOverlay("${FbItem._SEARCH.url}/?q=$query", fbCookie); true }
closeListener = { _ -> searchViewCache.clear() }
foregroundColor = prefs.textColor
backgroundColor = prefs.bgColor.withMinAlpha(200)
- onItemClick = { _, key, _, _ -> launchWebOverlay(key) }
+ onItemClick = { _, key, _, _ -> launchWebOverlay(key, fbCookie) }
}
}
}
@@ -758,7 +758,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
controlWebview?.resumeTimers()
launch {
val authDefer = BiometricUtils.authenticate(this@BaseMainActivity)
- FbCookie.switchBackUser()
+ fbCookie.switchBackUser()
authDefer.await()
if (shouldReload && prefs.autoRefreshFeed) {
refreshAll()
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
index efce11c6..23a247ad 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
@@ -97,7 +97,7 @@ class LoginActivity : BaseActivity() {
launch {
val cookie = web.loadLogin { refresh(it != 100) }.await()
L.d { "Login found" }
- FbCookie.save(cookie.id)
+ fbCookie.save(cookie.id)
webFadeOut()
profile.fadeIn()
loadInfo(cookie)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt
index 87fb1b17..357c159d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SelectorActivity.kt
@@ -63,7 +63,7 @@ class SelectorActivity : BaseActivity() {
) {
if (item.cookie == null) this@SelectorActivity.launchNewTask<LoginActivity>()
else launch {
- FbCookie.switchUser(item.cookie)
+ fbCookie.switchUser(item.cookie)
launchNewTask<MainActivity>(cookies())
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
index 028f8123..55ff3fba 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt
@@ -41,6 +41,7 @@ import com.mikepenz.iconics.typeface.library.community.material.CommunityMateria
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.pitchedapps.frost.R
import com.pitchedapps.frost.enums.Support
+import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.settings.getAppearancePrefs
import com.pitchedapps.frost.settings.getBehaviourPrefs
import com.pitchedapps.frost.settings.getDebugPrefs
@@ -68,6 +69,7 @@ import org.koin.android.ext.android.inject
*/
class SettingsActivity : KPrefActivity() {
+ val fbCookie: FbCookie by inject()
val prefs: Prefs by inject()
private var resultFlag = Activity.RESULT_CANCELED
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt
index 4de8d4f9..2b321d9e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt
@@ -228,7 +228,7 @@ abstract class WebOverlayActivityBase(private val userAgent: String = USER_AGENT
launch {
val authDefer = BiometricUtils.authenticate(this@WebOverlayActivityBase)
if (userId != prefs.userId) {
- FbCookie.switchUser(userId)
+ fbCookie.switchUser(userId)
}
authDefer.await()
reloadBase(true)