Skip to content

Commit

Permalink
Version updates and deep link bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerbwong committed Aug 1, 2023
1 parent 9c24c39 commit 1665fcb
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 20 deletions.
10 changes: 6 additions & 4 deletions app/src/main/kotlin/me/tylerbwong/stack/data/site/SiteStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SiteStore @Inject constructor(
) {
var site: String
@Synchronized
get() = deepLinkSites.firstOrNull()
get() = deepLinkSites.lastOrNull()
?: preferences.getString(SITE_KEY, defaultSite)
?: defaultSite
set(value) {
Expand All @@ -26,7 +26,7 @@ class SiteStore @Inject constructor(
/**
* Used to determine the current site for the deep link session only.
*/
private val deepLinkSites: MutableSet<String> = mutableSetOf()
private val deepLinkSites: MutableList<String> = mutableListOf()

val siteLiveData: LiveData<String>
get() = mutableSiteLiveData
Expand All @@ -37,8 +37,10 @@ class SiteStore @Inject constructor(
mutableSiteLiveData.value = this.site
}
fun pushCurrentDeepLinkSite(site: String) {
deepLinkSites.add(site)
mutableSiteLiveData.value = this.site
if (deepLinkSites.lastOrNull() != site) {
deepLinkSites.add(site)
mutableSiteLiveData.value = this.site
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class CommentHolder(
binding.commentBody.setSpannableFactory(noCopySpannableFactory)
}

@Suppress("ComplexMethod", "LongMethod")
override fun CommentHolderBinding.bind(item: CommentItem) {
val (bodyMarkdown, commentId, _, creationDate, _, owner, _) = item.comment
commentBody.setMarkdown(bodyMarkdown)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AnswerVotesHeaderHolder(
parent,
AnswerVotesHeaderHolderBinding::inflate
) {
@Suppress("LongMethod")
override fun AnswerVotesHeaderHolderBinding.bind(item: AnswerVotesHeaderItem) {
val voteCount = item.upVoteCount - item.downVoteCount
votes.text = itemView.context.resources.getQuantityString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ class SitesActivity : BaseActivity<ActivitySitesBinding>(
supportActionBar?.title = getString(R.string.sites, getString(it.filterNameRes))
}

viewModel.fetchSites()
viewModel.forceFetchSites()
}

override fun onResume() {
super.onResume()
viewModel.forceFetchSites()
viewModel.fetchSites()
viewModel.currentQuery?.let { searchView?.setQuery(it, true) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,9 @@ class SitesViewModel @Inject constructor(
}

private fun List<Site>.applySearch(query: String): List<Site> {
return filter {
val containsName = it.name.contains(query, ignoreCase = true)
val containsAudience = it.audience.contains(query, ignoreCase = true)
containsName || containsAudience
}
fun Site.queryInName() = name.contains(query, ignoreCase = true)
fun Site.queryInAudience() = audience.contains(query, ignoreCase = true)
return filter { it.queryInName() || it.queryInAudience() }
.sortedByDescending { it.queryInName() }
}
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/AndroidConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ object AndroidConfig {
const val APPLICATION_ID = "me.tylerbwong.stack"
const val COMPILE_SDK = 33
const val MIN_SDK = 26
const val TARGET_SDK = 33
const val TARGET_SDK = 34
const val VERSION_CODE = 24
const val VERSION_NAME = "2.1.2"
}
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[versions]
about-libraries = "10.6.2"
android-gradlePlugin = "8.0.2"
android-gradlePlugin = "8.1.0"
androidx-activity = "1.7.2"
androidx-appcompat = "1.6.1"
androidx-browser = "1.5.0"
androidx-compose-foundation = "1.4.3"
androidx-compose-compiler = "1.4.8"
androidx-compose-compiler = "1.5.1"
androidx-compose-material = "1.4.3"
androidx-compose-material3 = "1.2.0-alpha02"
androidx-compose-runtime = "1.4.3"
androidx-compose-ui = "1.4.3"
androidx-constraintlayout = "2.1.4"
androidx-core = "1.10.1"
androidx-fragment = "1.6.0"
androidx-fragment = "1.6.1"
androidx-hilt = "1.0.0"
androidx-lifecycle = "2.6.1"
androidx-preference = "1.2.0"
androidx-preference = "1.2.1"
androidx-profileinstaller = "1.3.1"
androidx-recyclerview = "1.3.0"
androidx-recyclerview = "1.3.1"
androidx-room = "2.5.2"
androidx-security = "1.1.0-alpha06"
androidx-swiperefreshlayout = "1.1.0"
Expand All @@ -36,16 +36,16 @@ detekt = "1.19.0"
espresso = "3.5.1"
google-firebase-bom = "32.2.0"
google-firebase-crashlytics-gradle = "2.9.7"
google-ksp = "1.8.22-1.0.11"
google-ksp = "1.9.0-1.0.12"
google-material = "1.9.0"
google-play-appUpdate = "2.1.0"
google-play-billing = "6.0.1"
google-play-review = "2.0.1"
google-services = "4.3.15"
insetter = "0.6.1"
javaPoet = "1.13.0"
jetbrains-kotlin = "1.8.22"
jetbrains-kotlinx-coroutines = "1.7.2"
jetbrains-kotlin = "1.9.0"
jetbrains-kotlinx-coroutines = "1.7.3"
jetbrains-markdown = "0.4.1"
junit = "4.13.2"
klock = "3.4.0"
Expand Down

0 comments on commit 1665fcb

Please sign in to comment.