diff options
author | Allan Wang <me@allanwang.ca> | 2018-03-11 21:23:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-11 21:23:29 -0400 |
commit | ee4f2eab359b83618d314ded2fa3d442c280bbfa (patch) | |
tree | ecd1e2bbbc6eb3728a7fc99394d06dfb4f008f57 /app | |
parent | fe51373f5a95323d64f6d966888a2c6c62a36deb (diff) | |
download | frost-ee4f2eab359b83618d314ded2fa3d442c280bbfa.tar.gz frost-ee4f2eab359b83618d314ded2fa3d442c280bbfa.tar.bz2 frost-ee4f2eab359b83618d314ded2fa3d442c280bbfa.zip |
Enhancement/auto refresh (#780)
* Add auto refresh
* Update changelog
* Clean url queries
* Do not discard h
Diffstat (limited to 'app')
5 files changed, 17 insertions, 5 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 diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml index 67461960..2b343ba5 100644 --- a/app/src/main/res/xml/frost_changelog.xml +++ b/app/src/main/res/xml/frost_changelog.xml @@ -9,8 +9,9 @@ <version title="v1.8.3" /> <item text="Add full notification channel support" /> <item text="Fix sound spam for multiple notifications" /> - <item text="" /> - <item text="" /> + <item text="Send feedback if no new notifications exist after manual refresh" /> + <item text="Automatically refresh if idled for a long time" /> + <item text="Clean up url queries" /> <version title="v1.8.2" /> <item text="Fix duplicate notification sounds" /> |