@@ -7,48 +7,48 @@ export default class GEOResourceManifest {
77 static Author = "Virgil Clyne" ;
88
99 static async downloadResourceManifest ( request = $request , countryCode = "CN" ) {
10- log ( ` ☑️ Download ResourceManifest` , "" ) ;
10+ log ( " ☑️ Download ResourceManifest" , "" ) ;
1111 const newRequest = { ...request } ;
1212 newRequest . url = new URL ( newRequest . url ) ;
1313 newRequest . url . searchParams . set ( "country_code" , countryCode ) ;
1414 newRequest . url = newRequest . url . toString ( ) ;
1515 newRequest [ "binary-mode" ] = true ;
1616 return fetch ( newRequest ) . then ( response => {
17- let rawBody = ( $app === "Quantumult X" ) ? new Uint8Array ( response . bodyBytes ?? [ ] ) : response . body ?? new Uint8Array ( ) ;
18- log ( ` ✅ Download ResourceManifest` , "" ) ;
17+ const rawBody = ( $app === "Quantumult X" ) ? new Uint8Array ( response . bodyBytes ?? [ ] ) : response . body ?? new Uint8Array ( ) ;
18+ log ( " ✅ Download ResourceManifest" , "" ) ;
1919 return { "ETag" : response . headers ?. [ "Etag" ] ?? response . headers ?. [ "etag" ] , "body" : GEOResourceManifestDownload . decode ( rawBody ) } ;
2020 } ) ;
2121 } ;
2222
2323 static cacheResourceManifest ( body = { } , cache = { } , countryCode = "CN" , ETag = "" ) {
24- log ( ` ☑️ Cache ResourceManifest` , "" ) ;
24+ log ( " ☑️ Cache ResourceManifest" , "" ) ;
2525 switch ( countryCode ) {
2626 case "CN" :
2727 if ( ETag !== cache ?. CN ?. ETag ) {
2828 cache . CN = { ...body , ETag } ;
2929 Storage . setItem ( "@iRingo.Maps.Caches" , cache ) ;
30- log ( ` ✅ Cache ResourceManifest` , "" ) ;
30+ log ( " ✅ Cache ResourceManifest" , "" ) ;
3131 } ;
3232 break ;
3333 case "KR" :
3434 if ( ETag !== cache ?. KR ?. ETag ) {
3535 cache . KR = { ...body , ETag } ;
3636 Storage . setItem ( "@iRingo.Maps.Caches" , cache ) ;
37- log ( ` ✅ Cache ResourceManifest` , "" ) ;
37+ log ( " ✅ Cache ResourceManifest" , "" ) ;
3838 } ;
3939 break ;
4040 default :
4141 if ( ETag !== cache ?. XX ?. ETag ) {
4242 cache . XX = { ...body , ETag } ;
4343 Storage . setItem ( "@iRingo.Maps.Caches" , cache ) ;
44- log ( ` ✅ Cache ResourceManifest` , "" ) ;
44+ log ( " ✅ Cache ResourceManifest" , "" ) ;
4545 } ;
4646 break ;
4747 } ;
4848 } ;
4949
5050 static tileSets ( tileSet = [ ] , caches = { } , settings = { } , countryCode = "CN" ) {
51- log ( ` ☑️ Set TileSets` , "" ) ;
51+ log ( " ☑️ Set TileSets" , "" ) ;
5252 //let tileNames = [];
5353 //caches.XX.tileSet.forEach(tile => tileNames.push(tile.style));
5454 //caches.CN.tileSet.forEach(tile => tileNames.push(tile.style));
@@ -260,13 +260,13 @@ export default class GEOResourceManifest {
260260 break ;
261261 } ;
262262 return tile ;
263- } ) . flat ( Infinity ) . filter ( Boolean ) ;
264- log ( ` ✅ Set TileSets` , "" ) ;
263+ } ) . flat ( Number . POSITIVE_INFINITY ) . filter ( Boolean ) ;
264+ log ( " ✅ Set TileSets" , "" ) ;
265265 return tileSet ;
266266 } ;
267267
268268 static attributions ( attributions = [ ] , caches = { } , countryCode = "CN" ) {
269- log ( ` ☑️ Set Attributions` , "" ) ;
269+ log ( " ☑️ Set Attributions" , "" ) ;
270270 switch ( countryCode ) {
271271 case "CN" :
272272 caches ?. XX ?. attribution ?. forEach ( attribution => {
@@ -292,7 +292,7 @@ export default class GEOResourceManifest {
292292 return 0 ;
293293 default :
294294 return 1 ;
295- } ;
295+ }
296296 } ) ;
297297 attributions = attributions . map ( ( attribution , index ) => {
298298 switch ( attribution . name ) {
@@ -351,13 +351,13 @@ export default class GEOResourceManifest {
351351 break ;
352352 } ;
353353 return attribution ;
354- } ) . flat ( Infinity ) . filter ( Boolean ) ;
355- log ( ` ✅ Set Attributions` , "" ) ;
354+ } ) . flat ( Number . POSITIVE_INFINITY ) . filter ( Boolean ) ;
355+ log ( " ✅ Set Attributions" , "" ) ;
356356 return attributions ;
357357 } ;
358358
359359 static resources ( resources = [ ] , caches = { } , countryCode = "CN" ) {
360- log ( ` ☑️ Set Resources` , "" ) ;
360+ log ( " ☑️ Set Resources" , "" ) ;
361361 switch ( countryCode ) {
362362 case "CN" :
363363 break ;
@@ -374,7 +374,7 @@ export default class GEOResourceManifest {
374374 } ;
375375
376376 static dataSets ( dataSets = [ ] , caches = { } , countryCode = "CN" ) {
377- log ( ` ☑️ Set DataSets` , "" ) ;
377+ log ( " ☑️ Set DataSets" , "" ) ;
378378 switch ( countryCode ) {
379379 case "CN" :
380380 dataSets = caches ?. XX ?. dataSet ;
@@ -384,12 +384,12 @@ export default class GEOResourceManifest {
384384 break ;
385385 } ;
386386 //dataSets.push({ "dataSetDescription": "AutoNavi", "identifier": 10 });
387- log ( ` ✅ Set DataSets` , "" ) ;
387+ log ( " ✅ Set DataSets" , "" ) ;
388388 return dataSets ;
389389 } ;
390390
391391 static urlInfoSets ( urlInfoSets = [ ] , caches = { } , settings = { } , countryCode = "CN" ) {
392- log ( ` ☑️ Set UrlInfoSets` , "" ) ;
392+ log ( " ☑️ Set UrlInfoSets" , "" ) ;
393393 urlInfoSets = urlInfoSets . map ( ( urlInfoSet , index ) => {
394394 switch ( countryCode ) {
395395 case "CN" :
@@ -515,12 +515,12 @@ export default class GEOResourceManifest {
515515 } ;
516516 return urlInfoSet ;
517517 } ) ;
518- log ( ` ✅ Set UrlInfoSets` , "" ) ;
518+ log ( " ✅ Set UrlInfoSets" , "" ) ;
519519 return urlInfoSets ;
520520 } ;
521521
522522 static muninBuckets ( muninBuckets = [ ] , caches = { } , settings = { } ) {
523- log ( ` ☑️ Set MuninBuckets` , "" ) ;
523+ log ( " ☑️ Set MuninBuckets" , "" ) ;
524524 switch ( settings . TileSet . Munin ) {
525525 case "AUTO" :
526526 default :
@@ -532,12 +532,12 @@ export default class GEOResourceManifest {
532532 muninBuckets = caches . XX . muninBucket ;
533533 break ;
534534 } ;
535- log ( ` ✅ Set MuninBuckets` , "" ) ;
535+ log ( " ✅ Set MuninBuckets" , "" ) ;
536536 return muninBuckets ;
537537 } ;
538538
539539 static displayStrings ( displayStrings = [ ] , caches = { } , countryCode = "CN" ) {
540- log ( ` ☑️ Set DisplayStrings` , "" ) ;
540+ log ( " ☑️ Set DisplayStrings" , "" ) ;
541541 switch ( countryCode ) {
542542 case "CN" :
543543 displayStrings = caches . XX . displayStrings . map ( ( displayString , index ) => {
@@ -551,12 +551,12 @@ export default class GEOResourceManifest {
551551 //displayStrings = caches.XX.displayStrings;
552552 break ;
553553 } ;
554- log ( ` ✅ Set DisplayStrings` , "" ) ;
554+ log ( " ✅ Set DisplayStrings" , "" ) ;
555555 return displayStrings ;
556556 } ;
557557
558558 static SetTileGroups ( body = { } ) {
559- log ( ` ☑️ Set TileGroups` , "" ) ;
559+ log ( " ☑️ Set TileGroups" , "" ) ;
560560 body . tileGroup = body . tileGroup . map ( tileGroup => {
561561 log ( `🚧 tileGroup.identifier: ${ tileGroup . identifier } ` ) ;
562562 tileGroup . identifier += Math . floor ( Math . random ( ) * 100 ) + 1 ;
@@ -575,7 +575,7 @@ export default class GEOResourceManifest {
575575 } ) ;
576576 return tileGroup ;
577577 } ) ;
578- log ( ` ✅ Set TileGroups` , "" ) ;
578+ log ( " ✅ Set TileGroups" , "" ) ;
579579 return body ;
580580 } ;
581581
0 commit comments