Skip to content

Commit 51fa153

Browse files
committed
Merge branch 'refactor/open-character' into 'master'
Otevření detailu postavy po jejím vytvoření Closes #43 See merge request fmasa/pv239-project!79
2 parents befb385 + fb231b9 commit 51fa153

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

app/src/main/java/cz/muni/fi/rpg/ui/characterCreation/CharacterCreationFragment.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,13 @@ class CharacterCreationFragment(
138138
points: Points
139139
) {
140140
launch {
141+
val characterId = CharacterId(args.partyId, authentication.getUserId())
141142
Timber.d("Creating character")
142143
characters.save(
143-
args.partyId,
144+
characterId.partyId,
144145
Character(
145146
name = info.name,
146-
userId = authentication.getUserId(),
147+
userId = characterId.userId,
147148
career = info.career,
148149
socialClass = info.socialClass,
149150
race = info.race,
@@ -157,7 +158,11 @@ class CharacterCreationFragment(
157158
)
158159
toast("Your character has been created")
159160

160-
withContext(Dispatchers.Main) { findNavController().popBackStack() }
161+
withContext(Dispatchers.Main) {
162+
findNavController().navigate(
163+
CharacterCreationFragmentDirections.openCharacter(characterId)
164+
)
165+
}
161166
}
162167

163168
}

app/src/main/res/navigation/mobile_navigation.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
<argument
6262
android:name="partyId"
6363
app:argType="java.util.UUID" />
64+
65+
<action
66+
android:id="@+id/openCharacter"
67+
app:destination="@id/nav_character"
68+
app:popUpTo="@id/nav_party_list" />
6469
</fragment>
6570

6671
<fragment

0 commit comments

Comments
 (0)