Package com.example.qrgo.firebase
Class PlayerProfileFirebaseManager
- java.lang.Object
-
- com.example.qrgo.firebase.BaseFirebaseConnectManager
-
- com.example.qrgo.firebase.PlayerProfileFirebaseManager
-
public class PlayerProfileFirebaseManager extends BaseFirebaseConnectManager
-
-
Field Summary
-
Fields inherited from class com.example.qrgo.firebase.BaseFirebaseConnectManager
db
-
-
Constructor Summary
Constructors Constructor Description PlayerProfileFirebaseManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNewPlayerProfile(java.lang.String username, java.lang.String firstName, java.lang.String lastName, java.lang.String contactPhone, java.lang.String contactEmail, int totalScore, int totalScans, int highestScore, int lowestScore, OnUserProfileAddListener listener)Adds a new player profile to the database.voiddeletePlayerProfile(java.lang.String username, OnUserProfileDeleteListener listener)Deletes a player profile from the database.voidgetBasicPlayerProfile(java.lang.String username, OnBasicPlayerProfileLoadedListener listener)Get BasicPlayerProfile object for given username.voidgetGlobalRankForHighScore(java.lang.String userName, OnGlobalRankLoadedListener listener)A function that retrieves the maximum highest score of qrcode globally among all users, user rank and calling users highest score of qrcode.voidgetGlobalRankForTotalScore(java.lang.String userName, OnGlobalRankLoadedListener listener)A function that retrieves the maximum total score globally, user rank and calling users total score.voidgetPlayerProfile(java.lang.String username, OnPlayerProfileGetListener listener)Retrieves the player profile for the specified username from the Firestore database and constructs aPlayerProfileobject containing the profile data along with associated QR codes and comments.voidgetPlayersSortedByHighestScore(OnPlayerListLoadedListener listener)A function that retrieves a list of players sorted by their highest score.voidgetPlayersSortedByLowestScore(OnPlayerListLoadedListener listener)A function that retrieves a list of players sorted by their lowest score.voidgetPlayersSortedByTotalScans(OnPlayerListLoadedListener listener)A function that retrieves a list of players sorted by their total score.voidgetPlayersSortedByTotalScore(OnPlayerListLoadedListener listener)A function that retrieves a list of players sorted by their total score.
-
-
-
Method Detail
-
addNewPlayerProfile
public void addNewPlayerProfile(java.lang.String username, java.lang.String firstName, java.lang.String lastName, java.lang.String contactPhone, java.lang.String contactEmail, int totalScore, int totalScans, int highestScore, int lowestScore, OnUserProfileAddListener listener)Adds a new player profile to the database.- Parameters:
username- The username of the player.contactPhone- The phone number of the player's emergency contact.contactEmail- The email address of the player's emergency contact.totalScore- The total score of the player. Pass in 0 initially.totalScans- The total scans of the player. Pass in 0 initially.highestScore- The highest score of the player. Pass in 0 initially.lowestScore- The lowest score of the player. Pass in 0 initially.listener- The listener to handle the result of the operation.
-
deletePlayerProfile
public void deletePlayerProfile(java.lang.String username, OnUserProfileDeleteListener listener)Deletes a player profile from the database.- Parameters:
username- The username of the player whose profile is to be deleted.listener- The listener to handle the result of the operation.
-
getPlayerProfile
public void getPlayerProfile(java.lang.String username, OnPlayerProfileGetListener listener)Retrieves the player profile for the specified username from the Firestore database and constructs aPlayerProfileobject containing the profile data along with associated QR codes and comments. Calls theOnPlayerProfileGetListener.onPlayerProfileGet(PlayerProfile)callback method with the resulting player profile object. If the username is not found in the database, calls theOnPlayerProfileGetListener.onPlayerProfileGet(PlayerProfile)callback method with a null parameter.- Parameters:
username- the username of the player whose profile is to be retrievedlistener- the callback listener to receive the player profile object or null if not found
-
getBasicPlayerProfile
public void getBasicPlayerProfile(java.lang.String username, OnBasicPlayerProfileLoadedListener listener)Get BasicPlayerProfile object for given username.- Parameters:
username- The username of the player.listener- The listener to be called when the BasicPlayerProfile is loaded or load fails.
-
getPlayersSortedByHighestScore
public void getPlayersSortedByHighestScore(OnPlayerListLoadedListener listener)
A function that retrieves a list of players sorted by their highest score.- Parameters:
listener- The listener to be notified of the result of the function.
-
getPlayersSortedByLowestScore
public void getPlayersSortedByLowestScore(OnPlayerListLoadedListener listener)
A function that retrieves a list of players sorted by their lowest score.- Parameters:
listener- The listener to be notified of the result of the function.
-
getPlayersSortedByTotalScore
public void getPlayersSortedByTotalScore(OnPlayerListLoadedListener listener)
A function that retrieves a list of players sorted by their total score.- Parameters:
listener- The listener to be notified of the result of the function.
-
getPlayersSortedByTotalScans
public void getPlayersSortedByTotalScans(OnPlayerListLoadedListener listener)
A function that retrieves a list of players sorted by their total score.- Parameters:
listener- The listener to be notified of the result of the function.
-
getGlobalRankForTotalScore
public void getGlobalRankForTotalScore(java.lang.String userName, OnGlobalRankLoadedListener listener)A function that retrieves the maximum total score globally, user rank and calling users total score.- Parameters:
listener- The listener to be notified of the result of the function.
-
getGlobalRankForHighScore
public void getGlobalRankForHighScore(java.lang.String userName, OnGlobalRankLoadedListener listener)A function that retrieves the maximum highest score of qrcode globally among all users, user rank and calling users highest score of qrcode.- Parameters:
listener- The listener to be notified of the result of the function.
-
-