Active User Flag
parent
c560f86db9
commit
d567956d90
|
@ -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
|
||||
|
|
|
@ -98,10 +98,12 @@ class UserMatchingPageState extends State<UserMatchingPage> {
|
|||
// 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
|
||||
|
|
|
@ -365,4 +365,14 @@ class UserService {
|
|||
return e.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/// Update the active field of [userId] to given [value]
|
||||
static Future<void> setUserActive(bool value, String userId) async {
|
||||
await FirebaseFirestore.instance
|
||||
.collection(Constants.dbCollectionUsers)
|
||||
.doc(userId)
|
||||
.update({
|
||||
Constants.dbFieldUsersActive: value,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue