1
1
package io .mosip .registration .clientmanager .service ;
2
2
3
+ import static io .mosip .registration .clientmanager .config .SessionManager .USER_NAME ;
4
+
3
5
import android .content .Context ;
6
+ import android .content .SharedPreferences ;
4
7
import android .graphics .Bitmap ;
5
8
import android .graphics .BitmapFactory ;
6
9
import android .util .Base64 ;
28
31
import java .util .HashMap ;
29
32
import java .util .List ;
30
33
import java .util .Map ;
34
+ import java .util .Objects ;
31
35
import java .util .Optional ;
32
36
import java .util .stream .Collectors ;
33
37
34
38
import javax .inject .Singleton ;
35
39
36
40
import io .mosip .registration .clientmanager .R ;
37
41
import io .mosip .registration .clientmanager .constant .Modality ;
42
+ import io .mosip .registration .clientmanager .dto .CenterMachineDto ;
38
43
import io .mosip .registration .clientmanager .dto .registration .BiometricsDto ;
39
44
import io .mosip .registration .clientmanager .dto .registration .RegistrationDto ;
40
45
import io .mosip .registration .clientmanager .dto .uispec .FieldSpecDto ;
@@ -53,6 +58,8 @@ public class TemplateService {
53
58
54
59
private Context appContext ;
55
60
61
+ SharedPreferences sharedPreferences ;
62
+
56
63
MasterDataService masterDataService ;
57
64
58
65
IdentitySchemaRepository identitySchemaRepository ;
@@ -61,6 +68,9 @@ public TemplateService(Context appContext, MasterDataService masterDataService,
61
68
this .appContext = appContext ;
62
69
this .masterDataService = masterDataService ;
63
70
this .identitySchemaRepository = identitySchemaRepository ;
71
+ sharedPreferences = this .appContext .getSharedPreferences (
72
+ this .appContext .getString (R .string .app_name ),
73
+ Context .MODE_PRIVATE );
64
74
}
65
75
66
76
public String getTemplate (RegistrationDto registrationDto , boolean isPreview ) throws Exception {
@@ -366,6 +376,9 @@ private String getImage(int imagePath) {
366
376
367
377
private void setBasicDetails (boolean isPreview , RegistrationDto registrationDto , VelocityContext velocityContext ) {
368
378
generateQRCode (velocityContext ,registrationDto );
379
+ CenterMachineDto centerMachineDto = new CenterMachineDto ();
380
+ centerMachineDto = masterDataService .getRegistrationCenterMachineDetails ();
381
+
369
382
velocityContext .put ("isPreview" , isPreview );
370
383
velocityContext .put ("ApplicationIDLabel" , appContext .getString (R .string .app_id ));
371
384
velocityContext .put ("ApplicationID" , registrationDto .getRId ());
@@ -383,9 +396,9 @@ private void setBasicDetails(boolean isPreview, RegistrationDto registrationDto,
383
396
velocityContext .put ("FaceLabel" , appContext .getString (R .string .face_label ));
384
397
velocityContext .put ("ExceptionPhotoLabel" , appContext .getString (R .string .exception_photo_label ));
385
398
velocityContext .put ("RONameLabel" , appContext .getString (R .string .ro_label ));
386
- velocityContext .put ("ROName" , "110011" );
399
+ velocityContext .put ("ROName" , sharedPreferences . getString ( USER_NAME , "" ) );
387
400
velocityContext .put ("RegCenterLabel" , appContext .getString (R .string .reg_center ));
388
- velocityContext .put ("RegCenter" , "10011" );
401
+ velocityContext .put ("RegCenter" , centerMachineDto . getCenterId () );
389
402
velocityContext .put ("ImportantGuidelines" , appContext .getString (R .string .imp_guidelines ));
390
403
391
404
velocityContext .put ("LeftEyeLabel" , appContext .getString (R .string .left_iris ));
0 commit comments