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