@galacean/effects-plugin-alipay-downgrade 2.4.3 → 2.4.4
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 +1 -1
- package/dist/alipay.mjs +1 -1
- package/dist/index.js +2 -2
- package/dist/index.min.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
package/dist/alipay.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/alipay"),n=require("@galacean/appx-adapter/alipay");function r(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}})),n.default=e,Object.freeze(n)}var t,o=r(e);function i(e,n,r,t,o,i,l){try{var a=e[i](l),s=a.value}catch(e){return void r(e)}a.done?n(s):Promise.resolve(s).then(t,o)}function l(e){return function(){var n=this,r=arguments;return new Promise((function(t,o){var l=e.apply(n,r);function a(e){i(l,t,o,a,s,"next",e)}function s(e){i(l,t,o,a,s,"throw",e)}a(void 0)}))}}function a(e,n){return a=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},a(e,n)}function s(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function u(){return u=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},u.apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError,exports.DeviceLevel=void 0,(t=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",t.Medium="medium",t.Low="low",t.Unknown="unknown";var c=["12,8","13,1","13,2","13,3","13,4"],d=function(){function n(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=exports.DeviceLevel.Unknown,this.isDowngrade=!1}var r=n.prototype;return r.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system,l=void 0===i?"Unknown":i;this.isIOS="iOS"===r,this.model=o,this.system=l,this.setLevel(n)},r.getDowngradeDecision=function(n){var r=void 0,t=void 0;if(n.error)return{downgrade:4!==n.error,level:this.getRenderLevel(),reason:"api error: "+n.error};try{var o=e.isString(n)?JSON.parse(n):n;if("downgradeResultType"in o?r=o.downgradeResultType:"resultType"in o&&(r=o.resultType,t=o.resultReason),n.context){var i=n.context.deviceInfo;if(i){var l=p(i.deviceLevel);l!==exports.DeviceLevel.Unknown&&(this.level=l)}}}catch(n){e.logger.error(n)}return void 0===r?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===r?{downgrade:!0,level:this.getRenderLevel(),reason:v(t)}:e.isAlipayMiniApp()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+r}},r.getRenderLevel=function(){return this.level===exports.DeviceLevel.High?e.spec.RenderLevel.S:this.level===exports.DeviceLevel.Medium?e.spec.RenderLevel.A:this.level===exports.DeviceLevel.Low?e.spec.RenderLevel.B:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},r.setLevel=function(e){if(this.level=p(e),this.level===exports.DeviceLevel.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?exports.DeviceLevel.Low:n<10?exports.DeviceLevel.Medium:exports.DeviceLevel.High}},r.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&c.find((function(n){return n===e.model}))){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},n}();function v(e){return-1===e?e+", unable to pull configuration":0===e?e+", no downgrade":1===e?e+", memory downgrade":2===e?e+", crash downgrade":3===e?e+", basic dimension downgrade":4===e?e+", technical point downgrade":5===e?e+", GPU downgrade":6===e?e+", self-healing downgrade":7===e?e+", 32-bit CPU downgrade":""+e}function p(e){return"high"===e?exports.DeviceLevel.High:"medium"===e||"middle"===e?exports.DeviceLevel.Medium:"low"===e?exports.DeviceLevel.Low:exports.DeviceLevel.Unknown}var f=Symbol("@@_inter_pause"),g="mock-pass",w="mock-fail",h=!1,y=void 0!==n.window;function m(){return m=l((function(r,t){var o,i,l,a,c;return s(this,(function(s){return void 0===t&&(t={}),y?(h||(h=!0,function(r){var t=r.autoPause;n.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",P),document.addEventListener("resume",R))}(t)),r===w||r===g?[2,Promise.resolve({bizId:r,downgrade:r===w,level:null!=(i=t.level)?i:e.spec.RenderLevel.S,reason:"mock"})]:(l=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge)||t.systemInfo&&t.downgradeResult?(c=performance.now(),[2,L(t,l).then((function(n){var o=performance.now();return function(e,n,r){return D.apply(this,arguments)}(r,t,l).then((function(i){var l=performance.now();e.logger.info("Downgrade time: "+(l-c)+"ms.");var a=new d;a.setSystemInfo(n);var s=a.getDowngradeDecision(i);return t.level&&(s.level=t.level),u({},s,{bizId:r,systemInfo:n,systemTime:o-c,downgradeResult:i,downgradeTime:l-o})}))}))]):[2,{bizId:r,downgrade:!1,level:null!=(a=t.level)?a:e.spec.RenderLevel.S,reason:"Non-Alipay environment"}]):[2,Promise.resolve({bizId:r,downgrade:!0,level:null!=(o=t.level)?o:e.spec.RenderLevel.S,reason:"当前环境无法访问 window"})]}))})),m.apply(this,arguments)}function L(e,n){return b.apply(this,arguments)}function b(){return b=l((function(e,n){return s(this,(function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise((function(e,r){n.call("getSystemInfo",(function(n){n.error?r(n):e(n)}))}))]}))})),b.apply(this,arguments)}function D(){return D=l((function(e,n,r){return s(this,(function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise((function(t,o){var i,l=["mars"],a=n.techPoint;a&&(i=l).push.apply(i,[].concat(a));var s,u={bizId:e,scene:0,ext:{techPoint:l}};(null!=(s=n.callBridge)?s:r.call)("getDowngradeResult",u,(function(e){t(e)}))}))]}))})),D.apply(this,arguments)}function x(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function P(n){n.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[f]=!0)})))}function R(n){n.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[f]&&(e.resume(),e[f]=!1)})))}var S=function(n){function r(){return n.apply(this,arguments)}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&a(e,n)}(r,n),r.processRawJSON=function(n,r){return void 0===r&&(r={}),l((function(){var n,t,o;return s(this,(function(i){if(t=null==(n=r.pluginData)?void 0:n.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return r.renderLevel||(r.renderLevel=null!=(o=null==t?void 0:t.level)?o:x()),[2]}))}))()},r}(e.AbstractPlugin);if(y){var O=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge;e.logger.register((function(n,r){for(var t=arguments.length,o=new Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];var l={message:"[Galacean Effects] "+r+" "+o.join(""),level:n};e.isAndroid()&&(l.anr_info="mars");try{null==O||O.call("localLog",l)}catch(e){console.error(e)}}))}var I="2.4.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@galacean/effects/alipay"),n=require("@galacean/appx-adapter/alipay");function r(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}})),n.default=e,Object.freeze(n)}var t,o=r(e);function i(e,n,r,t,o,i,l){try{var a=e[i](l),s=a.value}catch(e){return void r(e)}a.done?n(s):Promise.resolve(s).then(t,o)}function l(e){return function(){var n=this,r=arguments;return new Promise((function(t,o){var l=e.apply(n,r);function a(e){i(l,t,o,a,s,"next",e)}function s(e){i(l,t,o,a,s,"throw",e)}a(void 0)}))}}function a(e,n){return a=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},a(e,n)}function s(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function u(){return u=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},u.apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError,exports.DeviceLevel=void 0,(t=exports.DeviceLevel||(exports.DeviceLevel={})).High="high",t.Medium="medium",t.Low="low",t.Unknown="unknown";var c=["12,8","13,1","13,2","13,3","13,4"],d=function(){function n(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=exports.DeviceLevel.Unknown,this.isDowngrade=!1}var r=n.prototype;return r.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system,l=void 0===i?"Unknown":i;this.isIOS="iOS"===r,this.model=o,this.system=l,this.setLevel(n)},r.getDowngradeDecision=function(n){var r=void 0,t=void 0;if(n.error)return{downgrade:4!==n.error,level:this.getRenderLevel(),reason:"api error: "+n.error};try{var o=e.isString(n)?JSON.parse(n):n;if("downgradeResultType"in o?r=o.downgradeResultType:"resultType"in o&&(r=o.resultType,t=o.resultReason),n.context){var i=n.context.deviceInfo;if(i){var l=p(i.deviceLevel);l!==exports.DeviceLevel.Unknown&&(this.level=l)}}}catch(n){e.logger.error(n)}return void 0===r?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===r?{downgrade:!0,level:this.getRenderLevel(),reason:v(t)}:e.isAlipayMiniApp()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+r}},r.getRenderLevel=function(){return this.level===exports.DeviceLevel.High?e.spec.RenderLevel.S:this.level===exports.DeviceLevel.Medium?e.spec.RenderLevel.A:this.level===exports.DeviceLevel.Low?e.spec.RenderLevel.B:this.isIOS?e.spec.RenderLevel.S:e.spec.RenderLevel.B},r.setLevel=function(e){if(this.level=p(e),this.level===exports.DeviceLevel.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?exports.DeviceLevel.Low:n<10?exports.DeviceLevel.Medium:exports.DeviceLevel.High}},r.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&c.find((function(n){return n===e.model}))){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},n}();function v(e){return-1===e?e+", unable to pull configuration":0===e?e+", no downgrade":1===e?e+", memory downgrade":2===e?e+", crash downgrade":3===e?e+", basic dimension downgrade":4===e?e+", technical point downgrade":5===e?e+", GPU downgrade":6===e?e+", self-healing downgrade":7===e?e+", 32-bit CPU downgrade":""+e}function p(e){return"high"===e?exports.DeviceLevel.High:"medium"===e||"middle"===e?exports.DeviceLevel.Medium:"low"===e?exports.DeviceLevel.Low:exports.DeviceLevel.Unknown}var f=Symbol("@@_inter_pause"),g="mock-pass",w="mock-fail",h=!1,y=void 0!==n.window;function m(){return m=l((function(r,t){var o,i,l,a,c;return s(this,(function(s){return void 0===t&&(t={}),y?(h||(h=!0,function(r){var t=r.autoPause;n.window.addEventListener("unload",(function(){e.getActivePlayers().forEach((function(e){return e.dispose()}))})),t&&(document.addEventListener("pause",P),document.addEventListener("resume",R))}(t)),r===w||r===g?[2,Promise.resolve({bizId:r,downgrade:r===w,level:null!=(i=t.level)?i:e.spec.RenderLevel.S,reason:"mock"})]:(l=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge)||t.systemInfo&&t.downgradeResult?(c=performance.now(),[2,L(t,l).then((function(n){var o=performance.now();return function(e,n,r){return D.apply(this,arguments)}(r,t,l).then((function(i){var l=performance.now();e.logger.info("Downgrade time: "+(l-c)+"ms.");var a=new d;a.setSystemInfo(n);var s=a.getDowngradeDecision(i);return t.level&&(s.level=t.level),u({},s,{bizId:r,systemInfo:n,systemTime:o-c,downgradeResult:i,downgradeTime:l-o})}))}))]):[2,{bizId:r,downgrade:!1,level:null!=(a=t.level)?a:e.spec.RenderLevel.S,reason:"Non-Alipay environment"}]):[2,Promise.resolve({bizId:r,downgrade:!0,level:null!=(o=t.level)?o:e.spec.RenderLevel.S,reason:"当前环境无法访问 window"})]}))})),m.apply(this,arguments)}function L(e,n){return b.apply(this,arguments)}function b(){return b=l((function(e,n){return s(this,(function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise((function(e,r){n.call("getSystemInfo",(function(n){n.error?r(n):e(n)}))}))]}))})),b.apply(this,arguments)}function D(){return D=l((function(e,n,r){return s(this,(function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise((function(t,o){var i,l=["mars"],a=n.techPoint;a&&(i=l).push.apply(i,[].concat(a));var s,u={bizId:e,scene:0,ext:{techPoint:l}};(null!=(s=n.callBridge)?s:r.call)("getDowngradeResult",u,(function(e){t(e)}))}))]}))})),D.apply(this,arguments)}function x(){return e.isIOS()?e.spec.RenderLevel.S:e.spec.RenderLevel.B}function P(n){n.target===document&&(e.logger.info("Auto pause all players with data offloaded."),e.getActivePlayers().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[f]=!0)})))}function R(n){n.target===document&&(e.logger.info("Auto resume all players."),e.getActivePlayers().forEach((function(e){e[f]&&(e.resume(),e[f]=!1)})))}var S=function(n){function r(){return n.apply(this,arguments)}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&a(e,n)}(r,n),r.processRawJSON=function(n,r){return void 0===r&&(r={}),l((function(){var n,t,o;return s(this,(function(i){if(t=null==(n=r.pluginData)?void 0:n.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else e.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return r.renderLevel||(r.renderLevel=null!=(o=null==t?void 0:t.level)?o:x()),[2]}))}))()},r}(e.AbstractPlugin);if(y){var O=e.isAlipayMiniApp()?my:n.window.AlipayJSBridge;e.logger.register((function(n,r){for(var t=arguments.length,o=new Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];var l={message:"[Galacean Effects] "+r+" "+o.join(""),level:n};e.isAndroid()&&(l.anr_info="mars");try{null==O||O.call("localLog",l)}catch(e){console.error(e)}}))}var I="2.4.4";e.registerPlugin("alipay-downgrade",S,e.VFXItem),e.logger.info("Plugin downgrade version: 2.4.4."),I!==o.version&&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!"),exports.canUseBOM=y,exports.getDefaultRenderLevel=x,exports.getDowngradeResult=function(e){return m.apply(this,arguments)},exports.version=I;
|
|
2
2
|
//# sourceMappingURL=alipay.js.map
|
package/dist/alipay.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"@galacean/effects/alipay";import{isString as n,logger as r,isAlipayMiniApp as t,spec as o,isIOS as i,getActivePlayers as a,AbstractPlugin as l,isAndroid as s,registerPlugin as u,VFXItem as d}from"@galacean/effects/alipay";import{window as c}from"@galacean/appx-adapter/alipay";function f(e,n,r,t,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void r(e)}l.done?n(s):Promise.resolve(s).then(t,o)}function v(e){return function(){var n=this,r=arguments;return new Promise((function(t,o){var i=e.apply(n,r);function a(e){f(i,t,o,a,l,"next",e)}function l(e){f(i,t,o,a,l,"throw",e)}a(void 0)}))}}function p(e,n){return p=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},p(e,n)}function h(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&l[0]?t.return:l[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,l[1])).done)return o;switch(t=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,t=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=n.call(e,i)}catch(e){l=[6,e],t=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}function g(){return g=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},g.apply(this,arguments)}var w;"function"==typeof SuppressedError&&SuppressedError,function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(w||(w={}));var m=["12,8","13,1","13,2","13,3","13,4"],y=function(){function e(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=w.Unknown,this.isDowngrade=!1}var i=e.prototype;return i.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system,a=void 0===i?"Unknown":i;this.isIOS="iOS"===r,this.model=o,this.system=a,this.setLevel(n)},i.getDowngradeDecision=function(e){var o=void 0,i=void 0;if(e.error)return{downgrade:4!==e.error,level:this.getRenderLevel(),reason:"api error: "+e.error};try{var a=n(e)?JSON.parse(e):e;if("downgradeResultType"in a?o=a.downgradeResultType:"resultType"in a&&(o=a.resultType,i=a.resultReason),e.context){var l=e.context.deviceInfo;if(l){var s=L(l.deviceLevel);s!==w.Unknown&&(this.level=s)}}}catch(e){r.error(e)}return void 0===o?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===o?{downgrade:!0,level:this.getRenderLevel(),reason:b(i)}:t()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+o}},i.getRenderLevel=function(){return this.level===w.High?o.RenderLevel.S:this.level===w.Medium?o.RenderLevel.A:this.level===w.Low?o.RenderLevel.B:this.isIOS?o.RenderLevel.S:o.RenderLevel.B},i.setLevel=function(e){if(this.level=L(e),this.level===w.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?w.Low:n<10?w.Medium:w.High}},i.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&m.find((function(n){return n===e.model}))){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},e}();function b(e){return-1===e?e+", unable to pull configuration":0===e?e+", no downgrade":1===e?e+", memory downgrade":2===e?e+", crash downgrade":3===e?e+", basic dimension downgrade":4===e?e+", technical point downgrade":5===e?e+", GPU downgrade":6===e?e+", self-healing downgrade":7===e?e+", 32-bit CPU downgrade":""+e}function L(e){return"high"===e?w.High:"medium"===e||"middle"===e?w.Medium:"low"===e?w.Low:w.Unknown}var R=Symbol("@@_inter_pause"),S="mock-pass",P="mock-fail",I=!1,O=void 0!==c;function E(e){return k.apply(this,arguments)}function k(){return k=v((function(e,n){var i,l,s,u,d;return h(this,(function(f){return void 0===n&&(n={}),O?(I||(I=!0,function(e){var n=e.autoPause;c.addEventListener("unload",(function(){a().forEach((function(e){return e.dispose()}))})),n&&(document.addEventListener("pause",_),document.addEventListener("resume",A))}(n)),e===P||e===S?[2,Promise.resolve({bizId:e,downgrade:e===P,level:null!=(l=n.level)?l:o.RenderLevel.S,reason:"mock"})]:(s=t()?my:c.AlipayJSBridge)||n.systemInfo&&n.downgradeResult?(d=performance.now(),[2,D(n,s).then((function(t){var o=performance.now();return function(e,n,r){return U.apply(this,arguments)}(e,n,s).then((function(i){var a=performance.now();r.info("Downgrade time: "+(a-d)+"ms.");var l=new y;l.setSystemInfo(t);var s=l.getDowngradeDecision(i);return n.level&&(s.level=n.level),g({},s,{bizId:e,systemInfo:t,systemTime:o-d,downgradeResult:i,downgradeTime:a-o})}))}))]):[2,{bizId:e,downgrade:!1,level:null!=(u=n.level)?u:o.RenderLevel.S,reason:"Non-Alipay environment"}]):[2,Promise.resolve({bizId:e,downgrade:!0,level:null!=(i=n.level)?i:o.RenderLevel.S,reason:"当前环境无法访问 window"})]}))})),k.apply(this,arguments)}function D(e,n){return x.apply(this,arguments)}function x(){return x=v((function(e,n){return h(this,(function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise((function(e,r){n.call("getSystemInfo",(function(n){n.error?r(n):e(n)}))}))]}))})),x.apply(this,arguments)}function U(){return U=v((function(e,n,r){return h(this,(function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise((function(t,o){var i,a=["mars"],l=n.techPoint;l&&(i=a).push.apply(i,[].concat(l));var s,u={bizId:e,scene:0,ext:{techPoint:a}};(null!=(s=n.callBridge)?s:r.call)("getDowngradeResult",u,(function(e){t(e)}))}))]}))})),U.apply(this,arguments)}function T(){return i()?o.RenderLevel.S:o.RenderLevel.B}function _(e){e.target===document&&(r.info("Auto pause all players with data offloaded."),a().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[R]=!0)})))}function A(e){e.target===document&&(r.info("Auto resume all players."),a().forEach((function(e){e[R]&&(e.resume(),e[R]=!1)})))}var j=function(e){function n(){return e.apply(this,arguments)}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&p(e,n)}(n,e),n.processRawJSON=function(e,n){return void 0===n&&(n={}),v((function(){var e,t,o;return h(this,(function(i){if(t=null==(e=n.pluginData)?void 0:e.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else r.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:T()),[2]}))}))()},n}(l);if(O){var B=t()?my:c.AlipayJSBridge;r.register((function(e,n){for(var r=arguments.length,t=new Array(r>2?r-2:0),o=2;o<r;o++)t[o-2]=arguments[o];var i={message:"[Galacean Effects] "+n+" "+t.join(""),level:e};s()&&(i.anr_info="mars");try{null==B||B.call("localLog",i)}catch(e){console.error(e)}}))}var M="2.4.
|
|
1
|
+
import*as e from"@galacean/effects/alipay";import{isString as n,logger as r,isAlipayMiniApp as t,spec as o,isIOS as i,getActivePlayers as a,AbstractPlugin as l,isAndroid as s,registerPlugin as u,VFXItem as d}from"@galacean/effects/alipay";import{window as c}from"@galacean/appx-adapter/alipay";function f(e,n,r,t,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void r(e)}l.done?n(s):Promise.resolve(s).then(t,o)}function v(e){return function(){var n=this,r=arguments;return new Promise((function(t,o){var i=e.apply(n,r);function a(e){f(i,t,o,a,l,"next",e)}function l(e){f(i,t,o,a,l,"throw",e)}a(void 0)}))}}function p(e,n){return p=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},p(e,n)}function h(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&l[0]?t.return:l[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,l[1])).done)return o;switch(t=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,t=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=n.call(e,i)}catch(e){l=[6,e],t=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}}function g(){return g=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},g.apply(this,arguments)}var w;"function"==typeof SuppressedError&&SuppressedError,function(e){e.High="high",e.Medium="medium",e.Low="low",e.Unknown="unknown"}(w||(w={}));var m=["12,8","13,1","13,2","13,3","13,4"],y=function(){function e(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=w.Unknown,this.isDowngrade=!1}var i=e.prototype;return i.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=void 0===t?"UNKNOWN_DEVICE":t,i=e.system,a=void 0===i?"Unknown":i;this.isIOS="iOS"===r,this.model=o,this.system=a,this.setLevel(n)},i.getDowngradeDecision=function(e){var o=void 0,i=void 0;if(e.error)return{downgrade:4!==e.error,level:this.getRenderLevel(),reason:"api error: "+e.error};try{var a=n(e)?JSON.parse(e):e;if("downgradeResultType"in a?o=a.downgradeResultType:"resultType"in a&&(o=a.resultType,i=a.resultReason),e.context){var l=e.context.deviceInfo;if(l){var s=L(l.deviceLevel);s!==w.Unknown&&(this.level=s)}}}catch(e){r.error(e)}return void 0===o?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===o?{downgrade:!0,level:this.getRenderLevel(),reason:b(i)}:t()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+o}},i.getRenderLevel=function(){return this.level===w.High?o.RenderLevel.S:this.level===w.Medium?o.RenderLevel.A:this.level===w.Low?o.RenderLevel.B:this.isIOS?o.RenderLevel.S:o.RenderLevel.B},i.setLevel=function(e){if(this.level=L(e),this.level===w.Unknown&&/iPhone(\d+),/.test(this.model)){var n=+RegExp.$1;this.level=n<=9?w.Low:n<10?w.Medium:w.High}},i.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&m.find((function(n){return n===e.model}))){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},e}();function b(e){return-1===e?e+", unable to pull configuration":0===e?e+", no downgrade":1===e?e+", memory downgrade":2===e?e+", crash downgrade":3===e?e+", basic dimension downgrade":4===e?e+", technical point downgrade":5===e?e+", GPU downgrade":6===e?e+", self-healing downgrade":7===e?e+", 32-bit CPU downgrade":""+e}function L(e){return"high"===e?w.High:"medium"===e||"middle"===e?w.Medium:"low"===e?w.Low:w.Unknown}var R=Symbol("@@_inter_pause"),S="mock-pass",P="mock-fail",I=!1,O=void 0!==c;function E(e){return k.apply(this,arguments)}function k(){return k=v((function(e,n){var i,l,s,u,d;return h(this,(function(f){return void 0===n&&(n={}),O?(I||(I=!0,function(e){var n=e.autoPause;c.addEventListener("unload",(function(){a().forEach((function(e){return e.dispose()}))})),n&&(document.addEventListener("pause",_),document.addEventListener("resume",A))}(n)),e===P||e===S?[2,Promise.resolve({bizId:e,downgrade:e===P,level:null!=(l=n.level)?l:o.RenderLevel.S,reason:"mock"})]:(s=t()?my:c.AlipayJSBridge)||n.systemInfo&&n.downgradeResult?(d=performance.now(),[2,D(n,s).then((function(t){var o=performance.now();return function(e,n,r){return U.apply(this,arguments)}(e,n,s).then((function(i){var a=performance.now();r.info("Downgrade time: "+(a-d)+"ms.");var l=new y;l.setSystemInfo(t);var s=l.getDowngradeDecision(i);return n.level&&(s.level=n.level),g({},s,{bizId:e,systemInfo:t,systemTime:o-d,downgradeResult:i,downgradeTime:a-o})}))}))]):[2,{bizId:e,downgrade:!1,level:null!=(u=n.level)?u:o.RenderLevel.S,reason:"Non-Alipay environment"}]):[2,Promise.resolve({bizId:e,downgrade:!0,level:null!=(i=n.level)?i:o.RenderLevel.S,reason:"当前环境无法访问 window"})]}))})),k.apply(this,arguments)}function D(e,n){return x.apply(this,arguments)}function x(){return x=v((function(e,n){return h(this,(function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise((function(e,r){n.call("getSystemInfo",(function(n){n.error?r(n):e(n)}))}))]}))})),x.apply(this,arguments)}function U(){return U=v((function(e,n,r){return h(this,(function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise((function(t,o){var i,a=["mars"],l=n.techPoint;l&&(i=a).push.apply(i,[].concat(l));var s,u={bizId:e,scene:0,ext:{techPoint:a}};(null!=(s=n.callBridge)?s:r.call)("getDowngradeResult",u,(function(e){t(e)}))}))]}))})),U.apply(this,arguments)}function T(){return i()?o.RenderLevel.S:o.RenderLevel.B}function _(e){e.target===document&&(r.info("Auto pause all players with data offloaded."),a().forEach((function(e){e.paused||(e.pause({offloadTexture:!0}),e[R]=!0)})))}function A(e){e.target===document&&(r.info("Auto resume all players."),a().forEach((function(e){e[R]&&(e.resume(),e[R]=!1)})))}var j=function(e){function n(){return e.apply(this,arguments)}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&p(e,n)}(n,e),n.processRawJSON=function(e,n){return void 0===n&&(n={}),v((function(){var e,t,o;return h(this,(function(i){if(t=null==(e=n.pluginData)?void 0:e.downgrade){if(t.downgrade)throw new Error("Downgraded, reason: "+t.reason)}else r.warn("No downgrade result in pluginData of SceneLoadOptions.");return n.renderLevel||(n.renderLevel=null!=(o=null==t?void 0:t.level)?o:T()),[2]}))}))()},n}(l);if(O){var B=t()?my:c.AlipayJSBridge;r.register((function(e,n){for(var r=arguments.length,t=new Array(r>2?r-2:0),o=2;o<r;o++)t[o-2]=arguments[o];var i={message:"[Galacean Effects] "+n+" "+t.join(""),level:e};s()&&(i.anr_info="mars");try{null==B||B.call("localLog",i)}catch(e){console.error(e)}}))}var M="2.4.4";u("alipay-downgrade",j,d),r.info("Plugin downgrade version: 2.4.4."),M!==e.version&&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!");export{w as DeviceLevel,O as canUseBOM,T as getDefaultRenderLevel,E as getDowngradeResult,M as version};
|
|
2
2
|
//# sourceMappingURL=alipay.mjs.map
|
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.4.
|
|
6
|
+
* Version: v2.4.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -653,7 +653,7 @@ if (canUseBOM) {
|
|
|
653
653
|
|
|
654
654
|
/**
|
|
655
655
|
* 插件版本号
|
|
656
|
-
*/ var version = "2.4.
|
|
656
|
+
*/ var version = "2.4.4";
|
|
657
657
|
EFFECTS.registerPlugin("alipay-downgrade", AlipayDowngradePlugin, EFFECTS.VFXItem);
|
|
658
658
|
EFFECTS.logger.info("Plugin downgrade version: " + version + ".");
|
|
659
659
|
if (version !== EFFECTS__namespace.version) {
|
package/dist/index.min.js
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Description: Galacean Effects player downgrade plugin for Alipay
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,意绮,飂兮
|
|
6
|
-
* Version: v2.4.
|
|
7
|
-
*/function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.alipayDowngradePlugin={}),e.ge)}(this,function(e,n){"use strict";var r,t=function(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),n.default=e,Object.freeze(n)}(n);function o(e,n,r,t,o,i,l){try{var a=e[i](l),s=a.value}catch(e){r(e);return}a.done?n(s):Promise.resolve(s).then(t,o)}function i(e){return function(){var n=this,r=arguments;return new Promise(function(t,i){var l=e.apply(n,r);function a(e){o(l,t,i,a,s,"next",e)}function s(e){o(l,t,i,a,s,"throw",e)}a(void 0)})}}function l(e,n){return(l=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function a(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function s(){return(s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError,e.DeviceLevel=void 0,(r=e.DeviceLevel||(e.DeviceLevel={})).High="high",r.Medium="medium",r.Low="low",r.Unknown="unknown";var u=["12,8","13,1","13,2","13,3","13,4"],c=function(){function r(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=e.DeviceLevel.Unknown,this.isDowngrade=!1}var t=r.prototype;return t.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=e.system;this.isIOS="iOS"===r,this.model=void 0===t?"UNKNOWN_DEVICE":t,this.system=void 0===o?"Unknown":o,this.setLevel(n)},t.getDowngradeDecision=function(r){var t=void 0,o=void 0;if(r.error)return{downgrade:4!==r.error,level:this.getRenderLevel(),reason:"api error: "+r.error};try{var i=n.isString(r)?JSON.parse(r):r;if("downgradeResultType"in i?t=i.downgradeResultType:"resultType"in i&&(t=i.resultType,o=i.resultReason),r.context){var l=r.context.deviceInfo;if(l){var a=l.deviceLevel,s=d(a);s!==e.DeviceLevel.Unknown&&(this.level=s)}}}catch(e){n.logger.error(e)}return void 0===t?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===t?{downgrade:!0,level:this.getRenderLevel(),reason:function(e){if(-1===e)return""+e+", unable to pull configuration";if(0===e)return""+e+", no downgrade";if(1===e)return""+e+", memory downgrade";if(2===e)return""+e+", crash downgrade";if(3===e)return""+e+", basic dimension downgrade";if(4===e)return""+e+", technical point downgrade";if(5===e)return""+e+", GPU downgrade";else if(6===e)return""+e+", self-healing downgrade";else if(7===e)return""+e+", 32-bit CPU downgrade";else return""+e}(o)}:n.isAlipayMiniApp()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+t}},t.getRenderLevel=function(){return this.level===e.DeviceLevel.High?n.spec.RenderLevel.S:this.level===e.DeviceLevel.Medium?n.spec.RenderLevel.A:this.level===e.DeviceLevel.Low?n.spec.RenderLevel.B:this.isIOS?n.spec.RenderLevel.S:n.spec.RenderLevel.B},t.setLevel=function(n){if(this.level=d(n),this.level===e.DeviceLevel.Unknown&&/iPhone(\d+),/.test(this.model)){var r=+RegExp.$1;r<=9?this.level=e.DeviceLevel.Low:r<10?this.level=e.DeviceLevel.Medium:this.level=e.DeviceLevel.High}},t.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&u.find(function(n){return n===e.model})){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},r}();function d(n){return"high"===n?e.DeviceLevel.High:"medium"===n||"middle"===n?e.DeviceLevel.Medium:"low"===n?e.DeviceLevel.Low:e.DeviceLevel.Unknown}var f=Symbol("@@_inter_pause"),v="mock-fail",p=!1,g="undefined"!=typeof window;function h(){return(h=i(function(e,r){var t,o,i,l,u;return a(this,function(a){var d;return(void 0===r&&(r={}),g)?(p||(p=!0,d=r.autoPause,window.addEventListener("unload",function(){n.getActivePlayers().forEach(function(e){return e.dispose()})}),d&&(document.addEventListener("pause",L),document.addEventListener("resume",b))),e===v||"mock-pass"===e)?[2,Promise.resolve({bizId:e,downgrade:e===v,level:null!=(o=r.level)?o:n.spec.RenderLevel.S,reason:"mock"})]:(i=n.isAlipayMiniApp()?my:window.AlipayJSBridge)||r.systemInfo&&r.downgradeResult?(u=performance.now(),[2,(function(e,n){return w.apply(this,arguments)})(r,i).then(function(t){var o=performance.now();return(function(e,n,r){return y.apply(this,arguments)})(e,r,i).then(function(i){var l=performance.now();n.logger.info("Downgrade time: "+(l-u)+"ms.");var a=new c;a.setSystemInfo(t);var d=a.getDowngradeDecision(i);return r.level&&(d.level=r.level),s({},d,{bizId:e,systemInfo:t,systemTime:o-u,downgradeResult:i,downgradeTime:l-o})})})]):[2,{bizId:e,downgrade:!1,level:null!=(l=r.level)?l:n.spec.RenderLevel.S,reason:"Non-Alipay environment"}]:[2,Promise.resolve({bizId:e,downgrade:!0,level:null!=(t=r.level)?t:n.spec.RenderLevel.S,reason:"当前环境无法访问 window"})]})})).apply(this,arguments)}function w(){return(w=i(function(e,n){return a(this,function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise(function(e,r){n.call("getSystemInfo",function(n){n.error?r(n):e(n)})})]})})).apply(this,arguments)}function y(){return(y=i(function(e,n,r){return a(this,function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise(function(t,o){var i,l=["mars"],a=n.techPoint;a&&l.push.apply(l,[].concat(a)),(null!=(i=n.callBridge)?i:r.call)("getDowngradeResult",{bizId:e,scene:0,ext:{techPoint:l}},function(e){t(e)})})]})})).apply(this,arguments)}function m(){return n.isIOS()?n.spec.RenderLevel.S:n.spec.RenderLevel.B}function L(e){e.target===document&&(n.logger.info("Auto pause all players with data offloaded."),n.getActivePlayers().forEach(function(e){e.paused||(e.pause({offloadTexture:!0}),e[f]=!0)}))}function b(e){e.target===document&&(n.logger.info("Auto resume all players."),n.getActivePlayers().forEach(function(e){e[f]&&(e.resume(),e[f]=!1)}))}var D=function(e){function r(){return e.apply(this,arguments)}return!function(e,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&l(e,n)}(r,e),r.processRawJSON=function(e,r){return void 0===r&&(r={}),i(function(){var e,t,o;return a(this,function(i){if(t=null==(e=r.pluginData)?void 0:e.downgrade){if(t.downgrade)throw Error("Downgraded, reason: "+t.reason)}else n.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return r.renderLevel||(r.renderLevel=null!=(o=null==t?void 0:t.level)?o:m()),[2]})})()},r}(n.AbstractPlugin);if(g){var P=n.isAlipayMiniApp()?my:window.AlipayJSBridge;n.logger.register(function(e,r){for(var t=arguments.length,o=Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];var l={message:"[Galacean Effects] "+r+" "+o.join(""),level:e};n.isAndroid()&&(l.anr_info="mars");try{null==P||P.call("localLog",l)}catch(e){console.error(e)}})}var R="2.4.
|
|
6
|
+
* Version: v2.4.4
|
|
7
|
+
*/function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.alipayDowngradePlugin={}),e.ge)}(this,function(e,n){"use strict";var r,t=function(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,t.get?t:{enumerable:!0,get:function(){return e[r]}})}}),n.default=e,Object.freeze(n)}(n);function o(e,n,r,t,o,i,l){try{var a=e[i](l),s=a.value}catch(e){r(e);return}a.done?n(s):Promise.resolve(s).then(t,o)}function i(e){return function(){var n=this,r=arguments;return new Promise(function(t,i){var l=e.apply(n,r);function a(e){o(l,t,i,a,s,"next",e)}function s(e){o(l,t,i,a,s,"throw",e)}a(void 0)})}}function l(e,n){return(l=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function a(e,n){var r,t,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=a(0),l.throw=a(1),l.return=a(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function a(a){return function(s){return function(a){if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function s(){return(s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}"function"==typeof SuppressedError&&SuppressedError,e.DeviceLevel=void 0,(r=e.DeviceLevel||(e.DeviceLevel={})).High="high",r.Medium="medium",r.Low="low",r.Unknown="unknown";var u=["12,8","13,1","13,2","13,3","13,4"],c=function(){function r(){this.isIOS=!1,this.model="DESKTOP_DEBUG",this.system="Unknown",this.level=e.DeviceLevel.Unknown,this.isDowngrade=!1}var t=r.prototype;return t.setSystemInfo=function(e){var n=e.performance,r=e.platform,t=e.model,o=e.system;this.isIOS="iOS"===r,this.model=void 0===t?"UNKNOWN_DEVICE":t,this.system=void 0===o?"Unknown":o,this.setLevel(n)},t.getDowngradeDecision=function(r){var t=void 0,o=void 0;if(r.error)return{downgrade:4!==r.error,level:this.getRenderLevel(),reason:"api error: "+r.error};try{var i=n.isString(r)?JSON.parse(r):r;if("downgradeResultType"in i?t=i.downgradeResultType:"resultType"in i&&(t=i.resultType,o=i.resultReason),r.context){var l=r.context.deviceInfo;if(l){var a=l.deviceLevel,s=d(a);s!==e.DeviceLevel.Unknown&&(this.level=s)}}}catch(e){n.logger.error(e)}return void 0===t?{downgrade:!0,level:this.getRenderLevel(),reason:"call downgrade fail"}:1===t?{downgrade:!0,level:this.getRenderLevel(),reason:function(e){if(-1===e)return""+e+", unable to pull configuration";if(0===e)return""+e+", no downgrade";if(1===e)return""+e+", memory downgrade";if(2===e)return""+e+", crash downgrade";if(3===e)return""+e+", basic dimension downgrade";if(4===e)return""+e+", technical point downgrade";if(5===e)return""+e+", GPU downgrade";else if(6===e)return""+e+", self-healing downgrade";else if(7===e)return""+e+", 32-bit CPU downgrade";else return""+e}(o)}:n.isAlipayMiniApp()&&this.downgradeForMiniprogram()?{downgrade:!0,level:this.getRenderLevel(),reason:"Force downgrade by downgrade plugin"}:{downgrade:!1,level:this.getRenderLevel(),reason:""+t}},t.getRenderLevel=function(){return this.level===e.DeviceLevel.High?n.spec.RenderLevel.S:this.level===e.DeviceLevel.Medium?n.spec.RenderLevel.A:this.level===e.DeviceLevel.Low?n.spec.RenderLevel.B:this.isIOS?n.spec.RenderLevel.S:n.spec.RenderLevel.B},t.setLevel=function(n){if(this.level=d(n),this.level===e.DeviceLevel.Unknown&&/iPhone(\d+),/.test(this.model)){var r=+RegExp.$1;r<=9?this.level=e.DeviceLevel.Low:r<10?this.level=e.DeviceLevel.Medium:this.level=e.DeviceLevel.High}},t.downgradeForMiniprogram=function(){var e=this;if(this.isIOS&&u.find(function(n){return n===e.model})){var n=this.system.split(".");if(n.length>0&&"16"===n[0])return!0}return!1},r}();function d(n){return"high"===n?e.DeviceLevel.High:"medium"===n||"middle"===n?e.DeviceLevel.Medium:"low"===n?e.DeviceLevel.Low:e.DeviceLevel.Unknown}var f=Symbol("@@_inter_pause"),v="mock-fail",p=!1,g="undefined"!=typeof window;function h(){return(h=i(function(e,r){var t,o,i,l,u;return a(this,function(a){var d;return(void 0===r&&(r={}),g)?(p||(p=!0,d=r.autoPause,window.addEventListener("unload",function(){n.getActivePlayers().forEach(function(e){return e.dispose()})}),d&&(document.addEventListener("pause",L),document.addEventListener("resume",b))),e===v||"mock-pass"===e)?[2,Promise.resolve({bizId:e,downgrade:e===v,level:null!=(o=r.level)?o:n.spec.RenderLevel.S,reason:"mock"})]:(i=n.isAlipayMiniApp()?my:window.AlipayJSBridge)||r.systemInfo&&r.downgradeResult?(u=performance.now(),[2,(function(e,n){return w.apply(this,arguments)})(r,i).then(function(t){var o=performance.now();return(function(e,n,r){return y.apply(this,arguments)})(e,r,i).then(function(i){var l=performance.now();n.logger.info("Downgrade time: "+(l-u)+"ms.");var a=new c;a.setSystemInfo(t);var d=a.getDowngradeDecision(i);return r.level&&(d.level=r.level),s({},d,{bizId:e,systemInfo:t,systemTime:o-u,downgradeResult:i,downgradeTime:l-o})})})]):[2,{bizId:e,downgrade:!1,level:null!=(l=r.level)?l:n.spec.RenderLevel.S,reason:"Non-Alipay environment"}]:[2,Promise.resolve({bizId:e,downgrade:!0,level:null!=(t=r.level)?t:n.spec.RenderLevel.S,reason:"当前环境无法访问 window"})]})})).apply(this,arguments)}function w(){return(w=i(function(e,n){return a(this,function(r){return e.systemInfo?[2,Promise.resolve(e.systemInfo)]:[2,new Promise(function(e,r){n.call("getSystemInfo",function(n){n.error?r(n):e(n)})})]})})).apply(this,arguments)}function y(){return(y=i(function(e,n,r){return a(this,function(t){return n.downgradeResult?[2,Promise.resolve(n.downgradeResult)]:[2,new Promise(function(t,o){var i,l=["mars"],a=n.techPoint;a&&l.push.apply(l,[].concat(a)),(null!=(i=n.callBridge)?i:r.call)("getDowngradeResult",{bizId:e,scene:0,ext:{techPoint:l}},function(e){t(e)})})]})})).apply(this,arguments)}function m(){return n.isIOS()?n.spec.RenderLevel.S:n.spec.RenderLevel.B}function L(e){e.target===document&&(n.logger.info("Auto pause all players with data offloaded."),n.getActivePlayers().forEach(function(e){e.paused||(e.pause({offloadTexture:!0}),e[f]=!0)}))}function b(e){e.target===document&&(n.logger.info("Auto resume all players."),n.getActivePlayers().forEach(function(e){e[f]&&(e.resume(),e[f]=!1)}))}var D=function(e){function r(){return e.apply(this,arguments)}return!function(e,n){if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&l(e,n)}(r,e),r.processRawJSON=function(e,r){return void 0===r&&(r={}),i(function(){var e,t,o;return a(this,function(i){if(t=null==(e=r.pluginData)?void 0:e.downgrade){if(t.downgrade)throw Error("Downgraded, reason: "+t.reason)}else n.logger.warn("No downgrade result in pluginData of SceneLoadOptions.");return r.renderLevel||(r.renderLevel=null!=(o=null==t?void 0:t.level)?o:m()),[2]})})()},r}(n.AbstractPlugin);if(g){var P=n.isAlipayMiniApp()?my:window.AlipayJSBridge;n.logger.register(function(e,r){for(var t=arguments.length,o=Array(t>2?t-2:0),i=2;i<t;i++)o[i-2]=arguments[i];var l={message:"[Galacean Effects] "+r+" "+o.join(""),level:e};n.isAndroid()&&(l.anr_info="mars");try{null==P||P.call("localLog",l)}catch(e){console.error(e)}})}var R="2.4.4";n.registerPlugin("alipay-downgrade",D,n.VFXItem),n.logger.info("Plugin downgrade version: "+R+"."),R!==t.version&&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!"),e.canUseBOM=g,e.getDefaultRenderLevel=m,e.getDowngradeResult=function(e){return h.apply(this,arguments)},e.version=R,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
8
8
|
//# sourceMappingURL=index.min.js.map
|
package/dist/index.mjs
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.4.
|
|
6
|
+
* Version: v2.4.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -630,7 +630,7 @@ if (canUseBOM) {
|
|
|
630
630
|
|
|
631
631
|
/**
|
|
632
632
|
* 插件版本号
|
|
633
|
-
*/ var version = "2.4.
|
|
633
|
+
*/ var version = "2.4.4";
|
|
634
634
|
registerPlugin("alipay-downgrade", AlipayDowngradePlugin, VFXItem);
|
|
635
635
|
logger.info("Plugin downgrade version: " + version + ".");
|
|
636
636
|
if (version !== EFFECTS.version) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-plugin-alipay-downgrade",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"description": "Galacean Effects player downgrade plugin for Alipay",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"registry": "https://registry.npmjs.org"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@galacean/effects": "2.4.
|
|
42
|
+
"@galacean/effects": "2.4.4"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "vite",
|