Skip to content

Integrated Club Verification Screen with Firebase#37

Open
prashant273000 wants to merge 3 commits into
bsoc-bitbyte:mainfrom
prashant273000:main
Open

Integrated Club Verification Screen with Firebase#37
prashant273000 wants to merge 3 commits into
bsoc-bitbyte:mainfrom
prashant273000:main

Conversation

@prashant273000

@prashant273000 prashant273000 commented Jul 14, 2026

Copy link
Copy Markdown

What does this PR do?

Integrates ClubVerificationScreen into the app's navigation flow, replacing the previous placeholder. Adds status-check logic that calls UserRepository.fetchClubVerificationStatus and surfaces the result to the user via a Snackbar, and automatically navigates approved club admins to ClubDashboard.

Related Issue

Closes: #34

Brief Explanation of Approach

  1. ClubVerificationViewModel now injects UserRepository and uses FirebaseAuth.getInstance() to get the current admin's uid. onCheckStatusClick was changed to accept two callbacks - onApproved: () -> Unit and onMessage: (String) -> Unit — instead of the screen inferring a message itself from isVerified. Inside the ViewModel:

  2. Sets isLoading = true, calls userRepository.fetchClubVerificationStatus(uid).

  3. Updates ClubVerificationUiState with the new verificationStatus field (added alongside the existing isVerified flag) and isLoading = false.
    Branches on the returned status string:

  4. "approved" → fires onMessage("Verification Successful!") then onApproved().
    "pending" → fires a "still pending" message, no navigation.
    "rejected" → fires a "contact support" message, no navigation.
    any other value → falls back to showing the raw status.

  5. Wraps the call in try/catch so network/Firestore failures reset isLoading and tell us an error message via onMessage..

  6. ClubVerificationScreen was simplified to just pass these two callbacks through to the ViewModel, with onMessage launching a coroutine to show the Snackbar - removing the screen's own logic for deciding what message to display.
    In MainActivity, the ClubVerificationScreen entry now passes:

onNavigationBack = { backStack.removeLast() }
onNavigateToDashboard = { backStack.clear(); backStack.add(ScreenRoute.App.ClubDashboard) }

Additional Notes

  1. uid is fetched via auth.currentUser?.uid ?: return - if there's no signed-in use

  2. Added error handling which is now in place for the status-fetch call (catch (e: Exception) → onMessage("Error checking status: ${e.message}")).

  3. isVerified is retained in ClubVerificationUiState along with the new verificationStatus field .

@nirvan73 nirvan73 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@prashant273000 Please address the reviews left

Comment thread app/src/main/java/com/tpc/nudj/MainActivity.kt Outdated

@prashant273000 prashant273000 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have addressed all the reviews.

@prashant273000
prashant273000 requested a review from nirvan73 July 17, 2026 17:02
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.

Integrate Club Verification Screen with Firebase

2 participants