Skip to content

Commit

Permalink
Merge pull request #19 from BU-Spark/comments
Browse files Browse the repository at this point in the history
removed unnecessary comments
  • Loading branch information
molly-yan authored May 3, 2024
2 parents c88140c + 16a61f6 commit 4da8f9c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
2 changes: 0 additions & 2 deletions bu_passport/lib/auth/auth_gate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ class AuthGate extends StatelessWidget {
return StreamBuilder<User?>(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot) {
print(FirebaseAuth.instance.authStateChanges());

if (snapshot.connectionState == ConnectionState.waiting) {
// Show a loading indicator while waiting for the authentication state
return CircularProgressIndicator();
Expand Down
1 change: 0 additions & 1 deletion bu_passport/lib/pages/calendar_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class _CalendarPageState extends State<CalendarPage> {
// Filter events for the selected day
List<Event> selectedEvents =
firebaseService.fetchEventsForDay(_selectedDay, events);
print('Selected events: $selectedEvents');
return Column(
children: [
TableCalendar(
Expand Down
3 changes: 0 additions & 3 deletions bu_passport/lib/pages/event_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ class _EventPageState extends State<EventPage> {
// User's current location
final currentPosition = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high);
print("Event coords: $eventCoords");
print("Current position: $currentPosition");

// Calculate the distance between event to user
final double distance = Geolocator.distanceBetween(
Expand All @@ -109,7 +107,6 @@ class _EventPageState extends State<EventPage> {
eventCoords['lat'],
eventCoords['lng'],
);
print("Distance: $distance meters");

// Distance radius checking
if (distance <= 400) {
Expand Down
13 changes: 7 additions & 6 deletions bu_passport/lib/pages/profile_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ class _ProfilePageState extends State<ProfilePage>
List<Event> attendedEvents = [];
List<Event> userSavedEvents = [];
bool isLoading = true; // Indicates if the page is currently loading data.
FirebaseService firebaseService =
FirebaseService(db: FirebaseFirestore.instance); // Firebase service instance for database operations.
FirebaseService firebaseService = FirebaseService(
db: FirebaseFirestore
.instance); // Firebase service instance for database operations.

final TextEditingController _firstNameController = TextEditingController();
final TextEditingController _lastNameController = TextEditingController();
File? selectedImageFile; // The file for a selected profile image.
bool _isEditing = false; // Flag to check if the user is editing their profile.
bool _isEditing =
false; // Flag to check if the user is editing their profile.
final ImageService _imageService = ImageService();
String? userProfileImageUrl; // URL for the user's profile image.

Expand All @@ -58,7 +60,8 @@ class _ProfilePageState extends State<ProfilePage>

User? finalUser = FirebaseAuth.instance.currentUser;
late TabController _tabController; // Controller for managing tabs.
late Future<DocumentSnapshot> _userProfileFuture; // Future for retrieving user data from Firestore.
late Future<DocumentSnapshot>
_userProfileFuture; // Future for retrieving user data from Firestore.

@override
void initState() {
Expand Down Expand Up @@ -166,8 +169,6 @@ class _ProfilePageState extends State<ProfilePage>
double verticalMargin = screenHeight * 0.01; // 1% of screen height
double horizontalMargin = screenWidth * 0.035; // 2% of screen width

print(events);

if (events.isEmpty) {
return Center(child: Text(message, style: TextStyle(fontSize: 20)));
} else {
Expand Down
9 changes: 0 additions & 9 deletions bu_passport/lib/services/firebase_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ class FirebaseService {
await this.db.collection('users').doc(userUID).get();

if (snapshot.exists) {
print('Snapshot exists');
final userData = snapshot.data() as Map<String, dynamic>;
print('User Data: $userData'); // Print userData to see its contents

Users user = Users(
firstName: userData['firstName'],
Expand All @@ -86,7 +84,6 @@ class FirebaseService {
userSavedEvents:
Map<String, dynamic>.from(userData['userSavedEvents'] ?? {}),
);
print(user);
return user;
} else {
print('Snapshot does not exist');
Expand All @@ -112,7 +109,6 @@ class FirebaseService {
await this.db.collection('events').doc(eventId).update({
'savedUsers': FieldValue.arrayUnion([userUID]),
});
print("Event saved successfully");
} catch (error) {
print("Failed to save event: $error");
}
Expand All @@ -132,7 +128,6 @@ class FirebaseService {
await this.db.collection('events').doc(eventId).update({
'savedUsers': FieldValue.arrayRemove([userUID]),
});
print("Event unsaving successful");
} catch (error) {
print("Failed to unsave event: $error");
}
Expand All @@ -145,7 +140,6 @@ class FirebaseService {

if (userDocSnapshot.exists) {
final userData = userDocSnapshot.data() as Map<String, dynamic>;
print(userData['userSavedEvents']);
if (userData['userSavedEvents'] is Map) {
Map<String, dynamic> savedEvents = userData['userSavedEvents'] != null
? Map<String, dynamic>.from(userData['userSavedEvents'])
Expand Down Expand Up @@ -189,7 +183,6 @@ class FirebaseService {
bool isCheckedIn = entry.value;

Event? event = await fetchEventById(eventId);
print(event?.eventTitle);
if (event != null) {
DateTime startOfDayEvent = DateTime(event.eventStartTime.year,
event.eventStartTime.month, event.eventStartTime.day);
Expand Down Expand Up @@ -286,7 +279,6 @@ class FirebaseService {
await userDoc.update({
'userProfileURL': profileURL,
});
print("Profile URL updated successfully");
} catch (error) {
print("Failed to update profile URL: $error");
}
Expand Down Expand Up @@ -336,7 +328,6 @@ class FirebaseService {
await this.db.collection('users').get();
snapshot.docs.forEach((doc) {
final userData = doc.data();
print(userData);
Users user = Users(
firstName: userData['firstName'],
lastName: userData['lastName'],
Expand Down

0 comments on commit 4da8f9c

Please sign in to comment.