Skip to content

Conversation

@iqfareez
Copy link
Member

@iqfareez iqfareez commented Oct 5, 2025

This pull request refactors the way prayer times are managed and displayed in the app by introducing a dedicated provider and service for prayer time data. The changes improve state management, error handling, and UI responsiveness, and also update sharing functionality to use the new provider. The most important changes are grouped below:

Prayer Time State Management and Data Fetching

  • Added a new PrayerTimeProvider (lib/features/prayer_time/providers/prayer_time_provider.dart) that encapsulates prayer time state, loading, error handling, and exposes methods to fetch today's, monthly, and notification-relevant prayer times.
  • Added a new PrayerTimeService (lib/features/prayer_time/services/prayer_time_service.dart) responsible for fetching, caching, and providing prayer time data, as well as updating the home screen widget.

UI Refactoring and Integration

  • Refactored HomePage (lib/features/home/views/home_page.dart) to use PrayerTimeProvider for loading and displaying prayer times, replacing the previous FutureBuilder and PrayDataHandler logic. Error and loading states now use provider state, and the prayer time list is rendered via the new widget. [1] [2] [3]
  • Added a new UI widget PrayerTimeListWidget (lib/features/prayer_time/views/prayer_time_list_widget.dart) that displays today's prayer times, highlights the current prayer, and schedules notifications when appropriate.

Sharing Functionality Updates

  • Updated sharing logic in ShareTextBuilder and ShareFloatingActionButton to use prayer times from PrayerTimeProvider instead of the old handler, ensuring shared data is current and consistent with the app state. [1] [2] [3] [4] [5]…r and services.

Update code to better segregrate UI and logic side.

@iqfareez iqfareez requested a review from Copilot October 7, 2025 02:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors the prayer time management architecture by replacing the old PrayDataHandler with a new provider-service pattern. The refactoring introduces better state management, improved error handling, and cleaner separation of concerns between UI and business logic.

  • Replaced PrayDataHandler static class with PrayerTimeProvider and PrayerTimeService for better state management
  • Updated HomePage to use the new provider pattern instead of FutureBuilder with static methods
  • Refactored sharing functionality to work with the new prayer time provider

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pubspec.yaml Version bump to 2.13.6-pre.1+161
lib/views/prayer_time_view.dart Removed old prayer time view widget (278 lines deleted)
lib/utils/prayer_data_handler.dart Removed old static prayer data handler (41 lines deleted)
lib/main.dart Added PrayerTimeProvider to the provider list
lib/features/sharing/views/templates/base_share_card.dart Updated to use PrayerTimeProvider instead of PrayDataHandler
lib/features/sharing/views/share_floating_action_button.dart Updated sharing methods to use prayer time from provider
lib/features/sharing/utils/share_text_builder.dart Modified constructor to accept prayer times as parameter
lib/features/prayer_time/views/prayer_time_list_widget.dart New prayer time display widget with improved structure
lib/features/prayer_time/services/prayer_time_service.dart New service class for prayer time data management
lib/features/prayer_time/providers/prayer_time_provider.dart New provider for prayer time state management
lib/features/home/views/home_page.dart Updated to use new provider pattern instead of FutureBuilder

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

margin: EdgeInsets.symmetric(
vertical: MediaQuery.of(context).size.height / 320,
),
height: isOptional ? 55 : 80,
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The height logic is inverted. Optional prayers (Imsak, Syuruk, Dhuha) should have smaller height (55), but the original code had isOther set to true for mandatory prayers and false for optional ones, giving mandatory prayers height 80 and optional prayers height 55. The current logic gives optional prayers height 55 and mandatory prayers height 80, which appears correct, but please verify this matches the intended design.

Copilot uses AI. Check for mistakes.
@iqfareez
Copy link
Member Author

iqfareez commented Oct 9, 2025

Testing so far looks good and doesn't show any symptoms of regressions

@iqfareez iqfareez merged commit e193dd9 into master Oct 9, 2025
5 checks passed
@iqfareez iqfareez deleted the feature/refactor-prayer-handler branch October 9, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants