fix: bug do vitassay
This commit is contained in:
parent
edd776a5ec
commit
dce7d11a3e
|
@ -840,7 +840,7 @@ class PostScheduleVisitCall {
|
||||||
'unica': unica,
|
'unica': unica,
|
||||||
'idMotivo': idMotivo,
|
'idMotivo': idMotivo,
|
||||||
'idNAC': idNAC,
|
'idNAC': idNAC,
|
||||||
'obs': obs,
|
'Obs': obs,
|
||||||
'DevDesc': devDesc,
|
'DevDesc': devDesc,
|
||||||
},
|
},
|
||||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:hub/shared/utils/storage_util.dart';
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
|
import '../../../shared/services/authentication/authentication_service.dart';
|
||||||
import '/backend/api_requests/api_calls.dart';
|
import '/backend/api_requests/api_calls.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
|
||||||
|
@ -61,6 +62,14 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
try {
|
try {
|
||||||
setState(() => _loading = true);
|
setState(() => _loading = true);
|
||||||
var response = await PhpGroup.getLocalsCall.call();
|
var response = await PhpGroup.getLocalsCall.call();
|
||||||
|
final bool isError = response.jsonBody['error'];
|
||||||
|
|
||||||
|
|
||||||
|
if (isError) {
|
||||||
|
final String errorMsg = response.jsonBody['error_msg'];
|
||||||
|
_handleError(context, errorMsg);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||||
|
|
||||||
|
@ -73,11 +82,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
final bool isEnabled = isUnique && isActive;
|
final bool isEnabled = isUnique && isActive;
|
||||||
final bool isDisabled = isUnique && isBlocked;
|
final bool isDisabled = isUnique && isBlocked;
|
||||||
|
|
||||||
final bool isError = response.jsonBody['error'] == true;
|
|
||||||
final bool isInvalid = response.jsonBody['error_msg'] == 'Esse dispositivo nao pertence a esse usuario';
|
|
||||||
if(isError) DialogUtil.error(context, response.jsonBody['error_msg']);
|
|
||||||
if(isInvalid) StorageUtil().isLogged = false;
|
|
||||||
if(isInvalid) context.go('/welcomePage');
|
|
||||||
|
|
||||||
|
|
||||||
if (!isEmpty) {
|
if (!isEmpty) {
|
||||||
|
@ -119,6 +124,12 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _handleError(BuildContext context, String errorMsg) {
|
||||||
|
AuthenticationService.signOut(context);
|
||||||
|
DialogUtil.error(context, errorMsg);
|
||||||
|
LogUtil.requestAPIFailed('getLocals.php', '{devUUID: ${StorageUtil().devUUID}, cliUUID: ${StorageUtil().userUUID}}', 'Get Locals', errorMsg, StackTrace.current);
|
||||||
|
}
|
||||||
|
|
||||||
Future<dynamic> _fetchResponseLink(String status, String cliID) async {
|
Future<dynamic> _fetchResponseLink(String status, String cliID) async {
|
||||||
try {
|
try {
|
||||||
StorageUtil().cliUUID = cliID;
|
StorageUtil().cliUUID = cliID;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
@ -423,9 +425,8 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
await widget.getVisitors?.call(
|
await widget.getVisitors?.call(
|
||||||
_model.visitors,
|
_model.visitors,
|
||||||
);
|
);
|
||||||
await widget.getDocs?.call(
|
log('() => docs: ${_model.docs}');
|
||||||
_model.docs,
|
await widget.getDocs?.call(_model.docs);
|
||||||
);
|
|
||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/forgot_password_page/forgot_password_screen.dart';
|
import 'package:hub/pages/forgot_password_page/forgot_password_screen.dart';
|
||||||
import 'package:hub/shared/helpers/shared_preferences_storage_helper.dart';
|
import 'package:hub/shared/helpers/shared_preferences_storage_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/device_util.dart';
|
||||||
import 'package:hub/shared/utils/storage_util.dart';
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:responsive_framework/responsive_framework.dart';
|
import 'package:responsive_framework/responsive_framework.dart';
|
||||||
|
|
||||||
|
@ -265,6 +266,8 @@ class _AppState extends State<App> {
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
log('DeviceUtil: ${DeviceUtil.getDeviceOSVersion()}');
|
||||||
|
|
||||||
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
|
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
|
||||||
_appStateNotifier = AppStateNotifier.instance;
|
_appStateNotifier = AppStateNotifier.instance;
|
||||||
_router = createRouter(_appStateNotifier);
|
_router = createRouter(_appStateNotifier);
|
||||||
|
|
|
@ -229,27 +229,5 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void logout(BuildContext context) async {
|
|
||||||
showAlertDialog(
|
|
||||||
context,
|
|
||||||
'Logout',
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Are you sure you want to logout?',
|
|
||||||
ptText: 'Tem certeza',
|
|
||||||
), () async {
|
|
||||||
StorageUtil.purge();
|
|
||||||
// setState(() {});
|
|
||||||
|
|
||||||
context.go(
|
|
||||||
'/welcomePage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1501,7 +1501,7 @@ Widget scheduleVisit(BuildContext context, ScheduleCompleteVisitPageModel model,
|
||||||
.convertDateFormat(model.textController1.text),
|
.convertDateFormat(model.textController1.text),
|
||||||
dtFim: model
|
dtFim: model
|
||||||
.convertDateFormat(model.textController2.text),
|
.convertDateFormat(model.textController2.text),
|
||||||
unica: model.switchValue == true ? 'Sim' : 'Não',
|
unica: model.switchValue == true ? 'S' : 'N',
|
||||||
idMotivo: extractIdToStr(model.dropDownValue1!),
|
idMotivo: extractIdToStr(model.dropDownValue1!),
|
||||||
idNAC: extractIdToStr(model.dropDownValue2!),
|
idNAC: extractIdToStr(model.dropDownValue2!),
|
||||||
obs: model.textController3.text,
|
obs: model.textController3.text,
|
||||||
|
@ -1614,7 +1614,7 @@ Widget scheduleVisit(BuildContext context, ScheduleCompleteVisitPageModel model,
|
||||||
.toString()) ??
|
.toString()) ??
|
||||||
'',
|
'',
|
||||||
'Single Visit':
|
'Single Visit':
|
||||||
model.switchValue == true ? 'Sim' : 'Não',
|
model.switchValue == true ? 'S' : 'N',
|
||||||
if (model.textController3.text.isNotEmpty)
|
if (model.textController3.text.isNotEmpty)
|
||||||
'Observation': model.textController3.text,
|
'Observation': model.textController3.text,
|
||||||
},
|
},
|
||||||
|
|
|
@ -128,17 +128,15 @@ class AuthenticationService {
|
||||||
|
|
||||||
static Future<void> signOut(BuildContext context) async {
|
static Future<void> signOut(BuildContext context) async {
|
||||||
await PhpGroup.unregisterDevice.call();
|
await PhpGroup.unregisterDevice.call();
|
||||||
await StorageUtil.purge();
|
final Map<String, dynamic> extra = <String, dynamic>{
|
||||||
context.go(
|
|
||||||
'/welcomePage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
hasTransition: true,
|
hasTransition: true,
|
||||||
transitionType: PageTransitionType.scale,
|
transitionType: PageTransitionType.scale,
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
),
|
),
|
||||||
},
|
};
|
||||||
);
|
await StorageUtil.purge();
|
||||||
|
context.go( '/welcomePage', extra: extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> forgotPassword(BuildContext context, String email) async {
|
static Future<void> forgotPassword(BuildContext context, String email) async {
|
||||||
|
@ -189,6 +187,13 @@ class AuthenticationService {
|
||||||
String content;
|
String content;
|
||||||
try {
|
try {
|
||||||
await PhpGroup.deleteAccount.call().then((value) {
|
await PhpGroup.deleteAccount.call().then((value) {
|
||||||
|
final Map<String, dynamic> extra = <String, dynamic>{
|
||||||
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
|
hasTransition: true,
|
||||||
|
transitionType: PageTransitionType.scale,
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
),
|
||||||
|
};
|
||||||
if (value.jsonBody['error'] == false) {
|
if (value.jsonBody['error'] == false) {
|
||||||
content = FFLocalizations.of(context).getVariableText(
|
content = FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Account deleted successfully',
|
enText: 'Account deleted successfully',
|
||||||
|
@ -196,16 +201,7 @@ class AuthenticationService {
|
||||||
);
|
);
|
||||||
StorageUtil.purge();
|
StorageUtil.purge();
|
||||||
context.pop();
|
context.pop();
|
||||||
context.go(
|
context.go('/welcomePage', extra: extra);
|
||||||
'/welcomePage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}).catchError((err) {
|
}).catchError((err) {
|
||||||
context.pop();
|
context.pop();
|
||||||
|
|
|
@ -10,6 +10,7 @@ import '../../../components/organism_components/bottom_arrow_linked_locals_compo
|
||||||
import '../../../flutter_flow/flutter_flow_util.dart';
|
import '../../../flutter_flow/flutter_flow_util.dart';
|
||||||
import '../../utils/log_util.dart';
|
import '../../utils/log_util.dart';
|
||||||
import '../../utils/snackbar_util.dart';
|
import '../../utils/snackbar_util.dart';
|
||||||
|
import '../authentication/authentication_service.dart';
|
||||||
|
|
||||||
class LocalizationService {
|
class LocalizationService {
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ class LocalizationService {
|
||||||
final bool isAvailable = _isAvailable();
|
final bool isAvailable = _isAvailable();
|
||||||
|
|
||||||
if (isDisabled) {
|
if (isDisabled) {
|
||||||
context.go('/welcomePage');
|
AuthenticationService.signOut(context);
|
||||||
return true;
|
return true;
|
||||||
} else if (isUnavailable) {
|
} else if (isUnavailable) {
|
||||||
return await _handleUnavailable(context, locals);
|
return await _handleUnavailable(context, locals);
|
||||||
|
@ -185,9 +186,9 @@ class LocalizationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _handleError(BuildContext context, String errorMsg) {
|
static void _handleError(BuildContext context, String errorMsg) {
|
||||||
StorageUtil().isLogged = false;
|
AuthenticationService.signOut(context);
|
||||||
context.go('/welcomePage');
|
|
||||||
DialogUtil.error(context, errorMsg);
|
DialogUtil.error(context, errorMsg);
|
||||||
|
LogUtil.requestAPIFailed('getLocals.php', '{devUUID: ${StorageUtil().devUUID}, cliUUID: ${StorageUtil().userUUID}}', 'Get Locals', errorMsg, StackTrace.current);
|
||||||
}
|
}
|
||||||
static Future<bool> _handleUnavailable(BuildContext context, List<dynamic> locals) async {
|
static Future<bool> _handleUnavailable(BuildContext context, List<dynamic> locals) async {
|
||||||
log('() => isUnavailable');
|
log('() => isUnavailable');
|
||||||
|
|
|
@ -29,4 +29,17 @@ class DeviceUtil {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<String?> getDeviceOSVersion() async {
|
||||||
|
var deviceInfo = DeviceInfoPlugin();
|
||||||
|
if (Platform.isIOS) {
|
||||||
|
var iosDeviceInfo = await deviceInfo.iosInfo;
|
||||||
|
return iosDeviceInfo.systemVersion; // unique ID on iOS. e.g. 14.5
|
||||||
|
} else if (Platform.isAndroid) {
|
||||||
|
var androidDeviceInfo = await deviceInfo.androidInfo;
|
||||||
|
return androidDeviceInfo.version.release; // unique ID on Android. e.g . 11
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,9 +109,9 @@ class StorageUtil {
|
||||||
|
|
||||||
static Future<void> purge() async {
|
static Future<void> purge() async {
|
||||||
try {
|
try {
|
||||||
// await SecureStorageHelper().purge();
|
await SecureStorageHelper().purge();
|
||||||
// await SharedPreferencesStorageHelper().purge();
|
|
||||||
await SQLiteStorageHelper().purge();
|
await SQLiteStorageHelper().purge();
|
||||||
|
// await SharedPreferencesStorageHelper().purge();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('Error purging data: $e');
|
log('Error purging data: $e');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue