From 271cefff0cb430be81cb0d61dcab20529242554f Mon Sep 17 00:00:00 2001 From: Emre Date: Mon, 31 Jul 2023 15:28:52 +0200 Subject: [PATCH] Fix pseudo --- .../justMUSIC/lib/components/profile_component.dart | 2 +- .../lib/components/profile_list_component.dart | 4 ++-- Sources/justMUSIC/lib/model/User.dart | 9 ++++++++- Sources/justMUSIC/lib/model/mapper/UserMapper.dart | 7 ++++--- Sources/justMUSIC/lib/screens/add_friend_screen.dart | 12 ++++++++++++ Sources/justMUSIC/lib/services/AuthService.dart | 2 +- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Sources/justMUSIC/lib/components/profile_component.dart b/Sources/justMUSIC/lib/components/profile_component.dart index 2495065..dcfa8c6 100644 --- a/Sources/justMUSIC/lib/components/profile_component.dart +++ b/Sources/justMUSIC/lib/components/profile_component.dart @@ -31,7 +31,7 @@ class ProfileComponent extends StatelessWidget { ), GestureDetector( onLongPress: () async { - await Clipboard.setData(ClipboardData(text: user.pseudo)); + await Clipboard.setData(ClipboardData(text: user.uniquePseudo)); }, child: AutoSizeText( "${user.pseudo}", diff --git a/Sources/justMUSIC/lib/components/profile_list_component.dart b/Sources/justMUSIC/lib/components/profile_list_component.dart index 6fb8549..981dd9b 100644 --- a/Sources/justMUSIC/lib/components/profile_list_component.dart +++ b/Sources/justMUSIC/lib/components/profile_list_component.dart @@ -39,7 +39,7 @@ class _ProfileListComponentState extends State { ScrollConfiguration( behavior: ScrollBehavior().copyWith(scrollbars: false), child: Text( - widget.user.pseudo, + widget.user.uniquePseudo, style: GoogleFonts.plusJakartaSans(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w700), overflow: TextOverflow.ellipsis, maxLines: 1, @@ -48,7 +48,7 @@ class _ProfileListComponentState extends State { ScrollConfiguration( behavior: ScrollBehavior().copyWith(scrollbars: false), child: Text( - widget.user.id, + widget.user.pseudo, overflow: TextOverflow.ellipsis, style: GoogleFonts.plusJakartaSans(color: Colors.grey, fontWeight: FontWeight.w400), )) diff --git a/Sources/justMUSIC/lib/model/User.dart b/Sources/justMUSIC/lib/model/User.dart index 0f0bb79..6ddd1da 100644 --- a/Sources/justMUSIC/lib/model/User.dart +++ b/Sources/justMUSIC/lib/model/User.dart @@ -1,6 +1,7 @@ class User { final String _id; String _pseudo; + String _uniquePseudo; String _country; String _mail; String _pp; @@ -10,7 +11,7 @@ class User { List friends = []; // Constructor - User(this._id, this._pseudo, this._country, this._mail, this._pp, + User(this._id, this._pseudo, this._uniquePseudo, this._country, this._mail, this._pp, this._followers, this._capsules, this._followed, this.friends); //Getters and setters @@ -22,6 +23,12 @@ class User { _pseudo = value; } + String get uniquePseudo => _uniquePseudo; + + set uniquePseudo(String value) { + _uniquePseudo = value; + } + String get country => _country; set country(String value) { diff --git a/Sources/justMUSIC/lib/model/mapper/UserMapper.dart b/Sources/justMUSIC/lib/model/mapper/UserMapper.dart index 036a838..eba3d57 100644 --- a/Sources/justMUSIC/lib/model/mapper/UserMapper.dart +++ b/Sources/justMUSIC/lib/model/mapper/UserMapper.dart @@ -7,10 +7,11 @@ class UserMapper { final data = snapshot.data(); return User( snapshot.id, - data?["unique_id"] ?? "", + data?["pseudo"], + data?["unique_id"], data?["country"] ?? "", - data?["mail"] ?? "", - data?["profilePicture"] ?? "", + data?["mail"], + data?["picture"], data?["followers"] ?? 0, data?["nbCapsules"] ?? 0, data?["followed"] ?? 0, diff --git a/Sources/justMUSIC/lib/screens/add_friend_screen.dart b/Sources/justMUSIC/lib/screens/add_friend_screen.dart index 99ed9c4..b4024df 100644 --- a/Sources/justMUSIC/lib/screens/add_friend_screen.dart +++ b/Sources/justMUSIC/lib/screens/add_friend_screen.dart @@ -21,6 +21,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2UYSIpWSnX4gJhZJzaN4q.jpg?alt=media&token=39baf86a-4d19-4534-b777-1a4feca67359", @@ -30,6 +31,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -39,6 +41,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -48,6 +51,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -57,6 +61,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -66,6 +71,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -75,6 +81,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -84,6 +91,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -93,6 +101,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -102,6 +111,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -111,6 +121,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", @@ -120,6 +131,7 @@ class _AddFriendScreenState extends State { User( "&", "_pseudo", + "_pseudo", "_country", "_mail", "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609", diff --git a/Sources/justMUSIC/lib/services/AuthService.dart b/Sources/justMUSIC/lib/services/AuthService.dart index d7e39fa..7b289cf 100644 --- a/Sources/justMUSIC/lib/services/AuthService.dart +++ b/Sources/justMUSIC/lib/services/AuthService.dart @@ -18,7 +18,7 @@ class AuthService { "phone_number": "", "unique_id": uniqueId, "picture": - "https://media.licdn.com/dms/image/D4E03AQHvc_b89ogFtQ/profile-displayphoto-shrink_400_400/0/1665060931103?e=1695859200&v=beta&t=wVLbxqeokYiPJ13nJ3SMq97iZvcm3ra0ufWFZCSzhjg", + "https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/defaultImage.png?alt=media&token=cff5ae0a-e29e-4845-91f7-817597962f6b", "friends": [] };