fix(alarm): point the next-alarm show intent at the app, not the ring screen
The `AlarmClockInfo` show intent — what the status-bar alarm icon and the lockscreen's next-alarm line open — targeted `AlarmRingActivity` with `CLEAR_TASK`. Tapping it opened a ring screen for an alarm that was not ringing, which resolved to "finished" and closed itself again. It now opens the app on its Alarms tab. That show intent is what "next-alarm publishing" means, so the rule pinning it belongs to this milestone.
This commit is contained in:
+12
-4
@@ -5,13 +5,13 @@ import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import de.jeanlucmakiola.clockula.MainActivity
|
||||
import de.jeanlucmakiola.clockula.alarm.AlarmCapabilities
|
||||
import de.jeanlucmakiola.clockula.alarm.AlarmIntents
|
||||
import de.jeanlucmakiola.clockula.alarm.AlarmScheduler
|
||||
import de.jeanlucmakiola.clockula.alarm.receiver.AlarmFireReceiver
|
||||
import de.jeanlucmakiola.clockula.domain.alarm.ScheduleMode
|
||||
import de.jeanlucmakiola.clockula.domain.alarm.SchedulingPolicy
|
||||
import de.jeanlucmakiola.clockula.ui.ring.AlarmRingActivity
|
||||
import kotlin.time.Instant
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
@@ -92,12 +92,20 @@ class AndroidAlarmScheduler @Inject constructor(
|
||||
PENDING_INTENT_FLAGS,
|
||||
)
|
||||
|
||||
/** What the system opens when the user taps the status-bar alarm icon. */
|
||||
/**
|
||||
* What the system opens when the user taps the status-bar alarm icon or the
|
||||
* lockscreen's next-alarm line: the **alarms list**, which is what "show me
|
||||
* my next alarm" means. It pointed at the ring screen until M9, so tapping
|
||||
* it opened a ring screen for an alarm that was not ringing, which resolved
|
||||
* to `Finished` and closed itself (M9 D21). `MainActivity` is `singleTop`,
|
||||
* so an existing task is brought forward and `onNewIntent` selects the tab.
|
||||
*/
|
||||
private fun showPendingIntent(): PendingIntent = PendingIntent.getActivity(
|
||||
context,
|
||||
AlarmIntents.REQUEST_SHOW,
|
||||
Intent(context, AlarmRingActivity::class.java).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
Intent(context, MainActivity::class.java).apply {
|
||||
action = AlarmIntents.ACTION_SHOW_ALARMS
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
},
|
||||
PENDING_INTENT_FLAGS,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user