NotificationUtil: Navigate through splash fragment for updates notification
AuthData can get expired by the time a user clicks on the update notification. Navigating through splash fragment will ensure required checks being ran. Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -201,8 +201,9 @@ object NotificationUtil {
|
|||||||
fun getUpdateNotification(context: Context, updatesList: List<Update>): Notification {
|
fun getUpdateNotification(context: Context, updatesList: List<Update>): Notification {
|
||||||
val contentIntent = NavDeepLinkBuilder(context)
|
val contentIntent = NavDeepLinkBuilder(context)
|
||||||
.setGraph(R.navigation.mobile_navigation)
|
.setGraph(R.navigation.mobile_navigation)
|
||||||
.setDestination(R.id.updatesFragment)
|
.setDestination(R.id.splashFragment)
|
||||||
.setComponentName(MainActivity::class.java)
|
.setComponentName(MainActivity::class.java)
|
||||||
|
.setArguments(bundleOf("destinationId" to R.id.updatesFragment))
|
||||||
.createPendingIntent()
|
.createPendingIntent()
|
||||||
|
|
||||||
return NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_UPDATES)
|
return NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_UPDATES)
|
||||||
|
|||||||
@@ -194,8 +194,14 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun navigateToDefaultTab() {
|
private fun navigateToDefaultTab() {
|
||||||
|
val defaultDestination = Preferences.getInteger(requireContext(), PREFERENCE_DEFAULT_SELECTED_TAB)
|
||||||
val directions =
|
val directions =
|
||||||
when (Preferences.getInteger(requireContext(), PREFERENCE_DEFAULT_SELECTED_TAB)) {
|
when (requireArguments().getInt("destinationId", defaultDestination)) {
|
||||||
|
R.id.updatesFragment -> {
|
||||||
|
requireArguments().remove("destinationId")
|
||||||
|
SplashFragmentDirections.actionSplashFragmentToUpdatesFragment()
|
||||||
|
}
|
||||||
|
|
||||||
1 -> SplashFragmentDirections.actionSplashFragmentToGamesContainerFragment()
|
1 -> SplashFragmentDirections.actionSplashFragmentToGamesContainerFragment()
|
||||||
2 -> SplashFragmentDirections.actionSplashFragmentToUpdatesFragment()
|
2 -> SplashFragmentDirections.actionSplashFragmentToUpdatesFragment()
|
||||||
else -> SplashFragmentDirections.actionSplashFragmentToNavigationApps()
|
else -> SplashFragmentDirections.actionSplashFragmentToNavigationApps()
|
||||||
|
|||||||
Reference in New Issue
Block a user