diff options
Diffstat (limited to 'app/src/main/kotlin')
4 files changed, 14 insertions, 3 deletions
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 02f9134c..809e8a56 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -91,6 +91,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, override var videoViewer: FrostVideoViewer? = null private lateinit var drawer: Drawer private lateinit var drawerHeader: AccountHeader + private var lastAccessTime = -1L override var searchView: SearchView? = null private val searchViewCache = mutableMapOf<String, List<SearchItem>>() @@ -131,6 +132,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, setupDrawer(savedInstanceState) L.i { "Main started in ${System.currentTimeMillis() - start} ms" } initFab() + lastAccessTime = System.currentTimeMillis() } /** @@ -301,6 +303,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, } private fun refreshAll() { + L.d { "Refresh all" } fragmentSubject.onNext(REQUEST_REFRESH) } @@ -403,11 +406,16 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, super.onResume() FbCookie.switchBackUser {} controlWebview?.resumeTimers() + if (System.currentTimeMillis() - lastAccessTime > MAIN_TIMEOUT_DURATION) { + refreshAll() + } + lastAccessTime = System.currentTimeMillis() // precaution to avoid loops } override fun onPause() { controlWebview?.pauseTimers() L.v { "Pause main web timers" } + lastAccessTime = System.currentTimeMillis() super.onPause() } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt index cbb6087a..4386d0c9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt @@ -103,7 +103,7 @@ class FbUrlFormatter(url: String) { val misc = arrayOf("&" to "&") - val discardableQueries = arrayOf("ref", "refid") + val discardableQueries = arrayOf("ref", "refid", "acontext", "SharedWith") val converter = listOf( "\\3C " to "%3C", "\\3E " to "%3E", "\\23 " to "%23", "\\25 " to "%25", diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt index b77847de..a644e966 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt @@ -117,8 +117,9 @@ abstract class BaseFragment : Fragment(), FragmentContract, DynamicUiContract { when (it) { REQUEST_REFRESH -> { core?.apply { - reload(true) clearHistory() + firstLoad = true + firstLoadRequest() } } position -> { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Const.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Const.kt index 61ba4a09..0cb57ed5 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Const.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Const.kt @@ -13,4 +13,6 @@ const val REQUEST_RESTART = 1 shl 12 const val REQUEST_REFRESH = 1 shl 13 const val REQUEST_TEXT_ZOOM = 1 shl 14 const val REQUEST_NAV = 1 shl 15 -const val REQUEST_SEARCH = 1 shl 16
\ No newline at end of file +const val REQUEST_SEARCH = 1 shl 16 + +const val MAIN_TIMEOUT_DURATION = 30 * 60 * 1000 // 30 min
\ No newline at end of file |