mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-08 20:12:39 +01:00
Disable more components if web only
This commit is contained in:
parent
ae6709598c
commit
2afb85489e
@ -635,12 +635,11 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
|
|||||||
override fun getPageTitle(position: Int): CharSequence = getString(pages[position].titleId)
|
override fun getPageTitle(position: Int): CharSequence = getString(pages[position].titleId)
|
||||||
|
|
||||||
override fun getItemPosition(fragment: Any) =
|
override fun getItemPosition(fragment: Any) =
|
||||||
if (fragment !is BaseFragment)
|
when {
|
||||||
POSITION_UNCHANGED
|
fragment !is BaseFragment -> POSITION_UNCHANGED
|
||||||
else if (fragment is WebFragment || fragment.valid)
|
fragment is WebFragment || fragment.valid -> POSITION_UNCHANGED
|
||||||
POSITION_UNCHANGED
|
else -> POSITION_NONE
|
||||||
else
|
}
|
||||||
POSITION_NONE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override val lowerVideoPadding: PointF
|
override val lowerVideoPadding: PointF
|
||||||
|
@ -67,7 +67,7 @@ abstract class BaseFragment : Fragment(), CoroutineScope, FragmentContract, Dyna
|
|||||||
data: FbItem,
|
data: FbItem,
|
||||||
position: Int
|
position: Int
|
||||||
): BaseFragment {
|
): BaseFragment {
|
||||||
val fragment = if (!useFallback) base() else WebFragment()
|
val fragment = if (useFallback || Prefs.webOnly) WebFragment() else base()
|
||||||
val d = if (data == FbItem.FEED) FeedSort(Prefs.feedSort).item else data
|
val d = if (data == FbItem.FEED) FeedSort(Prefs.feedSort).item else data
|
||||||
fragment.withArguments(
|
fragment.withArguments(
|
||||||
ARG_URL to d.url,
|
ARG_URL to d.url,
|
||||||
|
@ -31,6 +31,7 @@ import com.pitchedapps.frost.utils.EnumBundle
|
|||||||
import com.pitchedapps.frost.utils.EnumBundleCompanion
|
import com.pitchedapps.frost.utils.EnumBundleCompanion
|
||||||
import com.pitchedapps.frost.utils.EnumCompanion
|
import com.pitchedapps.frost.utils.EnumCompanion
|
||||||
import com.pitchedapps.frost.utils.L
|
import com.pitchedapps.frost.utils.L
|
||||||
|
import com.pitchedapps.frost.utils.Prefs
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@ -162,13 +163,17 @@ class FrostRequestService : BaseJobService() {
|
|||||||
|
|
||||||
override fun onStartJob(params: JobParameters?): Boolean {
|
override fun onStartJob(params: JobParameters?): Boolean {
|
||||||
super.onStartJob(params)
|
super.onStartJob(params)
|
||||||
|
if (Prefs.webOnly) {
|
||||||
|
L.i { "Web only; skipping request service" }
|
||||||
|
return false
|
||||||
|
}
|
||||||
val bundle = params?.extras
|
val bundle = params?.extras
|
||||||
if (bundle == null) {
|
if (bundle == null) {
|
||||||
L.eThrow("Launched ${this::class.java.simpleName} without param data")
|
L.eThrow("Launched ${this::class.java.simpleName} without param data")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
val cookie = bundle.getCookie()
|
val cookie = bundle.getCookie()
|
||||||
if (cookie.isNullOrBlank()) {
|
if (cookie.isBlank()) {
|
||||||
L.eThrow("Launched ${this::class.java.simpleName} without cookie")
|
L.eThrow("Launched ${this::class.java.simpleName} without cookie")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,10 @@ class NotificationService : BaseJobService() {
|
|||||||
override fun onStartJob(params: JobParameters?): Boolean {
|
override fun onStartJob(params: JobParameters?): Boolean {
|
||||||
super.onStartJob(params)
|
super.onStartJob(params)
|
||||||
L.i { "Fetching notifications" }
|
L.i { "Fetching notifications" }
|
||||||
|
if (Prefs.webOnly) {
|
||||||
|
L.i { "Web only mode; skipping notification service" }
|
||||||
|
return false
|
||||||
|
}
|
||||||
launch {
|
launch {
|
||||||
try {
|
try {
|
||||||
sendNotifications(params)
|
sendNotifications(params)
|
||||||
|
Loading…
Reference in New Issue
Block a user