mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:10:24 +00:00
Use adfree flag to suppress ads
Adds adfree: boolean to player in UserMeResponseSchema and replaces the flares-length heuristic in Main.ts with a direct check of this field to determine whether ads should be shown.
This commit is contained in:
+3
-5
@@ -438,11 +438,9 @@ class Client {
|
||||
|
||||
const onUserMe = async (userMeResponse: UserMeResponse | false) => {
|
||||
updateAccountNavButton(userMeResponse);
|
||||
const hasLinkedAccount =
|
||||
!crazyGamesSDK.isOnCrazyGames() &&
|
||||
((userMeResponse || null)?.player?.flares?.length ?? 0) > 0;
|
||||
console.log("ads enabled: ", hasLinkedAccount);
|
||||
window.adsEnabled = !hasLinkedAccount && !crazyGamesSDK.isOnCrazyGames();
|
||||
const isAdFree =
|
||||
userMeResponse !== false && userMeResponse.player?.adfree === true;
|
||||
window.adsEnabled = !isAdFree && !crazyGamesSDK.isOnCrazyGames();
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("userMeResponse", {
|
||||
detail: userMeResponse,
|
||||
|
||||
@@ -77,6 +77,7 @@ export const UserMeResponseSchema = z.object({
|
||||
}),
|
||||
player: z.object({
|
||||
publicId: z.string(),
|
||||
adfree: z.boolean(),
|
||||
flares: z.string().array().optional(),
|
||||
achievements: z.object({
|
||||
singleplayerMap: z.array(SingleplayerMapAchievementSchema),
|
||||
|
||||
Reference in New Issue
Block a user