File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export function setShowError(value: boolean);
1414
1515export interface ZippedAssetPackageOptions {
1616 zipPath : string ;
17+ basePack ?
1718}
1819
1920export class ZippedAssetPackage extends BaseNative < any , ZippedAssetPackageOptions > {
Original file line number Diff line number Diff line change @@ -67,13 +67,27 @@ const currentAppFolder = knownFolders.currentApp();
6767
6868export class ZippedAssetPackage extends BaseNative < NTZippedAssetPackage , ZippedAssetPackageOptions > {
6969 createNative ( options : ZippedAssetPackageOptions ) {
70- const zipPath = getRelativePathToApp ( options . zipPath ) ;
71- if ( File . exists ( zipPath ) ) {
72- const vectorTileStyleSetData = NTAssetUtils . loadAsset ( zipPath ) ;
73- return NTZippedAssetPackage . alloc ( ) . initWithZipData ( vectorTileStyleSetData ) ;
74- } else {
75- console . error ( `could not find zip file: ${ options . zipPath } ` ) ;
76- return null ;
70+ let zipPath ;
71+ try {
72+ const fullZipPath = getFileName ( options . zipPath ) ;
73+ zipPath = getRelativePathToApp ( options . zipPath ) ;
74+ if ( File . exists ( fullZipPath ) ) {
75+ let assetPackage : NTAssetPackage ;
76+ if ( options . basePack ) {
77+ assetPackage = options . basePack . getNative ( ) ;
78+ }
79+ const vectorTileStyleSetData = NTAssetUtils . loadAsset ( zipPath ) ;
80+ if ( assetPackage ) {
81+ return NTZippedAssetPackage . alloc ( ) . initWithZipDataBaseAssetPackage ( vectorTileStyleSetData , assetPackage ) ;
82+ } else {
83+ return NTZippedAssetPackage . alloc ( ) . initWithZipData ( vectorTileStyleSetData ) ;
84+ }
85+ } else {
86+ throw new Error ( `could not find zip file: ${ options . zipPath } (${ zipPath } )` )
87+ }
88+ } catch ( error ) {
89+ console . error ( `ZippedAssetPackage(${ zipPath } , ${ options . zipPath } ): ${ error } ` ) ;
90+ throw error ;
7791 }
7892 }
7993 getAssetNames ( ) {
You can’t perform that action at this time.
0 commit comments