Extract from_notification extra to a constant in IntentNavigationExtras

Allow `IntentProvider` to receive extras and `PendingIntentFactory` to send them.
This commit is contained in:
Jorge Martín 2025-11-27 12:17:51 +01:00 committed by Jorge Martin Espinosa
parent 04feea5d25
commit 1d77aa447d
7 changed files with 54 additions and 15 deletions

View file

@ -10,6 +10,7 @@ package io.element.android.x.intent
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.core.net.toUri
import dev.zacsweers.metro.AppScope
import dev.zacsweers.metro.ContributesBinding
@ -32,11 +33,12 @@ class DefaultIntentProvider(
roomId: RoomId?,
threadId: ThreadId?,
eventId: EventId?,
extras: Bundle?,
): Intent {
return Intent(context, MainActivity::class.java).apply {
action = Intent.ACTION_VIEW
data = deepLinkCreator.create(sessionId, roomId, threadId, eventId).toUri()
putExtra("from_notification", true)
extras?.let(::putExtras)
}
}
}