@byvik/capacitor-play-games 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,279 @@
1
+ export type LeaderboardTimeSpan = 'daily' | 'weekly' | 'allTime';
2
+ export type LeaderboardCollection = 'public' | 'friends';
3
+ export interface AuthResult {
4
+ /**
5
+ * Whether a player is signed in to Play Games Services.
6
+ *
7
+ * @since 0.1.0
8
+ */
9
+ isAuthenticated: boolean;
10
+ /**
11
+ * Google API status code. Only present when the SDK reported an error.
12
+ *
13
+ * `10` (DEVELOPER_ERROR) means the app is misconfigured: the SHA-1 of this
14
+ * build or its package name is missing from the OAuth credentials in the
15
+ * Play Console. `16` and `12501` mean the player cancelled.
16
+ *
17
+ * @since 0.1.0
18
+ */
19
+ errorCode?: number;
20
+ /**
21
+ * Error message from the SDK. Only present when the SDK reported an error.
22
+ *
23
+ * @since 0.1.0
24
+ */
25
+ errorMessage?: string;
26
+ }
27
+ export interface Player {
28
+ /**
29
+ * @since 0.1.0
30
+ */
31
+ playerId: string;
32
+ /**
33
+ * The name the player shows in Play Games.
34
+ *
35
+ * @since 0.1.0
36
+ */
37
+ displayName: string;
38
+ /**
39
+ * The player's Play Games title, if they have one.
40
+ *
41
+ * @since 0.1.0
42
+ */
43
+ title?: string;
44
+ }
45
+ export interface SubmitScoreOptions {
46
+ /**
47
+ * @since 0.1.0
48
+ */
49
+ leaderboardId: string;
50
+ /**
51
+ * Raw score, an integer. For time leaderboards it is in milliseconds and for
52
+ * currency leaderboards in 1/1,000,000ths of the main unit.
53
+ *
54
+ * @since 0.1.0
55
+ */
56
+ score: number;
57
+ /**
58
+ * Wait for the server to confirm the score.
59
+ *
60
+ * With `false` the SDK queues the score, even offline, and the call resolves
61
+ * straight away. With `true` the call resolves once the server has the score
62
+ * and rejects when it cannot be reached; use it when you read the standing
63
+ * right after submitting.
64
+ *
65
+ * @default false
66
+ * @since 0.1.0
67
+ */
68
+ immediate?: boolean;
69
+ }
70
+ export interface LeaderboardOptions {
71
+ /**
72
+ * @since 0.1.0
73
+ */
74
+ leaderboardId: string;
75
+ /**
76
+ * @default 'allTime'
77
+ * @since 0.1.0
78
+ */
79
+ timeSpan?: LeaderboardTimeSpan;
80
+ /**
81
+ * `'friends'` needs the player's permission to read their friends list.
82
+ * Until they have granted it, `getLeaderboardStanding` rejects with code
83
+ * `'26703'` (CONSENT_REQUIRED).
84
+ *
85
+ * @default 'public'
86
+ * @since 0.1.0
87
+ */
88
+ collection?: LeaderboardCollection;
89
+ }
90
+ export interface LeaderboardStandingOptions extends LeaderboardOptions {
91
+ /**
92
+ * Skip the local cache and ask the server. The cached number of scores can
93
+ * be stale, but Google rate-limits forced reloads: keep it for moments when
94
+ * fresh data matters.
95
+ *
96
+ * @default false
97
+ * @since 0.1.0
98
+ */
99
+ forceReload?: boolean;
100
+ }
101
+ export interface LeaderboardStanding {
102
+ /**
103
+ * The player's rank, or `null` when unknown (for example, no score in this
104
+ * time span).
105
+ *
106
+ * @since 0.1.0
107
+ */
108
+ rank: number | null;
109
+ /**
110
+ * The player's raw score, or `null` when unknown.
111
+ *
112
+ * @since 0.1.0
113
+ */
114
+ score: number | null;
115
+ /**
116
+ * How many scores the leaderboard has in this time span and collection, or
117
+ * `null` when unknown.
118
+ *
119
+ * @since 0.1.0
120
+ */
121
+ numScores: number | null;
122
+ }
123
+ export interface AchievementOptions {
124
+ /**
125
+ * @since 0.1.0
126
+ */
127
+ achievementId: string;
128
+ }
129
+ export interface AchievementStepsOptions {
130
+ /**
131
+ * @since 0.1.0
132
+ */
133
+ achievementId: string;
134
+ /**
135
+ * @since 0.1.0
136
+ */
137
+ steps: number;
138
+ }
139
+ export interface SaveGameOptions {
140
+ /**
141
+ * Unique name of the saved game: 1 to 100 characters from `a-z`, `A-Z`,
142
+ * `0-9`, `-`, `.`, `_` and `~`.
143
+ *
144
+ * @since 0.1.0
145
+ */
146
+ name: string;
147
+ /**
148
+ * The contents, stored as UTF-8. Play allows up to 3 MB per saved game.
149
+ *
150
+ * @since 0.1.0
151
+ */
152
+ data: string;
153
+ /**
154
+ * Description shown in the Play Games saved games UI.
155
+ *
156
+ * @since 0.1.0
157
+ */
158
+ description?: string;
159
+ }
160
+ export interface LoadGameOptions {
161
+ /**
162
+ * @since 0.1.0
163
+ */
164
+ name: string;
165
+ }
166
+ export interface LoadGameResult {
167
+ /**
168
+ * The saved contents, or `null` when no saved game with that name exists.
169
+ *
170
+ * @since 0.1.0
171
+ */
172
+ data: string | null;
173
+ }
174
+ export interface PlayGamesPlugin {
175
+ /**
176
+ * Whether a player is signed in. Shows no UI and never rejects.
177
+ *
178
+ * The SDK tries a silent sign-in when the app starts, so this is the call
179
+ * to make before drawing anything that depends on the session.
180
+ *
181
+ * @since 0.1.0
182
+ */
183
+ isAuthenticated(): Promise<AuthResult>;
184
+ /**
185
+ * Ask the player to sign in. This is the only call that shows Google's
186
+ * sign-in UI, so make it from a button the player pressed. Never rejects:
187
+ * a cancelled or failed sign-in resolves with `isAuthenticated: false`.
188
+ *
189
+ * @since 0.1.0
190
+ */
191
+ signIn(): Promise<AuthResult>;
192
+ /**
193
+ * The signed-in player. Rejects when nobody is signed in.
194
+ *
195
+ * @since 0.1.0
196
+ */
197
+ getCurrentPlayer(): Promise<Player>;
198
+ /**
199
+ * Open the Play Games app, or its store listing when it is not installed.
200
+ *
201
+ * Useful when `signIn()` cannot succeed because the device has no Google
202
+ * account or the player has no Play Games profile: both are created there.
203
+ *
204
+ * @since 0.1.0
205
+ */
206
+ openPlayGamesApp(): Promise<void>;
207
+ /**
208
+ * Submit a score to a leaderboard.
209
+ *
210
+ * @since 0.1.0
211
+ */
212
+ submitScore(options: SubmitScoreOptions): Promise<void>;
213
+ /**
214
+ * The player's rank and score, and the number of scores in the
215
+ * leaderboard, read together for one time span and collection.
216
+ *
217
+ * @since 0.1.0
218
+ */
219
+ getLeaderboardStanding(options: LeaderboardStandingOptions): Promise<LeaderboardStanding>;
220
+ /**
221
+ * Open Google's UI for one leaderboard. Resolves when the UI opens.
222
+ *
223
+ * @since 0.1.0
224
+ */
225
+ showLeaderboard(options: LeaderboardOptions): Promise<void>;
226
+ /**
227
+ * Open Google's UI listing every leaderboard of the game.
228
+ *
229
+ * @since 0.1.0
230
+ */
231
+ showAllLeaderboards(): Promise<void>;
232
+ /**
233
+ * Unlock an achievement. Queued by the SDK when offline.
234
+ *
235
+ * @since 0.1.0
236
+ */
237
+ unlockAchievement(options: AchievementOptions): Promise<void>;
238
+ /**
239
+ * Reveal a hidden achievement. Queued by the SDK when offline.
240
+ *
241
+ * @since 0.1.0
242
+ */
243
+ revealAchievement(options: AchievementOptions): Promise<void>;
244
+ /**
245
+ * Add steps to an incremental achievement. Queued by the SDK when offline.
246
+ *
247
+ * @since 0.1.0
248
+ */
249
+ incrementAchievement(options: AchievementStepsOptions): Promise<void>;
250
+ /**
251
+ * Set the absolute progress of an incremental achievement. Play ignores a
252
+ * value lower than the one it already has, which makes this the safe choice
253
+ * when your own save holds the real counter.
254
+ *
255
+ * @since 0.1.0
256
+ */
257
+ setAchievementSteps(options: AchievementStepsOptions): Promise<void>;
258
+ /**
259
+ * Open Google's achievements UI. Resolves when the UI opens.
260
+ *
261
+ * @since 0.1.0
262
+ */
263
+ showAchievements(): Promise<void>;
264
+ /**
265
+ * Write a saved game to the player's Google account, creating it if needed.
266
+ * Conflicts between devices are resolved by keeping the most recently
267
+ * modified copy.
268
+ *
269
+ * @since 0.1.0
270
+ */
271
+ saveGame(options: SaveGameOptions): Promise<void>;
272
+ /**
273
+ * Read a saved game. Resolves with `data: null` when it does not exist and
274
+ * rejects when it could not be read.
275
+ *
276
+ * @since 0.1.0
277
+ */
278
+ loadGame(options: LoadGameOptions): Promise<LoadGameResult>;
279
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type LeaderboardTimeSpan = 'daily' | 'weekly' | 'allTime';\n\nexport type LeaderboardCollection = 'public' | 'friends';\n\nexport interface AuthResult {\n /**\n * Whether a player is signed in to Play Games Services.\n *\n * @since 0.1.0\n */\n isAuthenticated: boolean;\n\n /**\n * Google API status code. Only present when the SDK reported an error.\n *\n * `10` (DEVELOPER_ERROR) means the app is misconfigured: the SHA-1 of this\n * build or its package name is missing from the OAuth credentials in the\n * Play Console. `16` and `12501` mean the player cancelled.\n *\n * @since 0.1.0\n */\n errorCode?: number;\n\n /**\n * Error message from the SDK. Only present when the SDK reported an error.\n *\n * @since 0.1.0\n */\n errorMessage?: string;\n}\n\nexport interface Player {\n /**\n * @since 0.1.0\n */\n playerId: string;\n\n /**\n * The name the player shows in Play Games.\n *\n * @since 0.1.0\n */\n displayName: string;\n\n /**\n * The player's Play Games title, if they have one.\n *\n * @since 0.1.0\n */\n title?: string;\n}\n\nexport interface SubmitScoreOptions {\n /**\n * @since 0.1.0\n */\n leaderboardId: string;\n\n /**\n * Raw score, an integer. For time leaderboards it is in milliseconds and for\n * currency leaderboards in 1/1,000,000ths of the main unit.\n *\n * @since 0.1.0\n */\n score: number;\n\n /**\n * Wait for the server to confirm the score.\n *\n * With `false` the SDK queues the score, even offline, and the call resolves\n * straight away. With `true` the call resolves once the server has the score\n * and rejects when it cannot be reached; use it when you read the standing\n * right after submitting.\n *\n * @default false\n * @since 0.1.0\n */\n immediate?: boolean;\n}\n\nexport interface LeaderboardOptions {\n /**\n * @since 0.1.0\n */\n leaderboardId: string;\n\n /**\n * @default 'allTime'\n * @since 0.1.0\n */\n timeSpan?: LeaderboardTimeSpan;\n\n /**\n * `'friends'` needs the player's permission to read their friends list.\n * Until they have granted it, `getLeaderboardStanding` rejects with code\n * `'26703'` (CONSENT_REQUIRED).\n *\n * @default 'public'\n * @since 0.1.0\n */\n collection?: LeaderboardCollection;\n}\n\nexport interface LeaderboardStandingOptions extends LeaderboardOptions {\n /**\n * Skip the local cache and ask the server. The cached number of scores can\n * be stale, but Google rate-limits forced reloads: keep it for moments when\n * fresh data matters.\n *\n * @default false\n * @since 0.1.0\n */\n forceReload?: boolean;\n}\n\nexport interface LeaderboardStanding {\n /**\n * The player's rank, or `null` when unknown (for example, no score in this\n * time span).\n *\n * @since 0.1.0\n */\n rank: number | null;\n\n /**\n * The player's raw score, or `null` when unknown.\n *\n * @since 0.1.0\n */\n score: number | null;\n\n /**\n * How many scores the leaderboard has in this time span and collection, or\n * `null` when unknown.\n *\n * @since 0.1.0\n */\n numScores: number | null;\n}\n\nexport interface AchievementOptions {\n /**\n * @since 0.1.0\n */\n achievementId: string;\n}\n\nexport interface AchievementStepsOptions {\n /**\n * @since 0.1.0\n */\n achievementId: string;\n\n /**\n * @since 0.1.0\n */\n steps: number;\n}\n\nexport interface SaveGameOptions {\n /**\n * Unique name of the saved game: 1 to 100 characters from `a-z`, `A-Z`,\n * `0-9`, `-`, `.`, `_` and `~`.\n *\n * @since 0.1.0\n */\n name: string;\n\n /**\n * The contents, stored as UTF-8. Play allows up to 3 MB per saved game.\n *\n * @since 0.1.0\n */\n data: string;\n\n /**\n * Description shown in the Play Games saved games UI.\n *\n * @since 0.1.0\n */\n description?: string;\n}\n\nexport interface LoadGameOptions {\n /**\n * @since 0.1.0\n */\n name: string;\n}\n\nexport interface LoadGameResult {\n /**\n * The saved contents, or `null` when no saved game with that name exists.\n *\n * @since 0.1.0\n */\n data: string | null;\n}\n\nexport interface PlayGamesPlugin {\n /**\n * Whether a player is signed in. Shows no UI and never rejects.\n *\n * The SDK tries a silent sign-in when the app starts, so this is the call\n * to make before drawing anything that depends on the session.\n *\n * @since 0.1.0\n */\n isAuthenticated(): Promise<AuthResult>;\n\n /**\n * Ask the player to sign in. This is the only call that shows Google's\n * sign-in UI, so make it from a button the player pressed. Never rejects:\n * a cancelled or failed sign-in resolves with `isAuthenticated: false`.\n *\n * @since 0.1.0\n */\n signIn(): Promise<AuthResult>;\n\n /**\n * The signed-in player. Rejects when nobody is signed in.\n *\n * @since 0.1.0\n */\n getCurrentPlayer(): Promise<Player>;\n\n /**\n * Open the Play Games app, or its store listing when it is not installed.\n *\n * Useful when `signIn()` cannot succeed because the device has no Google\n * account or the player has no Play Games profile: both are created there.\n *\n * @since 0.1.0\n */\n openPlayGamesApp(): Promise<void>;\n\n /**\n * Submit a score to a leaderboard.\n *\n * @since 0.1.0\n */\n submitScore(options: SubmitScoreOptions): Promise<void>;\n\n /**\n * The player's rank and score, and the number of scores in the\n * leaderboard, read together for one time span and collection.\n *\n * @since 0.1.0\n */\n getLeaderboardStanding(options: LeaderboardStandingOptions): Promise<LeaderboardStanding>;\n\n /**\n * Open Google's UI for one leaderboard. Resolves when the UI opens.\n *\n * @since 0.1.0\n */\n showLeaderboard(options: LeaderboardOptions): Promise<void>;\n\n /**\n * Open Google's UI listing every leaderboard of the game.\n *\n * @since 0.1.0\n */\n showAllLeaderboards(): Promise<void>;\n\n /**\n * Unlock an achievement. Queued by the SDK when offline.\n *\n * @since 0.1.0\n */\n unlockAchievement(options: AchievementOptions): Promise<void>;\n\n /**\n * Reveal a hidden achievement. Queued by the SDK when offline.\n *\n * @since 0.1.0\n */\n revealAchievement(options: AchievementOptions): Promise<void>;\n\n /**\n * Add steps to an incremental achievement. Queued by the SDK when offline.\n *\n * @since 0.1.0\n */\n incrementAchievement(options: AchievementStepsOptions): Promise<void>;\n\n /**\n * Set the absolute progress of an incremental achievement. Play ignores a\n * value lower than the one it already has, which makes this the safe choice\n * when your own save holds the real counter.\n *\n * @since 0.1.0\n */\n setAchievementSteps(options: AchievementStepsOptions): Promise<void>;\n\n /**\n * Open Google's achievements UI. Resolves when the UI opens.\n *\n * @since 0.1.0\n */\n showAchievements(): Promise<void>;\n\n /**\n * Write a saved game to the player's Google account, creating it if needed.\n * Conflicts between devices are resolved by keeping the most recently\n * modified copy.\n *\n * @since 0.1.0\n */\n saveGame(options: SaveGameOptions): Promise<void>;\n\n /**\n * Read a saved game. Resolves with `data: null` when it does not exist and\n * rejects when it could not be read.\n *\n * @since 0.1.0\n */\n loadGame(options: LoadGameOptions): Promise<LoadGameResult>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { PlayGamesPlugin } from './definitions';
2
+ declare const PlayGames: PlayGamesPlugin;
3
+ export * from './definitions';
4
+ export { PlayGames };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const PlayGames = registerPlugin('PlayGames', {
3
+ web: () => import('./web').then((m) => new m.PlayGamesWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { PlayGames };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,SAAS,GAAG,cAAc,CAAkB,WAAW,EAAE;IAC7D,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;CAC7D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { PlayGamesPlugin } from './definitions';\n\nconst PlayGames = registerPlugin<PlayGamesPlugin>('PlayGames', {\n web: () => import('./web').then((m) => new m.PlayGamesWeb()),\n});\n\nexport * from './definitions';\nexport { PlayGames };\n"]}
@@ -0,0 +1,19 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { AuthResult, LeaderboardStanding, LoadGameResult, PlayGamesPlugin, Player } from './definitions';
3
+ export declare class PlayGamesWeb extends WebPlugin implements PlayGamesPlugin {
4
+ isAuthenticated(): Promise<AuthResult>;
5
+ signIn(): Promise<AuthResult>;
6
+ getCurrentPlayer(): Promise<Player>;
7
+ openPlayGamesApp(): Promise<void>;
8
+ submitScore(): Promise<void>;
9
+ getLeaderboardStanding(): Promise<LeaderboardStanding>;
10
+ showLeaderboard(): Promise<void>;
11
+ showAllLeaderboards(): Promise<void>;
12
+ unlockAchievement(): Promise<void>;
13
+ revealAchievement(): Promise<void>;
14
+ incrementAchievement(): Promise<void>;
15
+ setAchievementSteps(): Promise<void>;
16
+ showAchievements(): Promise<void>;
17
+ saveGame(): Promise<void>;
18
+ loadGame(): Promise<LoadGameResult>;
19
+ }
@@ -0,0 +1,50 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ const UNAVAILABLE = 'Play Games Services is only available on Android.';
3
+ export class PlayGamesWeb extends WebPlugin {
4
+ async isAuthenticated() {
5
+ throw this.unavailable(UNAVAILABLE);
6
+ }
7
+ async signIn() {
8
+ throw this.unavailable(UNAVAILABLE);
9
+ }
10
+ async getCurrentPlayer() {
11
+ throw this.unavailable(UNAVAILABLE);
12
+ }
13
+ async openPlayGamesApp() {
14
+ throw this.unavailable(UNAVAILABLE);
15
+ }
16
+ async submitScore() {
17
+ throw this.unavailable(UNAVAILABLE);
18
+ }
19
+ async getLeaderboardStanding() {
20
+ throw this.unavailable(UNAVAILABLE);
21
+ }
22
+ async showLeaderboard() {
23
+ throw this.unavailable(UNAVAILABLE);
24
+ }
25
+ async showAllLeaderboards() {
26
+ throw this.unavailable(UNAVAILABLE);
27
+ }
28
+ async unlockAchievement() {
29
+ throw this.unavailable(UNAVAILABLE);
30
+ }
31
+ async revealAchievement() {
32
+ throw this.unavailable(UNAVAILABLE);
33
+ }
34
+ async incrementAchievement() {
35
+ throw this.unavailable(UNAVAILABLE);
36
+ }
37
+ async setAchievementSteps() {
38
+ throw this.unavailable(UNAVAILABLE);
39
+ }
40
+ async showAchievements() {
41
+ throw this.unavailable(UNAVAILABLE);
42
+ }
43
+ async saveGame() {
44
+ throw this.unavailable(UNAVAILABLE);
45
+ }
46
+ async loadGame() {
47
+ throw this.unavailable(UNAVAILABL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C;IACtC,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AuthResult, LeaderboardStanding, LoadGameResult, PlayGamesPlugin, Player } from './definitions';\n\nconst UNAVAILABLE = 'Play Games Services is only available on Android.';\n\nexport class PlayGamesWeb extends WebPlugin implements PlayGamesPlugin {\n async isAuthenticated(): Promise<AuthResult> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async signIn(): Promise<AuthResult> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async getCurrentPlayer(): Promise<Player> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async openPlayGamesApp(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async submitScore(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async getLeaderboardStanding(): Promise<LeaderboardStanding> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async showLeaderboard(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async showAllLeaderboards(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async unlockAchievement(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async revealAchievement(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async incrementAchievement(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async setAchievementSteps(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async showAchievements(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async saveGame(): Promise<void> {\n throw this.unavailable(UNAVAILABLE);\n }\n\n async loadGame(): Promise<LoadGameResult> {\n throw this.unavailable(UNAVAILABLE);\n }\n}\n"]}
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ const PlayGames = core.registerPlugin('PlayGames', {
6
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.PlayGamesWeb()),
7
+ });
8
+
9
+ const UNAVAILABLE = 'Play Games Services is only available on Android.';
10
+ class PlayGamesWeb extends core.WebPlugin {
11
+ async isAuthenticated() {
12
+ throw this.unavailable(UNAVAILABLE);
13
+ }
14
+ async signIn() {
15
+ throw this.unavailable(UNAVAILABLE);
16
+ }
17
+ async getCurrentPlayer() {
18
+ throw this.unavailable(UNAVAILABLE);
19
+ }
20
+ async openPlayGamesApp() {
21
+ throw this.unavailable(UNAVAILABLE);
22
+ }
23
+ async submitScore() {
24
+ throw this.unavailable(UNAVAILABLE);
25
+ }
26
+ async getLeaderboardStanding() {
27
+ throw this.unavailable(UNAVAILABLE);
28
+ }
29
+ async showLeaderboard() {
30
+ throw this.unavailable(UNAVAILABLE);
31
+ }
32
+ async showAllLeaderboards() {
33
+ throw this.unavailable(UNAVAILABLE);
34
+ }
35
+ async unlockAchievement() {
36
+ throw this.unavailable(UNAVAILABLE);
37
+ }
38
+ async revealAchievement() {
39
+ throw this.unavailable(UNAVAILABLE);
40
+ }
41
+ async incrementAchievement() {
42
+ throw this.unavailable(UNAVAILABLE);
43
+ }
44
+ async setAchievementSteps() {
45
+ throw this.unavailable(UNAVAILABLE);
46
+ }
47
+ async showAchievements() {
48
+ throw this.unavailable(UNAVAILABLE);
49
+ }
50
+ async saveGame() {
51
+ throw this.unavailable(UNAVAILABLE);
52
+ }
53
+ async loadGame() {
54
+ throw this.unavailable(UNAVAILABLE);
55
+ }
56
+ }
57
+
58
+ var web = /*#__PURE__*/Object.freeze({
59
+ __proto__: null,
60
+ PlayGamesWeb: PlayGamesWeb
61
+ });
62
+
63
+ exports.PlayGames = PlayGames;
64
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst PlayGames = registerPlugin('PlayGames', {\n web: () => import('./web').then((m) => new m.PlayGamesWeb()),\n});\nexport * from './definitions';\nexport { PlayGames };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst UNAVAILABLE = 'Play Games Services is only available on Android.';\nexport class PlayGamesWeb extends WebPlugin {\n async isAuthenticated() {\n throw this.unavailable(UNAVAILABLE);\n }\n async signIn() {\n throw this.unavailable(UNAVAILABLE);\n }\n async getCurrentPlayer() {\n throw this.unavailable(UNAVAILABLE);\n }\n async openPlayGamesApp() {\n throw this.unavailable(UNAVAILABLE);\n }\n async submitScore() {\n throw this.unavailable(UNAVAILABLE);\n }\n async getLeaderboardStanding() {\n throw this.unavailable(UNAVAILABLE);\n }\n async showLeaderboard() {\n throw this.unavailable(UNAVAILABLE);\n }\n async showAllLeaderboards() {\n throw this.unavailable(UNAVAILABLE);\n }\n async unlockAchievement() {\n throw this.unavailable(UNAVAILABLE);\n }\n async revealAchievement() {\n throw this.unavailable(UNAVAILABLE);\n }\n async incrementAchievement() {\n throw this.unavailable(UNAVAILABLE);\n }\n async setAchievementSteps() {\n throw this.unavailable(UNAVAILABLE);\n }\n async showAchievements() {\n throw this.unavailable(UNAVAILABLE);\n }\n async saveGame() {\n throw this.unavailable(UNAVAILABLE);\n }\n async loadGame() {\n throw this.unavailable(UNAVAILABLE);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,SAAS,GAAGA,mBAAc,CAAC,WAAW,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CA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AAC,WAAW,CAAC;AAC3C,IAAI;AACJ,IAAI,MAAM,mBAAmB,GAAG;AAChC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC3C,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC3C,IAAI;AACJ,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC3C,IAAI;AACJ,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC3C,IAAI;AACJ;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,67 @@
1
+ var capacitorPlayGames = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const PlayGames = core.registerPlugin('PlayGames', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.PlayGamesWeb()),
6
+ });
7
+
8
+ const UNAVAILABLE = 'Play Games Services is only available on Android.';
9
+ class PlayGamesWeb extends core.WebPlugin {
10
+ async isAuthenticated() {
11
+ throw this.unavailable(UNAVAILABLE);
12
+ }
13
+ async signIn() {
14
+ throw this.unavailable(UNAVAILABLE);
15
+ }
16
+ async getCurrentPlayer() {
17
+ throw this.unavailable(UNAVAILABLE);
18
+ }
19
+ async openPlayGamesApp() {
20
+ throw this.unavailable(UNAVAILABLE);
21
+ }
22
+ async submitScore() {
23
+ throw this.unavailable(UNAVAILABLE);
24
+ }
25
+ async getLeaderboardStanding() {
26
+ throw this.unavailable(UNAVAILABLE);
27
+ }
28
+ async showLeaderboard() {
29
+ throw this.unavailable(UNAVAILABLE);
30
+ }
31
+ async showAllLeaderboards() {
32
+ throw this.unavailable(UNAVAILABLE);
33
+ }
34
+ async unlockAchievement() {
35
+ throw this.unavailable(UNAVAILABLE);
36
+ }
37
+ async revealAchievement() {
38
+ throw this.unavailable(UNAVAILABLE);
39
+ }
40
+ async incrementAchievement() {
41
+ throw this.unavailable(UNAVAILABLE);
42
+ }
43
+ async setAchievementSteps() {
44
+ throw this.unavailable(UNAVAILABLE);
45
+ }
46
+ async showAchievements() {
47
+ throw this.unavailable(UNAVAILABLE);
48
+ }
49
+ async saveGame() {
50
+ throw this.unavailable(UNAVAILABLE);
51
+ }
52
+ async loadGame() {
53
+ throw this.unavailable(UNAVAILABLE);
54
+ }
55
+ }
56
+
57
+ var web = /*#__PURE__*/Object.freeze({
58
+ __proto__: null,
59
+ PlayGamesWeb: PlayGamesWeb
60
+ });
61
+
62
+ exports.PlayGames = PlayGames;
63
+
64
+ return exports;
65
+
66
+ })({}, capacitorExports);
67
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst PlayGames = registerPlugin('PlayGames', {\n web: () => import('./web').then((m) => new m.PlayGamesWeb()),\n});\nexport * from './definitions';\nexport { PlayGames };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst UNAVAILABLE = 'Play Games Services is only available on Android.';\nexport class PlayGamesWeb extends WebPlugin {\n async isAuthenticated() {\n throw this.unavailable(UNAVAILABLE);\n }\n async signIn() {\n throw this.unavailable(UNAVAILABLE);\n }\n async getCurrentPlayer() {\n throw this.unavailable(UNAVAILABLE);\n }\n async openPlayGamesApp() {\n throw this.unavailable(UNAVAILABLE);\n }\n async submitScore() {\n throw this.unavailable(UNAVAILABLE);\n }\n async getLeaderboardStanding() {\n throw this.unavailable(UNAVAILABLE);\n }\n async showLeaderboard() {\n throw this.unavailable(UNAVAILABLE);\n }\n async showAllLeaderboards() {\n throw this.unavailable(UNAVAILABLE);\n }\n async unlockAchievement() {\n throw this.unavailable(UNAVAILABLE);\n }\n async revealAchievement() {\n throw this.unavailable(UNAVAILABLE);\n }\n async incrementAchievement() {\n throw this.unavailable(UNAVAILABLE);\n }\n async setAchievementSteps() {\n throw this.unavailable(UNAVAILABLE);\n }\n async showAchievements() {\n throw this.unavailable(UNAVAILABLE);\n }\n async saveGame() {\n throw this.unavailable(UNAVAILABLE);\n }\n async loadGame() {\n throw this.unavailable(UNAVAILABLE);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,SAAS,GAAGA,mBAAc,CAAC,WAAW,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IAChE,CAAC;;ICFD,MAAM,WAAW,GAAG,mDAAmD;IAChE,MAAM,YAAY,SAASC,cAAS,CAAC;IAC5C,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,sBAAsB,GAAG;IACnC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,mBAAmB,GAAG;IAChC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,oBAAoB,GAAG;IACjC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,mBAAmB,GAAG;IAChC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3C,IAAI;IACJ;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,79 @@
1
1
  {
2
2
  "name": "@byvik/capacitor-play-games",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Google Play Games Services v2 for Capacitor: sign-in, leaderboards, achievements and cloud saved games.",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/"
13
+ ],
14
+ "author": "byVik",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/byVik/capacitor-plugins.git",
19
+ "directory": "packages/play-games"
20
+ },
21
+ "homepage": "https://github.com/byVik/capacitor-plugins/tree/main/packages/play-games#readme",
22
+ "bugs": {
23
+ "url": "https://github.com/byVik/capacitor-plugins/issues"
24
+ },
25
+ "keywords": [
26
+ "capacitor",
27
+ "plugin",
28
+ "native",
29
+ "android",
30
+ "google-play-games",
31
+ "play-games-services",
32
+ "leaderboards",
33
+ "achievements",
34
+ "saved-games",
35
+ "cloud-save"
36
+ ],
37
+ "scripts": {
38
+ "verify": "npm run verify:android && npm run verify:web",
39
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
40
+ "verify:web": "npm run build",
41
+ "lint": "npm run eslint && npm run prettier -- --check",
42
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write",
43
+ "eslint": "eslint . --ext ts",
44
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
45
+ "docgen": "docgen --api PlayGamesPlugin --output-readme README.md --output-json dist/docs.json",
46
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
47
+ "clean": "rimraf ./dist",
48
+ "watch": "tsc --watch",
49
+ "prepublishOnly": "npm run build"
50
+ },
51
+ "devDependencies": {
52
+ "@capacitor/android": "^8.0.0",
53
+ "@capacitor/core": "^8.0.0",
54
+ "@capacitor/docgen": "^0.3.1",
55
+ "@ionic/eslint-config": "^0.4.0",
56
+ "@ionic/prettier-config": "^4.0.0",
57
+ "eslint": "^8.57.1",
58
+ "prettier": "^3.6.2",
59
+ "prettier-plugin-java": "^2.7.7",
60
+ "rimraf": "^6.1.0",
61
+ "rollup": "^4.53.2",
62
+ "typescript": "^5.9.3"
63
+ },
64
+ "peerDependencies": {
65
+ "@capacitor/core": ">=8.0.0"
66
+ },
67
+ "prettier": "@ionic/prettier-config",
68
+ "eslintConfig": {
69
+ "extends": "@ionic/eslint-config/recommended"
70
+ },
71
+ "publishConfig": {
72
+ "access": "public"
73
+ },
74
+ "capacitor": {
75
+ "android": {
76
+ "src": "android"
77
+ }
78
+ }
79
+ }