aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-30 12:55:56 -0400
committerGitHub <noreply@github.com>2017-08-30 12:55:56 -0400
commit270ff7705be5ec0c78f5eae4934779ff4b4c00ee (patch)
treefb0ba3e117e138391ac268bc8116e97140e6f436
parenta854dcc471078f4e21916730abb5d5d75dd7b03c (diff)
downloadfrost-270ff7705be5ec0c78f5eae4934779ff4b4c00ee.tar.gz
frost-270ff7705be5ec0c78f5eae4934779ff4b4c00ee.tar.bz2
frost-270ff7705be5ec0c78f5eae4934779ff4b4c00ee.zip
fix/searchview (#239)
* Keep searchview even if headless response fails * Keep searchview even if headless response fails * Update changelog and add search tests * Update kau and remove tests * Remove duplicate dispose calls
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt23
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt12
-rw-r--r--app/src/main/res/xml/frost_changelog.xml9
-rw-r--r--docs/Changelog.md6
-rw-r--r--gradle.properties2
6 files changed, 30 insertions, 24 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
index 29bc350b..dd8ed558 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt
@@ -143,8 +143,7 @@ class MainActivity : BaseActivity(), SearchWebView.SearchContract,
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
super.onPageScrolled(position, positionOffset, positionOffsetPixels)
val delta: Float by lazy { positionOffset * (255 - 128).toFloat() }
- tabsForEachView {
- tabPosition, view ->
+ tabsForEachView { tabPosition, view ->
view.setAllAlpha(when (tabPosition) {
position -> 255.0f - delta
position + 1 -> 128.0f + delta
@@ -163,15 +162,13 @@ class MainActivity : BaseActivity(), SearchWebView.SearchContract,
setFrostColors(toolbar, themeWindow = false, headers = arrayOf(appBar), backgrounds = arrayOf(viewPager))
tabs.setBackgroundColor(Prefs.mainActivityLayout.backgroundColor())
onCreateBilling()
- setNetworkObserver {
- connectivity ->
+ setNetworkObserver { connectivity ->
shouldLoadImages = !connectivity.isRoaming
}
}
fun tabsForEachView(action: (position: Int, view: BadgedIcon) -> Unit) {
- (0 until tabs.tabCount).asSequence().forEach {
- i ->
+ (0 until tabs.tabCount).asSequence().forEach { i ->
action(i, tabs.getTabAt(i)!!.customView as BadgedIcon)
}
}
@@ -200,10 +197,8 @@ class MainActivity : BaseActivity(), SearchWebView.SearchContract,
return@map arrayOf(feed, requests, messages, notifications).map { it?.getOrNull(0)?.ownText() }
}
.observeOn(AndroidSchedulers.mainThread())
- .subscribe {
- (feed, requests, messages, notifications) ->
- tabsForEachView {
- _, view ->
+ .subscribe { (feed, requests, messages, notifications) ->
+ tabsForEachView { _, view ->
when (view.iicon) {
FbItem.FEED.icon -> view.badgeText = feed
FbItem.FRIENDS.icon -> view.badgeText = requests
@@ -340,11 +335,9 @@ class MainActivity : BaseActivity(), SearchWebView.SearchContract,
* Something happened where the normal search function won't work
* Fallback to overlay style
*/
- override fun searchOverlayDispose() {
- hiddenSearchView?.dispose()
+ override fun disposeHeadlessSearch() {
hiddenSearchView = null
- searchView?.unBind { launchWebOverlay(FbItem.SEARCH.url); true }
- searchView = null
+ searchView?.config { textCallback = { _, _ -> } }
}
override fun emitSearchResponse(items: List<SearchItem>) {
@@ -373,7 +366,7 @@ class MainActivity : BaseActivity(), SearchWebView.SearchContract,
onItemClick = { _, key, _, _ -> launchWebOverlay(key) }
}
} else {
- if (searchView != null) searchOverlayDispose()
+ if (searchView != null) disposeHeadlessSearch()
else menu.findItem(R.id.action_search).setOnMenuItemClickListener { _ -> launchWebOverlay(FbItem.SEARCH.url); true }
}
return true
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt
index 34022c25..4936eaf4 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt
@@ -23,7 +23,7 @@ private val blankResource: WebResourceResponse by lazy { WebResourceResponse("te
//these hosts will redirect to a blank resource
private val blacklistHost: Set<String> =
setOf(
-// "edge-chat.facebook.com"
+// "edge-chat.facebook.com" //todo make more specific? This is required for message responses
)
//these hosts will return null and skip logging
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt
index dc2bd8af..16d9f4bf 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt
@@ -11,7 +11,6 @@ import com.pitchedapps.frost.facebook.USER_AGENT_BASIC
import com.pitchedapps.frost.injectors.JsAssets
import com.pitchedapps.frost.injectors.JsBuilder
import com.pitchedapps.frost.utils.L
-import com.pitchedapps.frost.utils.Prefs
import io.reactivex.schedulers.Schedulers
import io.reactivex.subjects.PublishSubject
import org.jetbrains.anko.runOnUiThread
@@ -118,13 +117,12 @@ class SearchWebView(context: Context, val contract: SearchContract) : WebView(co
fun emit(flag: Int) {
when (flag) {
0 -> {
- L.d("Search loaded successfully")
+ L.i("Search loaded successfully")
}
1 -> { //something is not found in the search view; this is effectively useless
- L.e("Search subject error; reverting to full overlay")
- Prefs.searchBar = false
- searchSubject.onComplete()
- contract.searchOverlayDispose()
+ L.e("Search subject error")
+ dispose()
+ contract.disposeHeadlessSearch()
}
2 -> {
L.v("Search emission received")
@@ -141,7 +139,7 @@ class SearchWebView(context: Context, val contract: SearchContract) : WebView(co
}
interface SearchContract {
- fun searchOverlayDispose()
+ fun disposeHeadlessSearch()
fun emitSearchResponse(items: List<SearchItem>)
val isSearchOpened: Boolean
}
diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml
index edfadce6..a53c1124 100644
--- a/app/src/main/res/xml/frost_changelog.xml
+++ b/app/src/main/res/xml/frost_changelog.xml
@@ -11,6 +11,15 @@
<!--<version title="Beta Updates" />-->
<version title="Beta Updates"/>
+ <item text="Fix new messages not showing" />
+ <item text="Fix theme for sharing and new messages" />
+ <item text="Prevent search bar settings from disabling itself if auto suggestions fail" />
+ <item text="Fix numerous crashes relating to search bar layouts" />
+ <item text="" />
+ <item text="" />
+ <item text="" />
+
+ <version title="v1.4.11"/>
<item text="Fix url loading bug and add option to launch urls in default browser (behaviour setting)" />
<item text="Allow for bottom bar tabs (appearance setting)" />
<item text="Allow custom ringtones for notifications and messages (notification setting)" />
diff --git a/docs/Changelog.md b/docs/Changelog.md
index d22a2622..f8b7ab27 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -1,6 +1,12 @@
# Changelog
## Beta Updates
+* Fix new messages not showing
+* Fix theme for sharing and new messages
+* Prevent search bar settings from disabling itself if auto suggestions fail
+* Fix numerous crashes relating to search bar layouts
+
+## v1.4.11
* Fix url loading bug and add option to launch urls in default browser (behaviour setting)
* Allow for bottom bar tabs (appearance setting)
* Allow custom ringtones for notifications and messages (notification setting)
diff --git a/gradle.properties b/gradle.properties
index 512c9c86..d405dbff 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,7 +17,7 @@ MIN_SDK=21
TARGET_SDK=26
BUILD_TOOLS=26.0.1
-KAU=4fa1b9b
+KAU=3.4.0
KOTLIN=1.1.4-2
COMMONS_TEXT=1.1