olympus-r-17plugins
Version:
A plugin of Olympus for 17zuoye.
61 lines (60 loc) • 2.2 kB
JavaScript
import * as tslib_1 from "tslib";
import { load } from "olympus-r/utils/HTTPUtil";
import { wrapHost } from "olympus-r/utils/URLUtil";
import { ClientType, GPUStatus, Platform } from "./Shell17";
import Shell17Mobile from "./Shell17Mobile";
/**
* @author Raykid
* @email initial_r@qq.com
* @create date 2017-10-25
* @modify date 2017-10-25
*
* 针对一起作业安卓外壳
*/
var Shell17Android = /** @class */ (function (_super) {
tslib_1.__extends(Shell17Android, _super);
function Shell17Android() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(Shell17Android.prototype, "platform", {
get: function () {
return Platform.Android17;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Shell17Android.prototype, "clientType", {
get: function () {
return ClientType.UNKNOWN;
},
enumerable: true,
configurable: true
});
Shell17Android.prototype.hasGPU = function (callback) {
// 安卓需要向后端请求是否开启硬件加速
var url = wrapHost("/client/closehalist.vpage", window.location.origin);
load({
url: url,
responseType: "json",
onResponse: function (data) {
if (data.success && data['halist'] && data['halist'] != null) {
var halist = data.halist;
var models = halist.split(",");
var ua = navigator.userAgent;
var close = false;
// 遍历数组,匹配到就是关闭,否则就是开启
for (var i in models) {
var model = models[i];
if (ua.indexOf(model) >= 0) {
close = true;
break;
}
}
callback(close ? GPUStatus.CLOSE : GPUStatus.AUTO);
}
}
});
};
return Shell17Android;
}(Shell17Mobile));
export default Shell17Android;