Skip to content

Commit

Permalink
[RCF-891] Scrolling Issue and Filter Remove (#494)
Browse files Browse the repository at this point in the history
* RCF-891 scrolling issue and filter remove

Signed-off-by: Sachin S P <[email protected]>

* RCF-1000 Pre-reg data not updated after new fetch

Signed-off-by: Sachin S P <[email protected]>

* RCF-933

Signed-off-by: Sachin S P <[email protected]>

* RCF-942 authentication image changes

Signed-off-by: Sachin S P <[email protected]>

* RCF-858 authentication failed for pdf data

Signed-off-by: Sachin S P <[email protected]>

---------

Signed-off-by: Sachin S P <[email protected]>
Co-authored-by: Sachin S P <[email protected]>
  • Loading branch information
SachinPremkumar and Sachin S P authored Dec 18, 2024
1 parent 857f582 commit 21837f0
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ TemplateService TemplateService(MasterDataService masterDataService, IdentitySch

@Provides
@Singleton
PreRegistrationDataSyncService PreRegistrationDataSyncService(PreRegistrationDataSyncDao preRegistrationDao, MasterDataService masterDataService, SyncRestService syncRestService, PreRegZipHandlingService preRegZipHandlingService, PreRegistrationList preRegistration, GlobalParamRepository globalParamRepository) {
return new PreRegistrationDataSyncServiceImpl(appContext, preRegistrationDao, masterDataService, syncRestService, preRegZipHandlingService, preRegistration, globalParamRepository);
PreRegistrationDataSyncService PreRegistrationDataSyncService(PreRegistrationDataSyncDao preRegistrationDao, MasterDataService masterDataService, SyncRestService syncRestService, PreRegZipHandlingService preRegZipHandlingService, PreRegistrationList preRegistration, GlobalParamRepository globalParamRepository, RegistrationService registrationService) {
return new PreRegistrationDataSyncServiceImpl(appContext, preRegistrationDao, masterDataService, syncRestService, preRegZipHandlingService, preRegistration, globalParamRepository, registrationService);
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.mosip.registration.clientmanager.spi.MasterDataService;
import io.mosip.registration.clientmanager.spi.PreRegistrationDataSyncService;
import io.mosip.registration.clientmanager.dto.registration.RegistrationDto;
import io.mosip.registration.clientmanager.spi.RegistrationService;
import io.mosip.registration.clientmanager.spi.SyncRestService;
import io.mosip.registration.clientmanager.util.SyncRestUtil;
import io.mosip.registration.packetmanager.util.DateUtils;
Expand Down Expand Up @@ -65,18 +66,20 @@ public class PreRegistrationDataSyncServiceImpl implements PreRegistrationDataSy
SharedPreferences sharedPreferences;
PreRegistrationList preRegistration;
GlobalParamRepository globalParamRepository;
RegistrationService registrationService;
private Context context;
private String result = "";
ExecutorService executorServiceForPreReg = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());

public PreRegistrationDataSyncServiceImpl(Context context,PreRegistrationDataSyncDao preRegistrationDao,MasterDataService masterDataService,SyncRestService syncRestService,PreRegZipHandlingService preRegZipHandlingService,PreRegistrationList preRegistration,GlobalParamRepository globalParamRepository){
public PreRegistrationDataSyncServiceImpl(Context context,PreRegistrationDataSyncDao preRegistrationDao,MasterDataService masterDataService,SyncRestService syncRestService,PreRegZipHandlingService preRegZipHandlingService,PreRegistrationList preRegistration,GlobalParamRepository globalParamRepository,RegistrationService registrationService){
this.context = context;
this.preRegistrationDao = preRegistrationDao;
this.masterDataService = masterDataService;
this.syncRestService = syncRestService;
this.preRegZipHandlingService = preRegZipHandlingService;
this.preRegistration = preRegistration;
this.globalParamRepository = globalParamRepository;
this.registrationService = registrationService;
sharedPreferences = this.context.getSharedPreferences(
this.context.getString(R.string.app_name),
Context.MODE_PRIVATE);
Expand Down Expand Up @@ -208,7 +211,7 @@ public Map<String, Object> getPreRegistration(@NonNull String preRegistrationId,
return attributeData;
}

private PreRegistrationList fetchPreRegistration(String preRegistrationId, String lastUpdatedTimeStamp) throws ClientCheckedException {
private PreRegistrationList fetchPreRegistration(String preRegistrationId, String lastUpdatedTimeStamp) throws Exception {
Log.i(TAG,"Fetching Pre-Registration started for {}"+ preRegistrationId);
// PreRegistrationList preRegistration;

Expand All @@ -220,17 +223,23 @@ private PreRegistrationList fetchPreRegistration(String preRegistrationId, Strin
try {
preRegistration = downloadAndSavePacket(preRegistrationId, lastUpdatedTimeStamp);
} catch (ExecutionException | InterruptedException e) {
this.registrationService.getRegistrationDto().getDocuments().clear();
this.registrationService.getRegistrationDto().getDemographics().clear();
throw new RuntimeException(e);
}
return preRegistration;
}

if(lastUpdatedTimeStamp == null /*||
preRegistration.getLastUpdatedPreRegTimeStamp().before(lastUpdatedTimeStamp)*/) {
Timestamp updatedPreRegTimeStamp = Timestamp.valueOf(preRegistration.getLastUpdatedPreRegTimeStamp());
Timestamp lastUpdatedTime = Timestamp.valueOf(lastUpdatedTimeStamp);
if(lastUpdatedTimeStamp == null ||
updatedPreRegTimeStamp.before(lastUpdatedTime)) {
Log.i(TAG,"Pre-Registration ID is not up-to-date downloading {}"+ preRegistrationId);
try {
return downloadAndSavePacket(preRegistrationId, lastUpdatedTimeStamp);
preRegistration = downloadAndSavePacket(preRegistrationId, lastUpdatedTimeStamp);
} catch (ExecutionException | InterruptedException e) {
this.registrationService.getRegistrationDto().getDocuments().clear();
this.registrationService.getRegistrationDto().getDemographics().clear();
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public void submitRegistrationDto(String makerName) throws Exception {
document.setType(entry.getValue().getType());
document.setFormat(entry.getValue().getFormat());
document.setRefNumber(entry.getValue().getRefNumber());
document.setDocument(convertImageToPDF(entry.getValue().getContent()));
document.setDocument(("pdf".equalsIgnoreCase(entry.getValue().getFormat()))?combineByteArray(entry.getValue().getContent()):convertImageToPDF(entry.getValue().getContent()));
Log.i(TAG, entry.getKey() + " >> PDF document size :" + document.getDocument().length);
packetWriterService.setDocument(this.registrationDto.getRId(), entry.getKey(), document);
});
Expand Down Expand Up @@ -306,6 +306,17 @@ private String getKey(RegistrationDto registrationDTO, String subType) throws Ex
return String.join(RegistrationConstants.COMMA, key);
}

private byte[] combineByteArray(List<byte[]> byteList) {
int totalLength = byteList.stream().mapToInt(byteArr -> byteArr.length).sum();
byte[] result = new byte[totalLength];
int currentPos = 0;
for (byte[] byteArr : byteList) {
System.arraycopy(byteArr, 0, result, currentPos, byteArr.length);
currentPos += byteArr.length;
}
return result;
}

private String getAdditionalInfo(Object fieldValue) {
if(fieldValue == null) { return null; }

Expand Down
5 changes: 5 additions & 0 deletions assets/images/AuthenticationIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions lib/ui/approve_packet/widget/template_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class TemplateBottomSheet {
}

Widget bottomSheet(BuildContext context) {
bool isPortrait = true;
isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;

return ChangeNotifierProvider<ApprovePacketsProvider>.value(
value: context.watch<ApprovePacketsProvider>(),
builder: (context, _) {
Expand Down Expand Up @@ -60,7 +59,7 @@ class TemplateBottomSheet {
child: SingleChildScrollView(
controller: ScrollController(),
child: SizedBox(
height: isPortrait ? 1400 : 2400,
height: isMobileSize ? 1500 : 2700,
child: WebViewPlus(
zoomEnabled: true,
onWebViewCreated: (controller) async {
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/export_packet/widgets/client_status_dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ClientStatusDropdown extends StatelessWidget {
DropdownMenuItem(
value: ClientStatus.REJECTED.name,
child: const Text("Rejected")),
DropdownMenuItem(
value: ClientStatus.SYNCED.name, child: const Text("Synced")),
// DropdownMenuItem(
// value: ClientStatus.SYNCED.name, child: const Text("Synced")),
DropdownMenuItem(
value: ClientStatus.EXPORTED.name,
child: const Text("Exported")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ class _OperatorBiometricCaptureScanBlockViewState
const SizedBox(
height: 40,
),
(biometricAttributeData.title != "Face" &&
/* (biometricAttributeData.title != "Face" &&
biometricAttributeData.title != "Exception")
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down Expand Up @@ -2233,7 +2233,7 @@ class _OperatorBiometricCaptureScanBlockViewState
color: secondaryColors.elementAt(24)),
),
),
),
),*/
SizedBox(
height: 20.h,
),
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/process_ui/new_process.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:registration_client/model/biometric_attribute_data.dart';
import 'package:registration_client/model/field.dart';
Expand Down Expand Up @@ -1086,7 +1087,7 @@ class _NewProcessState extends State<NewProcess> with WidgetsBindingObserver {
color: authIconBackground,
),
child: Center(
child: Image.asset('assets/images/Registering an [email protected]'),
child: SvgPicture.asset('assets/images/AuthenticationIcon.svg'),
),
);
}
Expand Down
8 changes: 8 additions & 0 deletions lib/ui/process_ui/widgets/pre_reg_data_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,12 @@ class _PreRegDataControlState extends State<PreRegDataControl> {
.fetchPreRegistrationDetail(
preRegIdController.text);
if (value.isNotEmpty) {
globalProvider.clearMap();
globalProvider.clearScannedPages();
widgetValue(widget.screen, value);
} else {
globalProvider.clearMap();
globalProvider.clearScannedPages();
globalProvider.preRegControllerRefresh = false;
}
}
Expand Down Expand Up @@ -335,8 +339,12 @@ class _PreRegDataControlState extends State<PreRegDataControl> {
.fetchPreRegistrationDetail(
preRegIdController.text);
if (value.isNotEmpty) {
globalProvider.clearMap();
globalProvider.clearScannedPages();
widgetValue(widget.screen, value);
} else {
globalProvider.clearMap();
globalProvider.clearScannedPages();
globalProvider.preRegControllerRefresh = false;
}
}
Expand Down

0 comments on commit 21837f0

Please sign in to comment.