Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3.8.6] Continue to remove unused platforms support. #17902

Merged
merged 2 commits into from
Nov 22, 2024
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
35 changes: 2 additions & 33 deletions cc.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,6 @@
"value": false,
"internal": false
},
"BAIDU": {
"comment": "Running in the baidu's mini game.",
"type": "boolean",
"value": false,
"ccGlobal": true,
"internal": false
},
"XIAOMI": {
"comment": "Running in the xiaomi's quick game.",
"type": "boolean",
Expand Down Expand Up @@ -539,35 +532,13 @@
"ccGlobal": true,
"internal": false
},
"COCOSPLAY": {
"comment": "Running in the cocosplay.",
"type": "boolean",
"value": false,
"ccGlobal": true,
"internal": false
},
"QTT": {
"comment": "Running in the qtt's quick game.",
"type": "boolean",
"value": false,
"ccGlobal": true,
"internal": false
},
"LINKSURE": {
"comment": "Running in the linksure's quick game.",
"type": "boolean",
"value": false,
"ccGlobal": true,
"internal": false
},
"MIGU": {
"comment": "Running in the migu's quick game.",
"type": "boolean",
"value": false,
"ccGlobal": true,
"internal": false
},

"EDITOR": {
"comment": "Running in the editor.",
"type": "boolean",
Expand Down Expand Up @@ -622,8 +593,6 @@
"value": false,
"internal": true
},


"DEV": {
"comment": "Running in the editor or preview.",
"type": "boolean",
Expand All @@ -635,14 +604,14 @@
"MINIGAME": {
"comment": "Running in mini game.",
"type": "boolean",
"value": "$WECHAT || $WECHAT_MINI_PROGRAM || $BAIDU || $XIAOMI || $ALIPAY || $TAOBAO || $TAOBAO_MINIGAME || $BYTEDANCE",
"value": "$WECHAT || $WECHAT_MINI_PROGRAM || $XIAOMI || $ALIPAY || $TAOBAO || $TAOBAO_MINIGAME || $BYTEDANCE",
"ccGlobal": true,
"internal": false
},
"RUNTIME_BASED": {
"comment": "Running in runtime based environment.",
"type": "boolean",
"value": "$OPPO || $VIVO || $HUAWEI || $COCOSPLAY || $QTT || $LINKSURE || $MIGU",
"value": "$OPPO || $VIVO || $HUAWEI || $MIGU",
"ccGlobal": true,
"internal": false
},
Expand Down
4 changes: 2 additions & 2 deletions cocos/asset/assets/image-asset.jsb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
THE SOFTWARE.
*/

import { ALIPAY, XIAOMI, JSB, TEST, BAIDU, EDITOR } from 'internal:constants';
import { ALIPAY, XIAOMI, JSB, TEST, EDITOR } from 'internal:constants';
import { Format, FormatFeatureBit, deviceManager } from '../../gfx';
import { PixelFormat } from './asset-enum';
import { sys, macro, warnID, cclegacy } from '../../core';
Expand Down Expand Up @@ -54,7 +54,7 @@ function isImageBitmap (imageSource: any): boolean {
}

function isNativeImage (imageSource: ImageSource): imageSource is (HTMLImageElement | HTMLCanvasElement | ImageBitmap) {
if (ALIPAY || XIAOMI || BAIDU) {
if (ALIPAY || XIAOMI) {
// We're unable to grab the constructors of Alipay native image or canvas object.
return !('_data' in imageSource);
}
Expand Down
4 changes: 2 additions & 2 deletions cocos/asset/assets/image-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

// @ts-check
import { ccclass, override } from 'cc.decorator';
import { EDITOR, ALIPAY, XIAOMI, JSB, TEST, BAIDU, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM, BYTEDANCE } from 'internal:constants';
import { EDITOR, ALIPAY, XIAOMI, JSB, TEST, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM, BYTEDANCE } from 'internal:constants';
import { Device, Format, FormatFeatureBit, deviceManager } from '../../gfx';
import { Asset } from './asset';
import { PixelFormat } from './asset-enum';
Expand Down Expand Up @@ -163,7 +163,7 @@

// 返回该图像源是否是平台提供的图像对象。
function isNativeImage (imageSource: ImageSource): imageSource is (HTMLImageElement | HTMLCanvasElement | ImageBitmap) {
if (ALIPAY || TAOBAO || TAOBAO_MINIGAME || XIAOMI || BAIDU || WECHAT_MINI_PROGRAM || BYTEDANCE) {
if (ALIPAY || TAOBAO || TAOBAO_MINIGAME || XIAOMI || WECHAT_MINI_PROGRAM || BYTEDANCE) {
// We're unable to grab the constructors of Alipay native image or canvas object.
return !('_data' in imageSource);
}
Expand Down Expand Up @@ -212,7 +212,7 @@
try {
// Create compressed file
// file header length
const fileHeaderLength = COMPRESSED_HEADER_LENGTH + COMPRESSED_MIPMAP_LEVEL_COUNT_LENGTH + files.length * COMPRESSED_MIPMAP_DATA_SIZE_LENGTH;

Check warning on line 215 in cocos/asset/assets/image-asset.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 153. Maximum allowed is 150
let fileLength = 0;
for (const file of files) {
fileLength += file.byteLength;
Expand Down
39 changes: 27 additions & 12 deletions cocos/core/platform/deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ markAsWarning(sys, 'sys', [
]);

// deprecate languageCode field
replaceProperty(sys, 'sys',
replaceProperty(
sys,
'sys',
['UNKNOWN', 'ENGLISH', 'CHINESE', 'FRENCH', 'ITALIAN',
'GERMAN', 'SPANISH', 'DUTCH', 'RUSSIAN', 'KOREAN',
'JAPANESE', 'HUNGARIAN', 'PORTUGUESE', 'ARABIC', 'NORWEGIAN',
Expand All @@ -52,19 +54,25 @@ replaceProperty(sys, 'sys',
newName: item,
target: sys.Language,
targetName: 'sys.Language',
})));
})),
);

// deprecate os field
replaceProperty(sys, 'sys',
replaceProperty(
sys,
'sys',
['UNKNOWN', 'IOS', 'ANDROID', 'WINDOWS', 'LINUX', 'OSX'].map((item) => ({
name: `OS_${item}`,
newName: item,
target: sys.OS,
targetName: 'sys.OS',
})));
})),
);

// deprecate browserType field
replaceProperty(sys, 'sys',
replaceProperty(
sys,
'sys',
['UNKNOWN', 'WECHAT', 'ANDROID', 'IE', 'EDGE', 'QQ', 'MOBILE_QQ',
'UC', 'UCBS', 'BAIDU_APP', 'BAIDU', 'MAXTHON', 'OPERA',
'OUPENG', 'MIUI', 'FIREFOX', 'SAFARI', 'CHROME', 'LIEBAO',
Expand All @@ -73,7 +81,8 @@ replaceProperty(sys, 'sys',
newName: item,
target: sys.BrowserType,
targetName: 'sys.BrowserType',
})));
})),
);
replaceProperty(sys, 'sys', [
{
name: 'BROWSER_TYPE_360',
Expand All @@ -84,14 +93,17 @@ replaceProperty(sys, 'sys', [
]);

// deprecate platform field
replaceProperty(sys, 'sys',
replaceProperty(
sys,
'sys',
['UNKNOWN', 'EDITOR_PAGE', 'EDITOR_CORE', 'MOBILE_BROWSER', 'DESKTOP_BROWSER', 'WIN32', 'MACOS', 'IOS', 'ANDROID', 'OHOS',
'WECHAT_GAME', 'BAIDU_MINI_GAME', 'XIAOMI_QUICK_GAME', 'ALIPAY_MINI_GAME', 'BYTEDANCE_MINI_GAME',
'OPPO_MINI_GAME', 'VIVO_MINI_GAME', 'HUAWEI_QUICK_GAME', 'COCOSPLAY', 'LINKSURE_MINI_GAME', 'QTT_MINI_GAME'].map((item) => ({
'WECHAT_GAME', 'XIAOMI_QUICK_GAME', 'ALIPAY_MINI_GAME', 'BYTEDANCE_MINI_GAME',
'OPPO_MINI_GAME', 'VIVO_MINI_GAME', 'HUAWEI_QUICK_GAME'].map((item) => ({
name: item,
target: sys.Platform,
targetName: 'sys.Platform',
})));
})),
);

// remove platform field
replaceProperty(sys, 'sys', [
Expand All @@ -108,11 +120,14 @@ replaceProperty(sys, 'sys', [
targetName: 'sys.Platform',
},
]);
removeProperty(sys, 'sys',
removeProperty(
sys,
'sys',
['LINUX', 'BLACKBERRY', 'NACL', 'EMSCRIPTEN', 'TIZEN',
'WINRT', 'WP8', 'QQ_PLAY', 'FB_PLAYABLE_ADS'].map((item) => ({
name: item,
})));
})),
);
replaceProperty(sys, 'sys', [
{
name: 'windowPixelResolution',
Expand Down
4 changes: 2 additions & 2 deletions cocos/gfx/webgl/webgl-swapchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
THE SOFTWARE.
*/

import { ALIPAY, RUNTIME_BASED, BYTEDANCE, WECHAT, LINKSURE, QTT, COCOSPLAY, HUAWEI, EDITOR, VIVO, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM } from 'internal:constants';
import { ALIPAY, RUNTIME_BASED, BYTEDANCE, WECHAT, HUAWEI, EDITOR, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM } from 'internal:constants';
import { systemInfo } from 'pal/system-info';
import { WebGLStateCache } from './webgl-state-cache';
import { WebGLTexture } from './webgl-texture';
Expand Down Expand Up @@ -149,7 +149,7 @@ export function getExtensions (gl: WebGLRenderingContext): IWebGLExtensions {

if (RUNTIME_BASED) {
// VAO implementations doesn't work well on some runtime platforms
if (LINKSURE || QTT || COCOSPLAY || HUAWEI) {
if (HUAWEI) {
res.OES_vertex_array_object$ = null;
}
}
Expand Down
9 changes: 2 additions & 7 deletions cocos/scene-graph/scene-globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
ccclass, visible, type, displayOrder, readOnly, slide, range, rangeStep,
editable, serializable, rangeMin, tooltip, formerlySerializedAs, displayName,
} from 'cc.decorator';
import { BAIDU } from 'internal:constants';

import { TextureCube } from '../asset/assets/texture-cube';
import { CCFloat, CCInteger } from '../core/data/utils/attribute';
import { Color, Quat, Vec3, Vec2, Vec4 } from '../core/math';
Expand Down Expand Up @@ -862,11 +862,6 @@ export class ShadowsInfo {
}
}
get enabled (): boolean {
if (BAIDU) {
if (this._type !== ShadowType.Planar) {
this._enabled = false;
}
}
return this._enabled;
}

Expand Down Expand Up @@ -1708,7 +1703,7 @@ export class SceneGlobals {
this.skin.activate(sceneData.skin);
this.postSettings.activate(sceneData.postSettings);
if (this.lightProbeInfo && sceneData.lightProbes) {
this.lightProbeInfo.activate(scene, sceneData.lightProbes as LightProbes);
this.lightProbeInfo.activate(scene, sceneData.lightProbes);
}

const root = legacyCC.director.root as Root;
Expand Down
5 changes: 1 addition & 4 deletions pal/env/minigame/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

/* eslint-disable import/no-dynamic-require */
import { BAIDU, TAOBAO, TAOBAO_MINIGAME, WECHAT, WECHAT_MINI_PROGRAM, XIAOMI } from 'internal:constants';
import { TAOBAO, TAOBAO_MINIGAME, WECHAT, WECHAT_MINI_PROGRAM, XIAOMI } from 'internal:constants';
import { checkPalIntegrity, withImpl } from '../../integrity-check';

declare const require: (path: string) => any;
Expand All @@ -40,9 +40,6 @@ export function loadJsFile (path: string): any {
if (XIAOMI) {
return require(`../../${path}`);
}
if (BAIDU) {
return __baiduRequire(`./${path}`);
}
if (WECHAT || WECHAT_MINI_PROGRAM) {
return __wxRequire(path);
}
Expand Down
13 changes: 3 additions & 10 deletions pal/env/runtime/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,16 @@
THE SOFTWARE.
*/

import { COCOSPLAY, HUAWEI, OPPO, VIVO } from 'internal:constants';
import { HUAWEI, OPPO, VIVO } from 'internal:constants';
import { checkPalIntegrity, withImpl } from '../../integrity-check';

declare const require: (path: string) => Promise<void>;
declare const ral: any;

export function findCanvas (): { frame: HTMLDivElement, container: HTMLDivElement, canvas: HTMLCanvasElement } {
const container = document.createElement('div');
let frame;
if (COCOSPLAY) {
frame = {
clientWidth: window.innerWidth,
clientHeight: window.innerHeight,
} as any;
} else {
frame = container.parentNode === document.body ? document.documentElement : container.parentNode as any;
}
const frame = container.parentNode === document.body ? document.documentElement : container.parentNode as any;

let canvas;
if (VIVO) {
canvas = window.mainCanvas;
Expand Down
35 changes: 7 additions & 28 deletions pal/minigame/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
THE SOFTWARE.
*/

import { COCOSPLAY, HUAWEI, LINKSURE, OPPO, QTT, VIVO } from 'internal:constants';
import { VIVO } from 'internal:constants';
import { SystemInfo, IMiniGame } from 'pal/minigame';
import { checkPalIntegrity, withImpl } from '../integrity-check';

Expand Down Expand Up @@ -66,24 +66,13 @@
},
});

if (LINKSURE || COCOSPLAY) {
// TODO: update system info when view resized, currently the resize callback is not supported.
let cachedSystemInfo = ral.getSystemInfoSync() as SystemInfo;
minigame.onWindowResize?.(() => {
// update cached system info
cachedSystemInfo = ral.getSystemInfoSync() as SystemInfo;
});
minigame.getSystemInfoSync = function (): SystemInfo {
return cachedSystemInfo;
};
}
// #endregion SystemInfo

// #region Accelerometer
let _customAccelerometerCb: AccelerometerChangeCallback | undefined;
let _innerAccelerometerCb: AccelerometerChangeCallback | undefined;
let _needHandleAccelerometerCb = false;
minigame.onAccelerometerChange = function (cb): void {

Check warning on line 75 in pal/minigame/runtime.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
if (!_innerAccelerometerCb) {
_innerAccelerometerCb = (res): void => {
if (!_needHandleAccelerometerCb) {
Expand All @@ -109,36 +98,26 @@
_needHandleAccelerometerCb = true;
_customAccelerometerCb = cb;
};
minigame.offAccelerometerChange = function (cb): void {

Check warning on line 101 in pal/minigame/runtime.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
_needHandleAccelerometerCb = false;
_customAccelerometerCb = undefined;
};
// #endregion Accelerometer

// NOTE: Audio playing crash on COCOSPLAY, need to play audio asynchronously.
if (COCOSPLAY) {
minigame.createInnerAudioContext = createInnerAudioContextPolyfill(ral, {
onPlay: true, // polyfill for vivo
onPause: true,
onStop: true,
onSeek: true,
}, true);
} else {
minigame.createInnerAudioContext = createInnerAudioContextPolyfill(ral, {
onPlay: true, // polyfill for vivo
onPause: true,
onStop: true,
onSeek: true,
});
}
minigame.createInnerAudioContext = createInnerAudioContextPolyfill(ral, {
onPlay: true, // polyfill for vivo
onPause: true,
onStop: true,
onSeek: true,
});

// #region SafeArea
minigame.getSafeArea = function (): SafeArea {

Check warning on line 115 in pal/minigame/runtime.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
const locSystemInfo = ral.getSystemInfoSync() as SystemInfo;
if (locSystemInfo.safeArea) {
return locSystemInfo.safeArea;
} else {
console.warn('getSafeArea is not supported on this platform');

Check failure on line 120 in pal/minigame/runtime.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected console statement
const systemInfo = minigame.getSystemInfoSync();
return {
top: 0,
Expand Down
4 changes: 0 additions & 4 deletions pal/system-info/enum-type/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export enum Platform {
// Minigame
WECHAT_GAME = 'WECHAT_GAME',
WECHAT_MINI_PROGRAM = 'WECHAT_MINI_PROGRAM',
BAIDU_MINI_GAME = 'BAIDU_MINI_GAME',
XIAOMI_QUICK_GAME = 'XIAOMI_QUICK_GAME',
ALIPAY_MINI_GAME = 'ALIPAY_MINI_GAME',
TAOBAO_CREATIVE_APP = 'TAOBAO_CREATIVE_APP',
Expand All @@ -49,8 +48,5 @@ export enum Platform {
OPPO_MINI_GAME = 'OPPO_MINI_GAME',
VIVO_MINI_GAME = 'VIVO_MINI_GAME',
HUAWEI_QUICK_GAME = 'HUAWEI_QUICK_GAME',
COCOSPLAY = 'COCOSPLAY',
LINKSURE_MINI_GAME = 'LINKSURE_MINI_GAME',
QTT_MINI_GAME = 'QTT_MINI_GAME',
MIGU_MINI_GAME = 'MIGU_MINI_GAME',
}
10 changes: 1 addition & 9 deletions pal/system-info/minigame/system-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
THE SOFTWARE.
*/

import { ALIPAY, BAIDU, BYTEDANCE, COCOSPLAY, HUAWEI, LINKSURE, OPPO, QTT, VIVO, MIGU, WECHAT, XIAOMI, DEBUG, TEST, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM } from 'internal:constants';
import { ALIPAY, BYTEDANCE, HUAWEI, OPPO, VIVO, MIGU, WECHAT, XIAOMI, DEBUG, TEST, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM } from 'internal:constants';

Check warning on line 25 in pal/system-info/minigame/system-info.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

This line has a length of 156. Maximum allowed is 150
import { minigame } from 'pal/minigame';
import { IFeatureMap } from 'pal/system-info';
import { EventTarget } from '../../../cocos/core/event';
Expand All @@ -36,8 +36,6 @@
currentPlatform = Platform.WECHAT_GAME;
} else if (WECHAT_MINI_PROGRAM) {
currentPlatform = Platform.WECHAT_MINI_PROGRAM;
} else if (BAIDU) {
currentPlatform = Platform.BAIDU_MINI_GAME;
} else if (XIAOMI) {
currentPlatform = Platform.XIAOMI_QUICK_GAME;
} else if (ALIPAY) {
Expand All @@ -54,12 +52,6 @@
currentPlatform = Platform.VIVO_MINI_GAME;
} else if (HUAWEI) {
currentPlatform = Platform.HUAWEI_QUICK_GAME;
} else if (COCOSPLAY) {
currentPlatform = Platform.COCOSPLAY;
} else if (LINKSURE) {
currentPlatform = Platform.LINKSURE_MINI_GAME;
} else if (QTT) {
currentPlatform = Platform.QTT_MINI_GAME;
} else if (MIGU) {
currentPlatform = Platform.MIGU_MINI_GAME;
}
Expand Down
Loading
Loading