Skip to content

Commit

Permalink
make it so the loadProjects call is made on the ui thread to avoid is…
Browse files Browse the repository at this point in the history
…sues with re-assigning the layout manager, also added some null safety for fun (#2087)
  • Loading branch information
mtgriego authored Aug 1, 2024
1 parent 3e12d8d commit 2d6291c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ class ProfileActivity : ComponentActivity() {
this.viewModel.outputs.projectList()
.compose(observeForUIV2())
.subscribe {
this.loadProjects(it)
runOnUiThread {
this.loadProjects(it)
}
}
.addToDisposable(disposables)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.kickstarter.libs.utils.EventContextValues
import com.kickstarter.libs.utils.NumberUtils
import com.kickstarter.libs.utils.extensions.addToDisposable
import com.kickstarter.libs.utils.extensions.isNonZero
import com.kickstarter.libs.utils.extensions.isNotNull
import com.kickstarter.libs.utils.extensions.isZero
import com.kickstarter.models.Project
import com.kickstarter.services.DiscoveryParams
Expand Down Expand Up @@ -136,7 +137,8 @@ interface ProfileViewModel {
.build()

paginator.isFetching
.subscribe(this.isFetchingProjects)
.subscribe { this.isFetchingProjects.onNext(it) }
.addToDisposable(disposables)

val loggedInUser = this.currentUser.loggedInUser()

Expand Down Expand Up @@ -166,7 +168,7 @@ interface ProfileViewModel {
) { a, b -> Pair.create(a, b) }
.map { p -> p.first || p.second }

this.projectList = paginator.paginatedData()
this.projectList = paginator.paginatedData().filter { it.isNotNull() }
this.resumeDiscoveryActivity = this.exploreProjectsButtonClicked

this.startMessageThreadsActivity = this.messagesButtonClicked
Expand Down

0 comments on commit 2d6291c

Please sign in to comment.