WIP:some change
This commit is contained in:
parent
810f787b38
commit
b66b543a28
|
@ -12,6 +12,8 @@ import '../../utils/log_util.dart';
|
|||
import '../../utils/snackbar_util.dart';
|
||||
|
||||
class LocalizationService {
|
||||
|
||||
|
||||
static Future<void> checkLocals(BuildContext context) async {
|
||||
try {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
|
@ -40,7 +42,6 @@ class LocalizationService {
|
|||
log(e.toString(), stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> processLocals(BuildContext context) async {
|
||||
try {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
|
@ -48,7 +49,8 @@ class LocalizationService {
|
|||
final bool isError = response.jsonBody['error'];
|
||||
|
||||
if (isError) {
|
||||
_handleError(context, response.jsonBody['error_msg']);
|
||||
final String errorMsg = response.jsonBody['error_msg'];
|
||||
_handleError(context, errorMsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -96,7 +98,6 @@ class LocalizationService {
|
|||
return await selectLocal(context);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> processData(BuildContext context) async {
|
||||
try {
|
||||
final GetDadosCall callback = PhpGroup.getDadosCall;
|
||||
|
@ -118,7 +119,6 @@ class LocalizationService {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> selectLocal(BuildContext context) async {
|
||||
return await showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
|
@ -137,7 +137,6 @@ class LocalizationService {
|
|||
),
|
||||
).then((_) async => await processData(context));
|
||||
}
|
||||
|
||||
static Future<void> unlinkLocal(BuildContext context) async {
|
||||
String content;
|
||||
try {
|
||||
|
@ -187,38 +186,6 @@ class LocalizationService {
|
|||
context.go('/welcomePage');
|
||||
DialogUtil.error(context, errorMsg);
|
||||
}
|
||||
|
||||
static void _logLocalsStatus(List<dynamic> locals) {
|
||||
for (var local in locals) {
|
||||
final String status = local['CLU_STATUS'];
|
||||
log('() => CLU_STATUS: $status');
|
||||
}
|
||||
}
|
||||
|
||||
static bool _isActive(List<dynamic> locals) {
|
||||
return locals.where((local) => local['CLU_STATUS'] == 'A').isNotEmpty;
|
||||
}
|
||||
|
||||
static bool _isInactived(List<dynamic> locals) {
|
||||
return locals.where((local) => local['CLI_ID'] != StorageUtil().cliUUID && local['CLU_STATUS'] == 'A').isNotEmpty;
|
||||
}
|
||||
|
||||
static bool _isPending(List<dynamic> locals) {
|
||||
return locals.where((local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A').isNotEmpty;
|
||||
}
|
||||
|
||||
static bool _isUnselected() {
|
||||
return StorageUtil().cliUUID.isEmpty && StorageUtil().cliName.isEmpty && StorageUtil().ownerUUID.isEmpty;
|
||||
}
|
||||
|
||||
static bool _isSelected(bool isInactived) {
|
||||
return StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty && isInactived;
|
||||
}
|
||||
|
||||
static bool _isAvailable() {
|
||||
return StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty;
|
||||
}
|
||||
|
||||
static Future<bool> _handleUnavailable(BuildContext context, List<dynamic> locals) async {
|
||||
log('() => isUnavailable');
|
||||
try {
|
||||
|
@ -239,7 +206,6 @@ class LocalizationService {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static Future<bool> _handleEnabled(BuildContext context, dynamic local) async {
|
||||
log('() => isEnabled');
|
||||
StorageUtil().cliName = local['CLI_NOME'];
|
||||
|
@ -249,6 +215,32 @@ class LocalizationService {
|
|||
return await processData(context);
|
||||
}
|
||||
|
||||
static void _logLocalsStatus(List<dynamic> locals) {
|
||||
for (var local in locals) {
|
||||
final String status = local['CLU_STATUS'];
|
||||
log('() => CLU_STATUS: $status');
|
||||
}
|
||||
}
|
||||
|
||||
static bool _isActive(List<dynamic> locals) {
|
||||
return locals.where((local) => local['CLU_STATUS'] == 'A').isNotEmpty;
|
||||
}
|
||||
static bool _isInactived(List<dynamic> locals) {
|
||||
return locals.where((local) => local['CLI_ID'] != StorageUtil().cliUUID && local['CLU_STATUS'] == 'A').isNotEmpty;
|
||||
}
|
||||
static bool _isPending(List<dynamic> locals) {
|
||||
return locals.where((local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A').isNotEmpty;
|
||||
}
|
||||
static bool _isUnselected() {
|
||||
return StorageUtil().cliUUID.isEmpty && StorageUtil().cliName.isEmpty && StorageUtil().ownerUUID.isEmpty;
|
||||
}
|
||||
static bool _isSelected(bool isInactived) {
|
||||
return StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty && isInactived;
|
||||
}
|
||||
static bool _isAvailable() {
|
||||
return StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty;
|
||||
}
|
||||
|
||||
static void _updateStorageUtil(Map<String, dynamic> jsonBody) {
|
||||
final bool whatsapp = jsonBody['whatsapp'] ?? false;
|
||||
final bool provisional = jsonBody['provisional'] ?? false;
|
||||
|
@ -261,4 +253,6 @@ class LocalizationService {
|
|||
StorageUtil().petAmountRegister = petAmountRegister;
|
||||
StorageUtil().userName = name;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -141,6 +141,8 @@ class StorageUtil {
|
|||
isFirstRun = false;
|
||||
await _sharedPreferences.prefs?.setBool('fre_isFirstRun', false);
|
||||
isLogged = false;
|
||||
final String message = '';
|
||||
|
||||
// _secureStorage.purge();
|
||||
// _sqliteStorage.purge();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue