mirror of
https://github.com/Dvorinka/1356.git
synced 2026-06-03 19:42:57 +00:00
feat: Complete Phase 1 - Full Flutter app implementation with comprehensive features
Version: 1.1.0 Major changes: - Implemented complete Flutter app structure with all core features - Added comprehensive UI screens for auth, countdown, goals, profile, settings, and social features - Integrated Supabase backend with authentication and data repositories - Added offline support with Hive caching and local storage - Implemented comprehensive routing with go_router - Added location services with Google Maps integration - Implemented notifications and home widget support - Added voice recording capabilities and AI chat features - Created comprehensive test suite and documentation - Added Android and iOS platform configurations - Implemented achievements system and social features - Added calendar integration and bucket list functionality This represents a complete Phase 1 milestone with 3,775 additions across 31 files.
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../../data/repositories/auth_repository.dart';
|
||||
import '../../../data/models/user_model.dart';
|
||||
import '../../../core/services/analytics_service.dart';
|
||||
|
||||
final authControllerProvider = StateNotifierProvider<AuthController, User?>((ref) {
|
||||
return AuthController(ref.read(authRepositoryProvider));
|
||||
});
|
||||
|
||||
final authRepositoryProvider = Provider<AuthRepository>((ref) {
|
||||
return AuthRepository(/* SupabaseClient instance will be injected */);
|
||||
return AuthRepository();
|
||||
});
|
||||
|
||||
class AuthController extends StateNotifier<User?> {
|
||||
final AuthRepository _authRepository;
|
||||
final AnalyticsService _analytics = AnalyticsService();
|
||||
|
||||
AuthController(this._authRepository) : super(null) {
|
||||
_init();
|
||||
@@ -21,27 +23,54 @@ class AuthController extends StateNotifier<User?> {
|
||||
state = _authRepository.currentUser;
|
||||
_authRepository.authStateChanges.listen((user) {
|
||||
state = user;
|
||||
if (user != null) {
|
||||
_analytics.setUserId(user.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool get isAuthenticated => _authRepository.isAuthenticated;
|
||||
|
||||
String? get currentUserId => _authRepository.currentUserId;
|
||||
|
||||
Future<bool> isSessionValid() async {
|
||||
return await _authRepository.isSessionValid();
|
||||
}
|
||||
|
||||
Future<void> refreshSession() async {
|
||||
await _authRepository.refreshSession();
|
||||
}
|
||||
|
||||
Future<void> signInWithEmail(String email, String password) async {
|
||||
await _authRepository.signInWithEmail(email, password);
|
||||
_analytics.logSignIn(method: 'email');
|
||||
}
|
||||
|
||||
Future<void> signUpWithEmail(String email, String password, String username) async {
|
||||
await _authRepository.signUpWithEmail(email, password, username);
|
||||
_analytics.logSignUp(method: 'email');
|
||||
}
|
||||
|
||||
Future<void> signInWithGoogle() async {
|
||||
await _authRepository.signInWithGoogle();
|
||||
_analytics.logSignIn(method: 'google');
|
||||
}
|
||||
|
||||
Future<void> signInWithApple() async {
|
||||
await _authRepository.signInWithApple();
|
||||
_analytics.logSignIn(method: 'apple');
|
||||
}
|
||||
|
||||
Future<void> signInWithGithub() async {
|
||||
await _authRepository.signInWithGithub();
|
||||
_analytics.logSignIn(method: 'github');
|
||||
}
|
||||
|
||||
Future<void> signOut() async {
|
||||
await _authRepository.signOut();
|
||||
state = null;
|
||||
_analytics.logSignOut();
|
||||
_analytics.reset();
|
||||
}
|
||||
|
||||
Future<void> resetPassword(String email) async {
|
||||
@@ -54,11 +83,30 @@ class AuthController extends StateNotifier<User?> {
|
||||
String? avatarUrl,
|
||||
bool? isPublicProfile,
|
||||
}) async {
|
||||
final updatedFields = <String>[];
|
||||
if (username != null) updatedFields.add('username');
|
||||
if (bio != null) updatedFields.add('bio');
|
||||
if (avatarUrl != null) updatedFields.add('avatar');
|
||||
if (isPublicProfile != null) {
|
||||
updatedFields.add('visibility');
|
||||
_analytics.logProfileVisibilityChanged(isPublic: isPublicProfile);
|
||||
}
|
||||
|
||||
await _authRepository.updateProfile(
|
||||
username: username,
|
||||
bio: bio,
|
||||
avatarUrl: avatarUrl,
|
||||
isPublicProfile: isPublicProfile,
|
||||
);
|
||||
|
||||
if (updatedFields.isNotEmpty) {
|
||||
_analytics.logProfileUpdated(fieldsUpdated: updatedFields.join(','));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_authRepository.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user