mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 04:44:55 +00:00
Merged with dev
This commit is contained in:
1
.env.dev
1
.env.dev
@ -1,2 +1,3 @@
|
|||||||
ENV_NAME=development
|
ENV_NAME=development
|
||||||
BASE_URL=https://syncrow-dev.azurewebsites.net
|
BASE_URL=https://syncrow-dev.azurewebsites.net
|
||||||
|
PROJECT_ID=0e62577c-06fa-41b9-8a92-99a21fbaf51c
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
ENV_NAME=production
|
ENV_NAME=production
|
||||||
BASE_URL=https://syncrow-staging.azurewebsites.net
|
BASE_URL=https://syncrow-staging.azurewebsites.net
|
||||||
|
PROJECT_ID=bcda711e-9fc2-4168-a05e-171b4026d1ff
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
ENV_NAME=staging
|
ENV_NAME=staging
|
||||||
BASE_URL=https://syncrow-staging.azurewebsites.net
|
BASE_URL=https://syncrow-staging.azurewebsites.net
|
||||||
|
PROJECT_ID=bcda711e-9fc2-4168-a05e-171b4026d1ff
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import 'package:share_plus/share_plus.dart';
|
|||||||
import 'package:syncrow_app/features/app_layout/model/permission_model.dart';
|
import 'package:syncrow_app/features/app_layout/model/permission_model.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdown.dart';
|
import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdown.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/subspace_model.dart';
|
import 'package:syncrow_app/features/devices/model/subspace_model.dart';
|
||||||
@ -28,6 +29,7 @@ import 'package:syncrow_app/navigation/routing_constants.dart';
|
|||||||
import 'package:syncrow_app/services/api/devices_api.dart';
|
import 'package:syncrow_app/services/api/devices_api.dart';
|
||||||
import 'package:syncrow_app/services/api/profile_api.dart';
|
import 'package:syncrow_app/services/api/profile_api.dart';
|
||||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
part 'home_state.dart';
|
part 'home_state.dart';
|
||||||
@ -67,6 +69,8 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
var uuid =
|
var uuid =
|
||||||
await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
||||||
user = await ProfileApi().fetchUserInfo(uuid);
|
user = await ProfileApi().fetchUserInfo(uuid);
|
||||||
|
project = user?.project;
|
||||||
|
|
||||||
emit(HomeUserInfoLoaded(user!));
|
emit(HomeUserInfoLoaded(user!));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return;
|
return;
|
||||||
@ -175,6 +179,8 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
|
|
||||||
SubSpaceModel? selectedRoom;
|
SubSpaceModel? selectedRoom;
|
||||||
|
|
||||||
|
Project? project;
|
||||||
|
|
||||||
PageController devicesPageController = PageController();
|
PageController devicesPageController = PageController();
|
||||||
|
|
||||||
PageController roomsPageController = PageController();
|
PageController roomsPageController = PageController();
|
||||||
@ -324,8 +330,8 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
//////////////////////////////////////// API ////////////////////////////////////////
|
//////////////////////////////////////// API ////////////////////////////////////////
|
||||||
generateInvitation(SpaceModel unit) async {
|
generateInvitation(SpaceModel unit) async {
|
||||||
try {
|
try {
|
||||||
final invitationCode =
|
final invitationCode = await SpacesAPI.generateInvitationCode(unit.id,
|
||||||
await SpacesAPI.generateInvitationCode(unit.id, unit.community.uuid);
|
unit.community.uuid, project?.uuid ?? TempConst.projectIdDev);
|
||||||
if (invitationCode.isNotEmpty) {
|
if (invitationCode.isNotEmpty) {
|
||||||
Share.share('The invitation code is $invitationCode');
|
Share.share('The invitation code is $invitationCode');
|
||||||
CustomSnackBar.displaySnackBar(
|
CustomSnackBar.displaySnackBar(
|
||||||
@ -380,8 +386,10 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
fetchRoomsByUnitId(SpaceModel space) async {
|
fetchRoomsByUnitId(SpaceModel space) async {
|
||||||
emitSafe(GetSpaceRoomsLoading());
|
emitSafe(GetSpaceRoomsLoading());
|
||||||
try {
|
try {
|
||||||
space.subspaces =
|
space.subspaces = await SpacesAPI.getSubSpaceBySpaceId(
|
||||||
await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id);
|
space.community.uuid,
|
||||||
|
space.id,
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
} catch (failure) {
|
} catch (failure) {
|
||||||
emitSafe(GetSpaceRoomsError(failure.toString()));
|
emitSafe(GetSpaceRoomsError(failure.toString()));
|
||||||
return;
|
return;
|
||||||
@ -414,7 +422,6 @@ class HomeCubit extends Cubit<HomeState> {
|
|||||||
emitSafe(ActivationError(errMessage: errorMsg));
|
emitSafe(ActivationError(errMessage: errorMsg));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////// Nav ///////////////////////////////////////
|
/////////////////////////////////////// Nav ///////////////////////////////////////
|
||||||
|
|||||||
27
lib/features/auth/model/project_model.dart
Normal file
27
lib/features/auth/model/project_model.dart
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
class Project {
|
||||||
|
final String uuid;
|
||||||
|
final String name;
|
||||||
|
final String description;
|
||||||
|
|
||||||
|
const Project({
|
||||||
|
required this.uuid,
|
||||||
|
required this.name,
|
||||||
|
required this.description,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Project.fromJson(Map<String, dynamic> json) {
|
||||||
|
return Project(
|
||||||
|
uuid: json['uuid'] as String,
|
||||||
|
name: json['name'] as String,
|
||||||
|
description: json['description'] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'uuid': uuid,
|
||||||
|
'name': name,
|
||||||
|
'description': description,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/auth/model/token.dart';
|
import 'package:syncrow_app/features/auth/model/token.dart';
|
||||||
|
|
||||||
class UserModel {
|
class UserModel {
|
||||||
@ -20,6 +21,7 @@ class UserModel {
|
|||||||
final bool? hasAcceptedAppAgreement;
|
final bool? hasAcceptedAppAgreement;
|
||||||
final DateTime? appAgreementAcceptedAt;
|
final DateTime? appAgreementAcceptedAt;
|
||||||
final Role? role;
|
final Role? role;
|
||||||
|
final Project? project;
|
||||||
|
|
||||||
UserModel({
|
UserModel({
|
||||||
required this.uuid,
|
required this.uuid,
|
||||||
@ -38,6 +40,7 @@ class UserModel {
|
|||||||
required this.hasAcceptedAppAgreement,
|
required this.hasAcceptedAppAgreement,
|
||||||
required this.appAgreementAcceptedAt,
|
required this.appAgreementAcceptedAt,
|
||||||
required this.role,
|
required this.role,
|
||||||
|
required this.project,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory UserModel.fromJson(Map<String, dynamic> json) {
|
factory UserModel.fromJson(Map<String, dynamic> json) {
|
||||||
@ -62,6 +65,8 @@ class UserModel {
|
|||||||
? DateTime.parse(json['appAgreementAcceptedAt'])
|
? DateTime.parse(json['appAgreementAcceptedAt'])
|
||||||
: null,
|
: null,
|
||||||
role: json['role'] != null ? Role.fromJson(json['role']) : null,
|
role: json['role'] != null ? Role.fromJson(json['role']) : null,
|
||||||
|
project:
|
||||||
|
json['project'] != null ? Project.fromJson(json['project']) : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +93,7 @@ class UserModel {
|
|||||||
? DateTime.parse(tempJson['appAgreementAcceptedAt'])
|
? DateTime.parse(tempJson['appAgreementAcceptedAt'])
|
||||||
: null,
|
: null,
|
||||||
role: tempJson['role'] != null ? Role.fromJson(tempJson['role']) : null,
|
role: tempJson['role'] != null ? Role.fromJson(tempJson['role']) : null,
|
||||||
);
|
project: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Uint8List? decodeBase64Image(String? base64String) {
|
static Uint8List? decodeBase64Image(String? base64String) {
|
||||||
@ -137,8 +142,10 @@ class Role {
|
|||||||
factory Role.fromJson(Map<String, dynamic> json) {
|
factory Role.fromJson(Map<String, dynamic> json) {
|
||||||
return Role(
|
return Role(
|
||||||
uuid: json['uuid'],
|
uuid: json['uuid'],
|
||||||
createdAt: json['createdAt'] != null ? DateTime.parse(json['createdAt']) : null,
|
createdAt:
|
||||||
updatedAt: json['updatedAt'] != null ? DateTime.parse(json['updatedAt']) : null,
|
json['createdAt'] != null ? DateTime.parse(json['createdAt']) : null,
|
||||||
|
updatedAt:
|
||||||
|
json['updatedAt'] != null ? DateTime.parse(json['updatedAt']) : null,
|
||||||
type: json['type'],
|
type: json['type'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
19
lib/features/common/bloc/project_cubit.dart
Normal file
19
lib/features/common/bloc/project_cubit.dart
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
|
|
||||||
|
class ProjectCubit extends Cubit<String?> {
|
||||||
|
final FlutterSecureStorage storage;
|
||||||
|
static const String projectKey = "selected_project_uuid";
|
||||||
|
|
||||||
|
ProjectCubit(this.storage) : super(null);
|
||||||
|
|
||||||
|
Future<void> setProjectUUID(String newUUID) async {
|
||||||
|
await storage.write(key: projectKey, value: newUUID);
|
||||||
|
emit(newUUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> clearProjectUUID() async {
|
||||||
|
await storage.delete(key: projectKey);
|
||||||
|
emit(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_state.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||||
@ -16,6 +17,7 @@ import 'package:syncrow_app/services/api/devices_api.dart';
|
|||||||
import 'package:syncrow_app/services/api/home_management_api.dart';
|
import 'package:syncrow_app/services/api/home_management_api.dart';
|
||||||
import 'package:syncrow_app/services/api/scene_api.dart';
|
import 'package:syncrow_app/services/api/scene_api.dart';
|
||||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
|
|
||||||
class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
||||||
@ -112,8 +114,9 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
|||||||
FetchRoomsEvent event, Emitter<SixSceneState> emit) async {
|
FetchRoomsEvent event, Emitter<SixSceneState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(SixSceneLoadingState());
|
emit(SixSceneLoadingState());
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
||||||
event.unit.community.uuid, event.unit.id);
|
event.unit.community.uuid, event.unit.id, project?.uuid ?? TempConst.projectIdDev);
|
||||||
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(SixSceneFailedState(errorMessage: e.toString()));
|
emit(SixSceneFailedState(errorMessage: e.toString()));
|
||||||
@ -125,12 +128,14 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
|||||||
try {
|
try {
|
||||||
emit(SixSceneLoadingState());
|
emit(SixSceneLoadingState());
|
||||||
if (_hasSelectionChanged) {
|
if (_hasSelectionChanged) {
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
await HomeManagementAPI.assignDeviceToRoom(
|
await HomeManagementAPI.assignDeviceToRoom(
|
||||||
event.unit.community.uuid, event.unit.id, event.roomId, sixSceneId);
|
event.unit.community.uuid, event.unit.id, event.roomId, sixSceneId, project?.uuid ?? TempConst.projectIdDev);
|
||||||
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
||||||
communityUuid: event.unit.community.uuid,
|
communityUuid: event.unit.community.uuid,
|
||||||
spaceUuid: event.unit.id,
|
spaceUuid: event.unit.id,
|
||||||
roomId: event.roomId);
|
roomId: event.roomId,
|
||||||
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
List<String> allDevicesIds = [];
|
List<String> allDevicesIds = [];
|
||||||
allDevices.forEach((element) {
|
allDevices.forEach((element) {
|
||||||
allDevicesIds.add(element.uuid!);
|
allDevicesIds.add(element.uuid!);
|
||||||
@ -341,8 +346,10 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
|||||||
emit(SixSceneLoadingState());
|
emit(SixSceneLoadingState());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
allScenes = await SceneApi.getScenesByUnitId(
|
allScenes = await SceneApi.getScenesByUnitId(
|
||||||
event.unitId, event.unit.community.uuid,
|
event.unitId, event.unit.community.uuid, project?.uuid ?? TempConst.projectIdDev,
|
||||||
showInDevice: event.showInDevice);
|
showInDevice: event.showInDevice);
|
||||||
|
|
||||||
filteredScenes = allScenes;
|
filteredScenes = allScenes;
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
@ -28,7 +27,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
bool allAcsPage = false;
|
bool allAcsPage = false;
|
||||||
bool allAcsOn = true;
|
bool allAcsOn = true;
|
||||||
bool allTempSame = true;
|
bool allTempSame = true;
|
||||||
int globalTemp = 25;
|
int globalTemp = 250;
|
||||||
Timer? _timer;
|
Timer? _timer;
|
||||||
|
|
||||||
ACsBloc({required this.acId}) : super(AcsInitialState()) {
|
ACsBloc({required this.acId}) : super(AcsInitialState()) {
|
||||||
@ -69,8 +68,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
for (var status in response['status']) {
|
for (var status in response['status']) {
|
||||||
statusModelList.add(StatusModel.fromJson(status));
|
statusModelList.add(StatusModel.fromJson(status));
|
||||||
}
|
}
|
||||||
deviceStatus =
|
deviceStatus = AcStatusModel.fromJson(response['productUuid'], statusModelList);
|
||||||
AcStatusModel.fromJson(response['productUuid'], statusModelList);
|
|
||||||
emit(GetAcStatusState(acStatusModel: deviceStatus));
|
emit(GetAcStatusState(acStatusModel: deviceStatus));
|
||||||
Future.delayed(const Duration(milliseconds: 500));
|
Future.delayed(const Duration(milliseconds: 500));
|
||||||
_listenToChanges(acId);
|
_listenToChanges(acId);
|
||||||
@ -96,8 +94,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
List<StatusModel> statusList = [];
|
List<StatusModel> statusList = [];
|
||||||
|
|
||||||
usersMap['status'].forEach((element) {
|
usersMap['status'].forEach((element) {
|
||||||
statusList
|
statusList.add(StatusModel(code: element['code'], value: element['value']));
|
||||||
.add(StatusModel(code: element['code'], value: element['value']));
|
|
||||||
});
|
});
|
||||||
deviceStatus =
|
deviceStatus =
|
||||||
AcStatusModel.fromJson(usersMap['productUuid'], statusList);
|
AcStatusModel.fromJson(usersMap['productUuid'], statusList);
|
||||||
@ -132,8 +129,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
for (var status in response['status']) {
|
for (var status in response['status']) {
|
||||||
statusModelList.add(StatusModel.fromJson(status));
|
statusModelList.add(StatusModel.fromJson(status));
|
||||||
}
|
}
|
||||||
deviceStatusList.add(
|
deviceStatusList.add(AcStatusModel.fromJson(devicesList[i].uuid ?? '', statusModelList));
|
||||||
AcStatusModel.fromJson(response['productUuid'], statusModelList));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_setAllAcsTempsAndSwitches();
|
_setAllAcsTempsAndSwitches();
|
||||||
@ -144,7 +140,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
if (allAcsPage) {
|
if (allAcsPage) {
|
||||||
emit(AcsLoadingState());
|
emit(AcsLoadingState());
|
||||||
for (AcStatusModel ac in deviceStatusList) {
|
for (AcStatusModel ac in deviceStatusList) {
|
||||||
if (ac.uuid == event.productId) {
|
if (ac.uuid == event.deviceId) {
|
||||||
ac.acSwitch = acSwitchValue;
|
ac.acSwitch = acSwitchValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,8 +153,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
await _runDeBouncerForOneDevice(
|
await _runDeBouncerForOneDevice(deviceId: event.deviceId, code: 'switch', value: acSwitchValue);
|
||||||
deviceId: event.deviceId, code: 'switch', value: acSwitchValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _changeAllAcSwitch(ChangeAllSwitch event, Emitter<AcsState> emit) async {
|
void _changeAllAcSwitch(ChangeAllSwitch event, Emitter<AcsState> emit) async {
|
||||||
@ -219,8 +214,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
deviceStatus.childLock = lockValue;
|
deviceStatus.childLock = lockValue;
|
||||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||||
|
|
||||||
await _runDeBouncerForOneDevice(
|
await _runDeBouncerForOneDevice(deviceId: acId, code: 'child_lock', value: lockValue);
|
||||||
deviceId: acId, code: 'child_lock', value: lockValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _increaseCoolTo(IncreaseCoolToTemp event, Emitter<AcsState> emit) async {
|
void _increaseCoolTo(IncreaseCoolToTemp event, Emitter<AcsState> emit) async {
|
||||||
@ -236,7 +230,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
if (allAcsPage) {
|
if (allAcsPage) {
|
||||||
emit(AcsLoadingState());
|
emit(AcsLoadingState());
|
||||||
for (AcStatusModel ac in deviceStatusList) {
|
for (AcStatusModel ac in deviceStatusList) {
|
||||||
if (ac.uuid == event.productId) {
|
if (ac.uuid == event.deviceId) {
|
||||||
ac.tempSet = value;
|
ac.tempSet = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,8 +242,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
await _runDeBouncerForOneDevice(
|
await _runDeBouncerForOneDevice(deviceId: event.deviceId, code: 'temp_set', value: value);
|
||||||
deviceId: event.deviceId, code: 'temp_set', value: value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _decreaseCoolTo(DecreaseCoolToTemp event, Emitter<AcsState> emit) async {
|
void _decreaseCoolTo(DecreaseCoolToTemp event, Emitter<AcsState> emit) async {
|
||||||
@ -265,7 +258,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
if (allAcsPage) {
|
if (allAcsPage) {
|
||||||
emit(AcsLoadingState());
|
emit(AcsLoadingState());
|
||||||
for (AcStatusModel ac in deviceStatusList) {
|
for (AcStatusModel ac in deviceStatusList) {
|
||||||
if (ac.uuid == event.productId) {
|
if (ac.uuid == event.deviceId) {
|
||||||
ac.tempSet = value;
|
ac.tempSet = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,8 +270,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
await _runDeBouncerForOneDevice(
|
await _runDeBouncerForOneDevice(deviceId: event.deviceId, code: 'temp_set', value: value);
|
||||||
deviceId: event.deviceId, code: 'temp_set', value: value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _changeAcMode(ChangeAcMode event, Emitter<AcsState> emit) async {
|
void _changeAcMode(ChangeAcMode event, Emitter<AcsState> emit) async {
|
||||||
@ -286,7 +278,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
if (allAcsPage) {
|
if (allAcsPage) {
|
||||||
emit(AcsLoadingState());
|
emit(AcsLoadingState());
|
||||||
for (AcStatusModel ac in deviceStatusList) {
|
for (AcStatusModel ac in deviceStatusList) {
|
||||||
if (ac.uuid == event.productId) {
|
if (ac.uuid == event.deviceId) {
|
||||||
ac.modeString = getACModeString(tempMode);
|
ac.modeString = getACModeString(tempMode);
|
||||||
ac.acMode = AcStatusModel.getACMode(getACModeString(tempMode));
|
ac.acMode = AcStatusModel.getACMode(getACModeString(tempMode));
|
||||||
}
|
}
|
||||||
@ -300,9 +292,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await _runDeBouncerForOneDevice(
|
await _runDeBouncerForOneDevice(
|
||||||
deviceId: event.deviceId,
|
deviceId: event.deviceId, code: 'mode', value: getACModeString(tempMode));
|
||||||
code: 'mode',
|
|
||||||
value: getACModeString(tempMode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _changeFanSpeed(ChangeFanSpeed event, Emitter<AcsState> emit) async {
|
void _changeFanSpeed(ChangeFanSpeed event, Emitter<AcsState> emit) async {
|
||||||
@ -313,25 +303,21 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
if (allAcsPage) {
|
if (allAcsPage) {
|
||||||
emit(AcsLoadingState());
|
emit(AcsLoadingState());
|
||||||
for (AcStatusModel ac in deviceStatusList) {
|
for (AcStatusModel ac in deviceStatusList) {
|
||||||
if (ac.uuid == event.productId) {
|
if (ac.uuid == event.deviceId) {
|
||||||
ac.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
|
ac.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
|
||||||
ac.acFanSpeed =
|
ac.acFanSpeed = AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
|
||||||
AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_emitAcsStatus(emit);
|
_emitAcsStatus(emit);
|
||||||
} else {
|
} else {
|
||||||
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
emit(AcChangeLoading(acStatusModel: deviceStatus));
|
||||||
deviceStatus.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
|
deviceStatus.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
|
||||||
deviceStatus.acFanSpeed =
|
deviceStatus.acFanSpeed = AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
|
||||||
AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
|
|
||||||
emit(AcModifyingState(acStatusModel: deviceStatus));
|
emit(AcModifyingState(acStatusModel: deviceStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
await _runDeBouncerForOneDevice(
|
await _runDeBouncerForOneDevice(
|
||||||
deviceId: event.deviceId,
|
deviceId: event.deviceId, code: 'level', value: getNextFanSpeedKey(fanSpeed));
|
||||||
code: 'level',
|
|
||||||
value: getNextFanSpeedKey(fanSpeed));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getACModeString(TempModes value) {
|
String getACModeString(TempModes value) {
|
||||||
@ -350,17 +336,15 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
allAcsOn = true;
|
allAcsOn = true;
|
||||||
allTempSame = true;
|
allTempSame = true;
|
||||||
if (deviceStatusList.isNotEmpty) {
|
if (deviceStatusList.isNotEmpty) {
|
||||||
int temp = deviceStatusList[0].tempSet;
|
int temp = deviceStatusList.first.tempSet;
|
||||||
deviceStatusList.firstWhere((element) {
|
for (var element in deviceStatusList) {
|
||||||
if (!element.acSwitch) {
|
if (!element.acSwitch) {
|
||||||
allAcsOn = false;
|
allAcsOn = false;
|
||||||
}
|
}
|
||||||
if (element.tempSet != temp) {
|
if (element.tempSet != temp) {
|
||||||
allTempSame = false;
|
allTempSame = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
|
||||||
});
|
|
||||||
if (allTempSame) {
|
if (allTempSame) {
|
||||||
globalTemp = temp;
|
globalTemp = temp;
|
||||||
}
|
}
|
||||||
@ -376,8 +360,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
for (int i = 0; i < deviceStatusList.length; i++) {
|
for (int i = 0; i < deviceStatusList.length; i++) {
|
||||||
try {
|
try {
|
||||||
await DevicesAPI.controlDevice(
|
await DevicesAPI.controlDevice(
|
||||||
DeviceControlModel(
|
DeviceControlModel(deviceId: devicesList[i].uuid, code: code, value: value),
|
||||||
deviceId: devicesList[i].uuid, code: code, value: value),
|
|
||||||
devicesList[i].uuid ?? '');
|
devicesList[i].uuid ?? '');
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
await Future.delayed(const Duration(milliseconds: 500));
|
await Future.delayed(const Duration(milliseconds: 500));
|
||||||
@ -399,10 +382,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
_timer = Timer(const Duration(seconds: 1), () async {
|
_timer = Timer(const Duration(seconds: 1), () async {
|
||||||
try {
|
try {
|
||||||
final response = await DevicesAPI.controlDevice(
|
final response = await DevicesAPI.controlDevice(
|
||||||
DeviceControlModel(
|
DeviceControlModel(deviceId: allAcsPage ? deviceId : acId, code: code, value: value),
|
||||||
deviceId: allAcsPage ? deviceId : acId,
|
|
||||||
code: code,
|
|
||||||
value: value),
|
|
||||||
allAcsPage ? deviceId : acId);
|
allAcsPage ? deviceId : acId);
|
||||||
|
|
||||||
if (!response['success']) {
|
if (!response['success']) {
|
||||||
@ -419,8 +399,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
if (value >= 20 && value <= 30) {
|
if (value >= 20 && value <= 30) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
emit(const AcsFailedState(
|
emit(const AcsFailedState(errorMessage: 'The temperature must be between 20 and 30'));
|
||||||
errorMessage: 'The temperature must be between 20 and 30'));
|
|
||||||
emit(GetAllAcsStatusState(
|
emit(GetAllAcsStatusState(
|
||||||
allAcsStatues: deviceStatusList,
|
allAcsStatues: deviceStatusList,
|
||||||
allAcs: devicesList,
|
allAcs: devicesList,
|
||||||
@ -446,9 +425,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
try {
|
try {
|
||||||
seconds = event.seconds;
|
seconds = event.seconds;
|
||||||
final response = await DevicesAPI.controlDevice(
|
final response = await DevicesAPI.controlDevice(
|
||||||
DeviceControlModel(
|
DeviceControlModel(deviceId: acId, code: 'countdown_time', value: event.duration), acId);
|
||||||
deviceId: acId, code: 'countdown_time', value: event.duration),
|
|
||||||
acId);
|
|
||||||
|
|
||||||
if (response['success'] ?? false) {
|
if (response['success'] ?? false) {
|
||||||
deviceStatus.countdown1 = seconds;
|
deviceStatus.countdown1 = seconds;
|
||||||
@ -469,24 +446,26 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _getCounterValue(GetCounterEvent event, Emitter<AcsState> emit) async {
|
void _getCounterValue(GetCounterEvent event, Emitter<AcsState> emit) async {
|
||||||
try {
|
|
||||||
emit(AcsLoadingState());
|
emit(AcsLoadingState());
|
||||||
var response = await DevicesAPI.getDeviceStatus(acId);
|
var response = await DevicesAPI.getDeviceStatus(acId);
|
||||||
List<StatusModel> statusModelList = [];
|
List<StatusModel> statusModelList = [];
|
||||||
for (var status in response['status']) {
|
for (var status in response['status']) {
|
||||||
statusModelList.add(StatusModel.fromJson(status));
|
statusModelList.add(StatusModel.fromJson(status));
|
||||||
}
|
}
|
||||||
deviceStatus =
|
deviceStatus = AcStatusModel.fromJson(response['productUuid'], statusModelList);
|
||||||
AcStatusModel.fromJson(response['productUuid'], statusModelList);
|
deviceStatus.countdown1;
|
||||||
|
var duration;
|
||||||
if (event.deviceCode == 'countdown_time') {
|
if (deviceStatus.countdown1 == 5) {
|
||||||
deviceStatus.countdown1 > 0
|
duration = const Duration(minutes: 30);
|
||||||
? _onStartTimer(deviceStatus.countdown1)
|
var countNum = duration.inSeconds;
|
||||||
: emit(UpdateTimerState(seconds: deviceStatus.countdown1));
|
_onStartTimer(countNum);
|
||||||
}
|
} else if (deviceStatus.countdown1 > 5) {
|
||||||
} catch (e) {
|
duration = Duration(minutes: deviceStatus.countdown1 * 6);
|
||||||
emit(AcsFailedState(errorMessage: e.toString()));
|
var countNum = duration.inSeconds;
|
||||||
return;
|
_onStartTimer(countNum);
|
||||||
|
} else {
|
||||||
|
_timer?.cancel();
|
||||||
|
emit(TimerRunComplete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
|
|
||||||
import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_state.dart';
|
||||||
@ -10,6 +12,7 @@ import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|||||||
|
|
||||||
import 'package:syncrow_app/services/api/devices_api.dart';
|
import 'package:syncrow_app/services/api/devices_api.dart';
|
||||||
import 'package:syncrow_app/services/api/home_management_api.dart';
|
import 'package:syncrow_app/services/api/home_management_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
|
|
||||||
class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
||||||
@ -27,11 +30,16 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
|||||||
|
|
||||||
static List<DevicesCategoryModel>? allCategories;
|
static List<DevicesCategoryModel>? allCategories;
|
||||||
|
|
||||||
Future<void> _onFetchAllDevices(FetchAllDevices event, Emitter<DeviceManagerState> emit) async {
|
Future<void> _onFetchAllDevices(
|
||||||
|
FetchAllDevices event, Emitter<DeviceManagerState> emit) async {
|
||||||
emit(state.copyWith(loading: true));
|
emit(state.copyWith(loading: true));
|
||||||
try {
|
try {
|
||||||
final allDevices = await HomeManagementAPI.fetchDevicesByUnitId();
|
Project? project = HomeCubit.getInstance().project;
|
||||||
emit(state.copyWith(devices: _getOnlyImplementedDevices(allDevices), loading: false));
|
|
||||||
|
final allDevices = await HomeManagementAPI.fetchDevicesByUnitId(
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
|
emit(state.copyWith(
|
||||||
|
devices: _getOnlyImplementedDevices(allDevices), loading: false));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(state.copyWith(error: e.toString(), loading: false));
|
emit(state.copyWith(error: e.toString(), loading: false));
|
||||||
}
|
}
|
||||||
@ -41,26 +49,31 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
|||||||
FetchDevicesByRoomId event, Emitter<DeviceManagerState> emit) async {
|
FetchDevicesByRoomId event, Emitter<DeviceManagerState> emit) async {
|
||||||
emit(state.copyWith(loading: true));
|
emit(state.copyWith(loading: true));
|
||||||
try {
|
try {
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
final devices = await DevicesAPI.getDevicesByRoomId(
|
final devices = await DevicesAPI.getDevicesByRoomId(
|
||||||
communityUuid: event.unit.community.uuid,
|
communityUuid: event.unit.community.uuid,
|
||||||
spaceUuid: event.unit.id,
|
spaceUuid: event.unit.id,
|
||||||
roomId: event.roomId,
|
roomId: event.roomId,
|
||||||
);
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
|
|
||||||
emit(state.copyWith(devices: _getOnlyImplementedDevices(devices), loading: false));
|
emit(state.copyWith(
|
||||||
|
devices: _getOnlyImplementedDevices(devices), loading: false));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(state.copyWith(error: e.toString(), loading: false));
|
emit(state.copyWith(error: e.toString(), loading: false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSelectCategory(SelectCategory event, Emitter<DeviceManagerState> emit) {
|
void _onSelectCategory(
|
||||||
|
SelectCategory event, Emitter<DeviceManagerState> emit) {
|
||||||
for (var i = 0; i < allCategories!.length; i++) {
|
for (var i = 0; i < allCategories!.length; i++) {
|
||||||
allCategories![i].isSelected = i == event.index;
|
allCategories![i].isSelected = i == event.index;
|
||||||
}
|
}
|
||||||
emit(state.copyWith(categoryChanged: true));
|
emit(state.copyWith(categoryChanged: true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onUnselectAllCategories(UnselectAllCategories event, Emitter<DeviceManagerState> emit) {
|
void _onUnselectAllCategories(
|
||||||
|
UnselectAllCategories event, Emitter<DeviceManagerState> emit) {
|
||||||
for (var category in allCategories!) {
|
for (var category in allCategories!) {
|
||||||
category.isSelected = false;
|
category.isSelected = false;
|
||||||
}
|
}
|
||||||
@ -104,7 +117,8 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
|||||||
_updateDevicesStatus(category, emit);
|
_updateDevicesStatus(category, emit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onTurnOnOffDevice(TurnOnOffDevice event, Emitter<DeviceManagerState> emit) {
|
void _onTurnOnOffDevice(
|
||||||
|
TurnOnOffDevice event, Emitter<DeviceManagerState> emit) {
|
||||||
var device = event.device;
|
var device = event.device;
|
||||||
device.isOnline = !device.isOnline!;
|
device.isOnline = !device.isOnline!;
|
||||||
DevicesCategoryModel category = allCategories!.firstWhere((category) {
|
DevicesCategoryModel category = allCategories!.firstWhere((category) {
|
||||||
@ -127,7 +141,8 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
|||||||
emit(state.copyWith(categoryChanged: true)); // Set category changed state
|
emit(state.copyWith(categoryChanged: true)); // Set category changed state
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateDevicesStatus(DevicesCategoryModel category, Emitter<DeviceManagerState> emit) {
|
void _updateDevicesStatus(
|
||||||
|
DevicesCategoryModel category, Emitter<DeviceManagerState> emit) {
|
||||||
if (category.devices != null && category.devices!.isNotEmpty) {
|
if (category.devices != null && category.devices!.isNotEmpty) {
|
||||||
bool? tempStatus = category.devices![0].isOnline;
|
bool? tempStatus = category.devices![0].isOnline;
|
||||||
for (var device in category.devices!) {
|
for (var device in category.devices!) {
|
||||||
@ -147,7 +162,8 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
|||||||
try {
|
try {
|
||||||
final deviceFunctions = await DevicesAPI.deviceFunctions(event.deviceId);
|
final deviceFunctions = await DevicesAPI.deviceFunctions(event.deviceId);
|
||||||
|
|
||||||
emit(state.copyWith(functionsLoading: false, deviceFunctions: deviceFunctions));
|
emit(state.copyWith(
|
||||||
|
functionsLoading: false, deviceFunctions: deviceFunctions));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(state.copyWith(functionsLoading: false, error: e.toString()));
|
emit(state.copyWith(functionsLoading: false, error: e.toString()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/device_settings_bloc/device_scene_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/device_settings_bloc/device_scene_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/device_settings_bloc/device_scene_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/device_settings_bloc/device_scene_state.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
@ -18,6 +19,7 @@ import 'package:syncrow_app/generated/assets.dart';
|
|||||||
import 'package:syncrow_app/services/api/devices_api.dart';
|
import 'package:syncrow_app/services/api/devices_api.dart';
|
||||||
import 'package:syncrow_app/services/api/home_management_api.dart';
|
import 'package:syncrow_app/services/api/home_management_api.dart';
|
||||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
|
|
||||||
class DeviceSettingBloc extends Bloc<DeviceSettingEvent, DeviceSettingState> {
|
class DeviceSettingBloc extends Bloc<DeviceSettingEvent, DeviceSettingState> {
|
||||||
@ -349,13 +351,20 @@ class DeviceSettingBloc extends Bloc<DeviceSettingEvent, DeviceSettingState> {
|
|||||||
AssignRoomEvent event, Emitter<DeviceSettingState> emit) async {
|
AssignRoomEvent event, Emitter<DeviceSettingState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(DeviceSettingLoadingState());
|
emit(DeviceSettingLoadingState());
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
if (_hasSelectionChanged) {
|
if (_hasSelectionChanged) {
|
||||||
await HomeManagementAPI.assignDeviceToRoom(
|
await HomeManagementAPI.assignDeviceToRoom(
|
||||||
event.unit.community.uuid, event.unit.id, event.roomId, deviceId);
|
event.unit.community.uuid,
|
||||||
|
event.unit.id,
|
||||||
|
event.roomId,
|
||||||
|
deviceId,
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
||||||
communityUuid: event.unit.community.uuid,
|
communityUuid: event.unit.community.uuid,
|
||||||
spaceUuid: event.unit.id,
|
spaceUuid: event.unit.id,
|
||||||
roomId: event.roomId);
|
roomId: event.roomId,
|
||||||
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
List<String> allDevicesIds = [];
|
List<String> allDevicesIds = [];
|
||||||
allDevices.forEach((element) {
|
allDevices.forEach((element) {
|
||||||
allDevicesIds.add(element.uuid!);
|
allDevicesIds.add(element.uuid!);
|
||||||
@ -375,8 +384,12 @@ class DeviceSettingBloc extends Bloc<DeviceSettingEvent, DeviceSettingState> {
|
|||||||
FetchRoomsEvent event, Emitter<DeviceSettingState> emit) async {
|
FetchRoomsEvent event, Emitter<DeviceSettingState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(DeviceSettingLoadingState());
|
emit(DeviceSettingLoadingState());
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
||||||
event.unit.community.uuid, event.unit.id);
|
event.unit.community.uuid,
|
||||||
|
event.unit.id,
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(
|
emit(
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
@ -22,6 +23,7 @@ import 'package:syncrow_app/services/api/devices_api.dart';
|
|||||||
import 'package:syncrow_app/services/api/home_management_api.dart';
|
import 'package:syncrow_app/services/api/home_management_api.dart';
|
||||||
import 'package:syncrow_app/services/api/network_exception.dart';
|
import 'package:syncrow_app/services/api/network_exception.dart';
|
||||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
part 'devices_state.dart';
|
part 'devices_state.dart';
|
||||||
|
|
||||||
@ -349,11 +351,14 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
.subspaces
|
.subspaces
|
||||||
.indexWhere((element) => element.id == roomId);
|
.indexWhere((element) => element.id == roomId);
|
||||||
try {
|
try {
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
HomeCubit.getInstance().selectedSpace!.subspaces[roomIndex].devices =
|
HomeCubit.getInstance().selectedSpace!.subspaces[roomIndex].devices =
|
||||||
await DevicesAPI.getDevicesByRoomId(
|
await DevicesAPI.getDevicesByRoomId(
|
||||||
communityUuid: unit!.community.uuid,
|
communityUuid: unit!.community.uuid,
|
||||||
spaceUuid: unit.id,
|
spaceUuid: unit.id,
|
||||||
roomId: roomId);
|
roomId: roomId,
|
||||||
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emitSafe(GetDevicesError(e.toString()));
|
emitSafe(GetDevicesError(e.toString()));
|
||||||
return;
|
return;
|
||||||
@ -450,10 +455,12 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
Future<void> fetchAllDevices(SpaceModel? unit) async {
|
Future<void> fetchAllDevices(SpaceModel? unit) async {
|
||||||
emitSafe(GetDevicesLoading());
|
emitSafe(GetDevicesLoading());
|
||||||
try {
|
try {
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
final devices = await DevicesAPI.getAllDevices(
|
final devices = await DevicesAPI.getAllDevices(
|
||||||
communityUuid: unit!.community.uuid,
|
communityUuid: unit!.community.uuid,
|
||||||
spaceUuid: unit.id,
|
spaceUuid: unit.id,
|
||||||
);
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
allDevices = devices;
|
allDevices = devices;
|
||||||
for (var deviceId in allDevices) {
|
for (var deviceId in allDevices) {
|
||||||
if (deviceId.type == "3G" || deviceId.type == "AC") {
|
if (deviceId.type == "3G" || deviceId.type == "AC") {
|
||||||
@ -572,8 +579,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
final statusIndex =
|
final statusIndex =
|
||||||
device.status.indexWhere((s) => s.code == switchCode);
|
device.status.indexWhere((s) => s.code == switchCode);
|
||||||
if (statusIndex != -1) {
|
if (statusIndex != -1) {
|
||||||
final currentValue = device.status[statusIndex].value ?? false;
|
final toggledValue = control.value;
|
||||||
final toggledValue = !currentValue;
|
|
||||||
final controlRequest = DeviceControlModel(
|
final controlRequest = DeviceControlModel(
|
||||||
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
||||||
final response =
|
final response =
|
||||||
@ -610,8 +616,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
final statusIndex =
|
final statusIndex =
|
||||||
device.status.indexWhere((s) => s.code == switchCode);
|
device.status.indexWhere((s) => s.code == switchCode);
|
||||||
if (statusIndex != -1) {
|
if (statusIndex != -1) {
|
||||||
final currentValue = device.status[statusIndex].value ?? false;
|
final toggledValue = control.value;
|
||||||
final toggledValue = !currentValue;
|
|
||||||
final controlRequest = DeviceControlModel(
|
final controlRequest = DeviceControlModel(
|
||||||
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
||||||
final response =
|
final response =
|
||||||
@ -643,8 +648,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
|
|
||||||
final statusIndex = device.status.indexWhere((s) => s.code == 'switch_1');
|
final statusIndex = device.status.indexWhere((s) => s.code == 'switch_1');
|
||||||
if (statusIndex != -1) {
|
if (statusIndex != -1) {
|
||||||
final currentValue = device.status[statusIndex].value ?? false;
|
final toggledValue = control.value;
|
||||||
final toggledValue = !currentValue;
|
|
||||||
final controlRequest = DeviceControlModel(
|
final controlRequest = DeviceControlModel(
|
||||||
code: 'switch_1', value: toggledValue, deviceId: deviceUuid);
|
code: 'switch_1', value: toggledValue, deviceId: deviceUuid);
|
||||||
final response =
|
final response =
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_state.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||||
@ -14,6 +16,7 @@ import 'package:syncrow_app/features/devices/model/subspace_model.dart';
|
|||||||
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
|
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
|
||||||
import 'package:syncrow_app/services/api/devices_api.dart';
|
import 'package:syncrow_app/services/api/devices_api.dart';
|
||||||
import 'package:syncrow_app/services/api/scene_api.dart';
|
import 'package:syncrow_app/services/api/scene_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
|
|
||||||
class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
||||||
@ -300,9 +303,11 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
LoadScenes event, Emitter<FourSceneState> emit) async {
|
LoadScenes event, Emitter<FourSceneState> emit) async {
|
||||||
emit(FourSceneLoadingState());
|
emit(FourSceneLoadingState());
|
||||||
try {
|
try {
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
if (event.unitId.isNotEmpty) {
|
if (event.unitId.isNotEmpty) {
|
||||||
allScenes = await SceneApi.getScenesByUnitId(
|
allScenes = await SceneApi.getScenesByUnitId(
|
||||||
event.unitId, event.unit.community.uuid,
|
event.unitId, event.unit.community.uuid, project?.uuid ?? TempConst.projectIdDev,
|
||||||
showInDevice: event.showInDevice);
|
showInDevice: event.showInDevice);
|
||||||
|
|
||||||
filteredScenes = allScenes;
|
filteredScenes = allScenes;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/model/community_model.dart';
|
import 'package:syncrow_app/features/app_layout/model/community_model.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_state.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||||
@ -20,6 +21,7 @@ import 'package:syncrow_app/navigation/routing_constants.dart';
|
|||||||
import 'package:syncrow_app/services/api/devices_api.dart';
|
import 'package:syncrow_app/services/api/devices_api.dart';
|
||||||
import 'package:syncrow_app/services/api/home_management_api.dart';
|
import 'package:syncrow_app/services/api/home_management_api.dart';
|
||||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
|
|
||||||
class SosBloc extends Bloc<SosEvent, SosState> {
|
class SosBloc extends Bloc<SosEvent, SosState> {
|
||||||
@ -186,8 +188,12 @@ class SosBloc extends Bloc<SosEvent, SosState> {
|
|||||||
FetchRoomsEvent event, Emitter<SosState> emit) async {
|
FetchRoomsEvent event, Emitter<SosState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(SosLoadingState());
|
emit(SosLoadingState());
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
||||||
event.unit.community.uuid, event.unit.id);
|
event.unit.community.uuid,
|
||||||
|
event.unit.id,
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(const SosFailedState(errorMessage: 'Something went wrong'));
|
emit(const SosFailedState(errorMessage: 'Something went wrong'));
|
||||||
@ -225,13 +231,19 @@ class SosBloc extends Bloc<SosEvent, SosState> {
|
|||||||
void _assignDevice(AssignRoomEvent event, Emitter<SosState> emit) async {
|
void _assignDevice(AssignRoomEvent event, Emitter<SosState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(SosLoadingState());
|
emit(SosLoadingState());
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
await HomeManagementAPI.assignDeviceToRoom(
|
await HomeManagementAPI.assignDeviceToRoom(
|
||||||
event.unit.community.uuid, event.unit.id, event.roomId, sosId);
|
event.unit.community.uuid,
|
||||||
|
event.unit.id,
|
||||||
|
event.roomId,
|
||||||
|
sosId,
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
||||||
communityUuid: event.unit.community.uuid,
|
communityUuid: event.unit.community.uuid,
|
||||||
spaceUuid: event.unit.id,
|
spaceUuid: event.unit.id,
|
||||||
roomId: event.roomId);
|
roomId: event.roomId,
|
||||||
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
|
|
||||||
List<String> allDevicesIds = [];
|
List<String> allDevicesIds = [];
|
||||||
|
|
||||||
@ -251,13 +263,16 @@ class SosBloc extends Bloc<SosEvent, SosState> {
|
|||||||
void _unassignDevice(UnassignRoomEvent event, Emitter<SosState> emit) async {
|
void _unassignDevice(UnassignRoomEvent event, Emitter<SosState> emit) async {
|
||||||
try {
|
try {
|
||||||
Map<String, bool> roomDevicesId = {};
|
Map<String, bool> roomDevicesId = {};
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
emit(SosLoadingState());
|
emit(SosLoadingState());
|
||||||
await HomeManagementAPI.unAssignDeviceToRoom(
|
await HomeManagementAPI.unAssignDeviceToRoom(
|
||||||
event.unit.community.uuid, event.unit.id, event.roomId, sosId);
|
event.unit.community.uuid, event.unit.id, event.roomId, sosId, project?.uuid ?? TempConst.projectIdDev);
|
||||||
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
||||||
communityUuid: event.unit.community.uuid,
|
communityUuid: event.unit.community.uuid,
|
||||||
spaceUuid: event.unit.id,
|
spaceUuid: event.unit.id,
|
||||||
roomId: event.roomId);
|
roomId: event.roomId,
|
||||||
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
|
|
||||||
List<String> allDevicesIds = [];
|
List<String> allDevicesIds = [];
|
||||||
|
|
||||||
|
|||||||
@ -27,24 +27,24 @@ class AcStatusModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
factory AcStatusModel.fromJson(String id, List<StatusModel> jsonList) {
|
factory AcStatusModel.fromJson(String id, List<StatusModel> jsonList) {
|
||||||
late bool _acSwitch;
|
bool _acSwitch = false;
|
||||||
late String _mode;
|
String _mode = '';
|
||||||
late int _tempSet;
|
int _tempSet = 210;
|
||||||
late int _currentTemp;
|
int _currentTemp = 210;
|
||||||
late String _fanSpeeds;
|
String _fanSpeeds = '';
|
||||||
late int _countdown1;
|
int _countdown1 = 0;
|
||||||
late bool _childLock;
|
bool _childLock = false;
|
||||||
for (int i = 0; i < jsonList.length; i++) {
|
for (int i = 0; i < jsonList.length; i++) {
|
||||||
if (jsonList[i].code == 'switch') {
|
if (jsonList[i].code == 'switch') {
|
||||||
_acSwitch = jsonList[i].value ?? false;
|
_acSwitch = jsonList[i].value ?? false;
|
||||||
} else if (jsonList[i].code == 'mode') {
|
} else if (jsonList[i].code == 'mode') {
|
||||||
_mode = jsonList[i].value ?? TempModes.cold;
|
_mode = jsonList[i].value ?? '';
|
||||||
} else if (jsonList[i].code == 'temp_set') {
|
} else if (jsonList[i].code == 'temp_set') {
|
||||||
_tempSet = jsonList[i].value ?? 210;
|
_tempSet = jsonList[i].value ?? 210;
|
||||||
} else if (jsonList[i].code == 'temp_current') {
|
} else if (jsonList[i].code == 'temp_current') {
|
||||||
_currentTemp = jsonList[i].value ?? 210;
|
_currentTemp = jsonList[i].value ?? 210;
|
||||||
} else if (jsonList[i].code == 'level') {
|
} else if (jsonList[i].code == 'level') {
|
||||||
_fanSpeeds = jsonList[i].value ?? 210;
|
_fanSpeeds = jsonList[i].value ?? '';
|
||||||
} else if (jsonList[i].code == 'child_lock') {
|
} else if (jsonList[i].code == 'child_lock') {
|
||||||
_childLock = jsonList[i].value ?? false;
|
_childLock = jsonList[i].value ?? false;
|
||||||
} else if (jsonList[i].code == 'countdown_time') {
|
} else if (jsonList[i].code == 'countdown_time') {
|
||||||
|
|||||||
@ -23,9 +23,9 @@ class CeilingSensorModel {
|
|||||||
required this.bodyMovement});
|
required this.bodyMovement});
|
||||||
|
|
||||||
factory CeilingSensorModel.fromJson(List<StatusModel> jsonList) {
|
factory CeilingSensorModel.fromJson(List<StatusModel> jsonList) {
|
||||||
late String _presenceState;
|
String _presenceState = 'none';
|
||||||
late int _sensitivity;
|
int _sensitivity = 1;
|
||||||
late String _checkingResult;
|
String _checkingResult = '';
|
||||||
int _presenceRange = 1;
|
int _presenceRange = 1;
|
||||||
int _sportsPara = 1;
|
int _sportsPara = 1;
|
||||||
int _moving_max_dis = 0;
|
int _moving_max_dis = 0;
|
||||||
|
|||||||
@ -10,11 +10,11 @@ class CurtainModel {
|
|||||||
});
|
});
|
||||||
|
|
||||||
factory CurtainModel.fromJson(List<StatusModel> jsonList) {
|
factory CurtainModel.fromJson(List<StatusModel> jsonList) {
|
||||||
late String _control;
|
String _control = '';
|
||||||
late int _percent;
|
int _percent = 0;
|
||||||
for (int i = 0; i < jsonList.length; i++) {
|
for (int i = 0; i < jsonList.length; i++) {
|
||||||
if (jsonList[i].code == 'control') {
|
if (jsonList[i].code == 'control') {
|
||||||
_control = jsonList[i].value ?? false;
|
_control = jsonList[i].value ?? '';
|
||||||
}
|
}
|
||||||
if (jsonList[i].code == 'percent_control') {
|
if (jsonList[i].code == 'percent_control') {
|
||||||
_percent = jsonList[i].value ?? 0;
|
_percent = jsonList[i].value ?? 0;
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
class DeviceInfoModel {
|
class DeviceInfoModel {
|
||||||
final int activeTime;
|
final int activeTime;
|
||||||
final String category;
|
final String category;
|
||||||
|
|||||||
@ -1,22 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
||||||
|
|
||||||
class DoorSensorModel {
|
class DoorSensorModel {
|
||||||
bool doorContactState;
|
bool doorContactState;
|
||||||
int batteryPercentage;
|
int batteryPercentage;
|
||||||
|
|
||||||
DoorSensorModel(
|
DoorSensorModel({
|
||||||
{required this.doorContactState,
|
required this.doorContactState,
|
||||||
required this.batteryPercentage,
|
required this.batteryPercentage,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory DoorSensorModel.fromJson(List<StatusModel> jsonList) {
|
factory DoorSensorModel.fromJson(List<StatusModel> jsonList) {
|
||||||
late bool _doorContactState;
|
bool _doorContactState = false;
|
||||||
late int _batteryPercentage;
|
int _batteryPercentage = 0;
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < jsonList.length; i++) {
|
for (int i = 0; i < jsonList.length; i++) {
|
||||||
if (jsonList[i].code == 'doorcontact_state') {
|
if (jsonList[i].code == 'doorcontact_state') {
|
||||||
|
|||||||
@ -24,15 +24,15 @@ class GarageDoorModel {
|
|||||||
});
|
});
|
||||||
|
|
||||||
factory GarageDoorModel.fromJson(List<StatusModel> jsonList) {
|
factory GarageDoorModel.fromJson(List<StatusModel> jsonList) {
|
||||||
late bool _switch1 = false;
|
bool _switch1 = false;
|
||||||
late bool _doorContactState = false;
|
bool _doorContactState = false;
|
||||||
late int _countdown1 = 0;
|
int _countdown1 = 0;
|
||||||
late int _countdownAlarm = 0;
|
int _countdownAlarm = 0;
|
||||||
late String _doorControl1 = "closed";
|
String _doorControl1 = "closed";
|
||||||
late bool _voiceControl1 = false;
|
bool _voiceControl1 = false;
|
||||||
late String _doorState1 = "closed";
|
String _doorState1 = "closed";
|
||||||
late int _batteryPercentage = 0;
|
int _batteryPercentage = 0;
|
||||||
late int _tr_timecon = 0;
|
int _tr_timecon = 0;
|
||||||
|
|
||||||
for (var status in jsonList) {
|
for (var status in jsonList) {
|
||||||
switch (status.code) {
|
switch (status.code) {
|
||||||
|
|||||||
@ -1,19 +1,17 @@
|
|||||||
|
|
||||||
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
||||||
|
|
||||||
class OneGangModel {
|
class OneGangModel {
|
||||||
bool firstSwitch;
|
bool firstSwitch;
|
||||||
int firstCountDown;
|
int firstCountDown;
|
||||||
|
|
||||||
OneGangModel(
|
OneGangModel({
|
||||||
{required this.firstSwitch,
|
required this.firstSwitch,
|
||||||
required this.firstCountDown,
|
required this.firstCountDown,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory OneGangModel.fromJson(List<StatusModel> jsonList) {
|
factory OneGangModel.fromJson(List<StatusModel> jsonList) {
|
||||||
late bool _switch;
|
bool _switch = false;
|
||||||
late int _count;
|
int _count = 0;
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < jsonList.length; i++) {
|
for (int i = 0; i < jsonList.length; i++) {
|
||||||
if (jsonList[i].code == 'switch_1') {
|
if (jsonList[i].code == 'switch_1') {
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
|
|
||||||
@ -15,15 +13,14 @@ class OneTouchModel {
|
|||||||
required this.firstCountDown,
|
required this.firstCountDown,
|
||||||
required this.light_mode,
|
required this.light_mode,
|
||||||
required this.relay,
|
required this.relay,
|
||||||
required this.relay_status_1
|
required this.relay_status_1});
|
||||||
});
|
|
||||||
|
|
||||||
factory OneTouchModel.fromJson(List<StatusModel> jsonList) {
|
factory OneTouchModel.fromJson(List<StatusModel> jsonList) {
|
||||||
late bool _switch;
|
bool _switch = false;
|
||||||
late int _count;
|
int _count = 0;
|
||||||
late String _relay;
|
String _relay = '';
|
||||||
late String _light_mode;
|
String _light_mode = '';
|
||||||
late String relay_status_1;
|
String relay_status_1 = '';
|
||||||
|
|
||||||
for (int i = 0; i < jsonList.length; i++) {
|
for (int i = 0; i < jsonList.length; i++) {
|
||||||
if (jsonList[i].code == 'switch_1') {
|
if (jsonList[i].code == 'switch_1') {
|
||||||
@ -41,10 +38,8 @@ class OneTouchModel {
|
|||||||
return OneTouchModel(
|
return OneTouchModel(
|
||||||
firstSwitch: _switch,
|
firstSwitch: _switch,
|
||||||
firstCountDown: _count,
|
firstCountDown: _count,
|
||||||
light_mode: lightStatusExtension.fromString(_light_mode) ,
|
light_mode: lightStatusExtension.fromString(_light_mode),
|
||||||
relay: StatusExtension.fromString(_relay ) ,
|
relay: StatusExtension.fromString(_relay),
|
||||||
relay_status_1: StatusExtension.fromString(relay_status_1 )
|
relay_status_1: StatusExtension.fromString(relay_status_1));
|
||||||
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,14 +22,14 @@ class SixSceneModel {
|
|||||||
});
|
});
|
||||||
|
|
||||||
factory SixSceneModel.fromJson(List<StatusModel> jsonList) {
|
factory SixSceneModel.fromJson(List<StatusModel> jsonList) {
|
||||||
late dynamic _scene_1;
|
dynamic _scene_1 = '';
|
||||||
late dynamic _scene_2;
|
dynamic _scene_2 = '';
|
||||||
late dynamic _scene_3;
|
dynamic _scene_3 = '';
|
||||||
late dynamic _scene_4;
|
dynamic _scene_4 = '';
|
||||||
late dynamic _scene_5;
|
dynamic _scene_5 = '';
|
||||||
late dynamic _scene_6;
|
dynamic _scene_6 = '';
|
||||||
late dynamic _scene_id_group_id;
|
dynamic _scene_id_group_id = 0;
|
||||||
late dynamic _switch_backlight;
|
dynamic _switch_backlight = false;
|
||||||
|
|
||||||
for (int i = 0; i < jsonList.length; i++) {
|
for (int i = 0; i < jsonList.length; i++) {
|
||||||
if (jsonList[i].code == 'scene_1') {
|
if (jsonList[i].code == 'scene_1') {
|
||||||
|
|||||||
@ -39,23 +39,23 @@ class SmartDoorModel {
|
|||||||
required this.normalOpenSwitch});
|
required this.normalOpenSwitch});
|
||||||
|
|
||||||
factory SmartDoorModel.fromJson(List<StatusModel> jsonList) {
|
factory SmartDoorModel.fromJson(List<StatusModel> jsonList) {
|
||||||
late int _unlockFingerprint;
|
int _unlockFingerprint = 0;
|
||||||
late int _unlockPassword;
|
int _unlockPassword = 0;
|
||||||
late int _unlockTemporary;
|
int _unlockTemporary = 0;
|
||||||
late int _unlockCard;
|
int _unlockCard = 0;
|
||||||
late String _unlockAlarm;
|
String _unlockAlarm = '';
|
||||||
late int _unlockRequest;
|
int _unlockRequest = 0;
|
||||||
late int _residualElectricity;
|
int _residualElectricity = 0;
|
||||||
late bool _reverseLock;
|
bool _reverseLock = false;
|
||||||
late int _unlockApp;
|
int _unlockApp = 0;
|
||||||
late bool _hijack;
|
bool _hijack = false;
|
||||||
late bool _doorbell;
|
bool _doorbell = false;
|
||||||
late String _unlockOfflinePd;
|
String _unlockOfflinePd = '';
|
||||||
late String _unlockOfflineClear;
|
String _unlockOfflineClear = '';
|
||||||
late String _unlockDoubleKit;
|
String _unlockDoubleKit = '';
|
||||||
late String _remoteNoPdSetkey;
|
String _remoteNoPdSetkey = '';
|
||||||
late String _remoteNoDpKey;
|
String _remoteNoDpKey = '';
|
||||||
late bool _normalOpenSwitch;
|
bool _normalOpenSwitch = false;
|
||||||
|
|
||||||
for (int i = 0; i < jsonList.length; i++) {
|
for (int i = 0; i < jsonList.length; i++) {
|
||||||
if (jsonList[i].code == 'unlock_fingerprint') {
|
if (jsonList[i].code == 'unlock_fingerprint') {
|
||||||
|
|||||||
@ -10,8 +10,8 @@ class SosModel {
|
|||||||
});
|
});
|
||||||
|
|
||||||
factory SosModel.fromJson(List<StatusModel> jsonList) {
|
factory SosModel.fromJson(List<StatusModel> jsonList) {
|
||||||
late String _sosContactState;
|
String _sosContactState = '';
|
||||||
late int _batteryPercentage;
|
int _batteryPercentage = 0;
|
||||||
|
|
||||||
for (int i = 0; i < jsonList.length; i++) {
|
for (int i = 0; i < jsonList.length; i++) {
|
||||||
if (jsonList[i].code == 'sos') {
|
if (jsonList[i].code == 'sos') {
|
||||||
|
|||||||
@ -43,6 +43,7 @@ class AcInterfaceControls extends StatelessWidget {
|
|||||||
PageRouteBuilder(
|
PageRouteBuilder(
|
||||||
pageBuilder: (context, animation1, animation2) =>
|
pageBuilder: (context, animation1, animation2) =>
|
||||||
AcTimerPage(
|
AcTimerPage(
|
||||||
|
deviceStatus: deviceStatus,
|
||||||
device: deviceModel,
|
device: deviceModel,
|
||||||
deviceCode: deviceModel.type!,
|
deviceCode: deviceModel.type!,
|
||||||
switchCode: '',
|
switchCode: '',
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_st
|
|||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/custom_halfhour_timer_picker.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/custom_halfhour_timer_picker.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||||
@ -20,10 +20,13 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
final DeviceModel device;
|
final DeviceModel device;
|
||||||
final String deviceCode;
|
final String deviceCode;
|
||||||
final String switchCode;
|
final String switchCode;
|
||||||
|
final AcStatusModel deviceStatus;
|
||||||
|
|
||||||
const AcTimerPage(
|
const AcTimerPage(
|
||||||
{required this.device,
|
{required this.device,
|
||||||
required this.deviceCode,
|
required this.deviceCode,
|
||||||
required this.switchCode,
|
required this.switchCode,
|
||||||
|
required this.deviceStatus,
|
||||||
super.key});
|
super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -37,27 +40,24 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
create: (context) => ACsBloc(acId: device.uuid ?? ''),
|
create: (context) => ACsBloc(acId: device.uuid ?? ''),
|
||||||
child: BlocBuilder<ACsBloc, AcsState>(
|
child: BlocBuilder<ACsBloc, AcsState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final oneGangBloc = BlocProvider.of<ACsBloc>(context);
|
final acBloc = BlocProvider.of<ACsBloc>(context);
|
||||||
Duration duration = Duration.zero;
|
Duration duration = Duration.zero;
|
||||||
int selectedValue = 0;
|
int selectedValue = 0;
|
||||||
|
|
||||||
int countNum = 0;
|
int countNum = 0;
|
||||||
if (state is UpdateTimerState) {
|
if (state is AcsInitialState) {
|
||||||
|
acBloc.add(GetCounterEvent(deviceCode: deviceCode));
|
||||||
|
} else if (state is UpdateTimerState) {
|
||||||
countNum = state.seconds;
|
countNum = state.seconds;
|
||||||
} else if (state is TimerRunInProgress) {
|
} else if (state is TimerRunInProgress) {
|
||||||
countNum = state.remainingTime;
|
countNum = state.remainingTime;
|
||||||
} else if (state is TimerRunComplete) {
|
} else if (state is TimerRunComplete) {
|
||||||
countNum = 0;
|
countNum = 0;
|
||||||
}
|
}
|
||||||
// else if (state is LoadingNewSate) {
|
|
||||||
// countNum = 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: false,
|
canPop: false,
|
||||||
onPopInvoked: (didPop) {
|
onPopInvoked: (didPop) {
|
||||||
if (!didPop) {
|
if (!didPop) {
|
||||||
oneGangBloc.add(OnClose());
|
acBloc.add(OnClose());
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -90,7 +90,7 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: SizedBox(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
@ -102,7 +102,7 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
.slidingBlueColor,
|
.slidingBlueColor,
|
||||||
fontSize: 40,
|
fontSize: 40,
|
||||||
)
|
)
|
||||||
: Container(
|
: SizedBox(
|
||||||
child: CustomHalfHourPicker(
|
child: CustomHalfHourPicker(
|
||||||
onValueChanged: (value) {
|
onValueChanged: (value) {
|
||||||
selectedValue =
|
selectedValue =
|
||||||
@ -120,8 +120,6 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
countNum =
|
countNum =
|
||||||
duration.inSeconds;
|
duration.inSeconds;
|
||||||
}
|
}
|
||||||
print(
|
|
||||||
"Selected Value: $selectedValue, Duration: $duration");
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -131,12 +129,14 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (countNum > 0) {
|
if (countNum > 0) {
|
||||||
oneGangBloc.add(SetCounterValue(
|
acBloc.add(SetCounterValue(
|
||||||
seconds: countNum,
|
seconds: countNum,
|
||||||
deviceCode:'countdown_time',
|
deviceCode:
|
||||||
|
'countdown_time',
|
||||||
duration: selectedValue));
|
duration: selectedValue));
|
||||||
} else if (duration != Duration.zero) {
|
} else if (duration !=
|
||||||
oneGangBloc.add(SetCounterValue(
|
Duration.zero) {
|
||||||
|
acBloc.add(SetCounterValue(
|
||||||
seconds: 0,
|
seconds: 0,
|
||||||
deviceCode:
|
deviceCode:
|
||||||
'countdown_time',
|
'countdown_time',
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class ACsList extends StatelessWidget {
|
|||||||
List<DeviceModel> devicesList = [];
|
List<DeviceModel> devicesList = [];
|
||||||
bool allOn = false;
|
bool allOn = false;
|
||||||
bool allTempSame = false;
|
bool allTempSame = false;
|
||||||
int temperature = 20;
|
int temperature = 250;
|
||||||
if (state is GetAllAcsStatusState) {
|
if (state is GetAllAcsStatusState) {
|
||||||
devicesStatuesList = state.allAcsStatues;
|
devicesStatuesList = state.allAcsStatues;
|
||||||
devicesList = state.allAcs;
|
devicesList = state.allAcs;
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_list.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_list.dart';
|
||||||
@ -40,7 +39,6 @@ class ACsView extends StatelessWidget {
|
|||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: deviceModel != null
|
appBar: deviceModel != null
|
||||||
? DeviceAppbar(
|
? DeviceAppbar(
|
||||||
//BlocProvider.of<ACsBloc>(context).deviceStatus.acSwitch.toString()
|
|
||||||
value: true,
|
value: true,
|
||||||
deviceName: deviceModel!.name!,
|
deviceName: deviceModel!.name!,
|
||||||
deviceUuid: deviceModel!.uuid!,
|
deviceUuid: deviceModel!.uuid!,
|
||||||
|
|||||||
@ -306,7 +306,7 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replaceAll('sec', 's')
|
.replaceAll('sec', 's')
|
||||||
.replaceAll('1hr', '1hour'), // Replacing "sec" with "s"
|
.replaceAll('1hr', '1hour'),
|
||||||
code: 'nobody_time'));
|
code: 'nobody_time'));
|
||||||
}
|
}
|
||||||
} else if (title == 'Maximum Distance') {
|
} else if (title == 'Maximum Distance') {
|
||||||
@ -332,7 +332,7 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
title: title.toString(),
|
title: title.toString(),
|
||||||
sensor: ceilingSensor,
|
sensor: ceilingSensor,
|
||||||
value: model.sensitivity,
|
value: model.sensitivity,
|
||||||
min: 0,
|
min: 1,
|
||||||
max: 10,
|
max: 10,
|
||||||
));
|
));
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
@ -344,7 +344,7 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => const CeilingHelpDescription()),
|
MaterialPageRoute(builder: (context) => const CeilingHelpDescription()),
|
||||||
);
|
);
|
||||||
} else if (title == 'Induction History') {
|
} else if (title == 'Presence Record') {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
@ -393,7 +393,7 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
'val': nobodyTimeVal,
|
'val': nobodyTimeVal,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'title': 'Induction History',
|
'title': 'Presence Record',
|
||||||
'icon': Assets.assetsIconsPresenceSensorAssetsInductionRecording,
|
'icon': Assets.assetsIconsPresenceSensorAssetsInductionRecording,
|
||||||
'page': null,
|
'page': null,
|
||||||
'withArrow': false,
|
'withArrow': false,
|
||||||
|
|||||||
@ -31,12 +31,12 @@ class MaxDistanceControl extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int _parseValue(String value) {
|
int _parseValue(String value) {
|
||||||
if (value.endsWith('sec')) {
|
if (value.endsWith('s')) {
|
||||||
return int.parse(value.replaceAll('sec', '').trim());
|
return int.parse(value.replaceAll('s', '').trim());
|
||||||
} else if (value.endsWith('min')) {
|
} else if (value.endsWith('min')) {
|
||||||
return int.parse(value.replaceAll('min', '').trim()) * 60;
|
return int.parse(value.replaceAll('min', '').trim()) * 60;
|
||||||
} else if (value.endsWith('hr')) {
|
} else if (value.endsWith('hour')) {
|
||||||
return int.parse(value.replaceAll('hr', '').trim()) * 3600;
|
return int.parse(value.replaceAll('hour', '').trim()) * 3600;
|
||||||
}
|
}
|
||||||
return 0; // Default to 0 if the format is unrecognized
|
return 0; // Default to 0 if the format is unrecognized
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ class MaxDistanceControlState extends State<MaxDistanceControl> {
|
|||||||
|
|
||||||
String _formatLabel(double seconds) {
|
String _formatLabel(double seconds) {
|
||||||
if (seconds == 0) return 'None';
|
if (seconds == 0) return 'None';
|
||||||
if (seconds < 60) return '${seconds.toInt()}sec';
|
if (seconds < 60) return '${seconds.toInt()}s';
|
||||||
if (seconds < 3600) {
|
if (seconds < 3600) {
|
||||||
final minutes = (seconds / 60).round();
|
final minutes = (seconds / 60).round();
|
||||||
return '${minutes}min';
|
return '${minutes}min';
|
||||||
@ -90,7 +90,6 @@ class MaxDistanceControlState extends State<MaxDistanceControl> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final double currentSeconds = _stepValues[_currentIndex];
|
final double currentSeconds = _stepValues[_currentIndex];
|
||||||
|
|
||||||
return Dialog(
|
return Dialog(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -128,7 +127,9 @@ class MaxDistanceControlState extends State<MaxDistanceControl> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
TitleMedium(
|
TitleMedium(
|
||||||
text: _formatLabel(currentSeconds),
|
text: _formatLabel(currentSeconds)
|
||||||
|
.replaceAll('1hr', '1hour')
|
||||||
|
.replaceAllMapped(RegExp(r's$'), (match) => 'sec'),
|
||||||
style: context.titleMedium.copyWith(
|
style: context.titleMedium.copyWith(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontsManager.bold,
|
fontWeight: FontsManager.bold,
|
||||||
|
|||||||
@ -21,32 +21,28 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
return BlocBuilder<HomeCubit, HomeState>(
|
return BlocBuilder<HomeCubit, HomeState>(
|
||||||
builder: (context, homeState) {
|
builder: (context, homeState) {
|
||||||
final homeCubit = HomeCubit.getInstance();
|
final homeCubit = HomeCubit.getInstance();
|
||||||
|
|
||||||
// Handle state priority: Errors first
|
// Handle state priority: Errors first
|
||||||
if (homeState is ActivationError) {
|
if (homeState is ActivationError) {
|
||||||
return const CreateUnitWidget();
|
return const CreateUnitWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle loading states
|
// Handle loading states
|
||||||
if (homeState is GetSpacesLoading || homeState is HomeLoading) {
|
if (homeState is GetSpacesLoading || homeState is HomeLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle error states
|
// Handle error states
|
||||||
if (homeState is GetSpacesError) {
|
if (homeState is GetSpacesError) {
|
||||||
return const CreateUnitWidget();
|
return const CreateUnitWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle success states
|
// Handle success states
|
||||||
if (homeState is GetSpacesSuccess ||
|
if (homeState is GetSpacesSuccess ||
|
||||||
homeState is RoomUnSelected ||
|
homeState is RoomUnSelected ||
|
||||||
homeState is RoomSelected ||
|
homeState is RoomSelected ||
|
||||||
homeState is NavChangePage) {
|
homeState is NavChangePage ||
|
||||||
|
homeState is GetSpaceRoomsSuccess) {
|
||||||
// Show empty state if no spaces
|
// Show empty state if no spaces
|
||||||
if (homeCubit.spaces.isEmpty) {
|
if (homeCubit.spaces.isEmpty) {
|
||||||
return const CreateUnitWidget();
|
return const CreateUnitWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
return BlocBuilder<DevicesCubit, DevicesState>(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
builder: (context, devicesState) {
|
builder: (context, devicesState) {
|
||||||
// Devices loading states
|
// Devices loading states
|
||||||
@ -55,7 +51,6 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
devicesState is GetDevicesLoading) {
|
devicesState is GetDevicesLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Devices error state
|
// Devices error state
|
||||||
if (devicesState is GetDevicesError) {
|
if (devicesState is GetDevicesError) {
|
||||||
return Center(child: BodyLarge(text: devicesState.errorMsg));
|
return Center(child: BodyLarge(text: devicesState.errorMsg));
|
||||||
@ -65,7 +60,6 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback for unknown states
|
// Fallback for unknown states
|
||||||
return const Center(child: BodyLarge(text: ''));
|
return const Center(child: BodyLarge(text: ''));
|
||||||
},
|
},
|
||||||
@ -74,7 +68,6 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _buildMainContent(BuildContext context, HomeCubit homeCubit) {
|
Widget _buildMainContent(BuildContext context, HomeCubit homeCubit) {
|
||||||
final devicesCubit = context.read<DevicesCubit>();
|
final devicesCubit = context.read<DevicesCubit>();
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
||||||
import 'package:syncrow_app/features/menu/bloc/create_unit_bloc/create_unit_event.dart';
|
import 'package:syncrow_app/features/menu/bloc/create_unit_bloc/create_unit_event.dart';
|
||||||
import 'package:syncrow_app/features/menu/bloc/create_unit_bloc/create_unit_state.dart';
|
import 'package:syncrow_app/features/menu/bloc/create_unit_bloc/create_unit_state.dart';
|
||||||
import 'package:syncrow_app/services/api/home_creation_api.dart';
|
import 'package:syncrow_app/services/api/home_creation_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
|
||||||
|
|
||||||
class CreateUnitBloc extends Bloc<CreateUnitEvent, CreateUnitState> {
|
class CreateUnitBloc extends Bloc<CreateUnitEvent, CreateUnitState> {
|
||||||
@ -239,8 +241,13 @@ Future<String> _createNewRoom(
|
|||||||
required String communityId}) async {
|
required String communityId}) async {
|
||||||
try {
|
try {
|
||||||
Map<String, String> body = {'subspaceName': roomName};
|
Map<String, String> body = {'subspaceName': roomName};
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
final response = await HomeCreation.createRoom(
|
final response = await HomeCreation.createRoom(
|
||||||
communityId: communityId, spaceId: unitId, body: body);
|
communityId: communityId,
|
||||||
|
spaceId: unitId,
|
||||||
|
body: body,
|
||||||
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
// if (response['data']['uuid'] != '') {
|
// if (response['data']['uuid'] != '') {
|
||||||
// final result = await _assignToRoom(roomId: response['data']['uuid'], userId: userId);
|
// final result = await _assignToRoom(roomId: response['data']['uuid'], userId: userId);
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart';
|
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart';
|
||||||
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart';
|
import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart';
|
||||||
@ -7,6 +8,7 @@ import 'package:syncrow_app/services/api/devices_api.dart';
|
|||||||
import 'package:syncrow_app/services/api/home_creation_api.dart';
|
import 'package:syncrow_app/services/api/home_creation_api.dart';
|
||||||
import 'package:syncrow_app/services/api/home_management_api.dart';
|
import 'package:syncrow_app/services/api/home_management_api.dart';
|
||||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
|
|
||||||
class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
|
class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
|
||||||
List<DeviceModel> allDevices = [];
|
List<DeviceModel> allDevices = [];
|
||||||
@ -24,8 +26,12 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
|
|||||||
FetchRoomsEvent event, Emitter<ManageUnitState> emit) async {
|
FetchRoomsEvent event, Emitter<ManageUnitState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(LoadingState());
|
emit(LoadingState());
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
final roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
final roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
||||||
event.unit.community.uuid, event.unit.id);
|
event.unit.community.uuid,
|
||||||
|
event.unit.id,
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(const ErrorState(message: 'Something went wrong'));
|
emit(const ErrorState(message: 'Something went wrong'));
|
||||||
@ -37,12 +43,16 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
|
|||||||
FetchDevicesByRoomIdEvent event, Emitter<ManageUnitState> emit) async {
|
FetchDevicesByRoomIdEvent event, Emitter<ManageUnitState> emit) async {
|
||||||
try {
|
try {
|
||||||
Map<String, bool> roomDevicesId = {};
|
Map<String, bool> roomDevicesId = {};
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
emit(LoadingState());
|
emit(LoadingState());
|
||||||
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
||||||
communityUuid: event.unit.community.uuid,
|
communityUuid: event.unit.community.uuid,
|
||||||
spaceUuid: event.unit.id,
|
spaceUuid: event.unit.id,
|
||||||
roomId: event.roomId);
|
roomId: event.roomId,
|
||||||
allDevices = await HomeManagementAPI.fetchDevicesByUserId();
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
|
allDevices = await HomeManagementAPI.fetchDevices(
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
|
|
||||||
List<String> allDevicesIds = [];
|
List<String> allDevicesIds = [];
|
||||||
|
|
||||||
@ -72,14 +82,21 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
|
|||||||
AssignRoomEvent event, Emitter<ManageUnitState> emit) async {
|
AssignRoomEvent event, Emitter<ManageUnitState> emit) async {
|
||||||
try {
|
try {
|
||||||
Map<String, bool> roomDevicesId = {};
|
Map<String, bool> roomDevicesId = {};
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
emit(LoadingState());
|
emit(LoadingState());
|
||||||
|
|
||||||
await HomeManagementAPI.assignDeviceToRoom(
|
await HomeManagementAPI.assignDeviceToRoom(
|
||||||
event.unit.community.uuid, event.unit.id, event.roomId, event.deviceId);
|
event.unit.community.uuid,
|
||||||
|
event.unit.id,
|
||||||
|
event.roomId,
|
||||||
|
event.deviceId,
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
||||||
communityUuid: event.unit.community.uuid,
|
communityUuid: event.unit.community.uuid,
|
||||||
spaceUuid: event.unit.id,
|
spaceUuid: event.unit.id,
|
||||||
roomId: event.roomId);
|
roomId: event.roomId,
|
||||||
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
|
|
||||||
List<String> allDevicesIds = [];
|
List<String> allDevicesIds = [];
|
||||||
|
|
||||||
@ -105,19 +122,25 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _unassignDevice(
|
void _unassignDevice(
|
||||||
UnassignRoomEvent event, Emitter<ManageUnitState> emit) async {
|
UnassignRoomEvent event, Emitter<ManageUnitState> emit) async {
|
||||||
try {
|
try {
|
||||||
Map<String, bool> roomDevicesId = {};
|
Map<String, bool> roomDevicesId = {};
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
emit(LoadingState());
|
emit(LoadingState());
|
||||||
|
|
||||||
await HomeManagementAPI.unAssignDeviceToRoom(
|
await HomeManagementAPI.unAssignDeviceToRoom(
|
||||||
event.unit.community.uuid, event.unit.id, event.roomId, event.deviceId);
|
event.unit.community.uuid,
|
||||||
|
event.unit.id,
|
||||||
|
event.roomId,
|
||||||
|
event.deviceId,
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
||||||
communityUuid: event.unit.community.uuid,
|
communityUuid: event.unit.community.uuid,
|
||||||
spaceUuid: event.unit.id,
|
spaceUuid: event.unit.id,
|
||||||
roomId: event.roomId);
|
roomId: event.roomId,
|
||||||
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
|
|
||||||
List<String> allDevicesIds = [];
|
List<String> allDevicesIds = [];
|
||||||
|
|
||||||
@ -143,18 +166,22 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_addNewRoom(AddNewRoom event, Emitter<ManageUnitState> emit) async {
|
_addNewRoom(AddNewRoom event, Emitter<ManageUnitState> emit) async {
|
||||||
Map<String, String> body = {'subspaceName': event.roomName};
|
Map<String, String> body = {'subspaceName': event.roomName};
|
||||||
try {
|
try {
|
||||||
emit(LoadingState());
|
emit(LoadingState());
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
final response = await HomeCreation.createRoom(
|
final response = await HomeCreation.createRoom(
|
||||||
communityId: event.unit.community.uuid,
|
communityId: event.unit.community.uuid,
|
||||||
spaceId: event.unit.id,
|
spaceId: event.unit.id,
|
||||||
body: body);
|
body: body,
|
||||||
|
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||||
if (response['data']['uuid'] != '') {
|
if (response['data']['uuid'] != '') {
|
||||||
final roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
final roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
||||||
event.unit.community.uuid, event.unit.id);
|
event.unit.community.uuid,
|
||||||
|
event.unit.id,
|
||||||
|
project?.uuid ?? TempConst.projectIdDev);
|
||||||
allDevices = await HomeManagementAPI.fetchDevicesByUserId();
|
allDevices = await HomeManagementAPI.fetchDevicesByUserId();
|
||||||
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
||||||
await HomeCubit.getInstance().fetchUnitsByUserId();
|
await HomeCubit.getInstance().fetchUnitsByUserId();
|
||||||
|
|||||||
@ -154,11 +154,11 @@ class MenuCubit extends Cubit<MenuState> {
|
|||||||
'title': 'Legal Information',
|
'title': 'Legal Information',
|
||||||
'color': const Color(0xFF001B72),
|
'color': const Color(0xFF001B72),
|
||||||
'buttons': [
|
'buttons': [
|
||||||
{
|
// {
|
||||||
'title': 'About',
|
// 'title': 'About',
|
||||||
'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsAbout,
|
// 'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsAbout,
|
||||||
'page': null
|
// 'page': null
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
'title': 'Privacy Policy',
|
'title': 'Privacy Policy',
|
||||||
'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsPrivacyPolicy,
|
'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsPrivacyPolicy,
|
||||||
|
|||||||
@ -23,8 +23,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
String timeZoneSelected = '';
|
String timeZoneSelected = '';
|
||||||
String regionSelected = '';
|
String regionSelected = '';
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
final TextEditingController nameController =
|
final TextEditingController nameController = TextEditingController(
|
||||||
TextEditingController(text: '${HomeCubit.user!.firstName} ${HomeCubit.user!.lastName}');
|
text: '${HomeCubit.user!.firstName} ${HomeCubit.user!.lastName}');
|
||||||
|
|
||||||
List<RegionModel> allRegions = [];
|
List<RegionModel> allRegions = [];
|
||||||
List<TimeZone> allTimeZone = [];
|
List<TimeZone> allTimeZone = [];
|
||||||
@ -77,10 +77,13 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
emit(NameEditingState(editName: editName));
|
emit(NameEditingState(editName: editName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _fetchUserInfo(InitialProfileEvent event, Emitter<ProfileState> emit) async {
|
void _fetchUserInfo(
|
||||||
|
InitialProfileEvent event, Emitter<ProfileState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(LoadingInitialState());
|
emit(LoadingInitialState());
|
||||||
HomeCubit.user = await ProfileApi().fetchUserInfo(HomeCubit.user!.uuid);
|
HomeCubit.user = await ProfileApi().fetchUserInfo(HomeCubit.user!.uuid);
|
||||||
|
HomeCubit.getInstance().project = HomeCubit.user?.project;
|
||||||
|
|
||||||
emit(SaveState());
|
emit(SaveState());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(FailedState(errorMessage: e.toString()));
|
emit(FailedState(errorMessage: e.toString()));
|
||||||
@ -88,7 +91,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _fetchTimeZone(TimeZoneInitialEvent event, Emitter<ProfileState> emit) async {
|
Future _fetchTimeZone(
|
||||||
|
TimeZoneInitialEvent event, Emitter<ProfileState> emit) async {
|
||||||
emit(LoadingInitialState());
|
emit(LoadingInitialState());
|
||||||
try {
|
try {
|
||||||
allTimeZone = await ProfileApi.fetchTimeZone();
|
allTimeZone = await ProfileApi.fetchTimeZone();
|
||||||
@ -100,7 +104,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future selectTimeZone(SelectTimeZoneEvent event, Emitter<ProfileState> emit) async {
|
Future selectTimeZone(
|
||||||
|
SelectTimeZoneEvent event, Emitter<ProfileState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(LoadingInitialState());
|
emit(LoadingInitialState());
|
||||||
timeZoneSelected = event.val;
|
timeZoneSelected = event.val;
|
||||||
@ -112,7 +117,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future selectRegion(SelectRegionEvent event, Emitter<ProfileState> emit) async {
|
Future selectRegion(
|
||||||
|
SelectRegionEvent event, Emitter<ProfileState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(LoadingInitialState());
|
emit(LoadingInitialState());
|
||||||
await ProfileApi.saveRegion(regionUuid: event.val);
|
await ProfileApi.saveRegion(regionUuid: event.val);
|
||||||
@ -124,7 +130,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> searchRegion(SearchRegionEvent event, Emitter<ProfileState> emit) async {
|
Future<void> searchRegion(
|
||||||
|
SearchRegionEvent event, Emitter<ProfileState> emit) async {
|
||||||
emit(LoadingInitialState());
|
emit(LoadingInitialState());
|
||||||
final query = event.query.toLowerCase();
|
final query = event.query.toLowerCase();
|
||||||
if (allRegions.isEmpty) {
|
if (allRegions.isEmpty) {
|
||||||
@ -140,7 +147,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> searchTimeZone(SearchTimeZoneEvent event, Emitter<ProfileState> emit) async {
|
Future<void> searchTimeZone(
|
||||||
|
SearchTimeZoneEvent event, Emitter<ProfileState> emit) async {
|
||||||
emit(LoadingInitialState());
|
emit(LoadingInitialState());
|
||||||
final query = event.query.toLowerCase();
|
final query = event.query.toLowerCase();
|
||||||
if (allTimeZone.isEmpty) {
|
if (allTimeZone.isEmpty) {
|
||||||
@ -156,7 +164,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _fetchRegion(RegionInitialEvent event, Emitter<ProfileState> emit) async {
|
void _fetchRegion(
|
||||||
|
RegionInitialEvent event, Emitter<ProfileState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(LoadingInitialState());
|
emit(LoadingInitialState());
|
||||||
allRegions = await ProfileApi.fetchRegion();
|
allRegions = await ProfileApi.fetchRegion();
|
||||||
@ -166,7 +175,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _selectImage(SelectImageEvent event, Emitter<ProfileState> emit) async {
|
Future<void> _selectImage(
|
||||||
|
SelectImageEvent event, Emitter<ProfileState> emit) async {
|
||||||
try {
|
try {
|
||||||
if (await _requestPermission()) {
|
if (await _requestPermission()) {
|
||||||
emit(ChangeImageState());
|
emit(ChangeImageState());
|
||||||
@ -283,7 +293,8 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
|
SharedPreferences sharedPreferences =
|
||||||
|
await SharedPreferences.getInstance();
|
||||||
bool firstClick = sharedPreferences.getBool('firstPermission') ?? true;
|
bool firstClick = sharedPreferences.getBool('firstPermission') ?? true;
|
||||||
await sharedPreferences.setBool('firstPermission', false);
|
await sharedPreferences.setBool('firstPermission', false);
|
||||||
if (firstClick == false) {
|
if (firstClick == false) {
|
||||||
|
|||||||
@ -28,8 +28,7 @@ class AssignDeviceView extends StatelessWidget {
|
|||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is FetchDeviceByRoomIdState) {
|
if (state is FetchDeviceByRoomIdState) {
|
||||||
if (state.allDevices.isEmpty) {
|
if (state.allDevices.isEmpty) {
|
||||||
CustomSnackBar.displaySnackBar(
|
CustomSnackBar.displaySnackBar('You do not have the devices');
|
||||||
'You do not have the permission to assign devices');
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,23 +16,16 @@ class ManageHomeView extends StatelessWidget {
|
|||||||
var spaces = HomeCubit.getInstance().spaces;
|
var spaces = HomeCubit.getInstance().spaces;
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: 'Manage Your Home',
|
title: 'Manage Your Home',
|
||||||
child: spaces == null
|
height: MediaQuery.sizeOf(context).height,
|
||||||
|
child: spaces.isEmpty
|
||||||
? const Center(
|
? const Center(
|
||||||
child: BodyMedium(text: 'No spaces found'),
|
child: BodyMedium(text: 'No spaces found'),
|
||||||
)
|
)
|
||||||
: Column(
|
: DefaultContainer(
|
||||||
children: [
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
|
||||||
DefaultContainer(
|
child: ListView.builder(
|
||||||
padding: const EdgeInsets.symmetric(
|
itemCount: spaces.length,
|
||||||
horizontal: 25,
|
itemBuilder: (context, index) {
|
||||||
vertical: 20,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: List.generate(
|
|
||||||
spaces.length,
|
|
||||||
(index) {
|
|
||||||
if (index == spaces.length - 1) {
|
if (index == spaces.length - 1) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -74,7 +67,7 @@ class ManageHomeView extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
BodyMedium(text: HomeCubit.getInstance().spaces![index].name),
|
BodyMedium(text: HomeCubit.getInstance().spaces[index].name),
|
||||||
const Icon(
|
const Icon(
|
||||||
Icons.arrow_forward_ios,
|
Icons.arrow_forward_ios,
|
||||||
color: ColorsManager.greyColor,
|
color: ColorsManager.greyColor,
|
||||||
@ -90,11 +83,7 @@ class ManageHomeView extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
}),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,12 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/model/project_model.dart';
|
||||||
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
|
import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_event.dart';
|
||||||
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
|
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
|
||||||
import 'package:syncrow_app/services/api/scene_api.dart';
|
import 'package:syncrow_app/services/api/scene_api.dart';
|
||||||
|
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||||
|
|
||||||
part 'scene_state.dart';
|
part 'scene_state.dart';
|
||||||
|
|
||||||
@ -23,9 +26,11 @@ class SceneBloc extends Bloc<SceneEvent, SceneState> {
|
|||||||
emit(SceneLoading());
|
emit(SceneLoading());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Project? project = HomeCubit.getInstance().project;
|
||||||
|
|
||||||
if (event.unitId.isNotEmpty) {
|
if (event.unitId.isNotEmpty) {
|
||||||
scenes = await SceneApi.getScenesByUnitId(
|
scenes = await SceneApi.getScenesByUnitId(event.unitId,
|
||||||
event.unitId, event.unit.community.uuid,
|
event.unit.community.uuid, project?.uuid ?? TempConst.projectIdDev,
|
||||||
showInDevice: event.showInDevice);
|
showInDevice: event.showInDevice);
|
||||||
emit(SceneLoaded(scenes, automationList));
|
emit(SceneLoaded(scenes, automationList));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -88,6 +88,8 @@ abstract class ApiEndpoints {
|
|||||||
//SPACE Module
|
//SPACE Module
|
||||||
//GET
|
//GET
|
||||||
static const String userSpaces = '/user/{userUuid}/spaces';
|
static const String userSpaces = '/user/{userUuid}/spaces';
|
||||||
|
static const String devices = '/projects/{projectUuid}/devices';
|
||||||
|
|
||||||
static const String spaceDevices =
|
static const String spaceDevices =
|
||||||
'/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/devices';
|
'/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/devices';
|
||||||
|
|
||||||
|
|||||||
@ -51,14 +51,11 @@ class DevicesAPI {
|
|||||||
static Future<Map<String, dynamic>> controlDevice(
|
static Future<Map<String, dynamic>> controlDevice(
|
||||||
DeviceControlModel controlModel, String deviceId) async {
|
DeviceControlModel controlModel, String deviceId) async {
|
||||||
try {
|
try {
|
||||||
print('object-*/-*/-*/${controlModel.toJson()}');
|
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
|
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
|
||||||
body: controlModel.toJson(),
|
body: controlModel.toJson(),
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('object-*/-*/-*/${json}');
|
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -191,7 +188,6 @@ class DevicesAPI {
|
|||||||
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('object-*-*-*${json}');
|
|
||||||
return json;
|
return json;
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
@ -223,13 +219,14 @@ class DevicesAPI {
|
|||||||
required String communityUuid,
|
required String communityUuid,
|
||||||
required String spaceUuid,
|
required String spaceUuid,
|
||||||
required String roomId,
|
required String roomId,
|
||||||
|
required String projectId,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
final String path = ApiEndpoints.deviceByRoom
|
final String path = ApiEndpoints.deviceByRoom
|
||||||
.replaceAll('{communityUuid}', communityUuid)
|
.replaceAll('{communityUuid}', communityUuid)
|
||||||
.replaceAll('{spaceUuid}', spaceUuid)
|
.replaceAll('{spaceUuid}', spaceUuid)
|
||||||
.replaceAll('{subSpaceUuid}', roomId)
|
.replaceAll('{subSpaceUuid}', roomId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', projectId);
|
||||||
|
|
||||||
final response = await _httpService.get(
|
final response = await _httpService.get(
|
||||||
path: path,
|
path: path,
|
||||||
@ -568,22 +565,18 @@ class DevicesAPI {
|
|||||||
static Future<List<DeviceModel>> getAllDevices({
|
static Future<List<DeviceModel>> getAllDevices({
|
||||||
required String communityUuid,
|
required String communityUuid,
|
||||||
required String spaceUuid,
|
required String spaceUuid,
|
||||||
|
required String projectId,
|
||||||
}) async {
|
}) async {
|
||||||
print('communityUuid=$communityUuid');
|
|
||||||
print('spaceUuid=$spaceUuid');
|
|
||||||
print('projectUuid=${TempConst.projectId}');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final String path = ApiEndpoints.getAllDevices
|
final String path = ApiEndpoints.getAllDevices
|
||||||
.replaceAll('{communityUuid}', communityUuid)
|
.replaceAll('{communityUuid}', communityUuid)
|
||||||
.replaceAll('{spaceUuid}', spaceUuid)
|
.replaceAll('{spaceUuid}', spaceUuid)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', projectId);
|
||||||
|
|
||||||
final response = await _httpService.get(
|
final response = await _httpService.get(
|
||||||
path: path,
|
path: path,
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('response-*/-*/$json');
|
|
||||||
final data = json['data'];
|
final data = json['data'];
|
||||||
|
|
||||||
if (data == null || data.isEmpty) {
|
if (data == null || data.isEmpty) {
|
||||||
|
|||||||
@ -145,12 +145,13 @@ class HomeCreation {
|
|||||||
required String communityId,
|
required String communityId,
|
||||||
required String spaceId,
|
required String spaceId,
|
||||||
required Map<String, String> body,
|
required Map<String, String> body,
|
||||||
|
required String projectId
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
final fullPath = ApiEndpoints.addSubSpace
|
final fullPath = ApiEndpoints.addSubSpace
|
||||||
.replaceAll('{communityUuid}', communityId)
|
.replaceAll('{communityUuid}', communityId)
|
||||||
.replaceAll('{spaceUuid}', spaceId)
|
.replaceAll('{spaceUuid}', spaceId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', projectId);
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: fullPath,
|
path: fullPath,
|
||||||
body: body,
|
body: body,
|
||||||
|
|||||||
@ -27,7 +27,23 @@ class HomeManagementAPI {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<List<DeviceModel>> fetchDevicesByUnitId() async {
|
static Future<List<DeviceModel>> fetchDevices(projectUuid) async {
|
||||||
|
List<DeviceModel> list = [];
|
||||||
|
|
||||||
|
await _httpService.get(
|
||||||
|
path: ApiEndpoints.devices.replaceAll("{projectUuid}", projectUuid),
|
||||||
|
showServerMessage: false,
|
||||||
|
expectedResponseModel: (json) {
|
||||||
|
json.forEach((value) {
|
||||||
|
list.add(DeviceModel.fromJson(value));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<DeviceModel>> fetchDevicesByUnitId(
|
||||||
|
String projectUuid) async {
|
||||||
List<DeviceModel> list = [];
|
List<DeviceModel> list = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -40,7 +56,7 @@ class HomeManagementAPI {
|
|||||||
final path = ApiEndpoints.spaceDevices
|
final path = ApiEndpoints.spaceDevices
|
||||||
.replaceAll('{communityUuid}', communityUuid)
|
.replaceAll('{communityUuid}', communityUuid)
|
||||||
.replaceAll('{spaceUuid}', spaceUuid)
|
.replaceAll('{spaceUuid}', spaceUuid)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', projectUuid);
|
||||||
|
|
||||||
await _httpService.get(
|
await _httpService.get(
|
||||||
path: path,
|
path: path,
|
||||||
@ -62,11 +78,16 @@ class HomeManagementAPI {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> assignDeviceToRoom(String communityId,
|
static Future<Map<String, dynamic>> assignDeviceToRoom(
|
||||||
String spaceId, String subSpaceId, String deviceId) async {
|
String communityId,
|
||||||
|
String spaceId,
|
||||||
|
String subSpaceId,
|
||||||
|
String deviceId,
|
||||||
|
String projectId) async {
|
||||||
try {
|
try {
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: ApiEndpoints.assignDeviceToRoom
|
path: ApiEndpoints.assignDeviceToRoom
|
||||||
|
.replaceAll('{projectUuid}', projectId)
|
||||||
.replaceAll('{communityUuid}', communityId)
|
.replaceAll('{communityUuid}', communityId)
|
||||||
.replaceAll('{spaceUuid}', spaceId)
|
.replaceAll('{spaceUuid}', spaceId)
|
||||||
.replaceAll('{subSpaceUuid}', subSpaceId)
|
.replaceAll('{subSpaceUuid}', subSpaceId)
|
||||||
@ -81,8 +102,12 @@ class HomeManagementAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> unAssignDeviceToRoom(String communityId,
|
static Future<Map<String, dynamic>> unAssignDeviceToRoom(
|
||||||
String spaceId, String subSpaceId, String deviceId) async {
|
String communityId,
|
||||||
|
String spaceId,
|
||||||
|
String subSpaceId,
|
||||||
|
String deviceId,
|
||||||
|
String projectId) async {
|
||||||
try {
|
try {
|
||||||
final response = await _httpService.delete(
|
final response = await _httpService.delete(
|
||||||
path: ApiEndpoints.assignDeviceToRoom
|
path: ApiEndpoints.assignDeviceToRoom
|
||||||
@ -90,7 +115,7 @@ class HomeManagementAPI {
|
|||||||
.replaceAll('{spaceUuid}', spaceId)
|
.replaceAll('{spaceUuid}', spaceId)
|
||||||
.replaceAll('{subSpaceUuid}', subSpaceId)
|
.replaceAll('{subSpaceUuid}', subSpaceId)
|
||||||
.replaceAll('{deviceUuid}', deviceId)
|
.replaceAll('{deviceUuid}', deviceId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId),
|
.replaceAll('{projectUuid}', projectId),
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
return json;
|
return json;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -50,14 +50,14 @@ class SceneApi {
|
|||||||
//get scene by unit id
|
//get scene by unit id
|
||||||
|
|
||||||
static Future<List<ScenesModel>> getScenesByUnitId(
|
static Future<List<ScenesModel>> getScenesByUnitId(
|
||||||
String unitId, String communityId,
|
String unitId, String communityId, String projectId,
|
||||||
{showInDevice = false}) async {
|
{showInDevice = false}) async {
|
||||||
try {
|
try {
|
||||||
final response = await _httpService.get(
|
final response = await _httpService.get(
|
||||||
path: ApiEndpoints.getUnitScenes
|
path: ApiEndpoints.getUnitScenes
|
||||||
.replaceAll('{spaceUuid}', unitId)
|
.replaceAll('{spaceUuid}', unitId)
|
||||||
.replaceAll('{communityUuid}', communityId)
|
.replaceAll('{communityUuid}', communityId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId),
|
.replaceAll('{projectUuid}', projectId),
|
||||||
queryParameters: {'showInHomePage': showInDevice},
|
queryParameters: {'showInHomePage': showInDevice},
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
|
|||||||
@ -32,13 +32,13 @@ class SpacesAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future<List<SubSpaceModel>> getSubSpaceBySpaceId(
|
static Future<List<SubSpaceModel>> getSubSpaceBySpaceId(
|
||||||
String communityId, String spaceId) async {
|
String communityId, String spaceId, String projectId) async {
|
||||||
try {
|
try {
|
||||||
// Construct the API path
|
// Construct the API path
|
||||||
final path = ApiEndpoints.listSubspace
|
final path = ApiEndpoints.listSubspace
|
||||||
.replaceFirst('{communityUuid}', communityId)
|
.replaceFirst('{communityUuid}', communityId)
|
||||||
.replaceFirst('{spaceUuid}', spaceId)
|
.replaceFirst('{spaceUuid}', spaceId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', projectId);
|
||||||
|
|
||||||
final response = await _httpService.get(
|
final response = await _httpService.get(
|
||||||
path: path,
|
path: path,
|
||||||
@ -66,12 +66,12 @@ class SpacesAPI {
|
|||||||
//factory/reset/{deviceUuid}
|
//factory/reset/{deviceUuid}
|
||||||
|
|
||||||
static Future<String> generateInvitationCode(
|
static Future<String> generateInvitationCode(
|
||||||
String unitId, String communityId) async {
|
String unitId, String communityId, String projectId) async {
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: ApiEndpoints.invitationCode
|
path: ApiEndpoints.invitationCode
|
||||||
.replaceAll('{unitUuid}', unitId)
|
.replaceAll('{unitUuid}', unitId)
|
||||||
.replaceAll('{communityUuid}', communityId)
|
.replaceAll('{communityUuid}', communityId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId),
|
.replaceAll('{projectUuid}', projectId),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
if (json != null && json['data'] != null) {
|
if (json != null && json['data'] != null) {
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
|
||||||
class TempConst {
|
class TempConst {
|
||||||
static const projectId = '0e62577c-06fa-41b9-8a92-99a21fbaf51c';
|
static String projectIdDev = dotenv.env['PROJECT_ID'] ?? '';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ description: This is the mobile application project, developed with Flutter for
|
|||||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||||
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 1.0.18+55
|
version: 1.0.30+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.6 <4.0.0"
|
sdk: ">=3.0.6 <4.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user