Skip to content

Commit

Permalink
version: 1.4.8+72. Fix app bug from last commit. Reverted applicationId
Browse files Browse the repository at this point in the history
  • Loading branch information
guyluz11 committed Jan 6, 2024
1 parent ae40437 commit 06d15ab
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ android {
}

defaultConfig {
applicationId "com.cybearjinni.devapp"
applicationId "com.cybearjinni.app"
minSdkVersion 22
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
Expand Down
10 changes: 5 additions & 5 deletions lib/presentation/organisms/open_area_organism.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class OpenAreaOrganism extends StatefulWidget {
const OpenAreaOrganism({
required this.areaEntity,
required this.entityTypes,
required this.devices,
required this.entities,
});

/// If it have value will only show Printers in this area
final AreaEntity areaEntity;
final Set<EntityTypes> entityTypes;
final Set<DeviceEntityBase> devices;
final Set<DeviceEntityBase> entities;

@override
State<OpenAreaOrganism> createState() => _OpenAreaOrganismState();
Expand All @@ -23,7 +23,7 @@ class OpenAreaOrganism extends StatefulWidget {
class _OpenAreaOrganismState extends State<OpenAreaOrganism> {
@override
Widget build(BuildContext context) {
if (widget.devices.isEmpty) {
if (widget.entities.isEmpty) {
return EmptyOpenAreaOrganism();
}

Expand All @@ -33,11 +33,11 @@ class _OpenAreaOrganismState extends State<OpenAreaOrganism> {
reverse: true,
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
final DeviceEntityBase device = widget.devices.elementAt(index);
final DeviceEntityBase device = widget.entities.elementAt(index);

return DeviceByTypeMolecule(device);
},
itemCount: widget.devices.length,
itemCount: widget.entities.length,
separatorBuilder: (BuildContext context, int index) =>
const SeparatorAtom(variant: SeparatorVariant.farAppart),
),
Expand Down
29 changes: 18 additions & 11 deletions lib/presentation/pages/entities_in_area_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class EntitiesInAreaPage extends StatefulWidget {
}

class _EntitiesInAreaPageState extends State<EntitiesInAreaPage> {
Set<DeviceEntityBase>? devices;
Set<DeviceEntityBase>? entities;
late bool showAllTypes;

@override
Expand All @@ -32,44 +32,51 @@ class _EntitiesInAreaPageState extends State<EntitiesInAreaPage> {
}

Future initialzeDevices() async {
final Map<String, DeviceEntityBase> devicesMap =
final Map<String, DeviceEntityBase> entitiesMap =
await ConnectionsService.instance.getAllEntities;
final Set<String> deviceIdsInArea =
final Set<String> entityIdsInArea =
widget.areaEntity.entitiesId.getOrCrash();
final Set<EntityTypes> entityTypes = widget.entityTypes;
final Set<DeviceEntityBase> tempDevices;
final Set<DeviceEntityBase> tempEntities;

tempDevices = devicesMap.values
tempEntities = entitiesMap.values
.where(
(element) =>
deviceIdsInArea.contains(element.getCbjDeviceId) &&
(showAllTypes || entityTypes.contains(element.entityTypes.type)),
entityIdsInArea.contains(element.getCbjDeviceId) &&
(showAllTypes ||
entityTypes.contains(element.entityTypes.type)) &&
supportedEntityType(element.entityTypes.type),
)
.toSet();

setState(() {
devices = tempDevices;
entities = tempEntities;
});
}

bool supportedEntityType(EntityTypes type) {
return !(type == EntityTypes.smartTypeNotSupported ||
type == EntityTypes.emptyEntity);
}

@override
Widget build(BuildContext context) {
String pageName = '';

if (showAllTypes) {
pageName = '${widget.areaEntity.cbjEntityName.getOrCrash()} Entities';
} else if (devices != null) {
} else if (entities != null) {
pageName =
'${widget.areaEntity.cbjEntityName.getOrCrash()} ${widget.entityTypes.firstOrNull?.name}';
}

return PageOrganism(
pageName: pageName,
child: devices != null
child: entities != null
? OpenAreaOrganism(
areaEntity: widget.areaEntity,
entityTypes: widget.entityTypes,
devices: devices!,
entities: entities!,
)
: const CircularProgressIndicatorAtom(),
);
Expand Down
6 changes: 3 additions & 3 deletions lib/presentation/pages/home_page/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class _HomePageState extends State<HomePage> {
.watchEntities()
.listen((MapEntry<String, DeviceEntityBase> entityEntery) {
if (!mounted ||
supportedDeviceType(entityEntery.value.entityTypes.type)) {
unSupportedEntityType(entityEntery.value.entityTypes.type)) {
return;
}

Expand Down Expand Up @@ -117,12 +117,12 @@ class _HomePageState extends State<HomePage> {
HashMap<String, DeviceEntityBase> entities,
) {
entities.removeWhere(
(key, value) => supportedDeviceType(value.entityTypes.type),
(key, value) => unSupportedEntityType(value.entityTypes.type),
);
return entities;
}

bool supportedDeviceType(EntityTypes type) {
bool unSupportedEntityType(EntityTypes type) {
return type == EntityTypes.smartTypeNotSupported ||
type == EntityTypes.emptyEntity;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cybearjinni
description: CyBear Jinni app to interact with your CyBear Jinni Smart Devices
version: 1.4.7+71
version: 1.4.8+72
homepage: https://cybearjinni.com

publish_to: 'none'
Expand Down

0 comments on commit 06d15ab

Please sign in to comment.