diff --git a/lib/pages/registration_complete_page.dart b/lib/pages/registration_complete_page.dart index eda6646..b6dd065 100644 --- a/lib/pages/registration_complete_page.dart +++ b/lib/pages/registration_complete_page.dart @@ -1,12 +1,17 @@ import 'package:flutter/material.dart'; import '../components/text_bold.dart'; import '../services/auth/auth_gate.dart'; +import '../services/auth/auth_service.dart'; +import '../services/user_service.dart'; class RegistrationCompletePage extends StatelessWidget { const RegistrationCompletePage({super.key}); @override Widget build(BuildContext context) { + // Set the user as active when the page is built + UserService.setUserActive(true, AuthService().getCurrentUser()!.uid); + return Scaffold( appBar: AppBar( automaticallyImplyLeading: false, // remove back button diff --git a/lib/pages/user_matching_page.dart b/lib/pages/user_matching_page.dart index d904d04..453bc8d 100644 --- a/lib/pages/user_matching_page.dart +++ b/lib/pages/user_matching_page.dart @@ -98,10 +98,12 @@ class UserMatchingPageState extends State { // add profiles accordingly allUsers.add(userProfile); // Exclude (1) the current user's profile, (2) the already liked profiles - // and (3) users that were disliked less than 24 hours ago + // (3) users that were disliked less than 24 hours ago + // and (4) not active profile if (userDoc.id != currentUserId && !likedUserIds.contains(userDoc.id) && - !dislikedUserIds.contains(userDoc.id)) { + !dislikedUserIds.contains(userDoc.id) && + (userProfile.active ?? false)) { showProfiles.add(userProfile); } } // end for diff --git a/lib/services/user_service.dart b/lib/services/user_service.dart index 51b4f83..9b32d16 100644 --- a/lib/services/user_service.dart +++ b/lib/services/user_service.dart @@ -365,4 +365,14 @@ class UserService { return e.toString(); } } + + /// Update the active field of [userId] to given [value] + static Future setUserActive(bool value, String userId) async { + await FirebaseFirestore.instance + .collection(Constants.dbCollectionUsers) + .doc(userId) + .update({ + Constants.dbFieldUsersActive: value, + }); + } }