diff --git a/Sources/justMUSIC/android/app/google-services.json b/Sources/justMUSIC/android/app/google-services.json
new file mode 100644
index 0000000..9fb09e0
--- /dev/null
+++ b/Sources/justMUSIC/android/app/google-services.json
@@ -0,0 +1,46 @@
+{
+ "project_info": {
+ "project_number": "994903990520",
+ "project_id": "justmusic-435d5",
+ "storage_bucket": "justmusic-435d5.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:994903990520:android:02a445b6561bf2820a9b0d",
+ "android_client_info": {
+ "package_name": "com.example.justmusic"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "994903990520-rdk6ldrmbi71ddqt84qfhtuficm7ngon.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyCjkofl0nvfzQqRZPv_-H99WoyYa7O660g"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "994903990520-9jsnq9ipdn7smk7tlbdd20i7j6sl3jcd.apps.googleusercontent.com",
+ "client_type": 3
+ },
+ {
+ "client_id": "994903990520-n6jd98ena56kb1tvtrd67tvb5et3nfbf.apps.googleusercontent.com",
+ "client_type": 2,
+ "ios_info": {
+ "bundle_id": "com.example.justmusic"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/Sources/justMUSIC/ios/Runner/GoogleService-Info.plist b/Sources/justMUSIC/ios/Runner/GoogleService-Info.plist
new file mode 100644
index 0000000..cdb37d7
--- /dev/null
+++ b/Sources/justMUSIC/ios/Runner/GoogleService-Info.plist
@@ -0,0 +1,34 @@
+
+
+
+
+ CLIENT_ID
+ 994903990520-n6jd98ena56kb1tvtrd67tvb5et3nfbf.apps.googleusercontent.com
+ REVERSED_CLIENT_ID
+ com.googleusercontent.apps.994903990520-n6jd98ena56kb1tvtrd67tvb5et3nfbf
+ API_KEY
+ AIzaSyBbYqsR6t7JTi8_XFNEHd43IRuKlYGeI3U
+ GCM_SENDER_ID
+ 994903990520
+ PLIST_VERSION
+ 1
+ BUNDLE_ID
+ com.example.justmusic
+ PROJECT_ID
+ justmusic-435d5
+ STORAGE_BUCKET
+ justmusic-435d5.appspot.com
+ IS_ADS_ENABLED
+
+ IS_ANALYTICS_ENABLED
+
+ IS_APPINVITE_ENABLED
+
+ IS_GCM_ENABLED
+
+ IS_SIGNIN_ENABLED
+
+ GOOGLE_APP_ID
+ 1:994903990520:ios:93188f32e320babe0a9b0d
+
+
\ No newline at end of file
diff --git a/Sources/justMUSIC/ios/firebase_app_id_file.json b/Sources/justMUSIC/ios/firebase_app_id_file.json
new file mode 100644
index 0000000..ef1bedc
--- /dev/null
+++ b/Sources/justMUSIC/ios/firebase_app_id_file.json
@@ -0,0 +1,7 @@
+{
+ "file_generated_by": "FlutterFire CLI",
+ "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
+ "GOOGLE_APP_ID": "1:994903990520:ios:93188f32e320babe0a9b0d",
+ "FIREBASE_PROJECT_ID": "justmusic-435d5",
+ "GCM_SENDER_ID": "994903990520"
+}
\ No newline at end of file
diff --git a/Sources/justMUSIC/lib/components/login_button.dart b/Sources/justMUSIC/lib/components/login_button.dart
index 3e41e8e..1d794dd 100644
--- a/Sources/justMUSIC/lib/components/login_button.dart
+++ b/Sources/justMUSIC/lib/components/login_button.dart
@@ -3,7 +3,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class LoginButton extends StatefulWidget {
- const LoginButton({Key? key}) : super(key: key);
+ final Function callback;
+
+ const LoginButton({Key? key, required this.callback}) : super(key: key);
@override
State createState() => _LoginButtonState();
@@ -14,7 +16,7 @@ class _LoginButtonState extends State {
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {
- Navigator.pushNamed(context, '/explanation');
+ widget.callback();
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Color(0xFF1C1C1C)),
diff --git a/Sources/justMUSIC/lib/firebase_options.dart b/Sources/justMUSIC/lib/firebase_options.dart
new file mode 100644
index 0000000..bfc6ec0
--- /dev/null
+++ b/Sources/justMUSIC/lib/firebase_options.dart
@@ -0,0 +1,76 @@
+// File generated by FlutterFire CLI.
+// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
+import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
+import 'package:flutter/foundation.dart'
+ show defaultTargetPlatform, kIsWeb, TargetPlatform;
+
+/// Default [FirebaseOptions] for use with your Firebase apps.
+///
+/// Example:
+/// ```dart
+/// import 'firebase_options.dart';
+/// // ...
+/// await Firebase.initializeApp(
+/// options: DefaultFirebaseOptions.currentPlatform,
+/// );
+/// ```
+class DefaultFirebaseOptions {
+ static FirebaseOptions get currentPlatform {
+ if (kIsWeb) {
+ return web;
+ }
+ switch (defaultTargetPlatform) {
+ case TargetPlatform.android:
+ return android;
+ case TargetPlatform.iOS:
+ return ios;
+ case TargetPlatform.macOS:
+ throw UnsupportedError(
+ 'DefaultFirebaseOptions have not been configured for macos - '
+ 'you can reconfigure this by running the FlutterFire CLI again.',
+ );
+ case TargetPlatform.windows:
+ throw UnsupportedError(
+ 'DefaultFirebaseOptions have not been configured for windows - '
+ 'you can reconfigure this by running the FlutterFire CLI again.',
+ );
+ case TargetPlatform.linux:
+ throw UnsupportedError(
+ 'DefaultFirebaseOptions have not been configured for linux - '
+ 'you can reconfigure this by running the FlutterFire CLI again.',
+ );
+ default:
+ throw UnsupportedError(
+ 'DefaultFirebaseOptions are not supported for this platform.',
+ );
+ }
+ }
+
+ static const FirebaseOptions web = FirebaseOptions(
+ apiKey: 'AIzaSyBv-Sba07nFFhctn6c3ARyvi9RfYwEKoNA',
+ appId: '1:994903990520:web:724c75003432ddbc0a9b0d',
+ messagingSenderId: '994903990520',
+ projectId: 'justmusic-435d5',
+ authDomain: 'justmusic-435d5.firebaseapp.com',
+ storageBucket: 'justmusic-435d5.appspot.com',
+ measurementId: 'G-D4YRLXK9TQ',
+ );
+
+ static const FirebaseOptions android = FirebaseOptions(
+ apiKey: 'AIzaSyCjkofl0nvfzQqRZPv_-H99WoyYa7O660g',
+ appId: '1:994903990520:android:02a445b6561bf2820a9b0d',
+ messagingSenderId: '994903990520',
+ projectId: 'justmusic-435d5',
+ storageBucket: 'justmusic-435d5.appspot.com',
+ );
+
+ static const FirebaseOptions ios = FirebaseOptions(
+ apiKey: 'AIzaSyBbYqsR6t7JTi8_XFNEHd43IRuKlYGeI3U',
+ appId: '1:994903990520:ios:93188f32e320babe0a9b0d',
+ messagingSenderId: '994903990520',
+ projectId: 'justmusic-435d5',
+ storageBucket: 'justmusic-435d5.appspot.com',
+ iosClientId: '994903990520-n6jd98ena56kb1tvtrd67tvb5et3nfbf.apps.googleusercontent.com',
+ iosBundleId: 'com.example.justmusic',
+ );
+}
diff --git a/Sources/justMUSIC/lib/main.dart b/Sources/justMUSIC/lib/main.dart
index 1203f32..283502a 100644
--- a/Sources/justMUSIC/lib/main.dart
+++ b/Sources/justMUSIC/lib/main.dart
@@ -1,3 +1,4 @@
+import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -10,12 +11,20 @@ import 'package:justmusic/screens/registration_screen.dart';
import 'package:justmusic/screens/welcome_screen.dart';
import 'package:justmusic/view_model/MusicViewModel.dart';
import 'package:justmusic/view_model/UserViewModel.dart';
+import 'package:firebase_core/firebase_core.dart';
+import 'firebase_options.dart';
-void main() {
+Future main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+ await Firebase.initializeApp(
+ options: DefaultFirebaseOptions.currentPlatform,
+ );
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
+ // ugly as fuck
+ static FirebaseFirestore db = FirebaseFirestore.instance;
static UserViewModel userViewModel = UserViewModel();
static MusicViewModel musicViewModel = MusicViewModel();
@@ -51,7 +60,7 @@ class MyApp extends StatelessWidget {
// is not restarted.
primarySwatch: Colors.blue,
),
- home: WellcomeScreen());
+ home: LoginScreen());
},
designSize: Size(390, 844),
);
diff --git a/Sources/justMUSIC/lib/model/User.dart b/Sources/justMUSIC/lib/model/User.dart
index f601867..f53996b 100644
--- a/Sources/justMUSIC/lib/model/User.dart
+++ b/Sources/justMUSIC/lib/model/User.dart
@@ -1,5 +1,5 @@
class User {
- final int _id;
+ final String _id;
String _pseudo;
String _country;
String _mail;
@@ -14,7 +14,7 @@ class User {
this._followers, this._capsules, this._followed, this.friends);
//Getters and setters
- int get id => _id;
+ String get id => _id;
String get pseudo => _pseudo;
diff --git a/Sources/justMUSIC/lib/model/mapper/UserMapper.dart b/Sources/justMUSIC/lib/model/mapper/UserMapper.dart
new file mode 100644
index 0000000..25a8900
--- /dev/null
+++ b/Sources/justMUSIC/lib/model/mapper/UserMapper.dart
@@ -0,0 +1,36 @@
+import 'package:cloud_firestore/cloud_firestore.dart';
+import 'package:justmusic/model/User.dart';
+import 'package:firebase_auth/firebase_auth.dart' as firebase_auth;
+import '../../main.dart';
+
+class UserMapper {
+ static User? toModel(DocumentSnapshot