Merge pull request #61 from FRE-Informatica/debit/fd-944
DEBIT/FD-944:Habilitar meu Dispositivo para Acesso
This commit is contained in:
commit
6d8cce7a17
|
@ -39,6 +39,7 @@ class PhpGroup {
|
|||
static GetLiberationsCall getLiberationsCall = GetLiberationsCall();
|
||||
static GetMessagesCall getMessagesCall = GetMessagesCall();
|
||||
static ChangeNotifica changeNotifica = ChangeNotifica();
|
||||
static UpdateIDE updateIDE = UpdateIDE();
|
||||
static RespondeVinculo resopndeVinculo = RespondeVinculo();
|
||||
static ChangePass changePass = ChangePass();
|
||||
static ChangePanic changePanic = ChangePanic();
|
||||
|
@ -543,6 +544,41 @@ class ChangeNotifica {
|
|||
}
|
||||
}
|
||||
|
||||
class UpdateIDE {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID = StorageUtil().devUUID;
|
||||
final String userUUID = StorageUtil().userUUID;
|
||||
final String cliID = StorageUtil().cliUUID;
|
||||
final String newIde = StorageUtil().userDevUUID;
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
callName: 'changeNotifica',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
params: {
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'newIde': newIde,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
isStreamingApi: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UpdToken {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
|
|
@ -53,9 +53,7 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
|||
String? Function(BuildContext, String?)? dateTimeTextControllerValidator;
|
||||
String? _dateTimeTextControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'uzefkuf9',
|
||||
);
|
||||
return FFLocalizations.of(context).getText('uzefkuf9');
|
||||
}
|
||||
|
||||
DateTime selectedDateTime;
|
||||
|
|
|
@ -78,6 +78,45 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
showAlertDialog(context, title, content, onConfirm);
|
||||
}
|
||||
|
||||
Future<void> toggleIdentification(BuildContext context) async {
|
||||
final String title = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Atualizar Identificador de Acesso',
|
||||
enText: 'Update Access Identifier',
|
||||
);
|
||||
final String content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Tem certeza que deseja habilitar seu dispositivo para acesso?',
|
||||
enText: 'Are you sure you want to enable your device for access?',
|
||||
);
|
||||
onConfirm() async {
|
||||
String content;
|
||||
await PhpGroup.updateIDE.call().then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
notifyListeners();
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Atualização do identificador de acesso realizada com sucesso',
|
||||
enText: 'Access identifier updated successfully',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content);
|
||||
} else {
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Erro ao atualizar identificador de acesso',
|
||||
enText: 'Error updating access identifier',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||
}
|
||||
}).catchError((e, s) {
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Erro ao atualizar identificador de acesso',
|
||||
enText: 'Error updating access identifier',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||
}).whenComplete(() => notifyListeners());
|
||||
context.pop();
|
||||
}
|
||||
|
||||
showAlertDialog(context, title, content, onConfirm);
|
||||
}
|
||||
|
||||
Future<void> toggleAccess(BuildContext context) async {
|
||||
onChange(String key) async {
|
||||
StorageUtil().accessPass = key;
|
||||
|
|
|
@ -75,7 +75,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
Expanded(
|
||||
flex: 2,
|
||||
child: ListView.builder(
|
||||
itemCount: 7, // Assuming 7 items for simplicity
|
||||
itemCount: 8,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
|
@ -117,6 +117,15 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
);
|
||||
break;
|
||||
case 2:
|
||||
icon = Icons.info;
|
||||
onPressed = () => model.toggleIdentification(context);
|
||||
isEnabled = false;
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Atualize suas informações de identificação de acesso.',
|
||||
enText: 'Update your access identification information.',
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
icon = Icons.notifications;
|
||||
onPressed = () => model.toggleNotify(context);
|
||||
isEnabled = StorageUtil().notify;
|
||||
|
@ -125,7 +134,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Enable to receive your access notification',
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
icon = Icons.lock;
|
||||
onPressed = () => model.toggleAccess(context);
|
||||
isEnabled = StorageUtil().access;
|
||||
|
@ -134,7 +143,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Enable to enter an access credential for the QRCode',
|
||||
);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
icon = Icons.lock_clock_sharp;
|
||||
onPressed = () => model.togglePanic(context);
|
||||
isEnabled = StorageUtil().panic;
|
||||
|
@ -143,7 +152,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Enable to enter a panic credential for the QRCode',
|
||||
);
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
icon = Icons.landscape;
|
||||
onPressed = () {
|
||||
model.localUnlink(context);
|
||||
|
@ -154,7 +163,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Enable to unlink from the selected location',
|
||||
);
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
icon = Icons.delete;
|
||||
onPressed = () => model.deleteAccount(context);
|
||||
isEnabled = false;
|
||||
|
@ -163,7 +172,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Delete your account and all associated data permanently.',
|
||||
);
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
icon = Icons.logout;
|
||||
onPressed = () => model.logout(context);
|
||||
isEnabled = false;
|
||||
|
|
Loading…
Reference in New Issue