11import 'dart:async' ;
22
33import 'package:dio/dio.dart' ;
4+ import 'package:flutter/foundation.dart' ;
45import 'package:google_sign_in/google_sign_in.dart' ;
56import 'package:injectable/injectable.dart' ;
67import 'package:on_time_front/core/logging/app_logger.dart' ;
@@ -15,6 +16,8 @@ import 'package:rxdart/subjects.dart';
1516
1617@Singleton (as : UserRepository )
1718class UserRepositoryImpl implements UserRepository {
19+ static const _googleIosClientId =
20+ '456571312261-r35ah9qi0qaq7al007e2db0e0jmjcmb4.apps.googleusercontent.com' ;
1821 static const _googleServerClientId =
1922 '456571312261-5kuf2r6i5i7lqjr7qealv06sdgkn3hcp.apps.googleusercontent.com' ;
2023 static const _googleScopes = ['email' , 'profile' ];
@@ -45,17 +48,10 @@ class UserRepositoryImpl implements UserRepository {
4548 }
4649
4750 Future <void > _initializeGoogleSignIn () async {
48- await _googleSignIn.initialize (serverClientId: _googleServerClientId);
49- final lightweightAuthentication = _googleSignIn
50- .attemptLightweightAuthentication ();
51- if (lightweightAuthentication != null ) {
52- unawaited (
53- lightweightAuthentication.catchError ((Object error) {
54- AppLogger .debug ('Google lightweight sign-in failed: $error ' );
55- return null ;
56- }),
57- );
58- }
51+ await _googleSignIn.initialize (
52+ clientId: _googleClientId,
53+ serverClientId: _googleServerClientId,
54+ );
5955 }
6056
6157 @override
@@ -241,4 +237,11 @@ class UserRepositoryImpl implements UserRepository {
241237 @override
242238 Stream <UserEntity > get userStream =>
243239 _userStreamController.asBroadcastStream ();
240+
241+ String ? get _googleClientId {
242+ if (kIsWeb) return null ;
243+ return defaultTargetPlatform == TargetPlatform .iOS
244+ ? _googleIosClientId
245+ : null ;
246+ }
244247}
0 commit comments