Skip to content

Commit

Permalink
Rcf 849 (#424)
Browse files Browse the repository at this point in the history
* qa-platform to collab

Signed-off-by: piyush-shukla03_infosys <[email protected]>

* Fixed dropdown validation issue

Signed-off-by: piyush-shukla03_infosys <[email protected]>

* Removed border for gender language labels

Signed-off-by: piyush-shukla03_infosys <[email protected]>

---------

Signed-off-by: piyush-shukla03_infosys <[email protected]>
Co-authored-by: piyush-shukla03_infosys <[email protected]>
  • Loading branch information
Piyush7034 and piyush-shukla03_infosys authored Aug 8, 2024
1 parent 24aaa25 commit a2806be
Show file tree
Hide file tree
Showing 17 changed files with 510 additions and 476 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void startRegistration(@NonNull List<String> languages, @NonNull String f
}

@Override
public void evaluateMVELVisible(@NonNull String fieldData, @NonNull String expression, @NonNull RegistrationDataPigeon.Result<Boolean> result) {
public void evaluateMVELVisible(@NonNull String fieldData, @NonNull RegistrationDataPigeon.Result<Boolean> result) {
try {
FieldSpecDto fieldSpecDto = JsonUtils.jsonStringToJavaObject(fieldData, new TypeReference<FieldSpecDto>() {
});
Expand All @@ -75,7 +75,7 @@ public void evaluateMVELVisible(@NonNull String fieldData, @NonNull String expre
}

@Override
public void evaluateMVELRequired(@NonNull String fieldData, @NonNull String expression, @NonNull RegistrationDataPigeon.Result<Boolean> result) {
public void evaluateMVELRequired(@NonNull String fieldData, @NonNull RegistrationDataPigeon.Result<Boolean> result) {
try {
FieldSpecDto fieldSpecDto = JsonUtils.jsonStringToJavaObject(fieldData, new TypeReference<FieldSpecDto>() {
});
Expand Down
27 changes: 14 additions & 13 deletions lib/platform_android/registration_service_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import 'package:registration_client/platform_spi/registration_service.dart';

class RegistrationServiceImpl implements RegistrationService {
@override
Future<String> startRegistration(List<String> langauages, String flowType, String process) async {
Future<String> startRegistration(
List<String> langauages, String flowType, String process) async {
String registrationStartResponse = '';
try {
registrationStartResponse =
await RegistrationDataApi().startRegistration(langauages, flowType, process);
registrationStartResponse = await RegistrationDataApi()
.startRegistration(langauages, flowType, process);
} on PlatformException {
registrationStartResponse = "Something went wrong!";
debugPrint('RegApi call failed');
Expand All @@ -29,11 +30,10 @@ class RegistrationServiceImpl implements RegistrationService {
}

@override
Future<bool> evaluateMVELVisible(String fieldData, String expression) async {
Future<bool> evaluateMVELVisible(String fieldData) async {
bool isMvelValid = false;
try {
isMvelValid =
await RegistrationDataApi().evaluateMVELVisible(fieldData, expression);
isMvelValid = await RegistrationDataApi().evaluateMVELVisible(fieldData);
} on PlatformException {
debugPrint('RegApi mvel visible call failed');
} catch (e) {
Expand All @@ -43,11 +43,10 @@ class RegistrationServiceImpl implements RegistrationService {
}

@override
Future<bool> evaluateMVELRequired(String fieldData, String expression) async {
Future<bool> evaluateMVELRequired(String fieldData) async {
bool isMvelValid = false;
try {
isMvelValid =
await RegistrationDataApi().evaluateMVELRequired(fieldData, expression);
isMvelValid = await RegistrationDataApi().evaluateMVELRequired(fieldData);
} on PlatformException {
debugPrint('RegApi mvel call failed');
} catch (e) {
Expand All @@ -57,11 +56,12 @@ class RegistrationServiceImpl implements RegistrationService {
}

@override
Future<String> getPreviewTemplate(bool isPreview, Map<String, String> templateValues) async {
Future<String> getPreviewTemplate(
bool isPreview, Map<String, String> templateValues) async {
String previewTemplate = '';
try {
previewTemplate =
await RegistrationDataApi().getPreviewTemplate(isPreview,templateValues);
previewTemplate = await RegistrationDataApi()
.getPreviewTemplate(isPreview, templateValues);
} on PlatformException {
debugPrint('Registration API template call failed');
} catch (e) {
Expand All @@ -72,7 +72,8 @@ class RegistrationServiceImpl implements RegistrationService {
}

@override
Future<RegistrationSubmitResponse> submitRegistrationDto(String makerName) async {
Future<RegistrationSubmitResponse> submitRegistrationDto(
String makerName) async {
late RegistrationSubmitResponse registrationSubmitResponse;
try {
registrationSubmitResponse =
Expand Down
10 changes: 6 additions & 4 deletions lib/platform_spi/registration_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import 'package:registration_client/pigeon/registration_data_pigeon.dart';
import 'package:registration_client/platform_android/registration_service_impl.dart';

abstract class RegistrationService {
Future<String> startRegistration(List<String> languages, String flopwType, String process);
Future<bool> evaluateMVELVisible(String fieldData, String expression);
Future<bool> evaluateMVELRequired(String fieldData, String expression);
Future<String> getPreviewTemplate(bool isPreview,Map<String,String> templateValues);
Future<String> startRegistration(
List<String> languages, String flopwType, String process);
Future<bool> evaluateMVELVisible(String fieldData);
Future<bool> evaluateMVELRequired(String fieldData);
Future<String> getPreviewTemplate(
bool isPreview, Map<String, String> templateValues);
Future<RegistrationSubmitResponse> submitRegistrationDto(String makerName);

factory RegistrationService() => getRegistrationServiceImpl();
Expand Down
15 changes: 7 additions & 8 deletions lib/provider/global_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@ class GlobalProvider with ChangeNotifier {
final formKey = GlobalKey<FormState>();
final updateFieldKey = GlobalKey<FormState>();
String _updateUINNumber = "";
String _onboardingProcessName="";
String _onboardingProcessName = "";
bool _isPageChanged = false;
String get updateUINNumber => _updateUINNumber;
String get onboardingProcessName => _onboardingProcessName;
bool get isPageChanged => _isPageChanged;
bool _preRegControllerRefresh = false;
bool get preRegControllerRefresh => _preRegControllerRefresh;


set isPageChanged(bool value){
set isPageChanged(bool value) {
_isPageChanged = value;
notifyListeners();
}
Expand Down Expand Up @@ -322,7 +321,7 @@ class GlobalProvider with ChangeNotifier {
notifyListeners();
}

setPreRegistrationId(String value){
setPreRegistrationId(String value) {
_preRegId = value;
notifyListeners();
}
Expand Down Expand Up @@ -444,9 +443,9 @@ class GlobalProvider with ChangeNotifier {
String x = '';
for (var i in chosenLang) {
String code = languageToCodeMapper[i]!;
if(label[code] != null) {
x = "$x${label[code] ?? ""}/ ";
}
if (label[code] != null) {
x = "$x${label[code] ?? ""}/ ";
}
}
return x.isEmpty ? x : x.substring(0, x.length - 2);
}
Expand Down Expand Up @@ -797,7 +796,7 @@ class GlobalProvider with ChangeNotifier {
}

removeSelectedUpdateFieldKey(String key) {
_selectedUpdateFields.remove(key);
_selectedUpdateFields.remove(key);
notifyListeners();
}

Expand Down
9 changes: 4 additions & 5 deletions lib/provider/registration_task_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,12 @@ class RegistrationTaskProvider with ChangeNotifier {
notifyListeners();
}

evaluateMVELVisible(String fieldData, String expression) async {
return await registrationService.evaluateMVELVisible(fieldData, expression);
evaluateMVELVisible(String fieldData) async {
return await registrationService.evaluateMVELVisible(fieldData);
}

evaluateMVELRequired(String fieldData, String expression) async {
return await registrationService.evaluateMVELRequired(
fieldData, expression);
evaluateMVELRequired(String fieldData) async {
return await registrationService.evaluateMVELRequired(fieldData);
}

setPreviewTemplate(String value) {
Expand Down
2 changes: 0 additions & 2 deletions lib/ui/machine_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import 'dart:convert';
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -147,7 +146,6 @@ class _MachineKeysState extends State<MachineKeys> {
onTap: () {
Clipboard.setData(ClipboardData(text: machineDetails)).then((value) {
showInSnackBar(appLocalizations.copy_message);
log("machine details: $machineDetails");
});
},
child: Container(
Expand Down
1 change: 0 additions & 1 deletion lib/ui/onboard/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:flutter_svg/flutter_svg.dart';
import 'package:intl/intl.dart';
Expand Down
51 changes: 21 additions & 30 deletions lib/ui/process_ui/new_process.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import 'package:registration_client/provider/connectivity_provider.dart';
import 'package:registration_client/provider/global_provider.dart';
import 'package:registration_client/provider/registration_task_provider.dart';

import 'package:registration_client/ui/common/tablet_header.dart';
import 'package:registration_client/ui/common/tablet_navbar.dart';
import 'package:registration_client/ui/post_registration/acknowledgement_page.dart';

import 'package:registration_client/ui/post_registration/preview_page.dart';
Expand Down Expand Up @@ -205,20 +203,20 @@ class _NewProcessState extends State<NewProcess> with WidgetsBindingObserver {
await globalProvider.getAudit("REG-EVT-003", "REG-MOD-103");
}

setScrollToTop(){
scrollController.animateTo(
scrollController.position.minScrollExtent,
duration: const Duration(milliseconds: 500),
curve: Curves.easeOut,
);
globalProvider.isPageChanged = false;
setScrollToTop() {
scrollController.animateTo(
scrollController.position.minScrollExtent,
duration: const Duration(milliseconds: 500),
curve: Curves.easeOut,
);
globalProvider.isPageChanged = false;
}

bool continueButton = false;
@override
Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
if(globalProvider.isPageChanged){
if (globalProvider.isPageChanged) {
setScrollToTop();
}
});
Expand All @@ -235,17 +233,15 @@ class _NewProcessState extends State<NewProcess> with WidgetsBindingObserver {
final Process newProcess = arguments["process"];
int size = newProcess.screens!.length;

evaluateMVELVisible(
String fieldData, String? engine, String? expression, Field e) async {
bool visible = await registrationTaskProvider.evaluateMVELVisible(
fieldData, expression!);
evaluateMVELVisible(String fieldData) async {
bool visible =
await registrationTaskProvider.evaluateMVELVisible(fieldData);
return visible;
}

evaluateMVELRequired(
String fieldData, String? engine, String? expression, Field e) async {
bool required = await registrationTaskProvider.evaluateMVELRequired(
fieldData, expression!);
evaluateMVELRequired(String fieldData) async {
bool required =
await registrationTaskProvider.evaluateMVELRequired(fieldData);
return required;
}

Expand Down Expand Up @@ -416,15 +412,9 @@ class _NewProcessState extends State<NewProcess> with WidgetsBindingObserver {
if (screen.fields!.elementAt(i)!.requiredOn != null &&
screen.fields!.elementAt(i)!.requiredOn!.isNotEmpty) {
bool visible = await evaluateMVELVisible(
jsonEncode(screen.fields!.elementAt(i)!.toJson()),
screen.fields!.elementAt(i)!.requiredOn?[0]?.engine,
screen.fields!.elementAt(i)!.requiredOn?[0]?.expr,
screen.fields!.elementAt(i)!);
jsonEncode(screen.fields!.elementAt(i)!.toJson()));
bool required = await evaluateMVELRequired(
jsonEncode(screen.fields!.elementAt(i)!.toJson()),
screen.fields!.elementAt(i)!.requiredOn?[0]?.engine,
screen.fields!.elementAt(i)!.requiredOn?[0]?.expr,
screen.fields!.elementAt(i)!);
jsonEncode(screen.fields!.elementAt(i)!.toJson()));
if (visible && required) {
if (screen.fields!.elementAt(i)!.inputRequired!) {
if (!(globalProvider.fieldInputValue
Expand Down Expand Up @@ -581,10 +571,11 @@ class _NewProcessState extends State<NewProcess> with WidgetsBindingObserver {
}

customValidation(globalProvider.newProcessTabIndex).then((value) {
continueButton = value &&
globalProvider.formKey.currentState != null &&
globalProvider.formKey.currentState!.validate();

setState(() {
continueButton = value &&
globalProvider.formKey.currentState != null &&
globalProvider.formKey.currentState!.validate();
});
if (globalProvider.newProcessTabIndex >= size) {
continueButton = true;
}
Expand Down
2 changes: 0 additions & 2 deletions lib/ui/process_ui/update_process.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import 'package:registration_client/provider/connectivity_provider.dart';
import 'package:registration_client/provider/global_provider.dart';
import 'package:registration_client/provider/registration_task_provider.dart';

import 'package:registration_client/ui/common/tablet_header.dart';
import 'package:registration_client/ui/common/tablet_navbar.dart';
import 'package:registration_client/ui/post_registration/acknowledgement_page.dart';

import 'package:registration_client/ui/post_registration/preview_page.dart';
Expand Down
4 changes: 1 addition & 3 deletions lib/ui/process_ui/widgets/age_date_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*
*/

import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

Expand Down Expand Up @@ -46,8 +44,8 @@ class _AgeDateControlState extends State<AgeDateControl> {
globalProvider = Provider.of<GlobalProvider>(context, listen: false);
registrationTaskProvider =
Provider.of<RegistrationTaskProvider>(context, listen: false);
_getSavedDate();
});
_getSavedDate();
super.initState();
}

Expand Down
Loading

0 comments on commit a2806be

Please sign in to comment.