Skip to content

Conversation

@qiuguohua
Copy link
Contributor

@qiuguohua qiuguohua commented Mar 13, 2025

Re: #

Description

https://developers.google.com/android/reference/com/google/android/gms/games/AnnotatedData
https://developers.google.com/android/reference/com/google/android/gms/games/achievement/Achievement
https://developers.google.com/android/reference/com/google/android/gms/games/achievement/AchievementBuffer

This version of the implementation is different from google play, in google play the type of AnnotatedData is a template, but currently only supports AchievementBuffer, so the current implementation is not implemented as a template.

Some methods are not realized:
AchievementBuffer :
close()
release()
Iterator iterator()
isCloseed()
Bundle getMetadata()
Iterator singleRefIterator()

Achievement:
getDescription(@nonnull CharArrayBuffer var1);
getFormattedCurrentSteps(@nonnull CharArrayBuffer var1);
getFormattedTotalSteps(@nonnull CharArrayBuffer var1);
getName(@nonnull CharArrayBuffer var1);
Uri getRevealedImageUri();
Uri getUnlockedImageUri();
But there are deprecated interfaces for this interface, and the already implemented
String getRevealedImageUrl();
String getUnlockedImageUrl();


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@qiuguohua qiuguohua requested a review from dumganhar March 13, 2025 06:18
@github-actions
Copy link

github-actions bot commented Mar 13, 2025

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1001924 bytes 1001924 bytes ✅ 0 bytes
2D All (legacy pipeline) 2662943 bytes 2662943 bytes ✅ 0 bytes
2D All (new pipeline) 2750172 bytes 2750172 bytes ✅ 0 bytes
(2D + 3D) All 10003554 bytes 10003554 bytes ✅ 0 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16915826 bytes 16915826 bytes ✅ 0 bytes

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -59082,8 +59082,14 @@
             export const RecallAccess: typeof __private.__types_jsb__jsb.RecallAccess;
             export type RecallAccess = __private.__types_jsb__jsb.RecallAccess;
             export const PlayException: typeof __private.__types_jsb__jsb.PlayException;
             export type PlayException = __private.__types_jsb__jsb.PlayException;
+            export const AnnotatedData: typeof __private.__types_jsb__jsb.AnnotatedData;
+            export type AnnotatedData = __private.__types_jsb__jsb.AnnotatedData;
+            export const AchievementBuffer: typeof __private.__types_jsb__jsb.AchievementBuffer;
+            export type AchievementBuffer = __private.__types_jsb__jsb.AchievementBuffer;
+            export const Achievement: typeof __private.__types_jsb__jsb.Achievement;
+            export type Achievement = __private.__types_jsb__jsb.Achievement;
             export type Continuation<T, K = void> = __private._vendor_google_play_task__ContinuationHelper<T, K>;
             export type Task<T, K = void> = __private._vendor_google_play_task__TaskHelper<T, K>;
         }
     }
@@ -73666,8 +73672,35 @@
             public hashCode(): number;
             public getSessionId(): string;
             public equals(other: __types_jsb_jsb__RecallAccess): boolean;
         }
+        export class __types_jsb_jsb__Achievement {
+            public static STATE_UNLOCKED: number;
+            public static STATE_REVEALED: number;
+            public static STATE_HIDDEN: number;
+            public static TYPE_STANDARD: number;
+            public static TYPE_INCREMENTAL: number;
+            public getCurrentSteps(): number;
+            public getState(): number;
+            public getTotalSteps(): number;
+            public getType(): number;
+            public getLastUpdatedTimestamp(): number;
+            public getXpValue(): number;
+            public getAchievementId(): string;
+            public getDescription(): string;
+            public getFormattedCurrentSteps(): string;
+            public getFormattedTotalSteps(): string;
+            public getName(): string;
+            public getRevealedImageUrl(): string;
+            public getUnlockedImageUrl(): string;
+        }
+        export class __types_jsb_jsb__AchievementBuffer {
+            public getCount(): number;
+            public get(i: number): __types_jsb_jsb__Achievement;
+            public close(): void;
+            public release(): void;
+            public isClosed(): boolean;
+        }
         export class __types_jsb_jsb__AchievementsClient {
             public showAchievements(): void;
             public incrementImmediate(id: string, numSteps: number): __types_jsb_jsb__PlayTask;
             public load(forceReload: boolean): __types_jsb_jsb__PlayTask;
@@ -74961,8 +74994,39 @@
                 public isAuthenticated(): __types_jsb_jsb__PlayTask;
                 public requestServerSideAccess(serverClientId: string, forceRefreshToken: boolean): __types_jsb_jsb__PlayTask;
                 public signIn(): __types_jsb_jsb__PlayTask;
             }
+            export class Achievement {
+                public static STATE_UNLOCKED: number;
+                public static STATE_REVEALED: number;
+                public static STATE_HIDDEN: number;
+                public static TYPE_STANDARD: number;
+                public static TYPE_INCREMENTAL: number;
+                public getCurrentSteps(): number;
+                public getState(): number;
+                public getTotalSteps(): number;
+                public getType(): number;
+                public getLastUpdatedTimestamp(): number;
+                public getXpValue(): number;
+                public getAchievementId(): string;
+                public getDescription(): string;
+                public getFormattedCurrentSteps(): string;
+                public getFormattedTotalSteps(): string;
+                public getName(): string;
+                public getRevealedImageUrl(): string;
+                public getUnlockedImageUrl(): string;
+            }
+            export class AchievementBuffer {
+                public getCount(): number;
+                public get(i: number): __types_jsb_jsb__Achievement;
+                public close(): void;
+                public release(): void;
+                public isClosed(): boolean;
+            }
+            export class AnnotatedData {
+                public isStale(): boolean;
+                public get(): __types_jsb_jsb__AchievementBuffer;
+            }
             export class AchievementsClient {
                 public showAchievements(): void;
                 public incrementImmediate(id: string, numSteps: number): __types_jsb_jsb__PlayTask;
                 public load(forceReload: boolean): __types_jsb_jsb__PlayTask;
@@ -75138,9 +75202,9 @@
         }
         export class _vendor_google_play_games__AchievementsClient {
             showAchievements(): void;
             incrementImmediate(id: string, numSteps: number): _vendor_google_play_task__TaskHelper<boolean>;
-            load(id: boolean): _vendor_google_play_task__TaskHelper<boolean>;
+            load(forceReload: boolean): _vendor_google_play_task__TaskHelper<__types_jsb__jsb.AnnotatedData>;
             revealImmediate(id: string): _vendor_google_play_task__TaskHelper<void>;
             setStepsImmediate(id: string, numSteps: number): _vendor_google_play_task__TaskHelper<boolean>;
             unlockImmediate(id: string): _vendor_google_play_task__TaskHelper<void>;
             increment(id: string, numSteps: number): void;
@@ -75163,8 +75227,12 @@
         }
         export class __types_jsb_jsb__AuthenticationResult {
             public isAuthenticated(): boolean;
         }
+        export class __types_jsb_jsb__AnnotatedData {
+            public isStale(): boolean;
+            public get(): __types_jsb_jsb__AchievementBuffer;
+        }
         export enum _cocos_video_video_player_enums__VideoPlayerEventType {
             /**
              * @en None.
              * @zh 无。

@dumganhar dumganhar requested a review from bofeng-song March 13, 2025 07:03
@dumganhar dumganhar changed the title V3.8.6 fix gp achievements load Support Google Play Achievement functionality Mar 13, 2025
@dumganhar dumganhar changed the title Support Google Play Achievement functionality Support Google Play Achievement Mar 13, 2025
@dumganhar dumganhar merged commit 949705b into cocos:v3.8.6 Mar 13, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants