WIP
This commit is contained in:
parent
01c38fcdc4
commit
ffa05b2f9a
|
@ -94,8 +94,6 @@ android {
|
||||||
}
|
}
|
||||||
debug {
|
debug {
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
minifyEnabled true
|
|
||||||
shrinkResources true
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,22 +28,17 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
late Future<void> _localsFuture;
|
late Future<void> _localsFuture;
|
||||||
List<dynamic> _localsWrap = [];
|
List<dynamic> _localsWrap = [];
|
||||||
|
|
||||||
@override
|
@override void setState(VoidCallback callback) {
|
||||||
void setState(VoidCallback callback) {
|
|
||||||
super.setState(callback);
|
super.setState(callback);
|
||||||
_model.onUpdate();
|
_model.onUpdate();
|
||||||
}
|
}
|
||||||
|
@override void initState() {
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
super.initState();
|
||||||
_model =
|
_model =
|
||||||
createModel(context, () => BottomArrowLinkedLocalsComponentModel());
|
createModel(context, () => BottomArrowLinkedLocalsComponentModel());
|
||||||
_localsFuture = _fetchLocals();
|
_localsFuture = _fetchLocals();
|
||||||
}
|
}
|
||||||
|
@override void dispose() {
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_model.maybeDispose();
|
_model.maybeDispose();
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
@ -69,13 +64,22 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
|
|
||||||
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||||
|
|
||||||
|
|
||||||
final bool isEmpty = locals.isEmpty;
|
final bool isEmpty = locals.isEmpty;
|
||||||
final bool isUnique = locals.length == 1;
|
final bool isUnique = locals.length == 1;
|
||||||
final bool isActive = locals[0]['CLU_STATUS'] == 'A';
|
final bool isActive = locals[0]['CLU_STATUS'] == 'A';
|
||||||
final bool isBlocked = locals[0]['CLU_STATUS'] == 'B';
|
final bool isBlocked = locals[0]['CLU_STATUS'] == 'B';
|
||||||
|
|
||||||
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) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_localsWrap.addAll(locals);
|
_localsWrap.addAll(locals);
|
||||||
|
|
|
@ -40,7 +40,14 @@ class LocalizationService {
|
||||||
StorageUtil().ownerUUID = '';
|
StorageUtil().ownerUUID = '';
|
||||||
StorageUtil().context?.go('/homePage');
|
StorageUtil().context?.go('/homePage');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
final bool isInvalid = response.jsonBody['error_msg'] == 'Esse dispositivo nao pertence a esse usuario';
|
||||||
|
if(isInvalid) StorageUtil().isLogged = false;
|
||||||
|
if(isInvalid) context.go('/welcomePage');
|
||||||
|
return DialogUtil.error(context, response.jsonBody['error_msg']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
log(e.toString(), stackTrace: s);
|
log(e.toString(), stackTrace: s);
|
||||||
}
|
}
|
||||||
|
@ -52,33 +59,30 @@ class LocalizationService {
|
||||||
|
|
||||||
final ApiCallResponse response = await callback.call();
|
final ApiCallResponse response = await callback.call();
|
||||||
|
|
||||||
final List<dynamic> locals = response.jsonBody['locais'].toList() ?? [];
|
|
||||||
|
|
||||||
|
final bool isError = response.jsonBody['error'] == true;
|
||||||
|
final bool isInvalid = response.jsonBody['error_msg'] == 'Esse dispositivo nao pertence a esse usuario';
|
||||||
|
|
||||||
|
if(isInvalid) StorageUtil().isLogged = false;
|
||||||
|
if(isInvalid) context.go('/welcomePage');
|
||||||
|
final List<dynamic> locals = response.jsonBody['locais'].toList() ?? [];
|
||||||
for (var local in locals) {
|
for (var local in locals) {
|
||||||
final String status = local['CLU_STATUS'];
|
final String status = local['CLU_STATUS'];
|
||||||
log('() => CLU_STATUS: $status');
|
log('() => CLU_STATUS: $status');
|
||||||
}
|
}
|
||||||
|
|
||||||
final bool isActive = locals
|
if(isError) DialogUtil.error(context, response.jsonBody['error_msg']);
|
||||||
.where((local) => local['CLU_STATUS'] == 'A')
|
if(isError) return false;
|
||||||
.toList()
|
|
||||||
.isNotEmpty;
|
final bool isActive = locals.where((local) => local['CLU_STATUS'] == 'A').toList().isNotEmpty;
|
||||||
final bool isInactived = locals
|
final bool isInactived = locals.where((local) => local['CLI_ID'] != StorageUtil().cliUUID && local['CLU_STATUS'] == 'A').toList().isNotEmpty;
|
||||||
.where((local) => local['CLI_ID'] != StorageUtil().cliUUID && local['CLU_STATUS'] == 'A').toList().isNotEmpty;
|
final bool isPending = locals.where((local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A').toList().isNotEmpty;
|
||||||
final bool isPending = locals
|
|
||||||
.where((local) =>
|
|
||||||
local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A')
|
|
||||||
.toList()
|
|
||||||
.isNotEmpty;
|
|
||||||
final bool isUnique = locals.length == 1;
|
final bool isUnique = locals.length == 1;
|
||||||
final bool isBlocked = locals[0]['CLU_STATUS'] == 'B';
|
final bool isBlocked = locals[0]['CLU_STATUS'] == 'B';
|
||||||
final bool isEnabled = isUnique && isActive;
|
final bool isEnabled = isUnique && isActive;
|
||||||
|
|
||||||
final bool isDisabled = isUnique && isBlocked;
|
final bool isDisabled = isUnique && isBlocked;
|
||||||
final bool isUnselected = StorageUtil().cliUUID.isEmpty &&
|
final bool isUnselected = StorageUtil().cliUUID.isEmpty && StorageUtil().cliName.isEmpty & StorageUtil().ownerUUID.isEmpty;
|
||||||
StorageUtil().cliName.isEmpty & StorageUtil().ownerUUID.isEmpty;
|
final bool isSelected = StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty && isInactived;
|
||||||
final bool isSelected =
|
|
||||||
StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty && isInactived;
|
|
||||||
final bool isUnavailable = isPending && isUnselected && isUnique;
|
final bool isUnavailable = isPending && isUnselected && isUnique;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ class StorageUtil {
|
||||||
Future<void> initSQLiteStorage() async {
|
Future<void> initSQLiteStorage() async {
|
||||||
log('SQLiteStorageHelper: Starting initialization');
|
log('SQLiteStorageHelper: Starting initialization');
|
||||||
try {
|
try {
|
||||||
// await _sqliteStorage.database;
|
await _sqliteStorage.database;
|
||||||
_devUUID = await _sqliteStorage.get('fre_devUUID') ?? '';
|
_devUUID = await _sqliteStorage.get('fre_devUUID') ?? '';
|
||||||
_userUUID = await _sqliteStorage.get('fre_userUUID') ?? '';
|
_userUUID = await _sqliteStorage.get('fre_userUUID') ?? '';
|
||||||
_userDevUUID = await _sqliteStorage.get('fre_userDevUUID') ?? '';
|
_userDevUUID = await _sqliteStorage.get('fre_userDevUUID') ?? '';
|
||||||
|
|
Loading…
Reference in New Issue