Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sync Course Dates to Calendar #228

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

HamzaIsrar12
Copy link
Contributor

@HamzaIsrar12 HamzaIsrar12 commented Feb 11, 2024

Description

Learner-9801 | Issue-105

Calendar Sync Integration

  • Integrated Sync to Calendar switch on the Course Dates tab.
  • Dynamically show/hide switch based on Remote config.
  • Added user permission prompt for calendar access.
  • Added confirmation alert for initial course additions.
  • Included course dates as events in the local app calendar.
  • Added AlertDialog Loader for event creation/update.
  • Implemented Calendar preference for streamlined alert management.
  • Added user prompt for updating or removing the calendar.
  • Added a prompt for out-of-sync calendar situations.
  • Update calendar events on the 'Shift Due Dates' CTA.

Remote Config for Calendar Feature

Retrieve the remote config from Django Admin within the enrollments API. Store the configuration in CorePreferences, ensuring it is updated with each enrollment API call.

The CalendarSync Config now manages specific values pertinent to the Calendar Sync integration on both the Course Home and Dates tab.

Waffle flags/config on LMS Django Admin:

  1. Open LMS Django Admin and go to Mobile API → Mobile configs.
  2. Make sure you have access to the table mobile_api_admin.
  3. Add a config with the name: configs whose value needs to be a JSON dictionary having the following format and key/value pairs:
  {
    "course_dates_calendar_sync": {
      "ios": {
        "enabled": true,
        "self_paced_enabled": true,
        "instructor_paced_enabled": true,
        "deep_links_enabled": false
      },
      "android": {
        "enabled": true,
        "self_paced_enabled": true,
        "instructor_paced_enabled": true,
        "deep_links_enabled": false
      }
    }
  }

Note

The backend team is working to fix some issues with Remote Config, in the meanwhile please enable the feature locally by passing default values to data model AppConfig.


Screenshots

1. Default State 2. Calendar Permission Dialog 3. Permission Dialog 4. Detail Dialog
5. Calendar Syncing 6. View Calendar Events 7. Remove Calendar 8. Out Of Sync Calendar

Demo

Calendar.Sync.webm

@moiz994
Copy link

moiz994 commented Feb 14, 2024

@HamzaIsrar12 It would be better to update the pop-up messages for the following 2 cases:

  • Add Calendar
  • Remove Calendar

Case: Add Calendar
Content:
Title: Add Course Dates to Calendar
Body: Would you like to add "" dates to your calendar?

You can edit or remove your course dates at any time from your calendar or settings.

CTAs: Cancel | Add

Case: Remove Calendar
Content:
Title: Remove Course Dates from Calendar
Body: Would you like to remove the "" dates from your calendar?
CTAs: Cancel | Remove

Additional info:
Calendar name is a combination of the app name and course name. i.e. - = edX - Harvard's CS50

Copy link
Contributor

@omerhabib26 omerhabib26 left a comment

Choose a reason for hiding this comment

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

Cases are working fine as expected but some code improvements can be made.

@volodymyr-chekyrta
Copy link
Contributor

@HamzaIsrar12, Could you please provide documentation on configuring the CourseEnrollments "config" on the LMS?
I need it to finish the review.

@moiz994
Copy link

moiz994 commented Feb 19, 2024

@HamzaIsrar12, Could you please provide documentation on configuring the CourseEnrollments "config" on the LMS? I need it to finish the review.

Hamza is out sick today. @omerhabib26 or @farhan-arshad-dev can either one of you help here?

@HamzaIsrar12
Copy link
Contributor Author

@volodymyr-chekyrta

Waffle flags/config on LMS Django Admin:

  1. Open LMS Django Admin and go to Mobile API → Mobile configs.
  2. Make sure you have access to the table mobile_api_admin.
  3. Add a config with the name: configs whose value needs to be a JSON dictionary having the following format and key/value pairs:
  {
    "course_dates_calendar_sync": {
      "ios": {
        "enabled": true,
        "self_paced_enabled": true,
        "instructor_paced_enabled": true,
        "deep_links_enabled": false
      },
      "android": {
        "enabled": true,
        "self_paced_enabled": true,
        "instructor_paced_enabled": true,
        "deep_links_enabled": false
      }
    }
  }

Copy link
Contributor

@omerhabib26 omerhabib26 left a comment

Choose a reason for hiding this comment

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

Some minor nits

if (calendarSyncUIState.isCalendarSyncEnabled) {
item {
CalendarSyncCard(
modifier = Modifier.padding(bottom = 16.dp),
Copy link
Contributor

Choose a reason for hiding this comment

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

still pending

omerhabib26
omerhabib26 previously approved these changes Feb 22, 2024
Copy link
Contributor

@volodymyr-chekyrta volodymyr-chekyrta left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Contributor

@k1rill k1rill left a comment

Choose a reason for hiding this comment

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

just one question about commented code

@k1rill k1rill self-requested a review February 26, 2024 10:41
k1rill
k1rill previously approved these changes Feb 26, 2024
Copy link
Contributor

@k1rill k1rill left a comment

Choose a reason for hiding this comment

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

LGTM

Calendar Sync Integration:
- Integrated "Sync to Calendar" switch on Course Dates tab.
- Dynamically show/hide switch based on Remote config.
- Added user permission prompt for calendar access.
- Added confirmation alert for initial course additions.
- Included course dates as events in the local app calendar.
- Added AlertDialog Loader for event creation/update.
- Implemented Calendar preference for streamlined alert management.
- Added user prompt for updating or removing the calendar.
- Added a prompt for out-of-sync calendar situations.
- Update calendar events on 'Shift Due Dates' CTA.

Remote Config for Calendar Feature:
- Retrieve remote config from LMS within the enrollments API.
 Store the configuration in CorePreferences, ensuring it is updated
 with each enrollments API call.

- The CalendarSync Config now manages specific values pertinent to
 the Calendar Sync integration on both the Course Home and Dates
 tab.

Fixes: LEARNER-9801
@k1rill k1rill self-requested a review February 26, 2024 11:22
@HamzaIsrar12 HamzaIsrar12 merged commit 92d697f into openedx:develop Feb 26, 2024
3 checks passed
@HamzaIsrar12 HamzaIsrar12 deleted the hamza/LEARNER-9801 branch February 26, 2024 12:23
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.

[Android] Option "Sync Dates to Calendar"
5 participants