open party chat from notification view

This commit is contained in:
Phillip Thelen 2019-06-14 13:22:37 +02:00
parent 6820ffcc66
commit 1a0df90180
3 changed files with 13 additions and 4 deletions

View file

@ -41,6 +41,10 @@
<action
android:id="@+id/openQuestDetail"
app:destination="@id/questDetailFragment" />
<argument
android:name="tabToOpen"
app:argType="integer"
android:defaultValue="0"/>
</fragment>
<fragment
android:id="@+id/questDetailFragment"

View file

@ -83,9 +83,13 @@ class PartyFragment : BaseMainFragment() {
viewPager?.currentItem = 0
setViewPagerAdapter()
setFragments()
arguments?.let {
val args = PartyFragmentArgs.fromBundle(it)
viewPager?.currentItem = args.tabToOpen
}
this.tutorialStepIdentifier = "party"
this.tutorialText = getString(R.string.tutorial_party)
}

View file

@ -63,14 +63,13 @@ open class NotificationsViewModel : BaseViewModel() {
* Custom notification types created by this class (from user data).
* Will be combined with the notifications coming from server.
*/
private val customNotifications: BehaviorSubject<List<Notification>>
private val customNotifications: BehaviorSubject<List<Notification>> = BehaviorSubject.create()
override fun inject(component: UserComponent) {
component.inject(this)
}
init {
customNotifications = BehaviorSubject.create()
customNotifications.onNext(emptyList())
disposable.add(userRepository.getUser()
@ -248,7 +247,9 @@ open class NotificationsViewModel : BaseViewModel() {
private fun clickNewChatMessage(notification: Notification, navController: MainNavigationController) {
val data = notification.data as? NewChatMessageData
if (isPartyMessage(data)) {
navController.navigate(R.id.partyFragment)
val bundle = Bundle()
bundle.putString("groupID", data?.group?.id)
navController.navigate(R.id.partyFragment, bundle)
} else {
val bundle = Bundle()
bundle.putString("groupID", data?.group?.id)