Skip to content

Commit

Permalink
feat(google-play-games-services): add getPlayerScore function (#2949)
Browse files Browse the repository at this point in the history
  • Loading branch information
arzanbhorr authored and danielsogl committed Apr 7, 2019
1 parent 39be275 commit 767d3b3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/@ionic-native/plugins/google-play-games-services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ export interface ScoreData {

}

export interface PlayerScoreData {
/**
* The player score.
*/
playerScore: number;
}

export interface LeaderboardData {

/**
Expand Down Expand Up @@ -126,6 +133,13 @@ export interface Player {
* leaderboardId: 'SomeLeaderboardId'
* });
*
* // Get the player score on a leaderboard.
* this.googlePlayGamesServices.getPlayerScore({
* leaderboardId: 'SomeLeaderBoardId'
* }).then((data: PlayerScoreData) => {
* console.log('Player score', data);
* });
*
* // Show the native leaderboards window.
* this.googlePlayGamesServices.showAllLeaderboards()
* .then(() => console.log('The leaderboard window is visible.'));
Expand Down Expand Up @@ -220,6 +234,19 @@ export class GooglePlayGamesServices extends IonicNativePlugin {
return;
}

/**
* Get the player score on a leaderboard. You should ensure that you have a
* successful return from auth() before requesting a score.
*
* @param data {LeaderboardData} The leaderboard score you want to request.
* @return {Promise<PlayerScoreData>} Returns a promise that resolves when Play
* Games Services returns the player score.
*/
@Cordova()
getPlayerScore(data: LeaderboardData): Promise<PlayerScoreData> {
return;
}

/**
* Launches the native Play Games leaderboard view controller to show all the
* leaderboards.
Expand Down

0 comments on commit 767d3b3

Please sign in to comment.