Skip to content

Commit 61abd3b

Browse files
liveHarshitiamareebjamal
authored andcommitted
fix: App crashes on first time sign in (#2055)
1 parent cf8460a commit 61abd3b

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

app/src/main/java/org/fossasia/openevent/general/auth/LoginFragment.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ class LoginFragment : Fragment() {
196196
SPEAKERS_CALL_FRAGMENT -> R.id.speakersCallFragment
197197
else -> R.id.eventsFragment
198198
}
199-
findNavController(rootView).popBackStack(destinationId, false)
199+
if (destinationId == R.id.eventsFragment) {
200+
findNavController(rootView).navigate(LoginFragmentDirections.actionLoginToEventsPop())
201+
} else {
202+
findNavController(rootView).popBackStack(destinationId, false)
203+
}
200204
rootView.snackbar(R.string.welcome_back)
201205
}
202206
}

app/src/main/java/org/fossasia/openevent/general/auth/SignUpFragment.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ class SignUpFragment : Fragment() {
202202
SPEAKERS_CALL_FRAGMENT -> R.id.speakersCallFragment
203203
else -> R.id.eventsFragment
204204
}
205-
findNavController(rootView).popBackStack(destinationId, false)
205+
if (destinationId == R.id.eventsFragment) {
206+
findNavController(rootView).navigate(SignUpFragmentDirections.actionSignUpToEventsPop())
207+
} else {
208+
findNavController(rootView).popBackStack(destinationId, false)
209+
}
206210
rootView.snackbar(R.string.logged_in_automatically)
207211
}
208212

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,11 @@
756756
app:destination="@id/authFragment"
757757
app:popUpTo="@id/authFragment"
758758
app:popUpToInclusive="true"/>
759+
<action
760+
android:id="@+id/action_login_to_events_pop"
761+
app:destination="@id/eventsFragment"
762+
app:popUpTo="@id/eventsFragment"
763+
app:popUpToInclusive="true"/>
759764
<argument
760765
android:name="email"
761766
app:argType="string"
@@ -776,6 +781,11 @@
776781
app:destination="@id/authFragment"
777782
app:popUpTo="@id/authFragment"
778783
app:popUpToInclusive="true"/>
784+
<action
785+
android:id="@+id/action_sign_up_to_events_pop"
786+
app:destination="@id/eventsFragment"
787+
app:popUpTo="@id/eventsFragment"
788+
app:popUpToInclusive="true"/>
779789
<argument
780790
android:name="email"
781791
app:argType="string"

0 commit comments

Comments
 (0)