mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 04:39:04 +00:00
Further tweaks for party page
This commit is contained in:
parent
ea9de8e5e6
commit
0d4528de67
4 changed files with 14 additions and 27 deletions
|
|
@ -125,13 +125,7 @@ class SocialRepositoryImpl(localRepository: SocialLocalRepository, apiClient: Ap
|
|||
|
||||
override fun retrieveGroup(id: String): Flowable<Group> {
|
||||
return Flowable.zip(apiClient.getGroup(id).doOnNext { localRepository.save(it) }, retrieveGroupChat(id)
|
||||
.map { message ->
|
||||
message.forEach {
|
||||
it.groupId = id
|
||||
}
|
||||
message
|
||||
}
|
||||
.doOnSuccess { localRepository.save(it) }.toFlowable(),
|
||||
.toFlowable(),
|
||||
BiFunction<Group, List<ChatMessage>, Group> { group, _ ->
|
||||
group
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,8 +93,6 @@ class ChatFragment : BaseFragment() {
|
|||
}
|
||||
})
|
||||
|
||||
refresh()
|
||||
|
||||
viewModel?.getChatMessages()?.subscribe(Consumer<RealmResults<ChatMessage>> { this.setChatMessages(it) }, RxErrorHandler.handleEmptyError())?.let { compositeSubscription.add(it) }
|
||||
|
||||
communityGuidelinesReviewView.setOnClickListener {
|
||||
|
|
|
|||
|
|
@ -191,7 +191,6 @@ class PartyDetailFragment : BaseFragment() {
|
|||
}
|
||||
|
||||
private fun updateMembersList(members: RealmResults<Member>?) {
|
||||
membersWrapper?.removeAllViews()
|
||||
val leaderID = viewModel?.leaderID
|
||||
members?.forEachIndexed { index, member ->
|
||||
val memberView = (if (membersWrapper?.childCount ?: 0 > index) {
|
||||
|
|
|
|||
|
|
@ -58,26 +58,22 @@ class PartyFragment : BaseMainFragment() {
|
|||
|
||||
viewModel.loadPartyID()
|
||||
|
||||
compositeSubscription.add(userRepository.getUser()
|
||||
.map {
|
||||
it.hasParty()
|
||||
}
|
||||
compositeSubscription.add(viewModel.groupIDFlowable.map { it.value != null }
|
||||
.distinctUntilChanged()
|
||||
.subscribe(Consumer {
|
||||
val fragment = firstFragment
|
||||
if (fragment != null) {
|
||||
childFragmentManager.beginTransaction().remove(fragment).commit()
|
||||
}
|
||||
viewPager?.adapter?.notifyDataSetChanged()
|
||||
val fragment = firstFragment
|
||||
if (fragment != null) {
|
||||
childFragmentManager.beginTransaction().remove(fragment).commit()
|
||||
}
|
||||
viewPager?.adapter?.notifyDataSetChanged()
|
||||
|
||||
if (it) {
|
||||
viewModel.retrieveGroup {}
|
||||
tabLayout?.visibility = View.VISIBLE
|
||||
} else {
|
||||
tabLayout?.visibility = View.GONE
|
||||
}
|
||||
|
||||
}, RxErrorHandler.handleEmptyError()))
|
||||
if (it) {
|
||||
viewModel.retrieveGroup {}
|
||||
tabLayout?.visibility = View.VISIBLE
|
||||
} else {
|
||||
tabLayout?.visibility = View.GONE
|
||||
}
|
||||
}, RxErrorHandler.handleEmptyError()))
|
||||
|
||||
viewPager?.currentItem = 0
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue