updated project hardcoded values

This commit is contained in:
hannathkadher
2025-02-16 20:55:13 +04:00
parent 67209961b4
commit 3f7f7ce49f
16 changed files with 199 additions and 77 deletions

View File

@ -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/space_model.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/devices/bloc/devices_cubit.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/profile_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/resource_manager/color_manager.dart';
part 'home_state.dart';
@ -67,6 +69,8 @@ class HomeCubit extends Cubit<HomeState> {
var uuid =
await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
user = await ProfileApi().fetchUserInfo(uuid);
project = user?.project;
emit(HomeUserInfoLoaded(user!));
} catch (e) {
return;
@ -175,6 +179,8 @@ class HomeCubit extends Cubit<HomeState> {
SubSpaceModel? selectedRoom;
Project? project;
PageController devicesPageController = PageController();
PageController roomsPageController = PageController();
@ -324,8 +330,8 @@ class HomeCubit extends Cubit<HomeState> {
//////////////////////////////////////// API ////////////////////////////////////////
generateInvitation(SpaceModel unit) async {
try {
final invitationCode =
await SpacesAPI.generateInvitationCode(unit.id, unit.community.uuid);
final invitationCode = await SpacesAPI.generateInvitationCode(unit.id,
unit.community.uuid, project?.uuid ?? TempConst.projectIdDev);
if (invitationCode.isNotEmpty) {
Share.share('The invitation code is $invitationCode');
CustomSnackBar.displaySnackBar(
@ -380,8 +386,10 @@ class HomeCubit extends Cubit<HomeState> {
fetchRoomsByUnitId(SpaceModel space) async {
emitSafe(GetSpaceRoomsLoading());
try {
space.subspaces =
await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id);
space.subspaces = await SpacesAPI.getSubSpaceBySpaceId(
space.community.uuid,
space.id,
project?.uuid ?? TempConst.projectIdDev);
} catch (failure) {
emitSafe(GetSpaceRoomsError(failure.toString()));
return;
@ -414,7 +422,6 @@ class HomeCubit extends Cubit<HomeState> {
emitSafe(ActivationError(errMessage: errorMsg));
return false;
}
}
/////////////////////////////////////// Nav ///////////////////////////////////////