@galacean/effects-plugin-alipay-downgrade 2.0.0-alpha.26 → 2.0.0-alpha.28

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.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player downgrade plugin for Alipay
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,意绮,飂兮
6
- * Version: v2.0.0-alpha.26
6
+ * Version: v2.0.0-alpha.28
7
7
  */
8
8
 
9
9
  'use strict';
@@ -32,39 +32,6 @@ function _interopNamespace(e) {
32
32
 
33
33
  var EFFECTS__namespace = /*#__PURE__*/_interopNamespace(EFFECTS);
34
34
 
35
- function _set_prototype_of(o, p) {
36
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
37
- o.__proto__ = p;
38
- return o;
39
- };
40
- return _set_prototype_of(o, p);
41
- }
42
-
43
- function _inherits(subClass, superClass) {
44
- if (typeof superClass !== "function" && superClass !== null) {
45
- throw new TypeError("Super expression must either be null or a function");
46
- }
47
- subClass.prototype = Object.create(superClass && superClass.prototype, {
48
- constructor: {
49
- value: subClass,
50
- writable: true,
51
- configurable: true
52
- }
53
- });
54
- if (superClass) _set_prototype_of(subClass, superClass);
55
- }
56
-
57
- // class DowngradeItem {
58
- // // empty
59
- // }
60
- var DowngradeVFXItem = /*#__PURE__*/ function(VFXItem) {
61
- _inherits(DowngradeVFXItem, VFXItem);
62
- function DowngradeVFXItem() {
63
- return VFXItem.apply(this, arguments);
64
- }
65
- return DowngradeVFXItem;
66
- }(EFFECTS.VFXItem);
67
-
68
35
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
69
36
  try {
70
37
  var info = gen[key](arg);
@@ -92,6 +59,28 @@ function _async_to_generator(fn) {
92
59
  };
93
60
  }
94
61
 
62
+ function _set_prototype_of(o, p) {
63
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
64
+ o.__proto__ = p;
65
+ return o;
66
+ };
67
+ return _set_prototype_of(o, p);
68
+ }
69
+
70
+ function _inherits(subClass, superClass) {
71
+ if (typeof superClass !== "function" && superClass !== null) {
72
+ throw new TypeError("Super expression must either be null or a function");
73
+ }
74
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
75
+ constructor: {
76
+ value: subClass,
77
+ writable: true,
78
+ configurable: true
79
+ }
80
+ });
81
+ if (superClass) _set_prototype_of(subClass, superClass);
82
+ }
83
+
95
84
  function __generator(thisArg, body) {
96
85
  var _ = {
97
86
  label: 0,
@@ -192,81 +181,248 @@ typeof SuppressedError === "function" ? SuppressedError : function _SuppressedEr
192
181
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
193
182
  };
194
183
 
184
+ function _extends() {
185
+ _extends = Object.assign || function assign(target) {
186
+ for(var i = 1; i < arguments.length; i++){
187
+ var source = arguments[i];
188
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
189
+ }
190
+ return target;
191
+ };
192
+ return _extends.apply(this, arguments);
193
+ }
194
+
195
+ var DeviceLevel;
196
+ (function(DeviceLevel) {
197
+ DeviceLevel["High"] = "high";
198
+ DeviceLevel["Medium"] = "medium";
199
+ DeviceLevel["Low"] = "low";
200
+ DeviceLevel["Unknown"] = "unknown";
201
+ })(DeviceLevel || (DeviceLevel = {}));
202
+
203
+ var deviceModelList = [
204
+ "12,8",
205
+ "13,1",
206
+ "13,2",
207
+ "13,3",
208
+ "13,4"
209
+ ];
210
+ var DeviceProxy = /*#__PURE__*/ function() {
211
+ function DeviceProxy() {
212
+ this.isIOS = false;
213
+ this.model = "DESKTOP_DEBUG";
214
+ this.system = "Unknown";
215
+ this.level = DeviceLevel.Unknown;
216
+ this.isDowngrade = false;
217
+ }
218
+ var _proto = DeviceProxy.prototype;
219
+ _proto.setSystemInfo = function setSystemInfo(systemInfo) {
220
+ var performance = systemInfo.performance, platform = systemInfo.platform, _systemInfo_model = systemInfo.model, model = _systemInfo_model === void 0 ? "UNKNOWN_DEVICE" : _systemInfo_model, _systemInfo_system = systemInfo.system, system = _systemInfo_system === void 0 ? "Unknown" : _systemInfo_system;
221
+ this.isIOS = platform === "iOS";
222
+ this.model = model;
223
+ this.system = system;
224
+ this.setLevel(performance);
225
+ };
226
+ _proto.getDowngradeDecision = function getDowngradeDecision(result) {
227
+ var resultType = undefined;
228
+ var resultReason = undefined;
229
+ if (result.error) {
230
+ // 无权调用的情况下不降级
231
+ return {
232
+ downgrade: result.error !== 4,
233
+ level: this.getRenderLevel(),
234
+ reason: "api error: " + result.error
235
+ };
236
+ }
237
+ try {
238
+ var ret = EFFECTS.isString(result) ? JSON.parse(result) : result;
239
+ if ("downgradeResultType" in ret) {
240
+ resultType = ret.downgradeResultType;
241
+ } else if ("resultType" in ret) {
242
+ resultType = ret.resultType;
243
+ resultReason = ret.resultReason;
244
+ }
245
+ if (result.context) {
246
+ var deviceInfo = result.context.deviceInfo;
247
+ if (deviceInfo) {
248
+ var deviceLevel = deviceInfo.deviceLevel;
249
+ var newLevel = getDeviceLevel(deviceLevel);
250
+ if (newLevel !== DeviceLevel.Unknown) {
251
+ this.level = newLevel;
252
+ }
253
+ }
254
+ }
255
+ } catch (ex) {
256
+ EFFECTS.logger.error(ex);
257
+ }
258
+ if (resultType === undefined) {
259
+ return {
260
+ downgrade: true,
261
+ level: this.getRenderLevel(),
262
+ reason: "call downgrade fail"
263
+ };
264
+ }
265
+ if (resultType === 1) {
266
+ return {
267
+ downgrade: true,
268
+ level: this.getRenderLevel(),
269
+ reason: getDowngradeReason(resultReason)
270
+ };
271
+ }
272
+ if (EFFECTS.isAlipayMiniApp() && this.downgradeForMiniprogram()) {
273
+ return {
274
+ downgrade: true,
275
+ level: this.getRenderLevel(),
276
+ reason: "Force downgrade by downgrade plugin"
277
+ };
278
+ }
279
+ return {
280
+ downgrade: false,
281
+ level: this.getRenderLevel(),
282
+ reason: resultType
283
+ };
284
+ };
285
+ _proto.getRenderLevel = function getRenderLevel() {
286
+ if (this.level === DeviceLevel.High) {
287
+ return EFFECTS.spec.RenderLevel.S;
288
+ } else if (this.level === DeviceLevel.Medium) {
289
+ return EFFECTS.spec.RenderLevel.A;
290
+ } else if (this.level === DeviceLevel.Low) {
291
+ return EFFECTS.spec.RenderLevel.B;
292
+ } else {
293
+ return this.isIOS ? EFFECTS.spec.RenderLevel.S : EFFECTS.spec.RenderLevel.B;
294
+ }
295
+ };
296
+ _proto.setLevel = function setLevel(level) {
297
+ this.level = getDeviceLevel(level);
298
+ if (this.level === DeviceLevel.Unknown) {
299
+ if (/iPhone(\d+),/.test(this.model)) {
300
+ var gen = +RegExp.$1;
301
+ if (gen <= 9) {
302
+ this.level = DeviceLevel.Low;
303
+ } else if (gen < 10) {
304
+ this.level = DeviceLevel.Medium;
305
+ } else {
306
+ this.level = DeviceLevel.High;
307
+ }
308
+ }
309
+ }
310
+ };
311
+ _proto.downgradeForMiniprogram = function downgradeForMiniprogram() {
312
+ var _this = this;
313
+ if (this.isIOS) {
314
+ if (deviceModelList.find(function(v) {
315
+ return v === _this.model;
316
+ })) {
317
+ var versionList = this.system.split(".");
318
+ if (versionList.length > 0 && versionList[0] === "16") {
319
+ return true;
320
+ }
321
+ }
322
+ }
323
+ return false;
324
+ };
325
+ return DeviceProxy;
326
+ }();
327
+ function getDowngradeReason(reason) {
328
+ if (reason === -1) {
329
+ return "" + reason + ", unable to pull configuration";
330
+ } else if (reason === 0) {
331
+ return "" + reason + ", no downgrade";
332
+ } else if (reason === 1) {
333
+ return "" + reason + ", memory downgrade";
334
+ } else if (reason === 2) {
335
+ return "" + reason + ", crash downgrade";
336
+ } else if (reason === 3) {
337
+ return "" + reason + ", basic dimension downgrade";
338
+ } else if (reason === 4) {
339
+ return "" + reason + ", technical point downgrade";
340
+ } else if (reason === 5) {
341
+ return "" + reason + ", GPU downgrade";
342
+ } else if (reason === 6) {
343
+ return "" + reason + ", self-healing downgrade";
344
+ } else if (reason === 7) {
345
+ return "" + reason + ", 32-bit CPU downgrade";
346
+ } else {
347
+ return "" + reason;
348
+ }
349
+ }
350
+ function getDeviceLevel(level) {
351
+ if (level === "high") {
352
+ return DeviceLevel.High;
353
+ } else if (level === "medium" || level === "middle") {
354
+ return DeviceLevel.Medium;
355
+ } else if (level === "low") {
356
+ return DeviceLevel.Low;
357
+ } else {
358
+ return DeviceLevel.Unknown;
359
+ }
360
+ }
361
+
362
+ var internalPaused = Symbol("@@_inter_pause");
195
363
  var mockIdPass = "mock-pass";
196
364
  var mockIdFail = "mock-fail";
197
- var DEVICE_LEVEL_HIGH = "high";
198
- var DEVICE_LEVEL_MEDIUM = "medium";
199
- var DEVICE_LEVEL_LOW = "low";
200
- var DEVICE_LEVEL_NONE = "none";
201
365
  var hasRegisterEvent = false;
202
366
  function getDowngradeResult(bizId) {
203
367
  return _getDowngradeResult.apply(this, arguments);
204
368
  }
205
369
  function _getDowngradeResult() {
206
370
  _getDowngradeResult = _async_to_generator(function(bizId, options) {
207
- var ap, now;
371
+ var _options_level, ap, _options_level1, systemStartTime;
208
372
  return __generator(this, function(_state) {
209
373
  if (options === void 0) options = {};
210
374
  if (!hasRegisterEvent) {
211
- registerEvent(options);
212
375
  hasRegisterEvent = true;
376
+ registerEvent(options);
213
377
  }
214
378
  if (bizId === mockIdFail || bizId === mockIdPass) {
215
379
  return [
216
380
  2,
217
381
  Promise.resolve({
218
- mock: {
219
- downgrade: bizId === mockIdFail
220
- }
382
+ bizId: bizId,
383
+ downgrade: bizId === mockIdFail,
384
+ level: (_options_level = options.level) != null ? _options_level : EFFECTS.spec.RenderLevel.S,
385
+ reason: "mock"
221
386
  })
222
387
  ];
223
388
  }
224
389
  ap = EFFECTS.isAlipayMiniApp() ? my : window.AlipayJSBridge;
225
- if (ap) {
226
- now = performance.now();
227
- return [
228
- 2,
229
- getSystemInfo().then(function(systemInfo) {
230
- return new Promise(function(resolve) {
231
- var techPoint = [
232
- "mars"
233
- ];
234
- var tc = options.techPoint;
235
- if (tc) {
236
- var _techPoint;
237
- (_techPoint = techPoint).push.apply(_techPoint, [].concat(tc));
238
- }
239
- var downgradeOptions = {
240
- bizId: bizId,
241
- scene: 0,
242
- ext: {
243
- techPoint: techPoint
244
- }
245
- };
246
- var downgradeCallback = function(result) {
247
- var totalTime = performance.now() - now;
248
- console.info("Downgrade time: " + totalTime + "ms.");
249
- resolve({
250
- bizId: bizId,
251
- systemInfo: systemInfo,
252
- downgradeResult: result,
253
- totalTime: totalTime
254
- });
255
- };
256
- var _options_callBridge;
257
- var callBridge = (_options_callBridge = options.callBridge) != null ? _options_callBridge : ap.call;
258
- callBridge("getDowngradeResult", downgradeOptions, downgradeCallback);
259
- });
260
- })
261
- ];
262
- } else {
390
+ if (!ap) {
263
391
  return [
264
392
  2,
265
- Promise.resolve({
266
- noAlipayEnv: true
267
- })
393
+ {
394
+ bizId: bizId,
395
+ downgrade: false,
396
+ level: (_options_level1 = options.level) != null ? _options_level1 : EFFECTS.spec.RenderLevel.S,
397
+ reason: "Non-Alipay environment"
398
+ }
268
399
  ];
269
400
  }
401
+ systemStartTime = performance.now();
402
+ return [
403
+ 2,
404
+ getSystemInfoJSAPI(options, ap).then(function(systemInfo) {
405
+ var systemEndTime = performance.now();
406
+ return getDowngradeResultJSAPI(bizId, options, ap).then(function(downgradeResult) {
407
+ var downgradeEndTime = performance.now();
408
+ EFFECTS.logger.info("Downgrade time: " + (downgradeEndTime - systemStartTime) + "ms.");
409
+ var device = new DeviceProxy();
410
+ device.setSystemInfo(systemInfo);
411
+ var decision = device.getDowngradeDecision(downgradeResult);
412
+ if (options.level) {
413
+ decision.level = options.level;
414
+ }
415
+ var result = _extends({}, decision, {
416
+ bizId: bizId,
417
+ systemInfo: systemInfo,
418
+ systemTime: systemEndTime - systemStartTime,
419
+ downgradeResult: downgradeResult,
420
+ downgradeTime: downgradeEndTime - systemEndTime
421
+ });
422
+ return result;
423
+ });
424
+ })
425
+ ];
270
426
  });
271
427
  });
272
428
  return _getDowngradeResult.apply(this, arguments);
@@ -283,17 +439,21 @@ function registerEvent(options) {
283
439
  document.addEventListener("resume", resumePausedPlayers);
284
440
  }
285
441
  }
286
- function getSystemInfo() {
287
- return _getSystemInfo.apply(this, arguments);
442
+ function getSystemInfoJSAPI(options, ap) {
443
+ return _getSystemInfoJSAPI.apply(this, arguments);
288
444
  }
289
- function _getSystemInfo() {
290
- _getSystemInfo = _async_to_generator(function() {
445
+ function _getSystemInfoJSAPI() {
446
+ _getSystemInfoJSAPI = _async_to_generator(function(options, ap) {
291
447
  return __generator(this, function(_state) {
292
- return [
293
- 2,
294
- new Promise(function(resolve, reject) {
295
- var ap = EFFECTS.isAlipayMiniApp() ? my : window.AlipayJSBridge;
296
- if (ap) {
448
+ if (options.systemInfo) {
449
+ return [
450
+ 2,
451
+ Promise.resolve(options.systemInfo)
452
+ ];
453
+ } else {
454
+ return [
455
+ 2,
456
+ new Promise(function(resolve, reject) {
297
457
  ap.call("getSystemInfo", function(e) {
298
458
  if (e.error) {
299
459
  reject(e);
@@ -301,189 +461,58 @@ function _getSystemInfo() {
301
461
  resolve(e);
302
462
  }
303
463
  });
304
- } else {
305
- reject("no ap");
306
- }
307
- })
308
- ];
464
+ })
465
+ ];
466
+ }
309
467
  });
310
468
  });
311
- return _getSystemInfo.apply(this, arguments);
469
+ return _getSystemInfoJSAPI.apply(this, arguments);
312
470
  }
313
- var DeviceProxy = /*#__PURE__*/ function() {
314
- function DeviceProxy() {
315
- this.isIOS = false;
316
- this.model = "DESKTOP_DEBUG";
317
- this.system = "Unknown";
318
- this.deviceLevel = DEVICE_LEVEL_NONE;
319
- this.isDowngrade = false;
320
- }
321
- var _proto = DeviceProxy.prototype;
322
- _proto.getRenderLevel = function getRenderLevel() {
323
- if (this.deviceLevel === DEVICE_LEVEL_HIGH) {
324
- return EFFECTS.spec.RenderLevel.S;
325
- } else if (this.deviceLevel === DEVICE_LEVEL_MEDIUM) {
326
- return EFFECTS.spec.RenderLevel.A;
327
- } else if (this.deviceLevel === DEVICE_LEVEL_LOW) {
328
- return EFFECTS.spec.RenderLevel.B;
329
- } else {
330
- return this.isIOS ? EFFECTS.spec.RenderLevel.S : EFFECTS.spec.RenderLevel.B;
331
- }
332
- };
333
- _proto.hasDeviceLevel = function hasDeviceLevel() {
334
- return isDeviceLevel(this.deviceLevel);
335
- };
336
- _proto.setBySystemInfo = function setBySystemInfo(systemInfo) {
337
- var performance1 = systemInfo.performance, platform = systemInfo.platform, _systemInfo_model = systemInfo.model, model = _systemInfo_model === void 0 ? "UNKNOWN_DEVICE" : _systemInfo_model, _systemInfo_system = systemInfo.system, system = _systemInfo_system === void 0 ? "Unknown" : _systemInfo_system;
338
- this.isIOS = platform === "iOS";
339
- this.model = model;
340
- this.system = system;
341
- if (performance1 && !this.hasDeviceLevel()) {
342
- this.deviceLevel = performance1;
343
- }
344
- };
345
- _proto.updateDeviceLevel = function updateDeviceLevel() {
346
- if (this.hasDeviceLevel()) {
347
- return;
348
- }
349
- if (/iPhone(\d+),/.test(this.model)) {
350
- var gen = +RegExp.$1;
351
- if (gen <= 9) {
352
- this.deviceLevel = DEVICE_LEVEL_LOW;
353
- } else if (gen < 10) {
354
- this.deviceLevel = DEVICE_LEVEL_MEDIUM;
355
- } else {
356
- this.deviceLevel = DEVICE_LEVEL_HIGH;
357
- }
358
- }
359
- };
360
- _proto.getDeviceInfo = function getDeviceInfo() {
361
- return {
362
- isIOS: this.isIOS,
363
- model: this.model,
364
- system: this.system,
365
- deviceLevel: this.deviceLevel
366
- };
367
- };
368
- return DeviceProxy;
369
- }();
370
- var device = new DeviceProxy();
371
- function checkDowngradeResult(result) {
372
- if (result.mock) {
373
- var _result_mock = result.mock, downgrade = _result_mock.downgrade, _result_mock_deviceLevel = _result_mock.deviceLevel, deviceLevel = _result_mock_deviceLevel === void 0 ? DEVICE_LEVEL_HIGH : _result_mock_deviceLevel;
374
- device.deviceLevel = deviceLevel;
375
- return {
376
- downgrade: downgrade,
377
- reason: "mock"
378
- };
379
- }
380
- if (result.noAlipayEnv) {
381
- return {
382
- downgrade: false,
383
- reason: "no AP env"
384
- };
385
- }
386
- if (!result.systemInfo) {
387
- return {
388
- downgrade: false,
389
- reason: "systemInfo is required"
390
- };
391
- }
392
- if (!result.downgradeResult) {
393
- return {
394
- downgrade: false,
395
- reason: "downgradeResult is required"
396
- };
397
- }
398
- device.setBySystemInfo(result.systemInfo);
399
- return parseDowngradeResult(result.downgradeResult);
471
+ function getDowngradeResultJSAPI(bizId, options, ap) {
472
+ return _getDowngradeResultJSAPI.apply(this, arguments);
400
473
  }
401
- function parseDowngradeResult(result) {
402
- var resultType = undefined;
403
- var resultReason = undefined;
404
- if (!result.error) {
405
- try {
406
- var ret = EFFECTS.isString(result) ? JSON.parse(result) : result;
407
- if ("downgradeResultType" in ret) {
408
- resultType = ret.downgradeResultType;
409
- } else if ("resultType" in ret) {
410
- resultType = ret.resultType;
411
- resultReason = ret.resultReason;
412
- }
413
- if (result.context) {
414
- var deviceInfo = result.context.deviceInfo;
415
- if (deviceInfo) {
416
- var deviceLevel = deviceInfo.deviceLevel;
417
- if (isDeviceLevel(deviceLevel)) {
418
- device.deviceLevel = deviceLevel;
419
- }
420
- }
421
- }
422
- device.updateDeviceLevel();
423
- } catch (ex) {
424
- console.error(ex);
425
- }
426
- if (resultType === undefined) {
427
- return {
428
- downgrade: true,
429
- reason: "call downgrade fail"
430
- };
431
- } else {
432
- if (resultType === 1) {
433
- return {
434
- downgrade: true,
435
- reason: getDowngradeReason(resultReason)
436
- };
474
+ function _getDowngradeResultJSAPI() {
475
+ _getDowngradeResultJSAPI = _async_to_generator(function(bizId, options, ap) {
476
+ return __generator(this, function(_state) {
477
+ if (options.downgradeResult) {
478
+ return [
479
+ 2,
480
+ Promise.resolve(options.downgradeResult)
481
+ ];
437
482
  } else {
438
- if (EFFECTS.isAlipayMiniApp() && downgradeForMiniprogram()) {
439
- return {
440
- downgrade: true,
441
- reason: "Force downgrade by downgrade plugin"
442
- };
443
- } else {
444
- return {
445
- downgrade: false,
446
- reason: resultType
447
- };
448
- }
483
+ return [
484
+ 2,
485
+ new Promise(function(resolve, reject) {
486
+ var techPoint = [
487
+ "mars"
488
+ ];
489
+ var tc = options.techPoint;
490
+ if (tc) {
491
+ var _techPoint;
492
+ (_techPoint = techPoint).push.apply(_techPoint, [].concat(tc));
493
+ }
494
+ var downgradeOptions = {
495
+ bizId: bizId,
496
+ scene: 0,
497
+ ext: {
498
+ techPoint: techPoint
499
+ }
500
+ };
501
+ var _options_callBridge;
502
+ var callBridge = (_options_callBridge = options.callBridge) != null ? _options_callBridge : ap.call;
503
+ callBridge("getDowngradeResult", downgradeOptions, function(result) {
504
+ resolve(result);
505
+ });
506
+ })
507
+ ];
449
508
  }
450
- }
451
- } else {
452
- // 无权调用的情况下不降级
453
- return {
454
- downgrade: result.error !== 4,
455
- reason: "api error: " + result.error
456
- };
457
- }
458
- }
459
- function getDowngradeReason(reason) {
460
- if (reason === -1) {
461
- return "" + reason + "-no config";
462
- } else if (reason === 0) {
463
- return "" + reason + "-none";
464
- } else if (reason === 1) {
465
- return "" + reason + "-downgrade by memory";
466
- } else if (reason === 2) {
467
- return "" + reason + "-downgrade by crash";
468
- } else if (reason === 3) {
469
- return "" + reason + "-downgrade by device";
470
- } else if (reason === 4) {
471
- return "" + reason + "-downgrade by force";
472
- } else {
473
- return "" + reason;
474
- }
475
- }
476
- function getRenderLevelByDevice(renderLevel) {
477
- if (!renderLevel) {
478
- return device.getRenderLevel();
479
- } else {
480
- return /[ABS]/.test(renderLevel) ? renderLevel : EFFECTS.spec.RenderLevel.S;
481
- }
509
+ });
510
+ });
511
+ return _getDowngradeResultJSAPI.apply(this, arguments);
482
512
  }
483
- function isDeviceLevel(deviceLevel) {
484
- return deviceLevel === DEVICE_LEVEL_HIGH || deviceLevel === DEVICE_LEVEL_MEDIUM || deviceLevel === DEVICE_LEVEL_LOW;
513
+ function getDefaultRenderLevel() {
514
+ return EFFECTS.isIOS() ? EFFECTS.spec.RenderLevel.S : EFFECTS.spec.RenderLevel.B;
485
515
  }
486
- var internalPaused = Symbol("@@_inter_pause");
487
516
  function pauseAllActivePlayers(e) {
488
517
  if (e.target === document) {
489
518
  EFFECTS.logger.info("Auto pause all players with data offloaded.");
@@ -513,29 +542,6 @@ function resumePausedPlayers(e) {
513
542
  });
514
543
  }
515
544
  }
516
- var deviceModelList = [
517
- "12,8",
518
- "13,1",
519
- "13,2",
520
- "13,3",
521
- "13,4"
522
- ];
523
- /**
524
- * iPhone SE2 和 12 全系列机型,如果是 iOS16 系统,在小程序中强制降级
525
- * @returns
526
- */ function downgradeForMiniprogram() {
527
- if (device.isIOS) {
528
- if (deviceModelList.find(function(v) {
529
- return v === device.model;
530
- })) {
531
- var versionList = device.system.split(".");
532
- if (versionList.length > 0 && versionList[0] === "16") {
533
- return true;
534
- }
535
- }
536
- }
537
- return false;
538
- }
539
545
 
540
546
  var AlipayDowngradePlugin = /*#__PURE__*/ function(AbstractPlugin) {
541
547
  _inherits(AlipayDowngradePlugin, AbstractPlugin);
@@ -545,19 +551,18 @@ var AlipayDowngradePlugin = /*#__PURE__*/ function(AbstractPlugin) {
545
551
  AlipayDowngradePlugin.processRawJSON = function processRawJSON(json, options) {
546
552
  if (options === void 0) options = {};
547
553
  return _async_to_generator(function() {
548
- var _options_pluginData, downgradeResult, downgradeDecision;
554
+ var _options_pluginData, downgradeResult, _downgradeResult_level;
549
555
  return __generator(this, function(_state) {
550
556
  downgradeResult = (_options_pluginData = options.pluginData) == null ? void 0 : _options_pluginData["downgrade"];
551
557
  if (downgradeResult) {
552
- downgradeDecision = checkDowngradeResult(downgradeResult);
553
- if (downgradeDecision.downgrade) {
554
- throw new Error("Downgraded, reason: " + downgradeDecision.reason + ".");
558
+ if (downgradeResult.downgrade) {
559
+ throw new Error("Downgraded, reason: " + downgradeResult.reason + ".");
555
560
  }
556
561
  } else {
557
- console.warn("No downgrade result in pluginData of SceneLoadOptions.");
562
+ EFFECTS.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");
558
563
  }
559
564
  if (!options.renderLevel) {
560
- options.renderLevel = getRenderLevelByDevice(options.renderLevel);
565
+ options.renderLevel = (_downgradeResult_level = downgradeResult == null ? void 0 : downgradeResult.level) != null ? _downgradeResult_level : getDefaultRenderLevel();
561
566
  }
562
567
  return [
563
568
  2
@@ -589,16 +594,14 @@ function nativeLogger(type, msg) {
589
594
  }
590
595
  }
591
596
 
592
- var version = "2.0.0-alpha.26";
593
- EFFECTS.registerPlugin("alipay-downgrade", AlipayDowngradePlugin, DowngradeVFXItem, true);
597
+ var version = "2.0.0-alpha.28";
598
+ EFFECTS.registerPlugin("alipay-downgrade", AlipayDowngradePlugin, EFFECTS.VFXItem, true);
594
599
  EFFECTS.logger.info("Plugin downgrade version: " + version + ".");
595
600
  if (version !== EFFECTS__namespace.version) {
596
601
  console.error("注意:请统一 Downgrade 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Downgrade plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");
597
602
  }
598
603
 
599
- exports.checkDowngradeResult = checkDowngradeResult;
600
- exports.downgradeForMiniprogram = downgradeForMiniprogram;
604
+ exports.getDefaultRenderLevel = getDefaultRenderLevel;
601
605
  exports.getDowngradeResult = getDowngradeResult;
602
- exports.getRenderLevelByDevice = getRenderLevelByDevice;
603
606
  exports.version = version;
604
607
  //# sourceMappingURL=index.js.map