Corrige toggle do lembrete diário que não ligava
- Re-verifica a permissão de notificações quando o app volta ao primeiro plano (scenePhase), refletindo mudanças feitas nos Ajustes do iPhone - Toggle otimista: liga imediatamente ao toque e reverte apenas se a autorização for negada - Prompt inicial completa a ativação sozinho ao voltar dos Ajustes com a permissão concedida - Novo teste de UI: ativar o lembrete pelo toggle das configurações Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -226,6 +226,7 @@ struct ReadingPlanView: View {
|
||||
struct ReminderPromptSheet: View {
|
||||
@Bindable var plan: ReadingPlanState
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
|
||||
@State private var time: Date = Calendar.current.date(bySettingHour: 20, minute: 0, second: 0, of: .now) ?? .now
|
||||
@State private var showDeniedInfo = false
|
||||
@@ -277,6 +278,14 @@ struct ReminderPromptSheet: View {
|
||||
.padding(.bottom, 16)
|
||||
.presentationDetents([.large])
|
||||
.interactiveDismissDisabled(false)
|
||||
// Se o usuário foi aos Ajustes e habilitou as notificações,
|
||||
// completa a ativação automaticamente ao voltar para o app.
|
||||
.task(id: scenePhase) {
|
||||
guard scenePhase == .active, showDeniedInfo else { return }
|
||||
if await ReadingReminderService.authorizationStatus() == .authorized {
|
||||
activateReminder()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func activateReminder() {
|
||||
|
||||
Reference in New Issue
Block a user