Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Limzen committed May 4, 2024
2 parents aedc3db + b60e499 commit 873f209
Show file tree
Hide file tree
Showing 11 changed files with 274 additions and 22 deletions.
75 changes: 75 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,72 +1,147 @@
PODS:
- AppAuth (1.7.5):
- AppAuth/Core (= 1.7.5)
- AppAuth/ExternalUserAgent (= 1.7.5)
- AppAuth/Core (1.7.5)
- AppAuth/ExternalUserAgent (1.7.5):
- AppAuth/Core
- audioplayers_darwin (0.0.1):
- Flutter
- Firebase/Auth (10.24.0):
- Firebase/CoreOnly
- FirebaseAuth (~> 10.24.0)
- Firebase/CoreOnly (10.24.0):
- FirebaseCore (= 10.24.0)
- firebase_auth (4.19.4):
- Firebase/Auth (= 10.24.0)
- firebase_core
- Flutter
- firebase_core (2.30.1):
- Firebase/CoreOnly (= 10.24.0)
- Flutter
- FirebaseAppCheckInterop (10.25.0)
- FirebaseAuth (10.24.0):
- FirebaseAppCheckInterop (~> 10.17)
- FirebaseCore (~> 10.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/Environment (~> 7.8)
- GTMSessionFetcher/Core (< 4.0, >= 2.1)
- RecaptchaInterop (~> 100.0)
- FirebaseCore (10.24.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12)
- FirebaseCoreInternal (10.25.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- Flutter (1.0.0)
- google_sign_in_ios (0.0.1):
- AppAuth (>= 1.7.4)
- Flutter
- FlutterMacOS
- GoogleSignIn (~> 7.1)
- GTMSessionFetcher (>= 3.4.0)
- GoogleSignIn (7.1.0):
- AppAuth (< 2.0, >= 1.7.3)
- GTMAppAuth (< 5.0, >= 4.1.1)
- GTMSessionFetcher/Core (~> 3.3)
- GoogleUtilities/AppDelegateSwizzler (7.13.2):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Privacy
- GoogleUtilities/Environment (7.13.2):
- GoogleUtilities/Privacy
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.13.2):
- GoogleUtilities/Environment
- GoogleUtilities/Privacy
- GoogleUtilities/Network (7.13.2):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Privacy
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.13.2)":
- GoogleUtilities/Privacy
- GoogleUtilities/Privacy (7.13.2)
- GoogleUtilities/Reachability (7.13.2):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GTMAppAuth (4.1.1):
- AppAuth/Core (~> 1.7)
- GTMSessionFetcher/Core (< 4.0, >= 3.3)
- GTMSessionFetcher (3.4.1):
- GTMSessionFetcher/Full (= 3.4.1)
- GTMSessionFetcher/Core (3.4.1)
- GTMSessionFetcher/Full (3.4.1):
- GTMSessionFetcher/Core
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- PromisesObjC (2.4.0)
- RecaptchaInterop (100.0.0)
- sqflite (0.0.3):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`)
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- Flutter (from `Flutter`)
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)

SPEC REPOS:
trunk:
- AppAuth
- Firebase
- FirebaseAppCheckInterop
- FirebaseAuth
- FirebaseCore
- FirebaseCoreInternal
- GoogleSignIn
- GoogleUtilities
- GTMAppAuth
- GTMSessionFetcher
- PromisesObjC
- RecaptchaInterop

EXTERNAL SOURCES:
audioplayers_darwin:
:path: ".symlinks/plugins/audioplayers_darwin/ios"
firebase_auth:
:path: ".symlinks/plugins/firebase_auth/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
Flutter:
:path: Flutter
google_sign_in_ios:
:path: ".symlinks/plugins/google_sign_in_ios/darwin"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"

SPEC CHECKSUMS:
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
Firebase: 91fefd38712feb9186ea8996af6cbdef41473442
firebase_auth: b782567cafd5cfd64debf54638a9f29b63abd7bf
firebase_core: 7f1e1156934d0da3be260174812842df9420e4ab
FirebaseAppCheckInterop: 5da5ce93e8797a215e3f677fb0654b74e736c8b8
FirebaseAuth: 711d01cccefaf10035b3090a92956d0dd4f99088
FirebaseCore: 11dc8a16dfb7c5e3c3f45ba0e191a33ac4f50894
FirebaseCoreInternal: 910a81992c33715fec9263ca7381d59ab3a750b7
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38
GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db
GoogleUtilities: c56430aef51a1aa57b25da78c3f8397e522c67b7
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
GTMSessionFetcher: 8000756fc1c19d2e5697b90311f7832d2e33f6cd
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec

PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
Expand Down
18 changes: 18 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
AD391FFF678BDCD13589FD5A /* [CP] Embed Pods Frameworks */,
3B92086DEF000E17E9046345 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -290,6 +291,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
3B92086DEF000E17E9046345 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
8A4C96B6F750C210D430AEBA /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
4 changes: 4 additions & 0 deletions ios/Runner/GoogleService-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>716247414791-di6i0kdd77u99bdl43sbdmc0h9pa9923.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.716247414791-di6i0kdd77u99bdl43sbdmc0h9pa9923</string>
<key>API_KEY</key>
<string>AIzaSyClhib10AmhoVtldDkGZHOZG66fVGh_ODQ</string>
<key>GCM_SENDER_ID</key>
Expand Down
3 changes: 3 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>FlutterDeepLinkingEnabled</key>
<true/>
<key>GIDClientID</key>
<string>716247414791-di6i0kdd77u99bdl43sbdmc0h9pa9923.apps.googleusercontent.com</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -13,6 +15,7 @@
<string>192.168.100.243</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.716247414791-di6i0kdd77u99bdl43sbdmc0h9pa9923</string>
<string>appscheme</string>
</array>
</dict>
Expand Down
8 changes: 8 additions & 0 deletions lib/config/route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:spotify_clone/screens/category_detail/category_detail.dart';
import 'package:spotify_clone/screens/common/splash_screen.dart';
import 'package:spotify_clone/screens/login/login_screen.dart';
import 'package:spotify_clone/screens/lyric/full_lyric_screen.dart';
import 'package:spotify_clone/screens/home/home_screen.dart';
import 'package:spotify_clone/screens/common/main_screen.dart';
Expand Down Expand Up @@ -130,6 +131,13 @@ class AppRouter {
);
},
),
GoRoute(
path: LoginScreen.routeName,
pageBuilder: (context, state) {
return const MaterialPage(
child: LoginScreen(),
);
}),
],
);

Expand Down
1 change: 0 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (context) => MusicPlayerProvider()),
ChangeNotifierProvider(create: (context) => CategoryProvider()),
ChangeNotifierProvider(create: (context) => PlaylistProvider()),
Provider(create: (context) => SpotifyService()),
],
child: MaterialApp.router(
routerDelegate: AppRouter.router.routerDelegate,
Expand Down
29 changes: 29 additions & 0 deletions lib/screens/login/login_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:spotify_clone/screens/home/home_screen.dart';
import 'package:spotify_clone/services/auth_service.dart';

class LoginScreen extends StatefulWidget {
static const routeName = '/login';
const LoginScreen({super.key});

@override
State<LoginScreen> createState() => _LoginScreenState();
}

class _LoginScreenState extends State<LoginScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () async {
final user = await AuthService.logInWithGoogle();
if (user.user != null) {
context.go(MyHomePage.routeName);
}
},
child: Text('Login with google')),
));
}
}
35 changes: 23 additions & 12 deletions lib/screens/search/widget/search_appbar.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:spotify_clone/screens/login/login_screen.dart';

AppBar searchAppBar(BuildContext context) {
final user = FirebaseAuth.instance.currentUser;

return AppBar(
automaticallyImplyLeading: false,
title: const Text(
'Search',
style: TextStyle(
fontWeight: FontWeight.bold,
automaticallyImplyLeading: false,
title: const Text(
'Search',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
centerTitle: false,
leading: const IconButton(
icon: Icon(Icons.person),
onPressed: null,
),
);
centerTitle: false,
leading: CircleAvatar(
radius: 10,
child: user?.photoURL != null
? ClipOval(
child: Image.network(
user!.photoURL!,
fit: BoxFit.cover,
),
)
: const Icon(Icons.person),
));
}
30 changes: 30 additions & 0 deletions lib/services/auth_service.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:firebase_auth/firebase_auth.dart';
import 'package:google_sign_in/google_sign_in.dart';

const List<String> scopes = <String>[
'email',
'https://www.googleapis.com/auth/contacts.readonly',
];

class AuthService {
static Future<UserCredential> logInWithGoogle() async {
final GoogleSignIn googleSignIn = GoogleSignIn(
scopes: scopes,
);
// Trigger the authentication flow
final GoogleSignInAccount? googleUser = await googleSignIn.signIn();

// Obtain the auth details from the request
final GoogleSignInAuthentication? googleAuth =
await googleUser?.authentication;

// Create a new credential
final credential = GoogleAuthProvider.credential(
accessToken: googleAuth?.accessToken,
idToken: googleAuth?.idToken,
);

// Once signed in, return the UserCredential
return await FirebaseAuth.instance.signInWithCredential(credential);
}
}
Loading

0 comments on commit 873f209

Please sign in to comment.