From 767d3b3dd40726fac66b676370a7a8eb54c55e63 Mon Sep 17 00:00:00 2001 From: Arzan Bhorr <46591393+arzanbhorr@users.noreply.github.com> Date: Sun, 7 Apr 2019 19:13:04 +0200 Subject: [PATCH] feat(google-play-games-services): add getPlayerScore function (#2949) --- .../google-play-games-services/index.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/@ionic-native/plugins/google-play-games-services/index.ts b/src/@ionic-native/plugins/google-play-games-services/index.ts index 6306ad20d1..a07951fa32 100644 --- a/src/@ionic-native/plugins/google-play-games-services/index.ts +++ b/src/@ionic-native/plugins/google-play-games-services/index.ts @@ -15,6 +15,13 @@ export interface ScoreData { } +export interface PlayerScoreData { + /** + * The player score. + */ + playerScore: number; +} + export interface LeaderboardData { /** @@ -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.')); @@ -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} Returns a promise that resolves when Play + * Games Services returns the player score. + */ + @Cordova() + getPlayerScore(data: LeaderboardData): Promise { + return; + } + /** * Launches the native Play Games leaderboard view controller to show all the * leaderboards.