Add midnight fallback notice, overnight simulations, and keyboard log filter

This commit is contained in:
dwindown
2026-04-07 11:27:39 +07:00
parent 414450125d
commit c1eade84ab
8 changed files with 1989 additions and 1615 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -13,13 +13,13 @@ class AdzanAlertScreen extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final screenData = ref.watch(screenStateProvider);
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
final schedule = ref.watch(todayScheduleProvider);
final schedule = ref.watch(runtimeScheduleProvider).schedule;
final settings = ref.watch(settingsProvider);
final size = MediaQuery.of(context).size;
final s = size.width / 1920;
final prayerLabel = screenData.activePrayer
?.displayLabel(isFriday: screenData.isFriday) ??
final prayerLabel =
screenData.activePrayer?.displayLabel(isFriday: screenData.isFriday) ??
'';
final timeStr =
'${clock.hour.toString().padLeft(2, '0')}:${clock.minute.toString().padLeft(2, '0')}';
@@ -54,8 +54,8 @@ class AdzanAlertScreen extends ConsumerWidget {
child: Center(
child: Opacity(
opacity: 0.03,
child: Icon(Icons.mosque, size: 500 * s,
color: SacredColors.onSurface),
child: Icon(Icons.mosque,
size: 500 * s, color: SacredColors.onSurface),
),
),
),
@@ -66,8 +66,8 @@ class AdzanAlertScreen extends ConsumerWidget {
left: 0,
right: 0,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 64 * s, vertical: 24 * s),
padding:
EdgeInsets.symmetric(horizontal: 64 * s, vertical: 24 * s),
color: SacredColors.background,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -136,7 +136,8 @@ class AdzanAlertScreen extends ConsumerWidget {
.withValues(alpha: 0.4),
borderRadius: BorderRadius.circular(SacredRadii.full),
border: Border.all(
color: SacredColors.outlineVariant.withValues(alpha: 0.15),
color:
SacredColors.outlineVariant.withValues(alpha: 0.15),
),
),
child: Row(
@@ -168,8 +169,8 @@ class AdzanAlertScreen extends ConsumerWidget {
style: GoogleFonts.plusJakartaSans(
fontSize: 48 * s,
fontWeight: FontWeight.w700,
color: SacredColors.onSurface
.withValues(alpha: 0.5),
color:
SacredColors.onSurface.withValues(alpha: 0.5),
),
),
Text(
@@ -253,9 +254,8 @@ class AdzanAlertScreen extends ConsumerWidget {
style: GoogleFonts.plusJakartaSans(
fontSize: isActive ? 32 * fs : 28 * fs,
fontWeight: isActive ? FontWeight.w700 : FontWeight.w600,
color: isActive
? SacredColors.primary
: SacredColors.onSurface,
color:
isActive ? SacredColors.primary : SacredColors.onSurface,
),
),
],
@@ -307,8 +307,8 @@ class _PulsingIconState extends State<_PulsingIcon>
height: 200 * s,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: SacredColors.secondary
.withValues(alpha: 0.1 * _ctrl.value),
color:
SacredColors.secondary.withValues(alpha: 0.1 * _ctrl.value),
boxShadow: [
BoxShadow(
blurRadius: 60 * s * _ctrl.value,

View File

@@ -93,12 +93,14 @@ class _HomeViewState extends ConsumerState<HomeView> {
if (result.synced) {
debugPrint('[AutoSync] Cache refreshed successfully.');
ref.invalidate(todayScheduleProvider);
ref.invalidate(runtimeScheduleProvider);
ref.invalidate(scheduleCacheStatusProvider);
return;
}
if (result.attempted) {
debugPrint('[AutoSync] Refresh attempt failed. Staying on local cache.');
debugPrint(
'[AutoSync] Refresh attempt failed. Staying on local cache.');
}
} finally {
_isAutoRefreshRunning = false;
@@ -211,7 +213,10 @@ class _HomeViewState extends ConsumerState<HomeView> {
BackgroundRotateAction? _matchManualRotateSequence() {
if (_recentKeys.length < 3) return null;
final tail = _recentKeys.sublist(_recentKeys.length - 3).map(_normalizedComboKey).toList();
final tail = _recentKeys
.sublist(_recentKeys.length - 3)
.map(_normalizedComboKey)
.toList();
if (tail[0] == LogicalKeyboardKey.arrowRight &&
tail[1] == LogicalKeyboardKey.arrowRight &&
tail[2] == LogicalKeyboardKey.select) {
@@ -294,14 +299,17 @@ class _HomeViewState extends ConsumerState<HomeView> {
if (previous == null) return;
// TRIGGER 1: Adzan Beep (Fires precisely when transitioning to Adzan)
if (previous.state != ScreenState.adzan && next.state == ScreenState.adzan) {
if (previous.state != ScreenState.adzan &&
next.state == ScreenState.adzan) {
SoundService.instance.playAdzanBeep();
}
// TRIGGER 2: 3-Second Iqomah Countdown
if (next.state == ScreenState.menujuIqomah && next.iqomahRemaining != null) {
if (next.state == ScreenState.menujuIqomah &&
next.iqomahRemaining != null) {
// Play precisely on the tick where it is 3 seconds.
if (previous.iqomahRemaining?.inSeconds != 3 && next.iqomahRemaining!.inSeconds == 3) {
if (previous.iqomahRemaining?.inSeconds != 3 &&
next.iqomahRemaining!.inSeconds == 3) {
SoundService.instance.playIqomahCountdown();
}
}

View File

@@ -21,7 +21,7 @@ class JumatScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
final schedule = ref.watch(todayScheduleProvider);
final schedule = ref.watch(runtimeScheduleProvider).schedule;
final settings = ref.watch(settingsProvider);
final screenData = ref.watch(screenStateProvider);
final size = MediaQuery.of(context).size;
@@ -31,8 +31,8 @@ class JumatScreen extends ConsumerWidget {
final timeStr = DateFormat('HH:mm').format(clock);
final secStr = DateFormat(':ss').format(clock);
final dateGregorian = DateFormat('EEEE, d MMMM yyyy', 'en').format(clock);
final dateHijri =
ref.watch(hijriDateProvider).valueOrNull ?? HijriDateFormatter.format(clock);
final dateHijri = ref.watch(hijriDateProvider).valueOrNull ??
HijriDateFormatter.format(clock);
final durToKhutbah = screenData.timeUntilNext ?? const Duration(minutes: 0);
final minToKhutbah = durToKhutbah.inMinutes;
@@ -42,7 +42,8 @@ class JumatScreen extends ConsumerWidget {
child: Stack(
children: [
// ── Underlay: Branded local image or Unsplash ──
if (settings.brandedBgImage != null && settings.brandedBgImage!.isNotEmpty)
if (settings.brandedBgImage != null &&
settings.brandedBgImage!.isNotEmpty)
Positioned.fill(
child: Image.file(
File(settings.brandedBgImage!),
@@ -99,16 +100,20 @@ class JumatScreen extends ConsumerWidget {
children: [
// Pill
Container(
padding: EdgeInsets.symmetric(horizontal: 24 * s, vertical: 8 * s),
padding: EdgeInsets.symmetric(
horizontal: 24 * s, vertical: 8 * s),
decoration: BoxDecoration(
color: SacredColors.secondary.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(SacredRadii.full),
border: Border.all(color: SacredColors.secondary.withValues(alpha: 0.2)),
border: Border.all(
color: SacredColors.secondary
.withValues(alpha: 0.2)),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
_PulsingDot(color: SacredColors.secondary, size: 12 * s),
_PulsingDot(
color: SacredColors.secondary, size: 12 * s),
SizedBox(width: 12 * s),
Text(
'PERSIAPAN JUMAT',
@@ -146,7 +151,8 @@ class JumatScreen extends ConsumerWidget {
style: GoogleFonts.plusJakartaSans(
fontSize: 48 * s,
fontWeight: FontWeight.w700,
color: SacredColors.primary.withValues(alpha: 0.7),
color:
SacredColors.primary.withValues(alpha: 0.7),
),
),
),
@@ -183,9 +189,11 @@ class JumatScreen extends ConsumerWidget {
child: Container(
padding: EdgeInsets.all(40 * s),
decoration: BoxDecoration(
color: SacredColors.surfaceContainerHigh.withValues(alpha: 0.6),
color: SacredColors.surfaceContainerHigh
.withValues(alpha: 0.6),
borderRadius: BorderRadius.circular(SacredRadii.xl),
border: Border.all(color: Colors.white.withValues(alpha: 0.05)),
border: Border.all(
color: Colors.white.withValues(alpha: 0.05)),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(SacredRadii.xl),
@@ -207,7 +215,10 @@ class JumatScreen extends ConsumerWidget {
letterSpacing: 3 * s,
),
),
HugeIcon(icon: HugeIcons.strokeRoundedSparkles, color: SacredColors.secondary, size: 24 * s),
HugeIcon(
icon: HugeIcons.strokeRoundedSparkles,
color: SacredColors.secondary,
size: 24 * s),
],
),
SizedBox(height: 16 * s),
@@ -223,23 +234,23 @@ class JumatScreen extends ConsumerWidget {
SizedBox(height: 32 * s),
// Khatib Info
_buildInfoTile(
s,
_buildInfoTile(s,
icon: Icons.person_pin,
color: SacredColors.primary,
label: 'KHATIB HARI INI',
value: settings.khatibName.isEmpty ? 'Belum Diatur' : settings.khatibName
),
value: settings.khatibName.isEmpty
? 'Belum Diatur'
: settings.khatibName),
SizedBox(height: 24 * s),
// Countdown Info
_buildInfoTile(
s,
_buildInfoTile(s,
icon: Icons.timer,
color: SacredColors.secondary,
label: 'KHUTBAH DIMULAI DALAM',
value: minToKhutbah > 0 ? '~ $minToKhutbah Menit' : 'Sebentar Lagi'
),
value: minToKhutbah > 0
? '~ $minToKhutbah Menit'
: 'Sebentar Lagi'),
],
),
),
@@ -277,7 +288,8 @@ class JumatScreen extends ConsumerWidget {
children: [
// Mosque Name
GestureDetector(
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const AdminScreen())),
onTap: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => const AdminScreen())),
child: Text(
settings.masjidName,
style: GoogleFonts.plusJakartaSans(
@@ -290,7 +302,10 @@ class JumatScreen extends ConsumerWidget {
// Mosque Address
Row(
children: [
HugeIcon(icon: HugeIcons.strokeRoundedMosque01, color: SacredColors.primary, size: 24 * s),
HugeIcon(
icon: HugeIcons.strokeRoundedMosque01,
color: SacredColors.primary,
size: 24 * s),
SizedBox(width: 8 * s),
Text(
settings.masjidAddress,
@@ -306,7 +321,11 @@ class JumatScreen extends ConsumerWidget {
);
}
Widget _buildInfoTile(double s, {required IconData icon, required Color color, required String label, required String value}) {
Widget _buildInfoTile(double s,
{required IconData icon,
required Color color,
required String label,
required String value}) {
return Container(
padding: EdgeInsets.all(20 * s),
decoration: BoxDecoration(
@@ -373,32 +392,44 @@ class JumatScreen extends ConsumerWidget {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildTimeItem(s, 'Fajr', schedule.subuh, Icons.brightness_3, false),
_buildTimeItem(s, 'Terbit', schedule.terbit, Icons.wb_twilight, false),
_buildTimeItem(
s, 'Terbit', schedule.terbit, Icons.wb_twilight, false),
_buildTimeItem(s, 'JUMAT', schedule.dzuhur, Icons.wb_sunny, true),
_buildTimeItem(s, 'Asr', schedule.ashar, Icons.sunny_snowing, false),
_buildTimeItem(s, 'Maghrib', schedule.maghrib, Icons.wb_cloudy, false),
_buildTimeItem(
s, 'Maghrib', schedule.maghrib, Icons.wb_cloudy, false),
_buildTimeItem(s, 'Isha', schedule.isya, Icons.bedtime, false),
],
),
);
}
Widget _buildTimeItem(double s, String name, String time, IconData icon, bool isJumat) {
Widget _buildTimeItem(
double s, String name, String time, IconData icon, bool isJumat) {
if (isJumat) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 48 * s, vertical: 12 * s),
decoration: BoxDecoration(
color: SacredColors.primary.withValues(alpha: 0.15),
border: Border.all(color: SacredColors.primary.withValues(alpha: 0.3)),
border:
Border.all(color: SacredColors.primary.withValues(alpha: 0.3)),
borderRadius: BorderRadius.circular(SacredRadii.xl),
),
child: Column(
children: [
Icon(icon, color: SacredColors.primary, size: 28 * s),
SizedBox(height: 8 * s),
Text(name, style: GoogleFonts.manrope(fontSize: 18 * s, fontWeight: FontWeight.w800, color: SacredColors.primary)),
Text(name,
style: GoogleFonts.manrope(
fontSize: 18 * s,
fontWeight: FontWeight.w800,
color: SacredColors.primary)),
SizedBox(height: 4 * s),
Text(time, style: GoogleFonts.plusJakartaSans(fontSize: 16 * s, fontWeight: FontWeight.w700, color: SacredColors.primary)),
Text(time,
style: GoogleFonts.plusJakartaSans(
fontSize: 16 * s,
fontWeight: FontWeight.w700,
color: SacredColors.primary)),
],
),
);
@@ -407,11 +438,21 @@ class JumatScreen extends ConsumerWidget {
padding: EdgeInsets.symmetric(horizontal: 24 * s, vertical: 8 * s),
child: Column(
children: [
Icon(icon, color: SacredColors.onSurface.withValues(alpha: 0.6), size: 24 * s),
Icon(icon,
color: SacredColors.onSurface.withValues(alpha: 0.6),
size: 24 * s),
SizedBox(height: 8 * s),
Text(name, style: GoogleFonts.manrope(fontSize: 16 * s, fontWeight: FontWeight.w500, color: SacredColors.onSurface.withValues(alpha: 0.6))),
Text(name,
style: GoogleFonts.manrope(
fontSize: 16 * s,
fontWeight: FontWeight.w500,
color: SacredColors.onSurface.withValues(alpha: 0.6))),
SizedBox(height: 4 * s),
Text(time, style: GoogleFonts.plusJakartaSans(fontSize: 16 * s, fontWeight: FontWeight.w700, color: SacredColors.onSurface)),
Text(time,
style: GoogleFonts.plusJakartaSans(
fontSize: 16 * s,
fontWeight: FontWeight.w700,
color: SacredColors.onSurface)),
],
),
);
@@ -420,7 +461,9 @@ class JumatScreen extends ConsumerWidget {
Widget _buildMarquee(double s, double fs, AppSettings settings) {
// Quick custom simplified marquee or fallback to settings.runningTexts
final texts = settings.runningTexts.isEmpty
? ["JUMAT MUBARAK: Luruskan dan rapatkan shaf. Harap non-aktifkan alat komunikasi."]
? [
"JUMAT MUBARAK: Luruskan dan rapatkan shaf. Harap non-aktifkan alat komunikasi."
]
: settings.runningTexts;
return Container(
@@ -448,29 +491,45 @@ class _PulsingDot extends StatefulWidget {
State<_PulsingDot> createState() => _PulsingDotState();
}
class _PulsingDotState extends State<_PulsingDot> with SingleTickerProviderStateMixin {
class _PulsingDotState extends State<_PulsingDot>
with SingleTickerProviderStateMixin {
late AnimationController _ctrl;
@override
void initState() {
super.initState();
_ctrl = AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))..repeat();
_ctrl = AnimationController(
vsync: this, duration: const Duration(milliseconds: 1200))
..repeat();
}
@override
void dispose() { _ctrl.dispose(); super.dispose(); }
void dispose() {
_ctrl.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return SizedBox(
width: widget.size, height: widget.size,
width: widget.size,
height: widget.size,
child: Stack(
children: [
FadeTransition(
opacity: Tween(begin: 0.75, end: 0.0).animate(_ctrl),
child: ScaleTransition(
scale: Tween(begin: 1.0, end: 2.0).animate(_ctrl),
child: Container(decoration: BoxDecoration(shape: BoxShape.circle, color: widget.color)),
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle, color: widget.color)),
),
),
Center(child: Container(width: widget.size, height: widget.size, decoration: BoxDecoration(shape: BoxShape.circle, color: widget.color))),
Center(
child: Container(
width: widget.size,
height: widget.size,
decoration: BoxDecoration(
shape: BoxShape.circle, color: widget.color))),
],
),
);
@@ -485,15 +544,23 @@ class _JumatMarquee extends StatefulWidget {
State<_JumatMarquee> createState() => _JumatMarqueeState();
}
class _JumatMarqueeState extends State<_JumatMarquee> with TickerProviderStateMixin {
class _JumatMarqueeState extends State<_JumatMarquee>
with TickerProviderStateMixin {
late AnimationController _ctrl;
@override
void initState() {
super.initState();
_ctrl = AnimationController(vsync: this, duration: const Duration(seconds: 30))..repeat();
_ctrl =
AnimationController(vsync: this, duration: const Duration(seconds: 30))
..repeat();
}
@override
void dispose() { _ctrl.dispose(); super.dispose(); }
void dispose() {
_ctrl.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final joined = widget.texts.join("");
@@ -504,8 +571,7 @@ class _JumatMarqueeState extends State<_JumatMarquee> with TickerProviderStateMi
letterSpacing: 2 * widget.s,
);
return LayoutBuilder(
builder: (context, constraints) {
return LayoutBuilder(builder: (context, constraints) {
return Stack(
children: [
AnimatedBuilder(
@@ -514,11 +580,18 @@ class _JumatMarqueeState extends State<_JumatMarquee> with TickerProviderStateMi
// Ensure endless scroll mathematically
return Positioned(
left: -(_ctrl.value * constraints.maxWidth),
top: 0, bottom: 0,
top: 0,
bottom: 0,
child: Row(
children: [
Container(alignment: Alignment.centerLeft, width: constraints.maxWidth, child: Text(joined, style: style, maxLines: 1)),
Container(alignment: Alignment.centerLeft, width: constraints.maxWidth, child: Text(joined, style: style, maxLines: 1)),
Container(
alignment: Alignment.centerLeft,
width: constraints.maxWidth,
child: Text(joined, style: style, maxLines: 1)),
Container(
alignment: Alignment.centerLeft,
width: constraints.maxWidth,
child: Text(joined, style: style, maxLines: 1)),
],
),
);
@@ -526,7 +599,6 @@ class _JumatMarqueeState extends State<_JumatMarquee> with TickerProviderStateMi
),
],
);
}
);
});
}
}

View File

@@ -28,7 +28,8 @@ class MainScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
final schedule = ref.watch(todayScheduleProvider);
final runtimeSchedule = ref.watch(runtimeScheduleProvider);
final schedule = runtimeSchedule.schedule;
final settings = ref.watch(settingsProvider);
final screenData = ref.watch(screenStateProvider);
final size = MediaQuery.of(context).size;
@@ -118,6 +119,8 @@ class MainScreen extends ConsumerWidget {
settings,
dateGregorian,
dateHijri,
showWaitingUpdateNotice:
runtimeSchedule.isFallbackFromPreviousDay,
inlineClockText:
centerSlide.isPrimary ? null : '$timeStr$secStr',
),
@@ -166,7 +169,7 @@ class MainScreen extends ConsumerWidget {
Widget _buildHeader(BuildContext context, double s, double fs,
AppSettings settings, String dateGregorian, String dateHijri,
{String? inlineClockText}) {
{required bool showWaitingUpdateNotice, String? inlineClockText}) {
final hScale = settings.scaleTopHeader;
final showInlineClock =
inlineClockText != null && inlineClockText.isNotEmpty;
@@ -252,6 +255,37 @@ class MainScreen extends ConsumerWidget {
),
),
if (showWaitingUpdateNotice)
Expanded(
flex: 2,
child: Align(
alignment: Alignment.centerRight,
child: Container(
margin: EdgeInsets.only(right: 16 * s),
padding: EdgeInsets.symmetric(
horizontal: 18 * s,
vertical: 9 * s,
),
decoration: BoxDecoration(
color: SacredColors.secondary.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(SacredRadii.full),
border: Border.all(
color: SacredColors.secondary.withValues(alpha: 0.7),
),
),
child: Text(
'Menunggu Update Data',
style: GoogleFonts.plusJakartaSans(
fontSize: 16 * s * hScale,
fontWeight: FontWeight.w700,
color: SacredColors.secondary,
letterSpacing: 0.3 * s,
),
),
),
),
),
// Right: Hijri date + mosque icon
Expanded(
flex: 3,

View File

@@ -13,15 +13,35 @@ import 'core/sacred_tokens.dart';
import 'data/local/models.dart';
import 'features/home/home_view.dart';
const String _duplicateKeyDownAssertion =
'A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed.';
bool _isIgnorableKeyboardAssertion(Object error, [StackTrace? stack]) {
final text = error.toString();
if (!text.contains(_duplicateKeyDownAssertion)) return false;
final stackText = stack?.toString() ?? '';
return stackText.isEmpty || stackText.contains('hardware_keyboard.dart');
}
bool _isIgnorableFlutterAssertion(FlutterErrorDetails details) {
return _isIgnorableKeyboardAssertion(details.exception, details.stack);
}
void main() {
runZonedGuarded(() async {
WidgetsFlutterBinding.ensureInitialized();
FlutterError.onError = (details) {
if (_isIgnorableFlutterAssertion(details)) {
return;
}
FlutterError.presentError(details);
debugPrint('[Fatal][FlutterError] ${details.exceptionAsString()}');
};
PlatformDispatcher.instance.onError = (error, stack) {
if (_isIgnorableKeyboardAssertion(error, stack)) {
return true;
}
debugPrint('[Fatal][PlatformDispatcher] $error');
debugPrintStack(stackTrace: stack);
return true;
@@ -104,8 +124,7 @@ Future<void> _sanitizeMediaSettings(Box<AppSettings> settingsBox) async {
? settings.brandedBgImage
: null;
final needsSave =
validSlides.length != settings.slideshowImages.length ||
final needsSave = validSlides.length != settings.slideshowImages.length ||
brandedBg != settings.brandedBgImage;
if (!needsSave) return;

View File

@@ -29,8 +29,7 @@ class BackgroundRotateCommand {
action = BackgroundRotateAction.random;
}
final backgroundRotateCommandProvider =
StateProvider<BackgroundRotateCommand>(
final backgroundRotateCommandProvider = StateProvider<BackgroundRotateCommand>(
(ref) => const BackgroundRotateCommand.initial(),
);
@@ -101,6 +100,44 @@ final todayScheduleProvider = Provider<DailyPrayerSchedule?>((ref) {
return SyncService.instance.getTodaySchedule(clock);
});
class RuntimeScheduleData {
final DailyPrayerSchedule? schedule;
final bool isFallbackFromPreviousDay;
const RuntimeScheduleData({
required this.schedule,
this.isFallbackFromPreviousDay = false,
});
const RuntimeScheduleData.empty()
: schedule = null,
isFallbackFromPreviousDay = false;
}
/// Runtime schedule used by main display/state machine.
/// If today's data is missing after midnight, we temporarily fallback to yesterday
/// so screen remains operational while showing a waiting-for-update notice.
final runtimeScheduleProvider = Provider<RuntimeScheduleData>((ref) {
final clock = ref.watch(clockProvider).valueOrNull;
if (clock == null) return const RuntimeScheduleData.empty();
final today = SyncService.instance.getTodaySchedule(clock);
if (today != null) {
return RuntimeScheduleData(schedule: today);
}
final previousDay = clock.subtract(const Duration(days: 1));
final fallback = SyncService.instance.getTodaySchedule(previousDay);
if (fallback != null) {
return RuntimeScheduleData(
schedule: fallback,
isFallbackFromPreviousDay: true,
);
}
return const RuntimeScheduleData.empty();
});
final scheduleCacheStatusProvider = Provider<ScheduleCacheStatus>((ref) {
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
return SyncService.instance.getCacheStatus(clock);
@@ -149,7 +186,7 @@ class ScreenStateData {
final screenStateProvider = Provider<ScreenStateData>((ref) {
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
final schedule = ref.watch(todayScheduleProvider);
final schedule = ref.watch(runtimeScheduleProvider).schedule;
final settings = ref.watch(settingsProvider);
final isFriday = clock.weekday == DateTime.friday;

View File

@@ -1,7 +1,7 @@
name: jamshalat_masjid_screen
description: Smart Digital Prayer Clock for Android TV Box
publish_to: 'none'
version: 1.0.14+15
version: 1.0.15+16
environment:
sdk: '>=3.0.0 <4.0.0'