Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .sampo/changesets/ait-host-game-center-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
npm/@mpgd/adapter-ait: patch (Fixed)
---

Treat a missing Apps in Toss operational-environment support constant as an unsupported Game
Center capability instead of failing wrapper startup. Leaderboard submission and opening remain
disabled until the host can verify the minimum native version.
36 changes: 36 additions & 0 deletions adapters/ait/src/host.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,42 @@ describe('AIT production host bridge', () => {
expect(showCount).toBe(1);
});

it('treats a missing Game Center environment constant as unsupported', async () => {
const diagnostic = vi.spyOn(console, 'debug').mockImplementation(() => {});
const submitScore = vi.fn(async () => ({ statusCode: 'SUCCESS' as const }));
const openLeaderboard = vi.fn(async () => {});

try {
const bridge = createAitHostBridge({
dependencies: createDependencies({
isMinVersionSupported: () => {
throw new Error('getOperationalEnvironment is not a constant handler');
},
submitGameCenterLeaderBoardScore: submitScore,
openGameCenterLeaderboard: openLeaderboard,
}),
});

await expect(request(bridge, 'runtime.getCapabilities', {})).resolves.toMatchObject({
nativeLeaderboard: false,
});
await expect(request(bridge, 'leaderboard.submitScore', { score: 42 })).resolves.toEqual({
submitted: false,
});
await expect(request(bridge, 'leaderboard.open', {})).resolves.toEqual({});
expect(submitScore).not.toHaveBeenCalled();
expect(openLeaderboard).not.toHaveBeenCalled();
expect(diagnostic).toHaveBeenCalledWith(
'AIT capability support check failed; disabling the feature.',
expect.objectContaining({
message: 'getOperationalEnvironment is not a constant handler',
}),
);
} finally {
diagnostic.mockRestore();
}
});

it('delegates supported Game Center score submission and opening', async () => {
const submittedScores: string[] = [];
let openCount = 0;
Expand Down
6 changes: 5 additions & 1 deletion adapters/ait/src/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,11 @@ function toAitDeepLink(input: string, appName: string): string | undefined {
}

function isGameCenterSupported(dependencies: AitHostDependencies): boolean {
return dependencies.isMinVersionSupported({ android: '5.221.0', ios: '5.221.0' });
return isCapabilitySupported(() =>
dependencies.isMinVersionSupported({
android: '5.221.0',
ios: '5.221.0',
}));
}

function areFullScreenAdsSupported(dependencies: AitHostDependencies): boolean {
Expand Down