Skip to content

Commit

Permalink
revert api key value
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-ishita-g committed Jul 19, 2024
1 parent 6ae239c commit 7929cff
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 84 deletions.
6 changes: 0 additions & 6 deletions app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GMSServices.provideAPIKey("")
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
Expand Down
43 changes: 10 additions & 33 deletions app/lib/ui/flow/auth/sign_in/sign_in_method_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -85,55 +84,33 @@ class SignInMethodsScreenViewNotifier
Future<void> 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(
showAppleLoading: false,
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,
stackTrace: stack,
);
}
}

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
Expand Down
42 changes: 22 additions & 20 deletions app/lib/ui/flow/intro/intro_page_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
],
),
),
);
}
Expand Down
24 changes: 0 additions & 24 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7929cff

Please sign in to comment.