mirror of
https://github.com/Dvorinka/1356.git
synced 2026-06-03 19:42:57 +00:00
build
This commit is contained in:
@@ -37,7 +37,10 @@ class AppScaffold extends StatelessWidget {
|
||||
actions: actions,
|
||||
)
|
||||
: null,
|
||||
body: SafeArea(child: body),
|
||||
body: body,
|
||||
extendBodyBehindAppBar: true,
|
||||
extendBody: true,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
floatingActionButton: floatingActionButton,
|
||||
bottomNavigationBar: bottomNavigationBar,
|
||||
);
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import '../models/user_model.dart';
|
||||
import '../../bootstrap/supabase_client.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart' as supabase;
|
||||
import 'package:google_sign_in/google_sign_in.dart';
|
||||
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
|
||||
|
||||
class AuthRepository {
|
||||
final supabase.SupabaseClient _client;
|
||||
@@ -110,30 +108,6 @@ class AuthRepository {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> signInWithApple() async {
|
||||
final credential = await SignInWithApple.getAppleIDCredential(
|
||||
scopes: [
|
||||
AppleIDAuthorizationScopes.email,
|
||||
AppleIDAuthorizationScopes.fullName,
|
||||
],
|
||||
);
|
||||
|
||||
final identityToken = credential.identityToken;
|
||||
if (identityToken == null) {
|
||||
throw Exception('No identity token from Apple sign-in');
|
||||
}
|
||||
|
||||
final response = await _client.auth.signInWithIdToken(
|
||||
provider: supabase.OAuthProvider.apple,
|
||||
idToken: identityToken,
|
||||
accessToken: credential.authorizationCode,
|
||||
);
|
||||
|
||||
if (response.user != null) {
|
||||
await _ensureUserProfileExists(response.user!.id, response.user!);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> signInWithGithub() async {
|
||||
await _client.auth.signInWithOAuth(
|
||||
supabase.OAuthProvider.github,
|
||||
|
||||
@@ -56,11 +56,6 @@ class AuthController extends StateNotifier<User?> {
|
||||
_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');
|
||||
|
||||
@@ -35,23 +35,6 @@ class _AuthChoiceScreenState extends ConsumerState<AuthChoiceScreen> {
|
||||
}
|
||||
|
||||
|
||||
Future<void> _handleAppleSignIn() async {
|
||||
setState(() => _isLoading = true);
|
||||
try {
|
||||
await ref.read(authControllerProvider.notifier).signInWithApple();
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Apple sign-in failed: $e')),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _isLoading = false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleGithubSignIn() async {
|
||||
setState(() => _isLoading = true);
|
||||
try {
|
||||
@@ -164,13 +147,6 @@ class _AuthChoiceScreenState extends ConsumerState<AuthChoiceScreen> {
|
||||
onPressed: _handleGoogleSignIn,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_SocialButton(
|
||||
icon: Icons.apple,
|
||||
label: 'Continue with Apple',
|
||||
isLoading: _isLoading,
|
||||
onPressed: _handleAppleSignIn,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_SocialButton(
|
||||
icon: Icons.code,
|
||||
label: 'Continue with GitHub',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'bootstrap/bootstrap.dart';
|
||||
import 'core/theme/app_theme.dart';
|
||||
@@ -8,6 +9,17 @@ import 'core/state/providers.dart';
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
),
|
||||
);
|
||||
|
||||
SystemChrome.setEnabledSystemUIMode(
|
||||
SystemUiMode.edgeToEdge,
|
||||
);
|
||||
|
||||
await bootstrap();
|
||||
|
||||
runApp(
|
||||
|
||||
Reference in New Issue
Block a user