1
1
import * as path from "path" ;
2
2
import * as Jimp from "jimp" ;
3
3
import * as Color from "color" ;
4
- import { Icons , SplashScreens , Operations } from "./image-definitions"
4
+ import { Icons , SplashScreens , Operations } from "./image-definitions" ;
5
5
import { exported } from "../../common/decorators" ;
6
6
7
7
export class AssetsGenerationService implements IAssetsGenerationService {
8
8
constructor ( private $logger : ILogger ,
9
- private $androidResourcesMigrationService : IAndroidResourcesMigrationService ) {
9
+ private $androidResourcesMigrationService : IAndroidResourcesMigrationService ) {
10
10
}
11
-
11
+
12
12
@exported ( "assetsGenerationService" )
13
13
public async generateIcons ( resourceGenerationData : IResourceGenerationData ) : Promise < void > {
14
14
this . $logger . info ( "Generating icons ..." ) ;
15
- await this . generateImagesForDefinitions ( resourceGenerationData . imagePath , resourceGenerationData . resourcesPath , Icons )
15
+ await this . generateImagesForDefinitions ( resourceGenerationData . imagePath , resourceGenerationData . resourcesPath , Icons ) ;
16
16
this . $logger . info ( "Icons generation completed." ) ;
17
17
}
18
18
19
19
@exported ( "assetsGenerationService" )
20
20
public async generateSplashScreens ( splashesGenerationData : ISplashesGenerationData ) : Promise < void > {
21
21
this . $logger . info ( "Generating splash screens ..." ) ;
22
- await this . generateImagesForDefinitions ( splashesGenerationData . imagePath , splashesGenerationData . resourcesPath , SplashScreens , splashesGenerationData . background )
22
+ await this . generateImagesForDefinitions ( splashesGenerationData . imagePath , splashesGenerationData . resourcesPath , SplashScreens , splashesGenerationData . background ) ;
23
23
this . $logger . info ( "Splash screens generation completed." ) ;
24
24
}
25
25
26
26
private async generateImagesForDefinitions ( imagePath : string , resourcesPath : string , definitions : any [ ] , background : string = "white" ) : Promise < void > {
27
27
const hasMigrated = this . $androidResourcesMigrationService . hasMigrated ( resourcesPath ) ;
28
-
29
- for ( let definition of definitions ) {
28
+
29
+ for ( const definition of definitions ) {
30
30
const operation = definition . operation || Operations . Resize ;
31
31
const scale = definition . scale || 0.8 ;
32
- const path = hasMigrated ? definition . path : ( definition . pathBeforeMigration || definition . path )
32
+ const path = hasMigrated ? definition . path : ( definition . pathBeforeMigration || definition . path ) ;
33
33
const outputPath = this . convertToAbsolutePath ( resourcesPath , path ) ;
34
34
35
35
switch ( operation ) {
@@ -68,7 +68,7 @@ export class AssetsGenerationService implements IAssetsGenerationService {
68
68
image = image . composite ( overlayImage , centeredWidth , centeredHeight ) ;
69
69
}
70
70
71
- image . write ( outputPath )
71
+ image . write ( outputPath ) ;
72
72
}
73
73
74
74
private convertToAbsolutePath ( resourcesPath : string , resourcePath : string ) {
@@ -84,4 +84,4 @@ export class AssetsGenerationService implements IAssetsGenerationService {
84
84
}
85
85
}
86
86
87
- $injector . register ( "assetsGenerationService" , AssetsGenerationService ) ;
87
+ $injector . register ( "assetsGenerationService" , AssetsGenerationService ) ;
0 commit comments