Skip to content

Conversation

@chitrakshbotwala
Copy link
Collaborator

added sessions , profile page and routed auth and onboarding

Copy link

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 pull request adds comprehensive authentication, user sessions, and profile management features to the Vector fitness tracking app. The changes introduce Firebase Authentication for user management, location-based session tracking with GPS, and a profile page with session history.

Key changes:

  • Implemented Firebase Authentication with email/password login, registration, and password reset flows
  • Added session tracking functionality with GPS location monitoring for walking, running, and cycling activities
  • Created profile management system with location services and session history viewing

Reviewed changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
pubspec.yaml Added firebase_auth, pinput, geolocator, flutter_map, latlong2, permission_handler, and geocoding dependencies
pubspec.lock Updated lockfile with new package dependencies and their transitive dependencies
windows/flutter/generated_plugins.cmake Registered Firebase Auth, geolocator, and permission handler plugins for Windows
windows/flutter/generated_plugin_registrant.cc Added plugin registrations for Windows platform
macos/Flutter/GeneratedPluginRegistrant.swift Registered Firebase Auth and geolocator plugins for macOS
android/app/src/main/AndroidManifest.xml Added location and foreground service permissions for GPS tracking
lib/core/constants.dart Added session page colors and database path constants
lib/core/services/firebase_service.dart Created centralized Firebase service singleton for Auth and Database instances
lib/core/services/firebase_auth_service.dart Implemented Firebase Authentication service wrapper
lib/core/services/firebase_database_service.dart Updated to use centralized Firebase service instance
lib/core/services/session_service.dart Added session tracking service for managing workout sessions in Firebase
lib/models/user_model.dart Created UserProfile model for user data
lib/models/session_tracking_model.dart Added models for activity tracking (SessionModel, LocationPoint, TodaySummary)
lib/view_models/auth_view_model.dart Implemented authentication state management
lib/view_models/session_view_model.dart Created session tracking state management with GPS integration
lib/view_models/profile_view_model.dart Added profile management with location services
lib/widgets/auth_wrapper.dart Created authentication routing wrapper to direct users based on auth/onboarding status
lib/widgets/bottomnav.dart Added incomplete bottom navigation widget (work in progress)
lib/views/register_view.dart Created user registration UI
lib/views/login_view.dart Implemented login screen
lib/views/verification_view.dart Added email verification page (appears to be incorrectly implemented)
lib/views/forgetpass_view.dart Created password reset request page
lib/views/newpass_view.dart Added new password entry page
lib/views/home_view.dart Implemented home screen with session launcher
lib/views/sessions_page.dart Created session tracking interface with activity selection and stats
lib/views/live_tracking_view.dart Added live GPS tracking view with map visualization
lib/views/profile_page.dart Implemented profile page with session history
lib/views/goals.dart Updated to integrate with authentication and navigate to HomeView after onboarding
lib/main.dart Added new ViewModels to Provider setup and changed initial route to AuthWrapper

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

Comment on lines +76 to +79
_buildInput(
label: 'Username',
hint: 'user@name10',
controller: _usernameController,
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The username field is collected in the registration form but never used. The AuthViewModel's register method only accepts email and password parameters. Either remove this field from the UI or update the register method to accept and store the username.

Copilot uses AI. Check for mistakes.
'Nov',
'Dec',
];
return '${date.day} ${months[date.month - 1]},${date.year}';
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

Missing space after comma in the date format string. Should be '${date.day} ${months[date.month - 1]}, ${date.year}' instead of '${date.day} ${months[date.month - 1]},${date.year}'.

Suggested change
return '${date.day} ${months[date.month - 1]},${date.year}';
return '${date.day} ${months[date.month - 1]}, ${date.year}';

Copilot uses AI. Check for mistakes.
Comment on lines +152 to +153
} catch (e) {
_error = 'Failed to start session: $e';
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The error messages in the session tracking flow are not user-friendly. For example, "Failed to start session: $e" exposes technical error details to users. Consider providing more helpful, user-friendly error messages and logging technical details separately for debugging.

Suggested change
} catch (e) {
_error = 'Failed to start session: $e';
} catch (e, stackTrace) {
// Log technical details for debugging while keeping the user message friendly
debugPrint('Failed to start session: $e');
debugPrint('$stackTrace');
_error = 'Unable to start session. Please try again.';

Copilot uses AI. Check for mistakes.
Comment on lines +103 to +125
onPressed: authVM.isLoading
? null
: () async {
final success = await authVM.register(
email: _emailController.text.trim(),
password: _passwordController.text.trim(),
);
if (success) {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (_) => const AuthWrapper(),
),
(route) => false,
);
} else if (authVM.error != null) {
ScaffoldMessenger.of(
context,
).showSnackBar(
SnackBar(content: Text(authVM.error!)),
);
}
},
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

Missing input validation for email and password fields. Users can submit the registration form with invalid or empty credentials. Add validation to check for proper email format and minimum password length before attempting registration.

Copilot uses AI. Check for mistakes.
borderRadius: BorderRadius.circular(40), // ✅ Figma radius
boxShadow: [
BoxShadow(
color: Colors.black,
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The shadow color should have opacity applied. Using Colors.black creates a completely opaque shadow which is likely not the intended design. Consider using Colors.black.withValues(alpha: 0.1) or similar for a softer shadow effect.

Suggested change
color: Colors.black,
color: Colors.black.withOpacity(0.1),

Copilot uses AI. Check for mistakes.
);
}

Widget _buildControlPanel(SessionViewModel sessionVM, dynamic activeSession) {
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The dynamic type for activeSession parameter is too loose. It should be explicitly typed as SessionModel for type safety and better code clarity.

Suggested change
Widget _buildControlPanel(SessionViewModel sessionVM, dynamic activeSession) {
Widget _buildControlPanel(SessionViewModel sessionVM, SessionModel activeSession) {

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +6
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

ACCESS_BACKGROUND_LOCATION permission requires special justification on Android 10+ and should only be requested if the app truly needs to track location in the background. If background tracking is not implemented, this permission should be removed. Also consider checking if FOREGROUND_SERVICE permission is actually used by implementing a foreground service for tracking.

Suggested change
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +97
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWell(
onTap: () =>
setState(() => rememberMe = !rememberMe),
child: Row(
children: [
Icon(
rememberMe
? Icons.check_box
: Icons.check_box_outline_blank,
color: Colors.white,
),
const SizedBox(width: 6),
const Text(
'Remember me',
style: TextStyle(color: Colors.white),
),
],
),
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The Remember Me checkbox state is collected but never used. Either implement persistence logic to remember the user's credentials or remove this non-functional UI element.

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +19
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
context.read<ProfileViewModel>().initialize();
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The profile and session history loading is triggered on every page initialization, which could be expensive. Consider implementing a refresh mechanism or caching strategy to avoid unnecessary data fetches when the data hasn't changed.

Suggested change
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
context.read<ProfileViewModel>().initialize();
// Simple in-memory caching to avoid reloading profile and session history
// on every page initialization within a short time window.
static DateTime? _lastInitialized;
static bool _isInitializing = false;
static const Duration _cacheValidity = Duration(minutes: 5);
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
final now = DateTime.now();
final shouldRefresh = _lastInitialized == null ||
now.difference(_lastInitialized!) > _cacheValidity;
if (shouldRefresh && !_isInitializing) {
_isInitializing = true;
try {
await context.read<ProfileViewModel>().initialize();
_lastInitialized = DateTime.now();
} finally {
_isInitializing = false;
}
}

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +20
final icons = [
'assets/icons/Vector.png',
'assets/icons/primary.png',
'assets/icons/SVGRepo_iconCarrier.png',
'assets/icons/Page_1.png',
];
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

Using hardcoded asset paths for icons ('assets/icons/Vector.png', etc.) without checking if these assets exist in the project. This will cause runtime errors if the assets are missing. Verify all asset files are included in pubspec.yaml.

Copilot uses AI. Check for mistakes.
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.

2 participants