Doric remove DoricAssetsResource for now
This commit is contained in:
parent
65105eabfc
commit
894cc91dd6
@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright [2021] [Doric.Pub]
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package pub.doric.resource;
|
|
||||||
|
|
||||||
import pub.doric.DoricContext;
|
|
||||||
import pub.doric.async.AsyncResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: This represents an arrayBuffer resource
|
|
||||||
* @Author: pengfei.zhou
|
|
||||||
* @CreateDate: 2021/11/18
|
|
||||||
*/
|
|
||||||
public class DoricArrayBufferResource extends DoricResource {
|
|
||||||
private final byte[] data;
|
|
||||||
|
|
||||||
public DoricArrayBufferResource(DoricContext doricContext, byte[] data) {
|
|
||||||
super(doricContext, "");
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AsyncResult<byte[]> fetchRaw() {
|
|
||||||
return new AsyncResult<>(data);
|
|
||||||
}
|
|
||||||
}
|
|
@ -48,17 +48,10 @@ public class DoricResourceManager {
|
|||||||
String identifier = resource.getProperty("identifier").asString().value();
|
String identifier = resource.getProperty("identifier").asString().value();
|
||||||
DoricResource doricResource = doricContext.getCachedResource(resId);
|
DoricResource doricResource = doricContext.getCachedResource(resId);
|
||||||
if (doricResource == null) {
|
if (doricResource == null) {
|
||||||
if ("arrayBuffer".equals(type)) {
|
DoricResourceLoader loader = mResourceLoaders.get(type);
|
||||||
doricResource = new DoricArrayBufferResource(
|
if (loader != null) {
|
||||||
doricContext,
|
doricResource = loader.load(doricContext, identifier);
|
||||||
resource.getProperty("data").asArrayBuffer().value()
|
doricContext.cacheResource(resId, doricResource);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
DoricResourceLoader loader = mResourceLoaders.get(type);
|
|
||||||
if (loader != null) {
|
|
||||||
doricResource = loader.load(doricContext, identifier);
|
|
||||||
doricContext.cacheResource(resId, doricResource);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return doricResource;
|
return doricResource;
|
||||||
|
@ -2244,23 +2244,6 @@ var BundleResource = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
return BundleResource;
|
return BundleResource;
|
||||||
}(iOSResource));
|
}(iOSResource));
|
||||||
var ArrayBufferResource = /** @class */ (function (_super) {
|
|
||||||
__extends$f(ArrayBufferResource, _super);
|
|
||||||
function ArrayBufferResource(data) {
|
|
||||||
var _this = _super.call(this, "arrayBuffer", "") || this;
|
|
||||||
_this.data = data;
|
|
||||||
return _this;
|
|
||||||
}
|
|
||||||
ArrayBufferResource.prototype.toModel = function () {
|
|
||||||
return {
|
|
||||||
data: this.data,
|
|
||||||
resId: this.resId,
|
|
||||||
type: this.type,
|
|
||||||
identifier: this.identifier,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
return ArrayBufferResource;
|
|
||||||
}(Resource));
|
|
||||||
|
|
||||||
var __extends$e = (undefined && undefined.__extends) || (function () {
|
var __extends$e = (undefined && undefined.__extends) || (function () {
|
||||||
var extendStatics = function (d, b) {
|
var extendStatics = function (d, b) {
|
||||||
@ -4640,7 +4623,6 @@ exports.AlphaAnimation = AlphaAnimation;
|
|||||||
exports.AndroidAssetsResource = AndroidAssetsResource;
|
exports.AndroidAssetsResource = AndroidAssetsResource;
|
||||||
exports.AndroidResource = AndroidResource;
|
exports.AndroidResource = AndroidResource;
|
||||||
exports.AnimationSet = AnimationSet;
|
exports.AnimationSet = AnimationSet;
|
||||||
exports.ArrayBufferResource = ArrayBufferResource;
|
|
||||||
exports.AssetsResource = AssetsResource;
|
exports.AssetsResource = AssetsResource;
|
||||||
exports.BOTTOM = BOTTOM;
|
exports.BOTTOM = BOTTOM;
|
||||||
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
||||||
|
@ -1680,20 +1680,6 @@ class BundleResource extends iOSResource {
|
|||||||
super("bundle", `${bundleName}://${fileName}`);
|
super("bundle", `${bundleName}://${fileName}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class ArrayBufferResource extends Resource {
|
|
||||||
constructor(data) {
|
|
||||||
super("arrayBuffer", "");
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
toModel() {
|
|
||||||
return {
|
|
||||||
data: this.data,
|
|
||||||
resId: this.resId,
|
|
||||||
type: this.type,
|
|
||||||
identifier: this.identifier,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
@ -3538,7 +3524,6 @@ exports.AlphaAnimation = AlphaAnimation;
|
|||||||
exports.AndroidAssetsResource = AndroidAssetsResource;
|
exports.AndroidAssetsResource = AndroidAssetsResource;
|
||||||
exports.AndroidResource = AndroidResource;
|
exports.AndroidResource = AndroidResource;
|
||||||
exports.AnimationSet = AnimationSet;
|
exports.AnimationSet = AnimationSet;
|
||||||
exports.ArrayBufferResource = ArrayBufferResource;
|
|
||||||
exports.AssetsResource = AssetsResource;
|
exports.AssetsResource = AssetsResource;
|
||||||
exports.BOTTOM = BOTTOM;
|
exports.BOTTOM = BOTTOM;
|
||||||
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
||||||
|
@ -3208,20 +3208,6 @@ class BundleResource extends iOSResource {
|
|||||||
super("bundle", `${bundleName}://${fileName}`);
|
super("bundle", `${bundleName}://${fileName}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class ArrayBufferResource extends Resource {
|
|
||||||
constructor(data) {
|
|
||||||
super("arrayBuffer", "");
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
toModel() {
|
|
||||||
return {
|
|
||||||
data: this.data,
|
|
||||||
resId: this.resId,
|
|
||||||
type: this.type,
|
|
||||||
identifier: this.identifier,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
@ -5307,7 +5293,6 @@ exports.AlphaAnimation = AlphaAnimation;
|
|||||||
exports.AndroidAssetsResource = AndroidAssetsResource;
|
exports.AndroidAssetsResource = AndroidAssetsResource;
|
||||||
exports.AndroidResource = AndroidResource;
|
exports.AndroidResource = AndroidResource;
|
||||||
exports.AnimationSet = AnimationSet;
|
exports.AnimationSet = AnimationSet;
|
||||||
exports.ArrayBufferResource = ArrayBufferResource;
|
|
||||||
exports.AssetsResource = AssetsResource;
|
exports.AssetsResource = AssetsResource;
|
||||||
exports.BOTTOM = BOTTOM;
|
exports.BOTTOM = BOTTOM;
|
||||||
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
||||||
|
10
doric-js/index.d.ts
vendored
10
doric-js/index.d.ts
vendored
@ -1766,16 +1766,6 @@ declare module 'doric/lib/src/util/resource' {
|
|||||||
export class BundleResource extends iOSResource {
|
export class BundleResource extends iOSResource {
|
||||||
constructor(bundleName: string, fileName: string);
|
constructor(bundleName: string, fileName: string);
|
||||||
}
|
}
|
||||||
export class ArrayBufferResource extends Resource {
|
|
||||||
data: ArrayBuffer;
|
|
||||||
constructor(data: ArrayBuffer);
|
|
||||||
toModel(): {
|
|
||||||
data: ArrayBuffer;
|
|
||||||
resId: string;
|
|
||||||
type: string;
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'doric/lib/src/pattern/candies' {
|
declare module 'doric/lib/src/pattern/candies' {
|
||||||
|
10
doric-js/lib/src/util/resource.d.ts
vendored
10
doric-js/lib/src/util/resource.d.ts
vendored
@ -50,13 +50,3 @@ export declare class MainBundleResource extends iOSResource {
|
|||||||
export declare class BundleResource extends iOSResource {
|
export declare class BundleResource extends iOSResource {
|
||||||
constructor(bundleName: string, fileName: string);
|
constructor(bundleName: string, fileName: string);
|
||||||
}
|
}
|
||||||
export declare class ArrayBufferResource extends Resource {
|
|
||||||
data: ArrayBuffer;
|
|
||||||
constructor(data: ArrayBuffer);
|
|
||||||
toModel(): {
|
|
||||||
data: ArrayBuffer;
|
|
||||||
resId: string;
|
|
||||||
type: string;
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
@ -71,17 +71,3 @@ export class BundleResource extends iOSResource {
|
|||||||
super("bundle", `${bundleName}://${fileName}`);
|
super("bundle", `${bundleName}://${fileName}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class ArrayBufferResource extends Resource {
|
|
||||||
constructor(data) {
|
|
||||||
super("arrayBuffer", "");
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
toModel() {
|
|
||||||
return {
|
|
||||||
data: this.data,
|
|
||||||
resId: this.resId,
|
|
||||||
type: this.type,
|
|
||||||
identifier: this.identifier,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -83,19 +83,3 @@ export class BundleResource extends iOSResource {
|
|||||||
super("bundle", `${bundleName}://${fileName}`)
|
super("bundle", `${bundleName}://${fileName}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ArrayBufferResource extends Resource {
|
|
||||||
data: ArrayBuffer
|
|
||||||
constructor(data: ArrayBuffer) {
|
|
||||||
super("arrayBuffer", "")
|
|
||||||
this.data = data
|
|
||||||
}
|
|
||||||
toModel() {
|
|
||||||
return {
|
|
||||||
data: this.data,
|
|
||||||
resId: this.resId,
|
|
||||||
type: this.type,
|
|
||||||
identifier: this.identifier,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
15
doric-web/dist/index.js
vendored
15
doric-web/dist/index.js
vendored
@ -3282,20 +3282,6 @@ class BundleResource extends iOSResource {
|
|||||||
super("bundle", `${bundleName}://${fileName}`);
|
super("bundle", `${bundleName}://${fileName}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class ArrayBufferResource extends Resource {
|
|
||||||
constructor(data) {
|
|
||||||
super("arrayBuffer", "");
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
toModel() {
|
|
||||||
return {
|
|
||||||
data: this.data,
|
|
||||||
resId: this.resId,
|
|
||||||
type: this.type,
|
|
||||||
identifier: this.identifier,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
@ -5140,7 +5126,6 @@ exports.AlphaAnimation = AlphaAnimation;
|
|||||||
exports.AndroidAssetsResource = AndroidAssetsResource;
|
exports.AndroidAssetsResource = AndroidAssetsResource;
|
||||||
exports.AndroidResource = AndroidResource;
|
exports.AndroidResource = AndroidResource;
|
||||||
exports.AnimationSet = AnimationSet;
|
exports.AnimationSet = AnimationSet;
|
||||||
exports.ArrayBufferResource = ArrayBufferResource;
|
|
||||||
exports.AssetsResource = AssetsResource;
|
exports.AssetsResource = AssetsResource;
|
||||||
exports.BOTTOM = BOTTOM;
|
exports.BOTTOM = BOTTOM;
|
||||||
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user