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