Skip to content

adding assigned moderators view#284

Merged
steryokhin merged 4 commits intodevelopfrom
feature/EPMEDU-1839-View-assigned-moderators-to-FP
Jan 25, 2026
Merged

adding assigned moderators view#284
steryokhin merged 4 commits intodevelopfrom
feature/EPMEDU-1839-View-assigned-moderators-to-FP

Conversation

@Giorgi217
Copy link
Copy Markdown
Collaborator

@Giorgi217 Giorgi217 commented Jan 14, 2026

Pull Request overview

Assigned Moderators & Role-Based Visibility


Problem

We needed a reliable way to detect if the current user is moderator/admin and conditionally show “Assigned moderators” on the details screen. Previously we only had user mode, but no reactive role updates.


Summary

This PR introduces observable user roles (volunteer / moderator / admin) and uses them to show a new “Assigned moderators” section on Feeding Point Details. The moderators list is fetched from feeding history, displayed only for moderator/admin, and includes a shimmer loading state plus an expand (chevron) button when there are more than 5 moderators.


Changes

File What changed
UserProfileServiceProtocol.swift Introduced UserRole (volunteer, moderator, admin) and added UserRoleObservable with userRolePublisher
UserProfileService.swift Exposed userRolePublisher so business logic can react to role changes
UserValidationModel.swift Decodes Cognito groups from ID token, maps them into UserRole, and publishes updates reactively
FeedingPointDetailsContract.swift Added onModeratorsChange and tapShowMoreModerators event to support moderators section
FeedingPointDetailsModel.swift Listens to userRolePublisher, fetches assigned moderators from feeding history, and exposes them via onModeratorsChange
FeedingPointDetailsModelMapper.swift Added support for moderators in the domain model
FeedingPointDetailsViewModel.swift Stores all moderators, controls expand/collapse logic, and maps data for the UI
FeedingPointDetailsViewMapper.swift Maps moderators into UI models and prepares Assigned moderators section
FeedingPointDetailsViewController.swift Renders moderators list, shimmer state, and chevron button
ModeratorsShimmerView.swift New shimmer placeholder for moderators section
ArrowButtonView.swift New reusable bold SF Symbol button for “Show more”
ButtonViewFactory.swift Added factory method for arrow button

🧠 How it works (High level)

  • Cognito ID token → decoded into roles
  • Roles are published via userRolePublisher
  • FeedingPointDetailsModel listens to role changes
  • If user is moderator/admin → assigned moderators are fetched
  • UI reacts automatically (shimmer → content → expand)

How to test

Volunteer

  • Sign in as volunteer
  • Open Feeding Point Details
    → Assigned moderators section should be hidden
Simulator Screenshot - iPhone 15 Pro - 2026-01-15 at 17 49 26

Moderator / Admin

  • Sign in as moderator/admin
  • Open Feeding Point Details
    → Moderators shimmer appears first (while loading)
    → Then “Assigned moderators” appears with up to 5 names
    → If total moderators > 5 → chevron down shows → tap to expand and reveal up to 10

Simulator Screenshot - iPhone 15 Pro - 2026-01-15 at 17 50 55 Simulator Screenshot - iPhone 15 Pro - 2026-01-15 at 17 51 06 Simulator Screenshot - iPhone 15 Pro - 2026-01-15 at 17 51 17

@steryokhin
Copy link
Copy Markdown
Collaborator

Great job!
Could you please provide the description and screenshots?

@kishorepran
Copy link
Copy Markdown
Collaborator

kishorepran commented Jan 16, 2026

One of the best descriptions I have seen in a pr, good work
Few concerns before we merge this is shared in group chat.

Copy link
Copy Markdown
Contributor

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 PR adds role-based visibility for an "Assigned Moderators" section on the Feeding Point Details screen. The implementation introduces a reactive user role system that decodes Cognito JWT tokens to determine if users are volunteers, moderators, or admins, and conditionally displays moderators only to authorized users.

Changes:

  • Introduced UserRole enum (volunteer, moderator, admin) with reactive role updates via userRolePublisher
  • Added moderators section to Feeding Point Details with shimmer loading state and expand/collapse functionality
  • Created ArrowButtonView component and ModeratorsShimmerView for the new UI elements

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
UserProfileServiceProtocol.swift Defines UserRole enum and UserRoleObservable protocol for reactive role updates
UserProfileService.swift Exposes userRolePublisher to propagate role changes
UserValidationModel.swift Decodes Cognito groups from JWT ID token and publishes role changes
FeedingPointDetailsContract.swift Adds onModeratorsChange callback and tapShowMoreModerators event
FeedingPointDetailsModel.swift Subscribes to role changes and fetches moderators from feeding history
FeedingPointDetailsModelMapper.swift Adds moderators field to domain model
FeedingPointDetailsViewModel.swift Manages moderator list state and expand/collapse logic
FeedingPointDetailsViewMapper.swift Maps moderators to UI models
FeedingPointDetailsViewController.swift Renders moderators UI with shimmer and expand button
ModeratorsShimmerView.swift Custom shimmer view for loading state
ArrowButtonView.swift Reusable chevron button component
ButtonViewFactory.swift Factory method for arrow button

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@steryokhin steryokhin merged commit 1e4b0c2 into develop Jan 25, 2026
2 checks passed
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.

5 participants