feat: checkpoint API migration and dzikir UX updates
This commit is contained in:
@@ -12,7 +12,7 @@ import '../../../data/local/models/quran_bookmark.dart';
|
||||
import '../../../data/local/models/app_settings.dart';
|
||||
import '../../../data/local/models/daily_worship_log.dart';
|
||||
import '../../../data/local/models/tilawah_log.dart';
|
||||
import '../../../data/services/equran_service.dart';
|
||||
import '../../../data/services/muslim_api_service.dart';
|
||||
import '../../../core/providers/tilawah_tracking_provider.dart';
|
||||
|
||||
class QuranReadingScreen extends ConsumerStatefulWidget {
|
||||
@@ -151,7 +151,8 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
|
||||
Future<void> _loadSurah() async {
|
||||
final surahNum = int.tryParse(widget.surahId) ?? 1;
|
||||
final data = await EQuranService.instance.getSurah(surahNum);
|
||||
final data = await MuslimApiService.instance.getSurah(surahNum);
|
||||
if (!mounted) return;
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
_surah = data;
|
||||
@@ -356,7 +357,9 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
} Future<void> _showEndTrackingDialog(TilawahSession session, int endVerseId) async {
|
||||
}
|
||||
|
||||
Future<void> _showEndTrackingDialog(TilawahSession session, int endVerseId) async {
|
||||
final endSurahId = _surah!['nomor'] ?? 1;
|
||||
final endSurahName = _surah!['namaLatin'] ?? '';
|
||||
|
||||
@@ -367,26 +370,30 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
calculatedAyat = (endVerseId - session.startVerseId).abs() + 1;
|
||||
} else {
|
||||
// Cross surah calculation
|
||||
final allSurahs = await EQuranService.instance.getAllSurahs();
|
||||
final allSurahs = await MuslimApiService.instance.getAllSurahs();
|
||||
if (allSurahs.isNotEmpty) {
|
||||
int startSurahIdx = allSurahs.indexWhere((s) => s['nomor'] == session.startSurahId);
|
||||
int endSurahIdx = allSurahs.indexWhere((s) => s['nomor'] == endSurahId);
|
||||
|
||||
// Ensure chronological calculation
|
||||
if (startSurahIdx > endSurahIdx) {
|
||||
final tempIdx = startSurahIdx; startSurahIdx = endSurahIdx; endSurahIdx = tempIdx;
|
||||
|
||||
if (startSurahIdx < 0 || endSurahIdx < 0) {
|
||||
calculatedAyat = (endVerseId - session.startVerseId).abs() + 1;
|
||||
} else {
|
||||
// Ensure chronological calculation
|
||||
if (startSurahIdx > endSurahIdx) {
|
||||
final tempIdx = startSurahIdx; startSurahIdx = endSurahIdx; endSurahIdx = tempIdx;
|
||||
}
|
||||
|
||||
final startSurahData = allSurahs[startSurahIdx];
|
||||
final int totalAyatInStart = (startSurahData['jumlahAyat'] as num?)?.toInt() ?? 1;
|
||||
|
||||
calculatedAyat += (totalAyatInStart - session.startVerseId) + 1; // Ayats inside StartSurah
|
||||
|
||||
for (int i = startSurahIdx + 1; i < endSurahIdx; i++) {
|
||||
calculatedAyat += (allSurahs[i]['jumlahAyat'] as int? ?? 0); // Intermediate Surahs
|
||||
}
|
||||
|
||||
calculatedAyat += endVerseId; // Ayats inside EndSurah
|
||||
}
|
||||
|
||||
final startSurahData = allSurahs[startSurahIdx];
|
||||
final int totalAyatInStart = (startSurahData['jumlahAyat'] as num?)?.toInt() ?? 1;
|
||||
|
||||
calculatedAyat += (totalAyatInStart - session.startVerseId) + 1; // Ayats inside StartSurah
|
||||
|
||||
for (int i = startSurahIdx + 1; i < endSurahIdx; i++) {
|
||||
calculatedAyat += (allSurahs[i]['jumlahAyat'] as int? ?? 0); // Intermediate Surahs
|
||||
}
|
||||
|
||||
calculatedAyat += endVerseId; // Ayats inside EndSurah
|
||||
} else {
|
||||
calculatedAyat = 1; // Fallback
|
||||
}
|
||||
@@ -572,6 +579,11 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(LucideIcons.headphones),
|
||||
tooltip: 'Murattal Surah',
|
||||
onPressed: _navigateToMurattal,
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
LucideIcons.brain,
|
||||
@@ -620,6 +632,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
style: TextStyle(
|
||||
fontFamily: 'Amiri',
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
@@ -802,6 +815,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Amiri',
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: 2.0,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user