From 7929cff16f9c1b3e8359f00d4d39bee3360262b1 Mon Sep 17 00:00:00 2001 From: cp-ishita-g Date: Fri, 19 Jul 2024 16:55:50 +0530 Subject: [PATCH] revert api key value --- app/ios/Podfile.lock | 6 --- app/ios/Runner/AppDelegate.swift | 2 + .../sign_in/sign_in_method_viewmodel.dart | 43 +++++-------------- app/lib/ui/flow/intro/intro_page_item.dart | 42 +++++++++--------- app/pubspec.lock | 24 ----------- app/pubspec.yaml | 1 - 6 files changed, 34 insertions(+), 84 deletions(-) diff --git a/app/ios/Podfile.lock b/app/ios/Podfile.lock index 57421a99..515af0da 100644 --- a/app/ios/Podfile.lock +++ b/app/ios/Podfile.lock @@ -1210,8 +1210,6 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - sign_in_with_apple (0.0.1): - - Flutter - sqflite (0.0.3): - Flutter - FlutterMacOS @@ -1240,7 +1238,6 @@ DEPENDENCIES: - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - - sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`) - sqflite (from `.symlinks/plugins/sqflite/darwin`) SPEC REPOS: @@ -1318,8 +1315,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/share_plus/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" - sign_in_with_apple: - :path: ".symlinks/plugins/sign_in_with_apple/ios" sqflite: :path: ".symlinks/plugins/sqflite/darwin" @@ -1372,7 +1367,6 @@ SPEC CHECKSUMS: RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21 share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 - sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654 diff --git a/app/ios/Runner/AppDelegate.swift b/app/ios/Runner/AppDelegate.swift index 70693e4a..004196ee 100644 --- a/app/ios/Runner/AppDelegate.swift +++ b/app/ios/Runner/AppDelegate.swift @@ -1,5 +1,6 @@ import UIKit import Flutter +import GoogleMaps @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { @@ -7,6 +8,7 @@ import Flutter _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { + GMSServices.provideAPIKey("") GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/app/lib/ui/flow/auth/sign_in/sign_in_method_viewmodel.dart b/app/lib/ui/flow/auth/sign_in/sign_in_method_viewmodel.dart index 8228d36c..6b3a4490 100644 --- a/app/lib/ui/flow/auth/sign_in/sign_in_method_viewmodel.dart +++ b/app/lib/ui/flow/auth/sign_in/sign_in_method_viewmodel.dart @@ -5,7 +5,6 @@ import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:google_sign_in/google_sign_in.dart'; -import 'package:sign_in_with_apple/sign_in_with_apple.dart'; part 'sign_in_method_viewmodel.freezed.dart'; @@ -85,17 +84,18 @@ class SignInMethodsScreenViewNotifier Future signInWithApple() async { try { state = state.copyWith(showAppleLoading: true, error: null); - final (userCredential, firstName, lastName) = - await _getUserCredentialFromApple(); - final String userIdToken = await userCredential.user?.getIdToken() ?? ''; + final appleProvider = AppleAuthProvider(); + appleProvider.addScope('email'); + final credential = await FirebaseAuth.instance.signInWithProvider(appleProvider); + final email = FirebaseAuth.instance.currentUser?.email; + final uid = FirebaseAuth.instance.currentUser?.uid ?? ''; final isNewUser = await authService.verifiedLogin( - uid: userCredential.user?.uid ?? '', - firebaseToken: userIdToken, - email: userCredential.user?.email, - firstName: firstName, - lastName: lastName, + uid: uid, + firebaseToken: await credential.user?.getIdToken(), + email: email, + firstName: credential.user?.displayName, authType: 3, ); state = state.copyWith( @@ -103,8 +103,7 @@ class SignInMethodsScreenViewNotifier socialSignInCompleted: true, isNewUser: isNewUser); } catch (error, stack) { - state = - state.copyWith(showAppleLoading: false, socialSignInCompleted: false); + state = state.copyWith(showAppleLoading: false, socialSignInCompleted: false); logger.e( 'SignInMethodScreenViewNotifier: error while sign in with apple', error: error, @@ -112,28 +111,6 @@ class SignInMethodsScreenViewNotifier ); } } - - Future<(UserCredential, String?, String?)> - _getUserCredentialFromApple() async { - try { - final credential = await SignInWithApple.getAppleIDCredential( - scopes: [ - AppleIDAuthorizationScopes.email, - AppleIDAuthorizationScopes.fullName, - ], - ); - final user = await firebaseAuth.signInWithCredential( - OAuthProvider('apple.com').credential( - idToken: credential.identityToken, - accessToken: credential.authorizationCode, - ), - ); - return (user, credential.givenName, credential.familyName); - } catch (error) { - logger.e('Error during Apple sign-in', error: error); - rethrow; - } - } } @freezed diff --git a/app/lib/ui/flow/intro/intro_page_item.dart b/app/lib/ui/flow/intro/intro_page_item.dart index 1b329289..0cc84d91 100644 --- a/app/lib/ui/flow/intro/intro_page_item.dart +++ b/app/lib/ui/flow/intro/intro_page_item.dart @@ -47,26 +47,28 @@ class IntroPageWidget extends StatelessWidget { Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const SizedBox(height: 40), - Text( - item.title, - style: AppTextStyle.header1 - .copyWith(color: context.colorScheme.textPrimary), - ), - const SizedBox(height: 24), - SvgPicture.asset(item.image), - const SizedBox(height: 16), - Text( - item.subtitle, - textAlign: TextAlign.center, - style: AppTextStyle.subtitle1 - .copyWith(color: context.colorScheme.textSecondary), - ), - ], + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const SizedBox(height: 24), + Text( + item.title, + style: AppTextStyle.header1 + .copyWith(color: context.colorScheme.textPrimary), + ), + const SizedBox(height: 24), + SvgPicture.asset(item.image, width: MediaQuery.of(context).size.width - 32, height: MediaQuery.of(context).size.width - 32), + const SizedBox(height: 16), + Text( + item.subtitle, + textAlign: TextAlign.center, + style: AppTextStyle.subtitle1 + .copyWith(color: context.colorScheme.textSecondary), + ), + ], + ), ), ); } diff --git a/app/pubspec.lock b/app/pubspec.lock index 55555b8d..0befb375 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -1476,30 +1476,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" - sign_in_with_apple: - dependency: "direct main" - description: - name: sign_in_with_apple - sha256: "5c34c601d6910d7db0077063001ccd9d9329ee58b9038ee07153ffcdd76e91bd" - url: "https://pub.dev" - source: hosted - version: "6.1.1" - sign_in_with_apple_platform_interface: - dependency: transitive - description: - name: sign_in_with_apple_platform_interface - sha256: c2ef2ce6273fce0c61acd7e9ff5be7181e33d7aa2b66508b39418b786cca2119 - url: "https://pub.dev" - source: hosted - version: "1.1.0" - sign_in_with_apple_web: - dependency: transitive - description: - name: sign_in_with_apple_web - sha256: c009e9beeb6c376e86aaa154fcc8b4e075d4bad90c56286b9668a51cdb6129ea - url: "https://pub.dev" - source: hosted - version: "2.1.0" sky_engine: dependency: transitive description: flutter diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 286e0c67..b078da28 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -72,7 +72,6 @@ dependencies: firebase_storage: ^11.7.7 cloud_firestore: ^4.15.5 google_sign_in: ^6.1.6 - sign_in_with_apple: ^6.1.0 logger: ^2.3.0 flutter_svg: ^2.0.9 # picker