From 15589968916b2e92a75dfb133fd16206f308ad1c Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 29 Oct 2024 18:41:59 +0400 Subject: [PATCH 01/26] models --- .env.dev | 2 +- .gitignore | 1 + ios/Podfile.lock | 60 +-- ios/Runner/Info.plist | 2 + .../app_layout/model/community_model.dart | 27 ++ .../app_layout/model/space_model.dart | 35 +- lib/features/devices/model/room_model.dart | 13 +- lib/services/api/api_links_endpoints.dart | 7 +- pubspec.lock | 372 ++++++++++-------- 9 files changed, 295 insertions(+), 224 deletions(-) create mode 100644 lib/features/app_layout/model/community_model.dart diff --git a/.env.dev b/.env.dev index e77609d..1fd358e 100644 --- a/.env.dev +++ b/.env.dev @@ -1,2 +1,2 @@ ENV_NAME=development -BASE_URL=https://syncrow-dev.azurewebsites.net \ No newline at end of file +BASE_URL=http://localhost:4001 \ No newline at end of file diff --git a/.gitignore b/.gitignore index c3e0679..34e3f36 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release +.env.dev diff --git a/ios/Podfile.lock b/ios/Podfile.lock index de7dea4..064c37d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -14,14 +14,14 @@ PODS: - Firebase/Database (10.25.0): - Firebase/CoreOnly - FirebaseDatabase (~> 10.25.0) - - firebase_analytics (10.8.7): + - firebase_analytics (10.10.7): - Firebase/Analytics (= 10.25.0) - firebase_core - Flutter - firebase_core (2.32.0): - Firebase/CoreOnly (= 10.25.0) - Flutter - - firebase_crashlytics (3.4.16): + - firebase_crashlytics (3.5.7): - Firebase/Crashlytics (= 10.25.0) - firebase_core - Flutter @@ -150,12 +150,12 @@ PODS: - nanopb/encode (= 2.30910.0) - nanopb/decode (2.30910.0) - nanopb/encode (2.30910.0) - - onesignal_flutter (5.2.0): + - onesignal_flutter (5.2.6): - Flutter - - OneSignalXCFramework (= 5.2.0) - - OneSignalXCFramework (5.2.0): - - OneSignalXCFramework/OneSignalComplete (= 5.2.0) - - OneSignalXCFramework/OneSignal (5.2.0): + - OneSignalXCFramework (= 5.2.5) + - OneSignalXCFramework (5.2.5): + - OneSignalXCFramework/OneSignalComplete (= 5.2.5) + - OneSignalXCFramework/OneSignal (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalLiveActivities @@ -163,38 +163,38 @@ PODS: - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalComplete (5.2.0): + - OneSignalXCFramework/OneSignalComplete (5.2.5): - OneSignalXCFramework/OneSignal - OneSignalXCFramework/OneSignalInAppMessages - OneSignalXCFramework/OneSignalLocation - - OneSignalXCFramework/OneSignalCore (5.2.0) - - OneSignalXCFramework/OneSignalExtension (5.2.0): + - OneSignalXCFramework/OneSignalCore (5.2.5) + - OneSignalXCFramework/OneSignalExtension (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalInAppMessages (5.2.0): + - OneSignalXCFramework/OneSignalInAppMessages (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLiveActivities (5.2.0): + - OneSignalXCFramework/OneSignalLiveActivities (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLocation (5.2.0): + - OneSignalXCFramework/OneSignalLocation (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalNotifications (5.2.0): + - OneSignalXCFramework/OneSignalNotifications (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalOSCore (5.2.0): + - OneSignalXCFramework/OneSignalOSCore (5.2.5): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalOutcomes (5.2.0): + - OneSignalXCFramework/OneSignalOutcomes (5.2.5): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalUser (5.2.0): + - OneSignalXCFramework/OneSignalUser (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore @@ -212,7 +212,7 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - sqflite (0.0.3): + - sqflite_darwin (0.0.4): - Flutter - FlutterMacOS - url_launcher_ios (0.0.1): @@ -232,7 +232,7 @@ DEPENDENCIES: - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite (from `.symlinks/plugins/sqflite/darwin`) + - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) SPEC REPOS: @@ -285,17 +285,17 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/share_plus/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" - sqflite: - :path: ".symlinks/plugins/sqflite/darwin" + sqflite_darwin: + :path: ".symlinks/plugins/sqflite_darwin/darwin" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d Firebase: 0312a2352584f782ea56f66d91606891d4607f06 - firebase_analytics: 3a9263fedec72970e6bd30a7132bbdd386de2c14 + firebase_analytics: cc06e24d6a2343c44f845b3112143db72d10ef78 firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197 - firebase_crashlytics: 0b7cb41f5fb3b6889d0fb408cfce3cc7a4247061 + firebase_crashlytics: 17e856fabec68d993662abaf2f6fe2413f0abece firebase_database: 2713033e426b176d4fe5e7195f3d19aa1b549a91 FirebaseAnalytics: ec00fe8b93b41dc6fe4a28784b8e51da0647a248 FirebaseAppCheckInterop: 6a1757cfd4067d8e00fccd14fcc1b8fd78cfac07 @@ -309,23 +309,23 @@ SPEC CHECKSUMS: FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be + flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12 GoogleAppMeasurement: 9abf64b682732fed36da827aa2a68f0221fd2356 GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 leveldb-library: e8eadf9008a61f9e1dde3978c086d2b6d9b9dc28 nanopb: 438bc412db1928dac798aa6fd75726007be04262 - onesignal_flutter: 5ce68a29861960168e81101cb1bd685d264361de - OneSignalXCFramework: bdf74fdc06888f9466dc21e826fe1549ed143095 - path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + onesignal_flutter: f441aaefa112988a1e786c695a30695ad0291763 + OneSignalXCFramework: 76ca508fc2b941317729d13fdec96817f8ef5b3b + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad - shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 - sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec - url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 + sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13 + url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe PODFILE CHECKSUM: 4243bd7f9184f79552dd731a7c9d5cad03bd2706 diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 0169fa9..8c1d5ff 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -2,6 +2,8 @@ + NSLocalNetworkUsageDescription + App requires access to local network to communicate with devices. CADisableMinimumFrameDurationOnPhone CFBundleDevelopmentRegion diff --git a/lib/features/app_layout/model/community_model.dart b/lib/features/app_layout/model/community_model.dart new file mode 100644 index 0000000..92e9a2c --- /dev/null +++ b/lib/features/app_layout/model/community_model.dart @@ -0,0 +1,27 @@ +class Community { + final String uuid; + final String name; + final String description; + + Community({ + required this.uuid, + required this.name, + required this.description, + }); + + factory Community.fromJson(Map json) { + return Community( + uuid: json['uuid'], + name: json['name'], + description: json['description'], + ); + } + + Map toJson() { + return { + 'uuid': uuid, + 'name': name, + 'description': description, + }; + } +} diff --git a/lib/features/app_layout/model/space_model.dart b/lib/features/app_layout/model/space_model.dart index 8d7d5b8..a9cfe01 100644 --- a/lib/features/app_layout/model/space_model.dart +++ b/lib/features/app_layout/model/space_model.dart @@ -1,36 +1,45 @@ +import 'package:syncrow_app/features/app_layout/model/community_model.dart'; import 'package:syncrow_app/features/devices/model/room_model.dart'; -import 'package:syncrow_app/utils/resource_manager/constants.dart'; class SpaceModel { - final String? id; - final String? name; - final SpaceType type; - late List? rooms; + final String id; + final String name; + final Community community; + final List subspaces; SpaceModel({ - required this.type, required this.id, required this.name, - required this.rooms, + required this.community, + this.subspaces = const [], // Default to an empty list }); + /// Converts the instance into JSON format. Map toJson() { return { 'id': id, - 'name': name, - 'rooms': rooms, + 'spaceName': name, + 'community': community.toJson(), + 'subspaces': subspaces.map((room) => room.toJson()).toList(), }; } + /// Factory constructor to create an instance from JSON. factory SpaceModel.fromJson(Map json) { + final spaceData = json['space'] as Map? ?? {}; + return SpaceModel( - id: json['uuid'], - name: json['name'], - type: spaceTypesMap[json['type']]!, - rooms: [], + id: json['uuid'] ?? '', + name: spaceData['spaceName'] ?? 'Unnamed Space', + community: Community.fromJson(spaceData['community'] ?? {}), + subspaces: (spaceData['subspaces'] as List?) + ?.map((item) => SubSpaceModel.fromJson(item)) + .toList() ?? + [], ); } + /// Helper method to parse a list of SpaceModel from JSON. static List fromJsonList(List jsonList) { return jsonList.map((item) => SpaceModel.fromJson(item)).toList(); } diff --git a/lib/features/devices/model/room_model.dart b/lib/features/devices/model/room_model.dart index 7a00b43..b2aa133 100644 --- a/lib/features/devices/model/room_model.dart +++ b/lib/features/devices/model/room_model.dart @@ -1,16 +1,13 @@ import 'package:syncrow_app/features/devices/model/device_model.dart'; -import 'package:syncrow_app/utils/resource_manager/constants.dart'; -class RoomModel { +class SubSpaceModel { final String? id; final String? name; - final SpaceType type; List? devices; - RoomModel({ + SubSpaceModel({ required this.id, required this.name, - required this.type, required this.devices, }); @@ -18,22 +15,20 @@ class RoomModel { return { 'id': id, 'name': name, - 'type': type, 'devices': devices, }; } - factory RoomModel.fromJson(Map json) { + factory SubSpaceModel.fromJson(Map json) { List devices = []; if (json['devices'] != null) { for (var device in json['devices']) { devices.add(DeviceModel.fromJson(device)); } } - return RoomModel( + return SubSpaceModel( id: json['uuid'], name: json['name'], - type: spaceTypesMap[json['type']]!, devices: [], ); } diff --git a/lib/services/api/api_links_endpoints.dart b/lib/services/api/api_links_endpoints.dart index 238bdf6..dcff924 100644 --- a/lib/services/api/api_links_endpoints.dart +++ b/lib/services/api/api_links_endpoints.dart @@ -55,7 +55,7 @@ abstract class ApiEndpoints { static const String addUnitToUser = '/unit/user'; //GET static const String unitByUuid = '/unit/'; - static const String unitChild = '/unit/child/'; + static const String listSubspace = '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; static const String unitParent = '/unit/parent/{unitUuid}'; static const String unitUser = '/unit/user/'; static const String invitationCode = '/unit/{unitUuid}/invitation-code'; @@ -75,6 +75,11 @@ abstract class ApiEndpoints { //PUT static const String renameRoom = '/room/{roomUuid}'; + + //SPACE Module +//GET + static const String userSpaces = '/user/{userUuid}/spaces'; + ///Group Module //POST static const String addGroup = '/group'; diff --git a/pubspec.lock b/pubspec.lock index 935996a..171bea8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.6.0" async: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: bloc - sha256: f53a110e3b48dcd78136c10daa5d51512443cea5e1348c9d80a320095fa2db9e + sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e" url: "https://pub.dev" source: hosted - version: "8.1.3" + version: "8.1.4" boolean_selector: dependency: transitive description: @@ -45,26 +45,26 @@ packages: dependency: "direct main" description: name: cached_network_image - sha256: "28ea9690a8207179c319965c13cd8df184d5ee721ae2ce60f398ced1219cea1f" + sha256: "4a5d8d2c728b0f3d0245f69f921d7be90cae4c2fd5288f773088672c0893f819" url: "https://pub.dev" source: hosted - version: "3.3.1" + version: "3.4.0" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - sha256: "9e90e78ae72caa874a323d78fa6301b3fb8fa7ea76a8f96dc5b5bf79f283bf2f" + sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.1.1" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - sha256: "42a835caa27c220d1294311ac409a43361088625a4f23c820b006dd9bffb3316" + sha256: "6322dde7a5ad92202e64df659241104a43db20ed594c41ca18de1014598d7996" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.3.0" characters: dependency: transitive description: @@ -93,18 +93,18 @@ packages: dependency: transitive description: name: cross_file - sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32" + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" url: "https://pub.dev" source: hosted - version: "0.3.4+1" + version: "0.3.4+2" crypto: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.6" csslib: dependency: transitive description: @@ -117,10 +117,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.8" day_picker: dependency: "direct main" description: @@ -133,26 +133,34 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: eead12d1a1ed83d8283ab4c2f3fca23ac4082f29f25f29dff0f758f57d06ec91 + sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074 url: "https://pub.dev" source: hosted - version: "10.1.0" + version: "10.1.2" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface - sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 + sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" dio: dependency: "direct main" description: name: dio - sha256: "49af28382aefc53562459104f64d16b9dfd1e8ef68c862d5af436cc8356ce5a8" + sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260" url: "https://pub.dev" source: hosted - version: "5.4.1" + version: "5.7.0" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8" + url: "https://pub.dev" + source: hosted + version: "2.0.0" equatable: dependency: "direct main" description: @@ -173,34 +181,34 @@ packages: dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.3" file: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" file_selector_linux: dependency: transitive description: name: file_selector_linux - sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + sha256: "712ce7fab537ba532c8febdb1a8f167b32441e74acd68c3ccb2e36dcb52c4ab2" url: "https://pub.dev" source: hosted - version: "0.9.2+1" + version: "0.9.3" file_selector_macos: dependency: transitive description: name: file_selector_macos - sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 + sha256: "271ab9986df0c135d45c3cdb6bd0faa5db6f4976d3e4b437cf7d0f258d941bfc" url: "https://pub.dev" source: hosted - version: "0.9.4" + version: "0.9.4+2" file_selector_platform_interface: dependency: transitive description: @@ -213,34 +221,34 @@ packages: dependency: transitive description: name: file_selector_windows - sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 + sha256: "8f5d2f6590d51ecd9179ba39c64f722edc15226cc93dcc8698466ad36a4a85a4" url: "https://pub.dev" source: hosted - version: "0.9.3+1" + version: "0.9.3+3" firebase_analytics: dependency: "direct main" description: name: firebase_analytics - sha256: c6220b23397f9302a42617227ee8fb1c5d718097a5351fcce53561d73fc10339 + sha256: dbf1e7ab22cfb1f4a4adb103b46a26276b4edc593d4a78ef6fb942bafc92e035 url: "https://pub.dev" source: hosted - version: "10.8.7" + version: "10.10.7" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface - sha256: "7f1c02cdd93a5e0a561af2f551465ffb6abdd541dbd0c8a9b8628d9ae0a5d024" + sha256: "3729b74f8cf1d974a27ba70332ecb55ff5ff560edc8164a6469f4a055b429c37" url: "https://pub.dev" source: hosted - version: "3.9.7" + version: "3.10.8" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web - sha256: ebb857c23f35fed52220b6c3271c12eeb6137de3930845223e3d0590b6fd0649 + sha256: "019cd7eee74254d33fbd2e29229367ce33063516bf6b3258a341d89e3b0f1655" url: "https://pub.dev" source: hosted - version: "0.5.5+19" + version: "0.5.7+7" firebase_core: dependency: "direct main" description: @@ -253,34 +261,34 @@ packages: dependency: transitive description: name: firebase_core_platform_interface - sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 + sha256: e30da58198a6d4b49d5bce4e852f985c32cb10db329ebef9473db2b9f09ce810 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.3.0" firebase_core_web: dependency: transitive description: name: firebase_core_web - sha256: "22fcb352744908224fc7be3caae254836099786acfe5df6e9fe901e9c2575a41" + sha256: "362e52457ed2b7b180964769c1e04d1e0ea0259fdf7025fdfedd019d4ae2bd88" url: "https://pub.dev" source: hosted - version: "2.17.1" + version: "2.17.5" firebase_crashlytics: dependency: "direct main" description: name: firebase_crashlytics - sha256: "0126fa101b74fb981796b3e6f47ccf7fc40237ec918327aaec7c0a06fd1bb4c1" + sha256: "9897c01efaa950d2f6da8317d12452749a74dc45f33b46390a14cfe28067f271" url: "https://pub.dev" source: hosted - version: "3.4.16" + version: "3.5.7" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface - sha256: cdfa0a20d66e1b32de542883c0ddf651ee9b66b12cebf73067e4d2cdc0865d17 + sha256: "16a71e08fbf6e00382816e1b13397898c29a54fa0ad969c2c2a3b82a704877f0" url: "https://pub.dev" source: hosted - version: "3.6.23" + version: "3.6.35" firebase_database: dependency: "direct main" description: @@ -309,10 +317,10 @@ packages: dependency: transitive description: name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" fl_chart: dependency: "direct main" description: @@ -338,90 +346,90 @@ packages: dependency: "direct main" description: name: flutter_bloc - sha256: "87325da1ac757fcc4813e6b34ed5dd61169973871fdf181d6c2109dd6935ece1" + sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a url: "https://pub.dev" source: hosted - version: "8.1.4" + version: "8.1.6" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager - sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba" + sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" url: "https://pub.dev" source: hosted - version: "3.3.1" + version: "3.4.1" flutter_dotenv: dependency: "direct main" description: name: flutter_dotenv - sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77" + sha256: b7c7be5cd9f6ef7a78429cabd2774d3c4af50e79cb2b7593e3d5d763ef95c61b url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.2.1" flutter_lints: dependency: "direct dev" description: name: flutter_lints - sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 + sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: c6b0b4c05c458e1c01ad9bcc14041dd7b1f6783d487be4386f793f47a8a4d03e + sha256: "9b78450b89f059e96c9ebb355fa6b3df1d6b330436e0b885fb49594c41721398" url: "https://pub.dev" source: hosted - version: "2.0.20" + version: "2.0.23" flutter_secure_storage: dependency: "direct main" description: name: flutter_secure_storage - sha256: ffdbb60130e4665d2af814a0267c481bcf522c41ae2e43caf69fa0146876d685 + sha256: "165164745e6afb5c0e3e3fcc72a012fb9e58496fb26ffb92cf22e16a821e85d0" url: "https://pub.dev" source: hosted - version: "9.0.0" + version: "9.2.2" flutter_secure_storage_linux: dependency: transitive description: name: flutter_secure_storage_linux - sha256: "3d5032e314774ee0e1a7d0a9f5e2793486f0dff2dd9ef5a23f4e3fb2a0ae6a9e" + sha256: "4d91bfc23047422cbcd73ac684bc169859ee766482517c22172c86596bf1464b" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" flutter_secure_storage_macos: dependency: transitive description: name: flutter_secure_storage_macos - sha256: bd33935b4b628abd0b86c8ca20655c5b36275c3a3f5194769a7b3f37c905369c + sha256: "1693ab11121a5f925bbea0be725abfcfbbcf36c1e29e571f84a0c0f436147a81" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.1.2" flutter_secure_storage_platform_interface: dependency: transitive description: name: flutter_secure_storage_platform_interface - sha256: "0d4d3a5dd4db28c96ae414d7ba3b8422fd735a8255642774803b2532c9a61d7e" + sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.2" flutter_secure_storage_web: dependency: transitive description: name: flutter_secure_storage_web - sha256: "30f84f102df9dcdaa2241866a958c2ec976902ebdaa8883fbfe525f1f2f3cf20" + sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.2.1" flutter_secure_storage_windows: dependency: transitive description: name: flutter_secure_storage_windows - sha256: "5809c66f9dd3b4b93b0a6e2e8561539405322ee767ac2f64d084e2ab5429d108" + sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.1.2" flutter_svg: dependency: "direct main" description: @@ -444,10 +452,10 @@ packages: dependency: "direct main" description: name: get_it - sha256: e6017ce7fdeaf218dc51a100344d8cb70134b80e28b760f8bb23c242437bafd7 + sha256: d85128a5dae4ea777324730dc65edd9c9f43155c109d5cc0a69cab74139fbac1 url: "https://pub.dev" source: hosted - version: "7.6.7" + version: "7.7.0" html: dependency: "direct main" description: @@ -460,10 +468,10 @@ packages: dependency: transitive description: name: http - sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.2.2" http_parser: dependency: transitive description: @@ -484,26 +492,26 @@ packages: dependency: transitive description: name: image_picker_android - sha256: "4161e1f843d8480d2e9025ee22411778c3c9eb7e40076dcf2da23d8242b7b51c" + sha256: d34e0d9e024e81321b2aeed7b202ec6181cc282e6a1c0c0b4e6ad07ef1065d82 url: "https://pub.dev" source: hosted - version: "0.8.12+3" + version: "0.8.12+16" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: "5d6eb13048cd47b60dbf1a5495424dea226c5faf3950e20bf8120a58efb5b5f3" + sha256: "717eb042ab08c40767684327be06a5d8dbb341fe791d514e4b92c7bbe1b7bb83" url: "https://pub.dev" source: hosted - version: "3.0.4" + version: "3.0.6" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: "6703696ad49f5c3c8356d576d7ace84d1faf459afb07accbb0fae780753ff447" + sha256: "4f0568120c6fcc0aaa04511cb9f9f4d29fc3d0139884b1d06be88dcec7641d6b" url: "https://pub.dev" source: hosted - version: "0.8.12" + version: "0.8.12+1" image_picker_linux: dependency: transitive description: @@ -556,18 +564,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" url: "https://pub.dev" source: hosted - version: "10.0.4" + version: "10.0.5" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.5" leak_tracker_testing: dependency: transitive description: @@ -596,26 +604,26 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.15.0" mime: dependency: transitive description: name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" nested: dependency: transitive description: @@ -628,18 +636,18 @@ packages: dependency: transitive description: name: octo_image - sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d" + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.0" onesignal_flutter: dependency: "direct main" description: name: onesignal_flutter - sha256: f3940387d6c7033a9c341aa0548f24d98217fce9182f9ad80bf2554b9dd3dc1a + sha256: "28e8295c1e79b029d010c6af6459683b1e1485246d95d42f13bba15ca35a94ae" url: "https://pub.dev" source: hosted - version: "5.2.0" + version: "5.2.6" path: dependency: transitive description: @@ -660,26 +668,26 @@ packages: dependency: transitive description: name: path_provider - sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.12" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.0" path_provider_linux: dependency: transitive description: @@ -700,10 +708,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.0" permission_handler: dependency: "direct main" description: @@ -716,34 +724,34 @@ packages: dependency: transitive description: name: permission_handler_android - sha256: "8bb852cd759488893805c3161d0b2b5db55db52f773dbb014420b304055ba2c5" + sha256: "71bbecfee799e65aff7c744761a57e817e73b738fedf62ab7afd5593da21f9f1" url: "https://pub.dev" source: hosted - version: "12.0.6" + version: "12.0.13" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: e9ad66020b89ff1b63908f247c2c6f931c6e62699b756ef8b3c4569350cd8662 + sha256: e6f6d73b12438ef13e648c4ae56bd106ec60d17e90a59c4545db6781229082a0 url: "https://pub.dev" source: hosted - version: "9.4.4" + version: "9.4.5" permission_handler_html: dependency: transitive description: name: permission_handler_html - sha256: "54bf176b90f6eddd4ece307e2c06cf977fb3973719c35a93b85cc7093eb6070d" + sha256: af26edbbb1f2674af65a8f4b56e1a6f526156bc273d0e65dd8075fab51c78851 url: "https://pub.dev" source: hosted - version: "0.1.1" + version: "0.1.3+2" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - sha256: "48d4fcf201a1dad93ee869ab0d4101d084f49136ec82a8a06ed9cfeacab9fd20" + sha256: e9c8eadee926c4532d0305dff94b85bf961f16759c3af791486613152af4b4f9 url: "https://pub.dev" source: hosted - version: "4.2.1" + version: "4.2.3" permission_handler_windows: dependency: transitive description: @@ -772,10 +780,10 @@ packages: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.6" plugin_platform_interface: dependency: transitive description: @@ -788,18 +796,18 @@ packages: dependency: transitive description: name: provider - sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c url: "https://pub.dev" source: hosted - version: "6.1.1" + version: "6.1.2" rxdart: dependency: transitive description: name: rxdart - sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" url: "https://pub.dev" source: hosted - version: "0.27.7" + version: "0.28.0" share_plus: dependency: "direct main" description: @@ -820,58 +828,58 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02" + sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.3.2" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" + sha256: "3b9febd815c9ca29c9e3520d50ec32f49157711e143b7a4ca039eb87e8ade5ab" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.3" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + sha256: "07e050c7cd39bad516f8d64c455f04508d09df104be326d8c02551590a0d513d" url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.5.3" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a" + sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.2" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" sky_engine: dependency: transitive description: flutter @@ -889,10 +897,10 @@ packages: dependency: "direct main" description: name: smooth_page_indicator - sha256: "725bc638d5e79df0c84658e1291449996943f93bacbc2cec49963dbbab48d8ae" + sha256: "3b28b0c545fa67ed9e5997d9f9720d486f54c0c607e056a1094544e36934dff3" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0+3" source_span: dependency: transitive description: @@ -913,18 +921,42 @@ packages: dependency: transitive description: name: sqflite - sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6 + sha256: "79a297dc3cc137e758c6a4baf83342b039e5a6d2436fcdf3f96a00adaaf2ad62" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.0" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: "78f489aab276260cdd26676d2169446c7ecd3484bbd5fead4ca14f3ed4dd9ee3" + url: "https://pub.dev" + source: hosted + version: "2.4.0" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" + sha256: "4468b24876d673418a7b7147e5a08a715b4998a7ae69227acafaab762e0e5490" url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.5.4+5" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "769733dddf94622d5541c73e4ddc6aa7b252d865285914b6fcd54a63c4b4f027" + url: "https://pub.dev" + source: hosted + version: "2.4.1-1" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.dev" + source: hosted + version: "2.4.0" stack_trace: dependency: transitive description: @@ -953,10 +985,10 @@ packages: dependency: transitive description: name: synchronized - sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" + sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225" url: "https://pub.dev" source: hosted - version: "3.1.0+1" + version: "3.3.0+3" term_glyph: dependency: transitive description: @@ -969,10 +1001,10 @@ packages: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.7.2" time_picker_spinner: dependency: "direct main" description: @@ -985,82 +1017,82 @@ packages: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" url_launcher: dependency: "direct main" description: name: url_launcher - sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e" + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.3.1" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 + sha256: "8fc3bae0b68c02c47c5c86fa8bfa74471d42687b0eded01b78de87872db745e2" url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.3.12" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" + sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e url: "https://pub.dev" source: hosted - version: "6.2.4" + version: "6.3.1" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.2.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + sha256: "769549c999acdb42b8bcfa7c43d72bf79a382ca7441ab18a808e101149daf672" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.1" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a" + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 + sha256: "44cf3aabcedde30f2dba119a9dea3b0f2672fbe6fa96e85536251d678216b3c4" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.3" uuid: dependency: "direct main" description: name: uuid - sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff url: "https://pub.dev" source: hosted - version: "4.4.0" + version: "4.5.1" vector_graphics: dependency: transitive description: @@ -1097,10 +1129,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "14.2.1" + version: "14.2.4" web: dependency: transitive description: @@ -1113,26 +1145,26 @@ packages: dependency: transitive description: name: win32 - sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + sha256: e1d0cc62e65dc2561f5071fcbccecf58ff20c344f8f3dc7d4922df372a11df1f url: "https://pub.dev" source: hosted - version: "5.2.0" + version: "5.7.1" win32_registry: dependency: transitive description: name: win32_registry - sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a" + sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.1.5" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.1.0" xml: dependency: transitive description: @@ -1142,5 +1174,5 @@ packages: source: hosted version: "6.5.0" sdks: - dart: ">=3.4.0 <4.0.0" - flutter: ">=3.22.0" + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.24.0" From 5a7ed3ec7c61bb15cf7ee8452857e37c92deb0cd Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 29 Oct 2024 18:44:41 +0400 Subject: [PATCH 02/26] subspace model added --- lib/features/devices/model/room_model.dart | 13 ++++--- .../devices/model/subspace_model.dart | 35 +++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 lib/features/devices/model/subspace_model.dart diff --git a/lib/features/devices/model/room_model.dart b/lib/features/devices/model/room_model.dart index b2aa133..7a00b43 100644 --- a/lib/features/devices/model/room_model.dart +++ b/lib/features/devices/model/room_model.dart @@ -1,13 +1,16 @@ import 'package:syncrow_app/features/devices/model/device_model.dart'; +import 'package:syncrow_app/utils/resource_manager/constants.dart'; -class SubSpaceModel { +class RoomModel { final String? id; final String? name; + final SpaceType type; List? devices; - SubSpaceModel({ + RoomModel({ required this.id, required this.name, + required this.type, required this.devices, }); @@ -15,20 +18,22 @@ class SubSpaceModel { return { 'id': id, 'name': name, + 'type': type, 'devices': devices, }; } - factory SubSpaceModel.fromJson(Map json) { + factory RoomModel.fromJson(Map json) { List devices = []; if (json['devices'] != null) { for (var device in json['devices']) { devices.add(DeviceModel.fromJson(device)); } } - return SubSpaceModel( + return RoomModel( id: json['uuid'], name: json['name'], + type: spaceTypesMap[json['type']]!, devices: [], ); } diff --git a/lib/features/devices/model/subspace_model.dart b/lib/features/devices/model/subspace_model.dart new file mode 100644 index 0000000..b2aa133 --- /dev/null +++ b/lib/features/devices/model/subspace_model.dart @@ -0,0 +1,35 @@ +import 'package:syncrow_app/features/devices/model/device_model.dart'; + +class SubSpaceModel { + final String? id; + final String? name; + List? devices; + + SubSpaceModel({ + required this.id, + required this.name, + required this.devices, + }); + + Map toJson() { + return { + 'id': id, + 'name': name, + 'devices': devices, + }; + } + + factory SubSpaceModel.fromJson(Map json) { + List devices = []; + if (json['devices'] != null) { + for (var device in json['devices']) { + devices.add(DeviceModel.fromJson(device)); + } + } + return SubSpaceModel( + id: json['uuid'], + name: json['name'], + devices: [], + ); + } +} From d025da6daf0ac136197a47171f60003589bb157a Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Wed, 30 Oct 2024 09:56:57 +0400 Subject: [PATCH 03/26] fixed space --- ios/Runner/AppDelegate.swift | 2 +- lib/features/app_layout/bloc/home_cubit.dart | 65 ++++++++++++------- lib/features/app_layout/bloc/home_state.dart | 4 +- .../app_layout/model/space_model.dart | 6 +- lib/features/devices/bloc/devices_cubit.dart | 18 ++--- .../view/widgets/devices_view_body.dart | 6 +- .../devices/view/widgets/room_page.dart | 4 +- .../devices/view/widgets/rooms_slider.dart | 6 +- .../manage_unit_bloc/manage_unit_bloc.dart | 6 +- .../manage_unit_bloc/manage_unit_event.dart | 13 ++-- .../manage_unit_bloc/manage_unit_state.dart | 3 +- .../widgets/manage_home/home_settings.dart | 2 +- .../view/widgets/manage_home/room_screen.dart | 11 ++-- .../scene/view/scene_rooms_tabbar.dart | 2 +- lib/services/api/home_creation_api.dart | 1 + lib/services/api/spaces_api.dart | 41 ++++++++---- 16 files changed, 114 insertions(+), 76 deletions(-) diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 70693e4..b636303 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import UIKit import Flutter -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart index 3e85cdc..7b72975 100644 --- a/lib/features/app_layout/bloc/home_cubit.dart +++ b/lib/features/app_layout/bloc/home_cubit.dart @@ -11,7 +11,7 @@ import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdo import 'package:syncrow_app/features/auth/model/user_model.dart'; import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart'; import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart'; -import 'package:syncrow_app/features/devices/model/room_model.dart'; +import 'package:syncrow_app/features/devices/model/subspace_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart'; import 'package:syncrow_app/features/menu/view/menu_view.dart'; import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart'; @@ -55,7 +55,8 @@ class HomeCubit extends Cubit { Future fetchUserInfo() async { try { - var uuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey); + var uuid = + await const FlutterSecureStorage().read(key: UserModel.userUuidKey); user = await ProfileApi().fetchUserInfo(uuid); emit(HomeUserInfoLoaded(user!)); // Emit state after fetching user info } catch (e) { @@ -76,9 +77,12 @@ class HomeCubit extends Cubit { selectedSpace = null; selectedRoom = null; pageIndex = 0; - OneSignal.User.pushSubscription.removeObserver((stateChanges) => oneSignalSubscriptionObserver); - OneSignal.Notifications.removePermissionObserver((permission) => oneSignalPermissionObserver); - OneSignal.Notifications.removeClickListener((event) => oneSignalClickListenerObserver); + OneSignal.User.pushSubscription + .removeObserver((stateChanges) => oneSignalSubscriptionObserver); + OneSignal.Notifications.removePermissionObserver( + (permission) => oneSignalPermissionObserver); + OneSignal.Notifications.removeClickListener( + (event) => oneSignalClickListenerObserver); return super.close(); } @@ -88,7 +92,7 @@ class HomeCubit extends Cubit { SpaceModel? selectedSpace; - RoomModel? selectedRoom; + SubSpaceModel? selectedRoom; PageController devicesPageController = PageController(); @@ -120,7 +124,9 @@ class HomeCubit extends Cubit { return; } - var userUuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? ''; + var userUuid = + await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? + ''; if (userUuid.isNotEmpty) { await OneSignal.login(userUuid); } @@ -128,21 +134,24 @@ class HomeCubit extends Cubit { await OneSignal.User.pushSubscription.optIn(); //this function will be called once a user is subscribed - oneSignalSubscriptionObserver = OneSignal.User.pushSubscription.addObserver((state) async { + oneSignalSubscriptionObserver = + OneSignal.User.pushSubscription.addObserver((state) async { if (state.current.optedIn) { await _sendSubscriptionId(); } }); // Send the player id when a user allows notifications - oneSignalPermissionObserver = OneSignal.Notifications.addPermissionObserver((state) async { + oneSignalPermissionObserver = + OneSignal.Notifications.addPermissionObserver((state) async { await _sendSubscriptionId(); }); //check if the player id is sent, if not send it again await _sendSubscriptionId(); - oneSignalClickListenerObserver = OneSignal.Notifications.addClickListener((event) async { + oneSignalClickListenerObserver = + OneSignal.Notifications.addClickListener((event) async { //Once the user clicks on the notification }); } catch (err) { @@ -173,7 +182,7 @@ class HomeCubit extends Cubit { if (index == 0) { unselectRoom(); } else { - selectedRoom = selectedSpace!.rooms![index - 1]; + selectedRoom = selectedSpace!.subspaces[index - 1]; emitSafe(RoomSelected(selectedRoom!)); } } @@ -188,7 +197,7 @@ class HomeCubit extends Cubit { if (index <= 0) { unselectRoom(); } else { - selectedRoom = selectedSpace!.rooms![index - 1]; + selectedRoom = selectedSpace!.subspaces[index - 1]; emitSafe(RoomSelected(selectedRoom!)); } } @@ -229,7 +238,9 @@ class HomeCubit extends Cubit { Future joinAUnit(String code) async { try { - var uuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? ''; + var uuid = + await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? + ''; Map body = {'userUuid': uuid, 'inviteCode': code}; final success = await SpacesAPI.joinUnit(body); @@ -247,7 +258,7 @@ class HomeCubit extends Cubit { fetchUnitsByUserId() async { emitSafe(GetSpacesLoading()); try { - spaces = await SpacesAPI.getUnitsByUserId(); + spaces = await SpacesAPI.getSpacesByUserId(); } catch (failure) { emitSafe(GetSpacesError("No units found")); return; @@ -258,6 +269,7 @@ class HomeCubit extends Cubit { await fetchRoomsByUnitId(selectedSpace!); emitSafe(GetSpacesSuccess(spaces!)); } else { + print("here in else"); emitSafe(GetSpacesError("No spaces found")); } } @@ -265,13 +277,14 @@ class HomeCubit extends Cubit { fetchRoomsByUnitId(SpaceModel space) async { emitSafe(GetSpaceRoomsLoading()); try { - space.rooms = await SpacesAPI.getRoomsBySpaceId(space.id!); + space.subspaces = + await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id); } catch (failure) { emitSafe(GetSpaceRoomsError(failure.toString())); return; } - if (space.rooms != null && space.rooms!.isNotEmpty) { - emitSafe(GetSpaceRoomsSuccess(space.rooms!)); + if (space.subspaces != null && space.subspaces!.isNotEmpty) { + emitSafe(GetSpaceRoomsSuccess(space.subspaces!)); } else { emitSafe(GetSpaceRoomsError("No rooms found")); } @@ -347,7 +360,8 @@ class HomeCubit extends Cubit { size: 32, ), style: ButtonStyle( - foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor), + foregroundColor: + WidgetStateProperty.all(ColorsManager.textPrimaryColor), ), onPressed: () { Navigator.pushNamed( @@ -368,7 +382,8 @@ class HomeCubit extends Cubit { NavigationService.navigatorKey.currentContext! .read() .add(const SmartSceneClearEvent()); - BlocProvider.of(NavigationService.navigatorKey.currentState!.context) + BlocProvider.of( + NavigationService.navigatorKey.currentState!.context) .add(ResetEffectivePeriod()); }, ), @@ -378,7 +393,8 @@ class HomeCubit extends Cubit { size: 28, ), style: ButtonStyle( - foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor), + foregroundColor: + WidgetStateProperty.all(ColorsManager.textPrimaryColor), ), onPressed: () {}, ), @@ -411,7 +427,8 @@ class HomeCubit extends Cubit { }; static var bottomNavItems = [ - defaultBottomNavBarItem(icon: Assets.assetsIconsDashboard, label: 'Dashboard'), + defaultBottomNavBarItem( + icon: Assets.assetsIconsDashboard, label: 'Dashboard'), // defaultBottomNavBarItem(icon: Assets.assetsIconslayout, label: 'Layout'), defaultBottomNavBarItem(icon: Assets.assetsIconsDevices, label: 'Devices'), defaultBottomNavBarItem(icon: Assets.assetsIconsRoutines, label: 'Routine'), @@ -437,7 +454,8 @@ class HomeCubit extends Cubit { void updateDevice(String deviceId) async { try { - final response = await DevicesAPI.firmwareDevice(deviceId: deviceId, firmwareVersion: '0'); + final response = await DevicesAPI.firmwareDevice( + deviceId: deviceId, firmwareVersion: '0'); if (response['success'] ?? false) { CustomSnackBar.displaySnackBar('No updates available'); } @@ -445,7 +463,8 @@ class HomeCubit extends Cubit { } } -BottomNavigationBarItem defaultBottomNavBarItem({required String icon, required String label}) { +BottomNavigationBarItem defaultBottomNavBarItem( + {required String icon, required String label}) { return BottomNavigationBarItem( icon: SvgPicture.asset(icon), activeIcon: SvgPicture.asset( diff --git a/lib/features/app_layout/bloc/home_state.dart b/lib/features/app_layout/bloc/home_state.dart index 1125e01..d5e09c6 100644 --- a/lib/features/app_layout/bloc/home_state.dart +++ b/lib/features/app_layout/bloc/home_state.dart @@ -33,7 +33,7 @@ class GetSpacesError extends HomeError { class GetSpaceRoomsLoading extends HomeLoading {} class GetSpaceRoomsSuccess extends HomeSuccess { - final List rooms; + final List rooms; GetSpaceRoomsSuccess(this.rooms); } @@ -50,7 +50,7 @@ class SpaceSelected extends HomeState { } class RoomSelected extends HomeState { - final RoomModel room; + final SubSpaceModel room; RoomSelected(this.room); } diff --git a/lib/features/app_layout/model/space_model.dart b/lib/features/app_layout/model/space_model.dart index a9cfe01..30712d4 100644 --- a/lib/features/app_layout/model/space_model.dart +++ b/lib/features/app_layout/model/space_model.dart @@ -1,11 +1,11 @@ import 'package:syncrow_app/features/app_layout/model/community_model.dart'; -import 'package:syncrow_app/features/devices/model/room_model.dart'; +import 'package:syncrow_app/features/devices/model/subspace_model.dart'; class SpaceModel { final String id; final String name; final Community community; - final List subspaces; + late List subspaces; SpaceModel({ required this.id, @@ -27,7 +27,7 @@ class SpaceModel { /// Factory constructor to create an instance from JSON. factory SpaceModel.fromJson(Map json) { final spaceData = json['space'] as Map? ?? {}; - + return SpaceModel( id: json['uuid'] ?? '', name: spaceData['spaceName'] ?? 'Unnamed Space', diff --git a/lib/features/devices/bloc/devices_cubit.dart b/lib/features/devices/bloc/devices_cubit.dart index 48e9ca0..943f0db 100644 --- a/lib/features/devices/bloc/devices_cubit.dart +++ b/lib/features/devices/bloc/devices_cubit.dart @@ -27,7 +27,7 @@ class DevicesCubit extends Cubit { if (HomeCubit.getInstance().selectedSpace != null && HomeCubit.getInstance().spaces!.isNotEmpty) { // fetchGroups(HomeCubit.getInstance().selectedSpace!.id!); - for (var room in HomeCubit.getInstance().selectedSpace!.rooms!) { + for (var room in HomeCubit.getInstance().selectedSpace!.subspaces!) { fetchDevicesByRoomId(room.id!); } fetchGroups(HomeCubit.getInstance().selectedSpace?.id ?? ''); @@ -104,8 +104,8 @@ class DevicesCubit extends Cubit { List get allDevices { List devices = []; if (HomeCubit.getInstance().selectedSpace != null && - HomeCubit.getInstance().selectedSpace!.rooms != null) { - for (var room in HomeCubit.getInstance().selectedSpace!.rooms!) { + HomeCubit.getInstance().selectedSpace!.subspaces != null) { + for (var room in HomeCubit.getInstance().selectedSpace!.subspaces!) { if (room.devices != null) { devices.addAll(room.devices!); } @@ -275,7 +275,7 @@ class DevicesCubit extends Cubit { deviceId, HomeCubit.getInstance() .selectedSpace! - .rooms! + .subspaces! .indexOf(HomeCubit.getInstance().selectedRoom!), code: control.code); }); @@ -308,15 +308,15 @@ class DevicesCubit extends Cubit { emitSafe(GetDevicesLoading()); int roomIndex = - HomeCubit.getInstance().selectedSpace!.rooms!.indexWhere((element) => element.id == roomId); + HomeCubit.getInstance().selectedSpace!.subspaces!.indexWhere((element) => element.id == roomId); try { - HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices = + HomeCubit.getInstance().selectedSpace!.subspaces![roomIndex].devices = await DevicesAPI.getDevicesByRoomId(roomId); } catch (e) { emitSafe(GetDevicesError(e.toString())); return; } - final devices = HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices; + final devices = HomeCubit.getInstance().selectedSpace!.subspaces![roomIndex].devices; emitSafe(GetDevicesSuccess(devices)); //get status for each device @@ -333,7 +333,7 @@ class DevicesCubit extends Cubit { emitSafe(GetDeviceStatusLoading(code: code)); int deviceIndex = HomeCubit.getInstance() .selectedSpace! - .rooms![roomIndex] + .subspaces![roomIndex] .devices! .indexWhere((element) => element.uuid == deviceUuid); List statuses = []; @@ -346,7 +346,7 @@ class DevicesCubit extends Cubit { emitSafe(GetDeviceStatusError(e.toString())); return; } - HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices![deviceIndex].status = + HomeCubit.getInstance().selectedSpace!.subspaces![roomIndex].devices![deviceIndex].status = statuses; emitSafe(GetDeviceStatusSuccess(code: code)); } diff --git a/lib/features/devices/view/widgets/devices_view_body.dart b/lib/features/devices/view/widgets/devices_view_body.dart index 53fa8a3..20deb64 100644 --- a/lib/features/devices/view/widgets/devices_view_body.dart +++ b/lib/features/devices/view/widgets/devices_view_body.dart @@ -78,8 +78,8 @@ class DevicesViewBody extends StatelessWidget { groupsList: DevicesCubit.getInstance().allCategories ?? [], ), if (HomeCubit.getInstance().selectedSpace != null) - if (HomeCubit.getInstance().selectedSpace!.rooms != null) - ...HomeCubit.getInstance().selectedSpace!.rooms!.map((room) { + if (HomeCubit.getInstance().selectedSpace!.subspaces != null) + ...HomeCubit.getInstance().selectedSpace!.subspaces!.map((room) { return RoomPage( room: room, ); @@ -95,7 +95,7 @@ class DevicesViewBody extends StatelessWidget { ), child: SmoothPageIndicator( controller: HomeCubit.getInstance().devicesPageController, - count: HomeCubit.getInstance().selectedSpace!.rooms!.length + 1, + count: HomeCubit.getInstance().selectedSpace!.subspaces!.length + 1, effect: const WormEffect( paintStyle: PaintingStyle.stroke, dotHeight: 8, diff --git a/lib/features/devices/view/widgets/room_page.dart b/lib/features/devices/view/widgets/room_page.dart index ce2028a..b2a1ce0 100644 --- a/lib/features/devices/view/widgets/room_page.dart +++ b/lib/features/devices/view/widgets/room_page.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; -import 'package:syncrow_app/features/devices/model/room_model.dart'; +import 'package:syncrow_app/features/devices/model/subspace_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/room_page_switch.dart'; class RoomPage extends StatelessWidget { const RoomPage({super.key, required this.room}); - final RoomModel room; + final SubSpaceModel room; @override Widget build(BuildContext context) { diff --git a/lib/features/devices/view/widgets/rooms_slider.dart b/lib/features/devices/view/widgets/rooms_slider.dart index a53efb3..f70122d 100644 --- a/lib/features/devices/view/widgets/rooms_slider.dart +++ b/lib/features/devices/view/widgets/rooms_slider.dart @@ -40,12 +40,12 @@ class RoomsSlider extends StatelessWidget { ), ), if (HomeCubit.getInstance().selectedSpace != null) - if (HomeCubit.getInstance().selectedSpace!.rooms != null) - ...HomeCubit.getInstance().selectedSpace!.rooms!.map( + if (HomeCubit.getInstance().selectedSpace!.subspaces != null) + ...HomeCubit.getInstance().selectedSpace!.subspaces!.map( (room) => InkWell( onTap: () { HomeCubit.getInstance().roomSliderPageChanged( - HomeCubit.getInstance().selectedSpace!.rooms!.indexOf(room)); + HomeCubit.getInstance().selectedSpace!.subspaces!.indexOf(room)); }, child: TitleMedium( text: room.name!, diff --git a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart index 46a0c8a..bffb001 100644 --- a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart +++ b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart @@ -22,7 +22,7 @@ class ManageUnitBloc extends Bloc { void _fetchRoomsAndDevices(FetchRoomsEvent event, Emitter emit) async { try { emit(LoadingState()); - final roomsList = await SpacesAPI.getRoomsBySpaceId(event.unitId); + final roomsList = await SpacesAPI.getSubSpaceBySpaceId(event.unit.community.uuid, event.unit.id); emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList)); } catch (e) { emit(const ErrorState(message: 'Something went wrong')); @@ -94,12 +94,12 @@ class ManageUnitBloc extends Bloc { } _addNewRoom(AddNewRoom event, Emitter emit) async { - Map body = {'roomName': event.roomName, 'unitUuid': event.unitId}; + Map body = {'roomName': event.roomName}; try { emit(LoadingState()); final response = await HomeCreation.createRoom(body); if (response['data']['uuid'] != '') { - final roomsList = await SpacesAPI.getRoomsBySpaceId(event.unitId); + final roomsList = await SpacesAPI.getSubSpaceBySpaceId(event.unit.community.uuid, event.unit.id); allDevices = await HomeManagementAPI.fetchDevicesByUserId(); emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList)); await HomeCubit.getInstance().fetchUnitsByUserId(); diff --git a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart index 03c0722..bd9de51 100644 --- a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart +++ b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart @@ -1,4 +1,5 @@ import 'package:equatable/equatable.dart'; +import 'package:syncrow_app/features/app_layout/model/space_model.dart'; abstract class ManageUnitEvent extends Equatable { const ManageUnitEvent(); @@ -12,12 +13,12 @@ class InitialEvent extends ManageUnitEvent {} class LoadingEvent extends ManageUnitEvent {} class FetchRoomsEvent extends ManageUnitEvent { - final String unitId; + final SpaceModel unit; - const FetchRoomsEvent({required this.unitId}); + const FetchRoomsEvent({required this.unit}); @override - List get props => [unitId]; + List get props => [unit]; } class FetchDevicesByRoomIdEvent extends ManageUnitEvent { @@ -31,12 +32,12 @@ class FetchDevicesByRoomIdEvent extends ManageUnitEvent { class AddNewRoom extends ManageUnitEvent { final String roomName; - final String unitId; + final SpaceModel unit; - const AddNewRoom({required this.roomName, required this.unitId}); + const AddNewRoom({required this.roomName, required this.unit}); @override - List get props => [roomName, unitId]; + List get props => [roomName, unit]; } class AssignRoomEvent extends ManageUnitEvent { diff --git a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart index 56236a5..f27105e 100644 --- a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart +++ b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_state.dart @@ -1,6 +1,7 @@ import 'package:equatable/equatable.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/room_model.dart'; +import 'package:syncrow_app/features/devices/model/subspace_model.dart'; abstract class ManageUnitState extends Equatable { const ManageUnitState(); @@ -14,7 +15,7 @@ class InitialState extends ManageUnitState {} class LoadingState extends ManageUnitState {} class FetchRoomsState extends ManageUnitState { - final List roomsList; + final List roomsList; final List devicesList; const FetchRoomsState({required this.devicesList, required this.roomsList}); diff --git a/lib/features/menu/view/widgets/manage_home/home_settings.dart b/lib/features/menu/view/widgets/manage_home/home_settings.dart index 751c04b..54b87a4 100644 --- a/lib/features/menu/view/widgets/manage_home/home_settings.dart +++ b/lib/features/menu/view/widgets/manage_home/home_settings.dart @@ -60,7 +60,7 @@ class HomeSettingsView extends StatelessWidget { onTap: () { Navigator.of(context).push(CustomPageRoute( builder: (context) => RoomsView( - unitId: space?.id ?? '', + unit: space!, ))); }, child: Container( diff --git a/lib/features/menu/view/widgets/manage_home/room_screen.dart b/lib/features/menu/view/widgets/manage_home/room_screen.dart index 34f2326..12aeac5 100644 --- a/lib/features/menu/view/widgets/manage_home/room_screen.dart +++ b/lib/features/menu/view/widgets/manage_home/room_screen.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:syncrow_app/features/app_layout/model/space_model.dart'; import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.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'; @@ -11,14 +12,14 @@ import 'package:syncrow_app/utils/helpers/snack_bar.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; class RoomsView extends StatelessWidget { - final String unitId; - const RoomsView({super.key, required this.unitId}); + final SpaceModel unit; + const RoomsView({super.key, required this.unit}); @override Widget build(BuildContext context) { TextEditingController textEditingController = TextEditingController(); return BlocProvider( - create: (context) => ManageUnitBloc()..add(FetchRoomsEvent(unitId: unitId)), + create: (context) => ManageUnitBloc()..add(FetchRoomsEvent(unit:unit )), child: BlocConsumer( listener: (context, state) {}, builder: (context, state) { @@ -62,7 +63,7 @@ class RoomsView extends StatelessWidget { MaterialPageRoute( builder: (context) => AssignDeviceView( roomId: state.roomsList[index].id ?? '', - unitId: unitId, + unitId: unit.id, )), ); }, @@ -100,7 +101,7 @@ class RoomsView extends StatelessWidget { BlocProvider.of(context).add( AddNewRoom( roomName: textEditingController.text, - unitId: unitId)); + unit: unit)); textEditingController.clear(); }, child: const Row( diff --git a/lib/features/scene/view/scene_rooms_tabbar.dart b/lib/features/scene/view/scene_rooms_tabbar.dart index a97d668..5f4932a 100644 --- a/lib/features/scene/view/scene_rooms_tabbar.dart +++ b/lib/features/scene/view/scene_rooms_tabbar.dart @@ -30,7 +30,7 @@ class _SceneRoomsTabBarDevicesViewState @override void initState() { - rooms = List.from(HomeCubit.getInstance().selectedSpace?.rooms ?? []); + rooms = List.from(HomeCubit.getInstance().selectedSpace?.subspaces ?? []); if (rooms != null) { if (rooms![0].id != '-1') { rooms?.insert( diff --git a/lib/services/api/home_creation_api.dart b/lib/services/api/home_creation_api.dart index 5ac6d5a..9c2e3b4 100644 --- a/lib/services/api/home_creation_api.dart +++ b/lib/services/api/home_creation_api.dart @@ -148,6 +148,7 @@ class HomeCreation { } } + static Future> assignUserToRoom(Map body) async { try { final response = await _httpService.post( diff --git a/lib/services/api/spaces_api.dart b/lib/services/api/spaces_api.dart index bd02075..0562bcf 100644 --- a/lib/services/api/spaces_api.dart +++ b/lib/services/api/spaces_api.dart @@ -1,32 +1,47 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:syncrow_app/features/app_layout/model/space_model.dart'; import 'package:syncrow_app/features/auth/model/user_model.dart'; -import 'package:syncrow_app/features/devices/model/room_model.dart'; +import 'package:syncrow_app/features/devices/model/subspace_model.dart'; import 'package:syncrow_app/services/api/api_links_endpoints.dart'; import 'package:syncrow_app/services/api/http_service.dart'; class SpacesAPI { static final HTTPService _httpService = HTTPService(); - static Future> getUnitsByUserId() async { - var uuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey); - final response = await _httpService.get( - path: "${ApiEndpoints.unitUser}$uuid", - showServerMessage: false, - expectedResponseModel: (json) => SpaceModel.fromJsonList(json), - ); - return response; + static Future> getSpacesByUserId() async { + try { + var uuid = + await const FlutterSecureStorage().read(key: UserModel.userUuidKey); + if (uuid == null) throw Exception("User UUID is missing"); + + final path = ApiEndpoints.userSpaces.replaceFirst('{userUuid}', uuid); + final response = await _httpService.get( + path: path, + showServerMessage: false, + expectedResponseModel: (json) => SpaceModel.fromJsonList(json['data']), + ); + + return response; + } catch (error) { + print("Error in getSpacesByUserId: $error"); + rethrow; // Rethrow the error to be caught by `fetchUnitsByUserId` + } } - static Future> getRoomsBySpaceId(String unitId) async { + static Future> getSubSpaceBySpaceId( + String communityId, String spaceId) async { + final path = ApiEndpoints.listSubspace + .replaceFirst('{communityUuid}', communityId) + .replaceFirst('{spaceUuid}', spaceId); + final response = await _httpService.get( - path: "${ApiEndpoints.unitChild}$unitId", + path: path, queryParameters: {"page": 1, "pageSize": 10}, showServerMessage: false, expectedResponseModel: (json) { - List rooms = []; + List rooms = []; for (var room in json['children']) { - rooms.add(RoomModel.fromJson(room)); + rooms.add(SubSpaceModel.fromJson(room)); } return rooms; }, From 489789da0aa377ab5deb10cd52bd76abaf946519 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Wed, 30 Oct 2024 11:04:36 +0400 Subject: [PATCH 04/26] fixed issues in space --- lib/features/app_layout/bloc/home_cubit.dart | 6 +++++- .../app_layout/model/community_model.dart | 8 ++++---- .../app_layout/model/space_model.dart | 19 +++++++++++++------ lib/services/api/spaces_api.dart | 6 ++++-- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart index 7b72975..816b64d 100644 --- a/lib/features/app_layout/bloc/home_cubit.dart +++ b/lib/features/app_layout/bloc/home_cubit.dart @@ -269,17 +269,21 @@ class HomeCubit extends Cubit { await fetchRoomsByUnitId(selectedSpace!); emitSafe(GetSpacesSuccess(spaces!)); } else { - print("here in else"); emitSafe(GetSpacesError("No spaces found")); } } fetchRoomsByUnitId(SpaceModel space) async { + print("Community ID: ${space.community.uuid}"); + print("Space ID: ${space.id}"); + emitSafe(GetSpaceRoomsLoading()); try { space.subspaces = await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id); } catch (failure) { + print("Error fetching subspaces: $failure"); + emitSafe(GetSpaceRoomsError(failure.toString())); return; } diff --git a/lib/features/app_layout/model/community_model.dart b/lib/features/app_layout/model/community_model.dart index 92e9a2c..d8b094c 100644 --- a/lib/features/app_layout/model/community_model.dart +++ b/lib/features/app_layout/model/community_model.dart @@ -6,14 +6,14 @@ class Community { Community({ required this.uuid, required this.name, - required this.description, + this.description = '', }); factory Community.fromJson(Map json) { return Community( - uuid: json['uuid'], - name: json['name'], - description: json['description'], + uuid: json['uuid'] ?? '', + name: json['name'] ?? 'Unnamed Community', + description: json['description'] ?? '', ); } diff --git a/lib/features/app_layout/model/space_model.dart b/lib/features/app_layout/model/space_model.dart index 30712d4..944ec7c 100644 --- a/lib/features/app_layout/model/space_model.dart +++ b/lib/features/app_layout/model/space_model.dart @@ -26,13 +26,17 @@ class SpaceModel { /// Factory constructor to create an instance from JSON. factory SpaceModel.fromJson(Map json) { - final spaceData = json['space'] as Map? ?? {}; + // Extract and log each part of space data + final id = json['uuid'] ?? ''; + final name = json['spaceName'] ?? 'Unnamed Space'; + final communityJson = json['community'] ?? {}; return SpaceModel( - id: json['uuid'] ?? '', - name: spaceData['spaceName'] ?? 'Unnamed Space', - community: Community.fromJson(spaceData['community'] ?? {}), - subspaces: (spaceData['subspaces'] as List?) + id: id, + name: name, + community: Community.fromJson( + communityJson), // Ensure Community is created correctly + subspaces: (json['subspaces'] as List?) ?.map((item) => SubSpaceModel.fromJson(item)) .toList() ?? [], @@ -41,6 +45,9 @@ class SpaceModel { /// Helper method to parse a list of SpaceModel from JSON. static List fromJsonList(List jsonList) { - return jsonList.map((item) => SpaceModel.fromJson(item)).toList(); + return jsonList.map((item) { + final spaceData = item['space']; // Extract the `space` object + return SpaceModel.fromJson(spaceData); // Pass to SpaceModel.fromJson + }).toList(); } } diff --git a/lib/services/api/spaces_api.dart b/lib/services/api/spaces_api.dart index 0562bcf..1565d3b 100644 --- a/lib/services/api/spaces_api.dart +++ b/lib/services/api/spaces_api.dart @@ -18,12 +18,13 @@ class SpacesAPI { final response = await _httpService.get( path: path, showServerMessage: false, - expectedResponseModel: (json) => SpaceModel.fromJsonList(json['data']), + expectedResponseModel: (json) { + return SpaceModel.fromJsonList(json['data']); + }, ); return response; } catch (error) { - print("Error in getSpacesByUserId: $error"); rethrow; // Rethrow the error to be caught by `fetchUnitsByUserId` } } @@ -33,6 +34,7 @@ class SpacesAPI { final path = ApiEndpoints.listSubspace .replaceFirst('{communityUuid}', communityId) .replaceFirst('{spaceUuid}', spaceId); + print("Constructed path: $path"); final response = await _httpService.get( path: path, From 5c65bac076fa2c4989cfbf4ddbced63ae431773c Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Wed, 30 Oct 2024 12:27:31 +0400 Subject: [PATCH 05/26] removed logs --- lib/features/app_layout/bloc/home_cubit.dart | 4 -- .../devices/model/subspace_model.dart | 6 +-- lib/services/api/spaces_api.dart | 45 ++++++++++++------- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart index 816b64d..e4dde3e 100644 --- a/lib/features/app_layout/bloc/home_cubit.dart +++ b/lib/features/app_layout/bloc/home_cubit.dart @@ -274,15 +274,11 @@ class HomeCubit extends Cubit { } fetchRoomsByUnitId(SpaceModel space) async { - print("Community ID: ${space.community.uuid}"); - print("Space ID: ${space.id}"); - emitSafe(GetSpaceRoomsLoading()); try { space.subspaces = await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id); } catch (failure) { - print("Error fetching subspaces: $failure"); emitSafe(GetSpaceRoomsError(failure.toString())); return; diff --git a/lib/features/devices/model/subspace_model.dart b/lib/features/devices/model/subspace_model.dart index b2aa133..f8be0aa 100644 --- a/lib/features/devices/model/subspace_model.dart +++ b/lib/features/devices/model/subspace_model.dart @@ -15,7 +15,7 @@ class SubSpaceModel { return { 'id': id, 'name': name, - 'devices': devices, + 'devices': devices?.map((device) => device.toJson()).toList(), }; } @@ -28,8 +28,8 @@ class SubSpaceModel { } return SubSpaceModel( id: json['uuid'], - name: json['name'], - devices: [], + name: json['subspaceName'], + devices: devices, ); } } diff --git a/lib/services/api/spaces_api.dart b/lib/services/api/spaces_api.dart index 1565d3b..15122cb 100644 --- a/lib/services/api/spaces_api.dart +++ b/lib/services/api/spaces_api.dart @@ -31,24 +31,35 @@ class SpacesAPI { static Future> getSubSpaceBySpaceId( String communityId, String spaceId) async { - final path = ApiEndpoints.listSubspace - .replaceFirst('{communityUuid}', communityId) - .replaceFirst('{spaceUuid}', spaceId); - print("Constructed path: $path"); + try { + // Construct the API path + final path = ApiEndpoints.listSubspace + .replaceFirst('{communityUuid}', communityId) + .replaceFirst('{spaceUuid}', spaceId); - final response = await _httpService.get( - path: path, - queryParameters: {"page": 1, "pageSize": 10}, - showServerMessage: false, - expectedResponseModel: (json) { - List rooms = []; - for (var room in json['children']) { - rooms.add(SubSpaceModel.fromJson(room)); - } - return rooms; - }, - ); - return response; + + final response = await _httpService.get( + path: path, + queryParameters: {"page": 1, "pageSize": 10}, + showServerMessage: false, + expectedResponseModel: (json) { + + List rooms = []; + if (json['data'] != null) { + for (var subspace in json['data']) { + rooms.add(SubSpaceModel.fromJson(subspace)); + } + } else { + print("Warning: 'data' key is missing or null in response JSON."); + } + return rooms; + }, + ); + + return response; + } catch (error, stackTrace) { + return []; // Return an empty list if there's an error + } } static Future generateInvitationCode( From 13a4bf25b39c676ee7439fc5f0d0f6a8804d41d9 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Wed, 30 Oct 2024 19:16:10 +0400 Subject: [PATCH 06/26] added unit devices --- lib/features/app_layout/bloc/home_cubit.dart | 1 + .../device_manager_bloc.dart | 24 +++++--- .../device_manager_event.dart | 4 +- lib/features/devices/bloc/devices_cubit.dart | 55 ++++++++++++------- .../manage_unit_bloc/manage_unit_bloc.dart | 30 +++++++--- .../manage_unit_bloc/manage_unit_event.dart | 11 ++-- .../widgets/manage_home/assign_devices.dart | 53 ++++++++++++------ .../view/widgets/manage_home/room_screen.dart | 1 + .../bloc/tab_change/tab_change_bloc.dart | 2 +- .../bloc/tab_change/tab_change_event.dart | 6 +- .../scene/view/scene_rooms_tabbar.dart | 9 ++- lib/navigation/router.dart | 17 +++++- lib/services/api/api_links_endpoints.dart | 9 ++- lib/services/api/devices_api.dart | 55 +++++++++++++------ lib/services/api/home_management_api.dart | 31 +++++++++-- 15 files changed, 220 insertions(+), 88 deletions(-) diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart index e4dde3e..bc4d7b2 100644 --- a/lib/features/app_layout/bloc/home_cubit.dart +++ b/lib/features/app_layout/bloc/home_cubit.dart @@ -260,6 +260,7 @@ class HomeCubit extends Cubit { try { spaces = await SpacesAPI.getSpacesByUserId(); } catch (failure) { + print(failure); emitSafe(GetSpacesError("No units found")); return; } diff --git a/lib/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart b/lib/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart index a8b1eb1..2824ef0 100644 --- a/lib/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart +++ b/lib/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart @@ -25,7 +25,8 @@ class DeviceManagerBloc extends Bloc { static List? allCategories; - Future _onFetchAllDevices(FetchAllDevices event, Emitter emit) async { + Future _onFetchAllDevices( + FetchAllDevices event, Emitter emit) async { emit(state.copyWith(loading: true)); try { final allDevices = await HomeManagementAPI.fetchDevicesByUnitId(); @@ -39,21 +40,27 @@ class DeviceManagerBloc extends Bloc { FetchDevicesByRoomId event, Emitter emit) async { emit(state.copyWith(loading: true)); try { - final devices = await DevicesAPI.getDevicesByRoomId(event.roomId); + final devices = await DevicesAPI.getDevicesByRoomId( + communityUuid: event.unit.community.uuid, + spaceUuid: event.unit.id, + roomId: event.roomId, + ); emit(state.copyWith(devices: devices, loading: false)); } catch (e) { emit(state.copyWith(error: e.toString(), loading: false)); } } - void _onSelectCategory(SelectCategory event, Emitter emit) { + void _onSelectCategory( + SelectCategory event, Emitter emit) { for (var i = 0; i < allCategories!.length; i++) { allCategories![i].isSelected = i == event.index; } emit(state.copyWith(categoryChanged: true)); } - void _onUnselectAllCategories(UnselectAllCategories event, Emitter emit) { + void _onUnselectAllCategories( + UnselectAllCategories event, Emitter emit) { for (var category in allCategories!) { category.isSelected = false; } @@ -97,7 +104,8 @@ class DeviceManagerBloc extends Bloc { _updateDevicesStatus(category, emit); } - void _onTurnOnOffDevice(TurnOnOffDevice event, Emitter emit) { + void _onTurnOnOffDevice( + TurnOnOffDevice event, Emitter emit) { var device = event.device; device.isOnline = !device.isOnline!; DevicesCategoryModel category = allCategories!.firstWhere((category) { @@ -120,7 +128,8 @@ class DeviceManagerBloc extends Bloc { emit(state.copyWith(categoryChanged: true)); // Set category changed state } - void _updateDevicesStatus(DevicesCategoryModel category, Emitter emit) { + void _updateDevicesStatus( + DevicesCategoryModel category, Emitter emit) { if (category.devices != null && category.devices!.isNotEmpty) { bool? tempStatus = category.devices![0].isOnline; for (var device in category.devices!) { @@ -140,7 +149,8 @@ class DeviceManagerBloc extends Bloc { try { final deviceFunctions = await DevicesAPI.deviceFunctions(event.deviceId); - emit(state.copyWith(functionsLoading: false, deviceFunctions: deviceFunctions)); + emit(state.copyWith( + functionsLoading: false, deviceFunctions: deviceFunctions)); } catch (e) { emit(state.copyWith(functionsLoading: false, error: e.toString())); } diff --git a/lib/features/devices/bloc/device_manager_bloc/device_manager_event.dart b/lib/features/devices/bloc/device_manager_bloc/device_manager_event.dart index 867027d..e0abf8c 100644 --- a/lib/features/devices/bloc/device_manager_bloc/device_manager_event.dart +++ b/lib/features/devices/bloc/device_manager_bloc/device_manager_event.dart @@ -1,5 +1,6 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; +import 'package:syncrow_app/features/app_layout/model/space_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_model.dart'; @@ -15,8 +16,9 @@ class FetchAllDevices extends DeviceManagerEvent {} class FetchDevicesByRoomId extends DeviceManagerEvent { final String roomId; + final SpaceModel unit; - const FetchDevicesByRoomId(this.roomId); + const FetchDevicesByRoomId(this.roomId, this.unit); @override List get props => [roomId]; diff --git a/lib/features/devices/bloc/devices_cubit.dart b/lib/features/devices/bloc/devices_cubit.dart index 943f0db..982f904 100644 --- a/lib/features/devices/bloc/devices_cubit.dart +++ b/lib/features/devices/bloc/devices_cubit.dart @@ -23,14 +23,22 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart'; part 'devices_state.dart'; class DevicesCubit extends Cubit { + Future _initializeDevices(SpaceModel selectedSpace) async { + // Fetch devices for each room in the selected space + for (var room in selectedSpace.subspaces ?? []) { + await fetchDevicesByRoomId(selectedSpace, room.id!); + } + + // Fetch groups based on the selected space ID + await fetchGroups(selectedSpace.id ?? ''); + } + DevicesCubit._() : super(DevicesInitial()) { - if (HomeCubit.getInstance().selectedSpace != null && - HomeCubit.getInstance().spaces!.isNotEmpty) { - // fetchGroups(HomeCubit.getInstance().selectedSpace!.id!); - for (var room in HomeCubit.getInstance().selectedSpace!.subspaces!) { - fetchDevicesByRoomId(room.id!); - } - fetchGroups(HomeCubit.getInstance().selectedSpace?.id ?? ''); + final selectedSpace = HomeCubit.getInstance().selectedSpace; + final spaces = HomeCubit.getInstance().spaces; + + if (selectedSpace != null && spaces != null && spaces.isNotEmpty) { + _initializeDevices(selectedSpace); } } @@ -87,10 +95,10 @@ class DevicesCubit extends Cubit { return const DoorsListView(); case DeviceType.Curtain: return const CurtainListView(); - // case DeviceType.ThreeGang: - // return const ThreeGangSwitchesView(); - // case DeviceType.Gateway: - // return const GateWayView(); + // case DeviceType.ThreeGang: + // return const ThreeGangSwitchesView(); + // case DeviceType.Gateway: + // return const GateWayView(); default: return null; } @@ -303,20 +311,26 @@ class DevicesCubit extends Cubit { } } - fetchDevicesByRoomId(String? roomId) async { + fetchDevicesByRoomId(SpaceModel? unit, String? roomId) async { if (roomId == null) return; emitSafe(GetDevicesLoading()); - int roomIndex = - HomeCubit.getInstance().selectedSpace!.subspaces!.indexWhere((element) => element.id == roomId); + int roomIndex = HomeCubit.getInstance() + .selectedSpace! + .subspaces! + .indexWhere((element) => element.id == roomId); try { HomeCubit.getInstance().selectedSpace!.subspaces![roomIndex].devices = - await DevicesAPI.getDevicesByRoomId(roomId); + await DevicesAPI.getDevicesByRoomId( + communityUuid: unit!.community.uuid, + spaceUuid: unit.id, + roomId: roomId); } catch (e) { emitSafe(GetDevicesError(e.toString())); return; } - final devices = HomeCubit.getInstance().selectedSpace!.subspaces![roomIndex].devices; + final devices = + HomeCubit.getInstance().selectedSpace!.subspaces![roomIndex].devices; emitSafe(GetDevicesSuccess(devices)); //get status for each device @@ -346,8 +360,11 @@ class DevicesCubit extends Cubit { emitSafe(GetDeviceStatusError(e.toString())); return; } - HomeCubit.getInstance().selectedSpace!.subspaces![roomIndex].devices![deviceIndex].status = - statuses; + HomeCubit.getInstance() + .selectedSpace! + .subspaces![roomIndex] + .devices![deviceIndex] + .status = statuses; emitSafe(GetDeviceStatusSuccess(code: code)); } @@ -396,8 +413,6 @@ class DevicesCubit extends Cubit { // emitSafe(LightBrightnessChanged(value)); // } // } - - } enum LightMode { diff --git a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart index bffb001..f225077 100644 --- a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart +++ b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart @@ -19,10 +19,12 @@ class ManageUnitBloc extends Bloc { on(_addNewRoom); } - void _fetchRoomsAndDevices(FetchRoomsEvent event, Emitter emit) async { + void _fetchRoomsAndDevices( + FetchRoomsEvent event, Emitter emit) async { try { emit(LoadingState()); - final roomsList = await SpacesAPI.getSubSpaceBySpaceId(event.unit.community.uuid, event.unit.id); + final roomsList = await SpacesAPI.getSubSpaceBySpaceId( + event.unit.community.uuid, event.unit.id); emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList)); } catch (e) { emit(const ErrorState(message: 'Something went wrong')); @@ -30,11 +32,15 @@ class ManageUnitBloc extends Bloc { } } - void _fetchDevicesByRoomId(FetchDevicesByRoomIdEvent event, Emitter emit) async { + void _fetchDevicesByRoomId( + FetchDevicesByRoomIdEvent event, Emitter emit) async { try { Map roomDevicesId = {}; emit(LoadingState()); - final devicesList = await DevicesAPI.getDevicesByRoomId(event.roomId); + final devicesList = await DevicesAPI.getDevicesByRoomId( + communityUuid: event.unit.community.uuid, + spaceUuid: event.unit.id, + roomId: event.roomId); allDevices = await HomeManagementAPI.fetchDevicesByUserId(); List allDevicesIds = []; @@ -61,13 +67,20 @@ class ManageUnitBloc extends Bloc { } } - void _assignDevice(AssignRoomEvent event, Emitter emit) async { + void _assignDevice( + AssignRoomEvent event, Emitter emit) async { try { Map roomDevicesId = {}; emit(LoadingState()); - Map body = {"deviceUuid": event.deviceId, "roomUuid": event.roomId}; + Map body = { + "deviceUuid": event.deviceId, + "roomUuid": event.roomId + }; await HomeManagementAPI.assignDeviceToRoom(body); - final devicesList = await DevicesAPI.getDevicesByRoomId(event.roomId); + final devicesList = await DevicesAPI.getDevicesByRoomId( + communityUuid: event.unit.community.uuid, + spaceUuid: event.unit.id, + roomId: event.roomId); List allDevicesIds = []; @@ -99,7 +112,8 @@ class ManageUnitBloc extends Bloc { emit(LoadingState()); final response = await HomeCreation.createRoom(body); if (response['data']['uuid'] != '') { - final roomsList = await SpacesAPI.getSubSpaceBySpaceId(event.unit.community.uuid, event.unit.id); + final roomsList = await SpacesAPI.getSubSpaceBySpaceId( + event.unit.community.uuid, event.unit.id); allDevices = await HomeManagementAPI.fetchDevicesByUserId(); emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList)); await HomeCubit.getInstance().fetchUnitsByUserId(); diff --git a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart index bd9de51..4db0ea3 100644 --- a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart +++ b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart @@ -23,11 +23,12 @@ class FetchRoomsEvent extends ManageUnitEvent { class FetchDevicesByRoomIdEvent extends ManageUnitEvent { final String roomId; + final SpaceModel unit; - const FetchDevicesByRoomIdEvent({required this.roomId}); + const FetchDevicesByRoomIdEvent({required this.roomId, required this.unit}); @override - List get props => [roomId]; + List get props => [roomId, unit]; } class AddNewRoom extends ManageUnitEvent { @@ -43,9 +44,11 @@ class AddNewRoom extends ManageUnitEvent { class AssignRoomEvent extends ManageUnitEvent { final String roomId; final String deviceId; + final SpaceModel unit; - const AssignRoomEvent({required this.roomId, required this.deviceId}); + const AssignRoomEvent( + {required this.roomId, required this.deviceId, required this.unit}); @override - List get props => [roomId]; + List get props => [roomId, unit]; } diff --git a/lib/features/menu/view/widgets/manage_home/assign_devices.dart b/lib/features/menu/view/widgets/manage_home/assign_devices.dart index bc097fb..e8002ab 100644 --- a/lib/features/menu/view/widgets/manage_home/assign_devices.dart +++ b/lib/features/menu/view/widgets/manage_home/assign_devices.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:syncrow_app/features/app_layout/model/space_model.dart'; import 'package:syncrow_app/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.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'; @@ -11,16 +12,24 @@ import 'package:syncrow_app/utils/helpers/snack_bar.dart'; class AssignDeviceView extends StatelessWidget { final String unitId; final String roomId; - const AssignDeviceView({super.key, required this.unitId, required this.roomId}); + final SpaceModel unit; + const AssignDeviceView( + {super.key, + required this.unitId, + required this.roomId, + required this.unit}); @override Widget build(BuildContext context) { return BlocProvider( - create: (context) => ManageUnitBloc()..add(FetchDevicesByRoomIdEvent(roomId: roomId)), - child: BlocConsumer(listener: (context, state) { + create: (context) => ManageUnitBloc() + ..add(FetchDevicesByRoomIdEvent(roomId: roomId, unit: unit)), + child: BlocConsumer( + listener: (context, state) { if (state is FetchDeviceByRoomIdState) { if (state.allDevices.isEmpty) { - CustomSnackBar.displaySnackBar('You do not have the permission to assign devices'); + CustomSnackBar.displaySnackBar( + 'You do not have the permission to assign devices'); Navigator.of(context).pop(); } } @@ -34,7 +43,8 @@ class AssignDeviceView extends StatelessWidget { width: MediaQuery.sizeOf(context).width, height: MediaQuery.sizeOf(context).height, child: GridView.builder( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 10.0, mainAxisSpacing: 10.0, @@ -52,11 +62,14 @@ class AssignDeviceView extends StatelessWidget { ), ), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ SvgPicture.asset( state.allDevices[index].icon!, @@ -64,19 +77,27 @@ class AssignDeviceView extends StatelessWidget { ), GestureDetector( onTap: () { - if (state.roomDevicesId[ - state.allDevices[index].uuid!] ?? + if (state.roomDevicesId[state + .allDevices[index] + .uuid!] ?? false == false) { - BlocProvider.of(context).add( - AssignRoomEvent( - deviceId: - state.allDevices[index].uuid ?? '', + BlocProvider.of< + ManageUnitBloc>( + context) + .add(AssignRoomEvent( + deviceId: state + .allDevices[ + index] + .uuid ?? + '', + unit: unit, roomId: roomId)); } }, child: SvgPicture.asset( - state.roomDevicesId[ - state.allDevices[index].uuid!] ?? + state.roomDevicesId[state + .allDevices[index] + .uuid!] ?? false ? Assets.blueCheckboxIcon : Assets.emptyCheckboxIcon, diff --git a/lib/features/menu/view/widgets/manage_home/room_screen.dart b/lib/features/menu/view/widgets/manage_home/room_screen.dart index 12aeac5..1ab85ab 100644 --- a/lib/features/menu/view/widgets/manage_home/room_screen.dart +++ b/lib/features/menu/view/widgets/manage_home/room_screen.dart @@ -64,6 +64,7 @@ class RoomsView extends StatelessWidget { builder: (context) => AssignDeviceView( roomId: state.roomsList[index].id ?? '', unitId: unit.id, + unit: unit, )), ); }, diff --git a/lib/features/scene/bloc/tab_change/tab_change_bloc.dart b/lib/features/scene/bloc/tab_change/tab_change_bloc.dart index a7c6481..7fc18db 100644 --- a/lib/features/scene/bloc/tab_change/tab_change_bloc.dart +++ b/lib/features/scene/bloc/tab_change/tab_change_bloc.dart @@ -17,7 +17,7 @@ class TabBarBloc extends Bloc { if (event.roomId == "-1") { deviceManagerBloc.add(FetchAllDevices()); } else { - deviceManagerBloc.add(FetchDevicesByRoomId(event.roomId)); + deviceManagerBloc.add(FetchDevicesByRoomId(event.roomId,event.unit)); } emit(TabSelected( roomId: event.roomId, selectedTabIndex: event.selectedIndex)); diff --git a/lib/features/scene/bloc/tab_change/tab_change_event.dart b/lib/features/scene/bloc/tab_change/tab_change_event.dart index c052280..f39d823 100644 --- a/lib/features/scene/bloc/tab_change/tab_change_event.dart +++ b/lib/features/scene/bloc/tab_change/tab_change_event.dart @@ -1,3 +1,5 @@ +import 'package:syncrow_app/features/app_layout/model/space_model.dart'; + abstract class TabBarEvent { const TabBarEvent(); } @@ -5,5 +7,7 @@ abstract class TabBarEvent { class TabChanged extends TabBarEvent { final int selectedIndex; final String roomId; - const TabChanged({required this.selectedIndex, required this.roomId}); + final SpaceModel unit; + const TabChanged( + {required this.selectedIndex, required this.roomId, required this.unit}); } diff --git a/lib/features/scene/view/scene_rooms_tabbar.dart b/lib/features/scene/view/scene_rooms_tabbar.dart index 5f4932a..9d0a491 100644 --- a/lib/features/scene/view/scene_rooms_tabbar.dart +++ b/lib/features/scene/view/scene_rooms_tabbar.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.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/model/space_model.dart'; import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart'; import 'package:syncrow_app/features/devices/model/room_model.dart'; import 'package:syncrow_app/features/scene/bloc/tab_change/tab_change_bloc.dart'; @@ -27,9 +28,11 @@ class _SceneRoomsTabBarDevicesViewState with SingleTickerProviderStateMixin { late final TabController _tabController; List? rooms = []; + late final SpaceModel selectedSpace; @override void initState() { + selectedSpace = HomeCubit.getInstance().selectedSpace!; rooms = List.from(HomeCubit.getInstance().selectedSpace?.subspaces ?? []); if (rooms != null) { if (rooms![0].id != '-1') { @@ -56,8 +59,10 @@ class _SceneRoomsTabBarDevicesViewState final value = _tabController.index; /// select tab - context.read().add( - TabChanged(selectedIndex: value, roomId: rooms?[value].id ?? '')); + context.read().add(TabChanged( + selectedIndex: value, + roomId: rooms?[value].id ?? '', + unit: selectedSpace)); return; } } diff --git a/lib/navigation/router.dart b/lib/navigation/router.dart index 990b7fb..c09a307 100644 --- a/lib/navigation/router.dart +++ b/lib/navigation/router.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.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/view/app_layout.dart'; import 'package:syncrow_app/features/auth/view/otp_view.dart'; import 'package:syncrow_app/features/auth/view/login_view.dart'; @@ -84,9 +86,18 @@ class Router { DeviceManagerBloc()..add(FetchAllDevices()), ), BlocProvider( - create: (BuildContext context) => TabBarBloc( - context.read()) - ..add(const TabChanged(selectedIndex: 0, roomId: '-1')), + create: (BuildContext context) => + TabBarBloc(context.read()) + ..add(TabChanged( + selectedIndex: 0, + roomId: '-1', + unit: SpaceModel( + id: '-1', + name: '', + community: Community( + uuid: '-1', + name: '', + )))), ), ], child: const SceneRoomsTabBarDevicesView(), diff --git a/lib/services/api/api_links_endpoints.dart b/lib/services/api/api_links_endpoints.dart index dcff924..225fd60 100644 --- a/lib/services/api/api_links_endpoints.dart +++ b/lib/services/api/api_links_endpoints.dart @@ -55,7 +55,8 @@ abstract class ApiEndpoints { static const String addUnitToUser = '/unit/user'; //GET static const String unitByUuid = '/unit/'; - static const String listSubspace = '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; + static const String listSubspace = + '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; static const String unitParent = '/unit/parent/{unitUuid}'; static const String unitUser = '/unit/user/'; static const String invitationCode = '/unit/{unitUuid}/invitation-code'; @@ -75,10 +76,11 @@ abstract class ApiEndpoints { //PUT static const String renameRoom = '/room/{roomUuid}'; - //SPACE Module //GET static const String userSpaces = '/user/{userUuid}/spaces'; + static const String spaceDevices = + '/communities/{communityUuid}/spaces/{spaceUuid}/devices'; ///Group Module //POST @@ -106,7 +108,8 @@ abstract class ApiEndpoints { static const String openDoorLock = '/door-lock/open/{doorLockUuid}'; //GET - static const String deviceByRoom = '/device/room'; + static const String deviceByRoom = + '/communities/:communityUuid/spaces/:spaceUuid/subspaces/:subSpaceUuid/devices'; static const String deviceByUuid = '/device/{deviceUuid}'; static const String deviceFunctions = '/device/{deviceUuid}/functions'; static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices'; diff --git a/lib/services/api/devices_api.dart b/lib/services/api/devices_api.dart index 8d096f7..60fc203 100644 --- a/lib/services/api/devices_api.dart +++ b/lib/services/api/devices_api.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:developer'; 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_model.dart'; @@ -130,23 +129,43 @@ class DevicesAPI { return response; } - static Future> getDevicesByRoomId(String roomId) async { - final response = await _httpService.get( - path: ApiEndpoints.deviceByRoom, - queryParameters: {"roomUuid": roomId}, - showServerMessage: false, - expectedResponseModel: (json) { - if (json == null || json.isEmpty || json == []) { - return []; - } - List devices = []; - for (var device in json) { - devices.add(DeviceModel.fromJson(device)); - } - return devices; - }, - ); - return response; + static Future> getDevicesByRoomId({ + required String communityUuid, + required String spaceUuid, + required String roomId, + }) async { + try { + final String path = ApiEndpoints.deviceByRoom + .replaceAll(':communityUuid', communityUuid) + .replaceAll(':spaceUuid', spaceUuid) + .replaceAll(':subSpaceUuid', roomId); + + final response = await _httpService.get( + path: path, + showServerMessage: false, + expectedResponseModel: (json) { + final data = json['data']; + + if (data == null || data.isEmpty) { + return []; + } + if (json == null || json.isEmpty || json == []) { + return []; + } + return data + .map((device) => DeviceModel.fromJson(device)) + .toList(); + }, + ); + + return response; + } catch (e) { + // Log the error if needed + print("Error fetching devices for room: $e"); + + // Return an empty list in case of error + return []; + } } static Future> getDevicesByGatewayId( diff --git a/lib/services/api/home_management_api.dart b/lib/services/api/home_management_api.dart index 9eb35b2..c9183b7 100644 --- a/lib/services/api/home_management_api.dart +++ b/lib/services/api/home_management_api.dart @@ -28,15 +28,38 @@ class HomeManagementAPI { static Future> fetchDevicesByUnitId() async { List list = []; - await _httpService.get( - path: ApiEndpoints.getDevicesByUnitId.replaceAll( - "{unitUuid}", HomeCubit.getInstance().selectedSpace?.id ?? ''), + + try { + // Retrieve selected space details + final selectedSpace = HomeCubit.getInstance().selectedSpace; + final communityUuid = selectedSpace?.community?.uuid ?? ''; + final spaceUuid = selectedSpace?.id ?? ''; + + // Ensure both placeholders are replaced + final path = ApiEndpoints.spaceDevices + .replaceAll("{communityUuid}", communityUuid) + .replaceAll("{spaceUuid}", spaceUuid); + + // Debugging: Log the path + print("Fetching devices with path: $path"); + + await _httpService.get( + path: path, showServerMessage: false, expectedResponseModel: (json) { json.forEach((value) { list.add(DeviceModel.fromJson(value)); }); - }); + }, + ); + + // Debugging: Log successful fetch + print("Successfully fetched ${list.length} devices."); + } catch (e) { + // Log the error for debugging + print("Error fetching devices for the unit: $e"); + } + return list; } From 80d26513700e9c7fab4f0abe57d94a2c81afa001 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 31 Oct 2024 10:19:38 +0400 Subject: [PATCH 07/26] scene and automation has been updated --- lib/features/app_layout/bloc/home_cubit.dart | 1 - .../devices/view/widgets/ACs/acs_view.dart | 10 ++++-- .../view/widgets/devices_view_body.dart | 1 + .../view/widgets/room_page_switch.dart | 1 + .../devices/view/widgets/rooms_slider.dart | 14 ++++++--- .../scene/helper/scene_logic_helper.dart | 2 +- .../scene/model/create_scene_model.dart | 31 ++++++++++++------- lib/features/scene/model/scenes_model.dart | 2 +- .../scene/view/scene_rooms_tabbar.dart | 7 ++--- .../scene_devices/scene_devices_body.dart | 5 +-- lib/services/api/devices_api.dart | 1 + 11 files changed, 47 insertions(+), 28 deletions(-) diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart index bc4d7b2..e4dde3e 100644 --- a/lib/features/app_layout/bloc/home_cubit.dart +++ b/lib/features/app_layout/bloc/home_cubit.dart @@ -260,7 +260,6 @@ class HomeCubit extends Cubit { try { spaces = await SpacesAPI.getSpacesByUserId(); } catch (failure) { - print(failure); emitSafe(GetSpacesError("No units found")); return; } diff --git a/lib/features/devices/view/widgets/ACs/acs_view.dart b/lib/features/devices/view/widgets/ACs/acs_view.dart index be84084..7680ba7 100644 --- a/lib/features/devices/view/widgets/ACs/acs_view.dart +++ b/lib/features/devices/view/widgets/ACs/acs_view.dart @@ -22,6 +22,8 @@ class ACsView extends StatelessWidget { @override Widget build(BuildContext context) { + print("ACsView deviceModel UUID: ${deviceModel?.uuid}"); + return BlocProvider( create: (context) => ACsBloc(acId: deviceModel?.uuid ?? '') ..add(AcsInitial(allAcs: deviceModel != null ? false : true)), @@ -66,12 +68,14 @@ class ACsView extends StatelessWidget { child: state is AcsLoadingState ? const Center( child: DefaultContainer( - width: 50, height: 50, child: CircularProgressIndicator()), + width: 50, + height: 50, + child: CircularProgressIndicator()), ) : RefreshIndicator( onRefresh: () async { - BlocProvider.of(context) - .add(AcsInitial(allAcs: deviceModel != null ? false : true)); + BlocProvider.of(context).add(AcsInitial( + allAcs: deviceModel != null ? false : true)); }, child: Container( padding: const EdgeInsets.only(top: 40), diff --git a/lib/features/devices/view/widgets/devices_view_body.dart b/lib/features/devices/view/widgets/devices_view_body.dart index 20deb64..bfa9f7d 100644 --- a/lib/features/devices/view/widgets/devices_view_body.dart +++ b/lib/features/devices/view/widgets/devices_view_body.dart @@ -69,6 +69,7 @@ class DevicesViewBody extends StatelessWidget { Expanded( child: PageView( + controller: HomeCubit.getInstance().devicesPageController, onPageChanged: (index) { HomeCubit.getInstance().devicesPageChanged(index); diff --git a/lib/features/devices/view/widgets/room_page_switch.dart b/lib/features/devices/view/widgets/room_page_switch.dart index 8e06f4d..8522c1c 100644 --- a/lib/features/devices/view/widgets/room_page_switch.dart +++ b/lib/features/devices/view/widgets/room_page_switch.dart @@ -86,6 +86,7 @@ class RoomPageSwitch extends StatelessWidget { /// /// The [device] parameter represents the device model. void showDeviceInterface(DeviceModel device, BuildContext context) { + switch (device.productType) { case DeviceType.AC: Navigator.push( diff --git a/lib/features/devices/view/widgets/rooms_slider.dart b/lib/features/devices/view/widgets/rooms_slider.dart index f70122d..f04d7b8 100644 --- a/lib/features/devices/view/widgets/rooms_slider.dart +++ b/lib/features/devices/view/widgets/rooms_slider.dart @@ -22,7 +22,6 @@ class RoomsSlider extends StatelessWidget { onPageChanged: (index) { HomeCubit.getInstance().roomSliderPageChanged(index); }, - children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 15), @@ -45,15 +44,20 @@ class RoomsSlider extends StatelessWidget { (room) => InkWell( onTap: () { HomeCubit.getInstance().roomSliderPageChanged( - HomeCubit.getInstance().selectedSpace!.subspaces!.indexOf(room)); + HomeCubit.getInstance() + .selectedSpace! + .subspaces! + .indexOf(room)); }, child: TitleMedium( text: room.name!, style: context.titleMedium.copyWith( fontSize: 25, - color: HomeCubit.getInstance().selectedRoom == room - ? ColorsManager.textPrimaryColor - : ColorsManager.textPrimaryColor.withOpacity(.2), + color: + HomeCubit.getInstance().selectedRoom == room + ? ColorsManager.textPrimaryColor + : ColorsManager.textPrimaryColor + .withOpacity(.2), ), ), ), diff --git a/lib/features/scene/helper/scene_logic_helper.dart b/lib/features/scene/helper/scene_logic_helper.dart index 3219ba2..8ddecc8 100644 --- a/lib/features/scene/helper/scene_logic_helper.dart +++ b/lib/features/scene/helper/scene_logic_helper.dart @@ -124,7 +124,7 @@ mixin SceneLogicHelper { )); } else { final createSceneModel = CreateSceneModel( - unitUuid: HomeCubit.getInstance().selectedSpace!.id ?? '', + spaceUuid: HomeCubit.getInstance().selectedSpace!.id ?? '', sceneName: sceneName.text, decisionExpr: 'and', actions: [ diff --git a/lib/features/scene/model/create_scene_model.dart b/lib/features/scene/model/create_scene_model.dart index 5475b93..9690bd3 100644 --- a/lib/features/scene/model/create_scene_model.dart +++ b/lib/features/scene/model/create_scene_model.dart @@ -1,50 +1,57 @@ import 'dart:convert'; +import 'dart:ffi'; import 'package:flutter/foundation.dart'; class CreateSceneModel { - String unitUuid; + String spaceUuid; String sceneName; String decisionExpr; List actions; + bool showInHomePage; CreateSceneModel({ - required this.unitUuid, + required this.spaceUuid, required this.sceneName, required this.decisionExpr, required this.actions, + this.showInHomePage = false, }); CreateSceneModel copyWith({ - String? unitUuid, + String? spaceUuid, String? sceneName, String? decisionExpr, List? actions, + bool? showInHomePage, }) { return CreateSceneModel( - unitUuid: unitUuid ?? this.unitUuid, + spaceUuid: spaceUuid ?? this.spaceUuid, sceneName: sceneName ?? this.sceneName, decisionExpr: decisionExpr ?? this.decisionExpr, actions: actions ?? this.actions, + showInHomePage: showInHomePage ?? this.showInHomePage, ); } Map toMap([String? sceneId]) { return { - if (sceneId == null) 'unitUuid': unitUuid, + if (sceneId == null) 'spaceUuid': spaceUuid, 'sceneName': sceneName, 'decisionExpr': decisionExpr, 'actions': actions.map((x) => x.toMap()).toList(), + 'showInHomePage': showInHomePage, }; } factory CreateSceneModel.fromMap(Map map) { return CreateSceneModel( - unitUuid: map['unitUuid'] ?? '', + spaceUuid: map['spaceUuid'] ?? '', sceneName: map['sceneName'] ?? '', decisionExpr: map['decisionExpr'] ?? '', actions: List.from( map['actions']?.map((x) => CreateSceneAction.fromMap(x))), + showInHomePage: map['showInHomePage'] ?? false, ); } @@ -55,7 +62,7 @@ class CreateSceneModel { @override String toString() { - return 'CreateSceneModel(unitUuid: $unitUuid, sceneName: $sceneName, decisionExpr: $decisionExpr, actions: $actions)'; + return 'CreateSceneModel(unitUuid: $spaceUuid, sceneName: $sceneName, decisionExpr: $decisionExpr, actions: $actions)'; } @override @@ -63,18 +70,20 @@ class CreateSceneModel { if (identical(this, other)) return true; return other is CreateSceneModel && - other.unitUuid == unitUuid && + other.spaceUuid == spaceUuid && other.sceneName == sceneName && other.decisionExpr == decisionExpr && - listEquals(other.actions, actions); + listEquals(other.actions, actions) && + other.showInHomePage == showInHomePage; } @override int get hashCode { - return unitUuid.hashCode ^ + return spaceUuid.hashCode ^ sceneName.hashCode ^ decisionExpr.hashCode ^ - actions.hashCode; + actions.hashCode ^ + showInHomePage.hashCode; } } diff --git a/lib/features/scene/model/scenes_model.dart b/lib/features/scene/model/scenes_model.dart index 4c0066c..52b6a8a 100644 --- a/lib/features/scene/model/scenes_model.dart +++ b/lib/features/scene/model/scenes_model.dart @@ -19,7 +19,7 @@ class ScenesModel { String toRawJson() => json.encode(toJson()); factory ScenesModel.fromJson(Map json) => ScenesModel( - id: json["id"], + id: json["uuid"], name: json["name"] ?? '', status: json["status"] ?? '', type: json["type"] ?? '', diff --git a/lib/features/scene/view/scene_rooms_tabbar.dart b/lib/features/scene/view/scene_rooms_tabbar.dart index 9d0a491..d9dcb80 100644 --- a/lib/features/scene/view/scene_rooms_tabbar.dart +++ b/lib/features/scene/view/scene_rooms_tabbar.dart @@ -3,7 +3,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/model/space_model.dart'; import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart'; -import 'package:syncrow_app/features/devices/model/room_model.dart'; +import 'package:syncrow_app/features/devices/model/subspace_model.dart'; import 'package:syncrow_app/features/scene/bloc/tab_change/tab_change_bloc.dart'; import 'package:syncrow_app/features/scene/bloc/tab_change/tab_change_event.dart'; import 'package:syncrow_app/features/scene/widgets/scene_devices/scene_devices_body.dart'; @@ -27,7 +27,7 @@ class _SceneRoomsTabBarDevicesViewState extends State with SingleTickerProviderStateMixin { late final TabController _tabController; - List? rooms = []; + List? rooms = []; late final SpaceModel selectedSpace; @override @@ -38,11 +38,10 @@ class _SceneRoomsTabBarDevicesViewState if (rooms![0].id != '-1') { rooms?.insert( 0, - RoomModel( + SubSpaceModel( name: 'All Devices', devices: DevicesCubit.getInstance().allDevices, id: '-1', - type: SpaceType.Room, ), ); } diff --git a/lib/features/scene/widgets/scene_devices/scene_devices_body.dart b/lib/features/scene/widgets/scene_devices/scene_devices_body.dart index b5296b7..a57919b 100644 --- a/lib/features/scene/widgets/scene_devices/scene_devices_body.dart +++ b/lib/features/scene/widgets/scene_devices/scene_devices_body.dart @@ -4,6 +4,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart'; import 'package:syncrow_app/features/devices/bloc/device_manager_bloc/device_manager_state.dart'; import 'package:syncrow_app/features/devices/model/room_model.dart'; +import 'package:syncrow_app/features/devices/model/subspace_model.dart'; import 'package:syncrow_app/features/scene/bloc/tab_change/tab_change_bloc.dart'; import 'package:syncrow_app/features/scene/bloc/tab_change/tab_change_state.dart'; import 'package:syncrow_app/features/scene/enum/create_scene_enum.dart'; @@ -24,7 +25,7 @@ class SceneDevicesBody extends StatelessWidget { }) : _tabController = tabController; final TabController _tabController; - final List? rooms; + final List? rooms; @override Widget build(BuildContext context) { @@ -76,7 +77,7 @@ class SceneDevicesBody extends StatelessWidget { } Widget _buildRoomTab( - RoomModel room, BuildContext context, bool isAutomationDeviceStatus) { + SubSpaceModel room, BuildContext context, bool isAutomationDeviceStatus) { return BlocBuilder( builder: (context, state) { if (state.loading && state.devices == null) { diff --git a/lib/services/api/devices_api.dart b/lib/services/api/devices_api.dart index 60fc203..0af2276 100644 --- a/lib/services/api/devices_api.dart +++ b/lib/services/api/devices_api.dart @@ -64,6 +64,7 @@ class DevicesAPI { showServerMessage: false, expectedResponseModel: (json) => DevicesCategoryModel.fromJsonList(json), ); + return response; } From 79f224f4819a6b1a63cc3e698080b66b6ecfdec6 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 31 Oct 2024 10:34:39 +0400 Subject: [PATCH 08/26] revert back env --- .env.dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.dev b/.env.dev index 1fd358e..e77609d 100644 --- a/.env.dev +++ b/.env.dev @@ -1,2 +1,2 @@ ENV_NAME=development -BASE_URL=http://localhost:4001 \ No newline at end of file +BASE_URL=https://syncrow-dev.azurewebsites.net \ No newline at end of file From ea202812cd200d5d38858e5eacee65688108b2a2 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 31 Oct 2024 10:35:26 +0400 Subject: [PATCH 09/26] revert back --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 34e3f36..c3e0679 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,3 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release -.env.dev From b7b48006af4fb96f5ec22b15af7de02f3a5b0688 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 31 Oct 2024 10:38:15 +0400 Subject: [PATCH 10/26] revert config --- ios/Podfile.lock | 60 +++---- ios/Runner/Info.plist | 2 - pubspec.lock | 376 +++++++++++++++++++----------------------- 3 files changed, 202 insertions(+), 236 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 064c37d..de7dea4 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -14,14 +14,14 @@ PODS: - Firebase/Database (10.25.0): - Firebase/CoreOnly - FirebaseDatabase (~> 10.25.0) - - firebase_analytics (10.10.7): + - firebase_analytics (10.8.7): - Firebase/Analytics (= 10.25.0) - firebase_core - Flutter - firebase_core (2.32.0): - Firebase/CoreOnly (= 10.25.0) - Flutter - - firebase_crashlytics (3.5.7): + - firebase_crashlytics (3.4.16): - Firebase/Crashlytics (= 10.25.0) - firebase_core - Flutter @@ -150,12 +150,12 @@ PODS: - nanopb/encode (= 2.30910.0) - nanopb/decode (2.30910.0) - nanopb/encode (2.30910.0) - - onesignal_flutter (5.2.6): + - onesignal_flutter (5.2.0): - Flutter - - OneSignalXCFramework (= 5.2.5) - - OneSignalXCFramework (5.2.5): - - OneSignalXCFramework/OneSignalComplete (= 5.2.5) - - OneSignalXCFramework/OneSignal (5.2.5): + - OneSignalXCFramework (= 5.2.0) + - OneSignalXCFramework (5.2.0): + - OneSignalXCFramework/OneSignalComplete (= 5.2.0) + - OneSignalXCFramework/OneSignal (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalLiveActivities @@ -163,38 +163,38 @@ PODS: - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalComplete (5.2.5): + - OneSignalXCFramework/OneSignalComplete (5.2.0): - OneSignalXCFramework/OneSignal - OneSignalXCFramework/OneSignalInAppMessages - OneSignalXCFramework/OneSignalLocation - - OneSignalXCFramework/OneSignalCore (5.2.5) - - OneSignalXCFramework/OneSignalExtension (5.2.5): + - OneSignalXCFramework/OneSignalCore (5.2.0) + - OneSignalXCFramework/OneSignalExtension (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalInAppMessages (5.2.5): + - OneSignalXCFramework/OneSignalInAppMessages (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLiveActivities (5.2.5): + - OneSignalXCFramework/OneSignalLiveActivities (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLocation (5.2.5): + - OneSignalXCFramework/OneSignalLocation (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalNotifications (5.2.5): + - OneSignalXCFramework/OneSignalNotifications (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalOSCore (5.2.5): + - OneSignalXCFramework/OneSignalOSCore (5.2.0): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalOutcomes (5.2.5): + - OneSignalXCFramework/OneSignalOutcomes (5.2.0): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalUser (5.2.5): + - OneSignalXCFramework/OneSignalUser (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore @@ -212,7 +212,7 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - sqflite_darwin (0.0.4): + - sqflite (0.0.3): - Flutter - FlutterMacOS - url_launcher_ios (0.0.1): @@ -232,7 +232,7 @@ DEPENDENCIES: - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) + - sqflite (from `.symlinks/plugins/sqflite/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) SPEC REPOS: @@ -285,17 +285,17 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/share_plus/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" - sqflite_darwin: - :path: ".symlinks/plugins/sqflite_darwin/darwin" + sqflite: + :path: ".symlinks/plugins/sqflite/darwin" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d Firebase: 0312a2352584f782ea56f66d91606891d4607f06 - firebase_analytics: cc06e24d6a2343c44f845b3112143db72d10ef78 + firebase_analytics: 3a9263fedec72970e6bd30a7132bbdd386de2c14 firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197 - firebase_crashlytics: 17e856fabec68d993662abaf2f6fe2413f0abece + firebase_crashlytics: 0b7cb41f5fb3b6889d0fb408cfce3cc7a4247061 firebase_database: 2713033e426b176d4fe5e7195f3d19aa1b549a91 FirebaseAnalytics: ec00fe8b93b41dc6fe4a28784b8e51da0647a248 FirebaseAppCheckInterop: 6a1757cfd4067d8e00fccd14fcc1b8fd78cfac07 @@ -309,23 +309,23 @@ SPEC CHECKSUMS: FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12 + flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be GoogleAppMeasurement: 9abf64b682732fed36da827aa2a68f0221fd2356 GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 leveldb-library: e8eadf9008a61f9e1dde3978c086d2b6d9b9dc28 nanopb: 438bc412db1928dac798aa6fd75726007be04262 - onesignal_flutter: f441aaefa112988a1e786c695a30695ad0291763 - OneSignalXCFramework: 76ca508fc2b941317729d13fdec96817f8ef5b3b - path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + onesignal_flutter: 5ce68a29861960168e81101cb1bd685d264361de + OneSignalXCFramework: bdf74fdc06888f9466dc21e826fe1549ed143095 + path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad - shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 - sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13 - url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe + shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec + url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 PODFILE CHECKSUM: 4243bd7f9184f79552dd731a7c9d5cad03bd2706 diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 8c1d5ff..0169fa9 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -2,8 +2,6 @@ - NSLocalNetworkUsageDescription - App requires access to local network to communicate with devices. CADisableMinimumFrameDurationOnPhone CFBundleDevelopmentRegion diff --git a/pubspec.lock b/pubspec.lock index 171bea8..4b11f46 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,10 +13,10 @@ packages: dependency: transitive description: name: args - sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.4.2" async: dependency: transitive description: @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: bloc - sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e" + sha256: f53a110e3b48dcd78136c10daa5d51512443cea5e1348c9d80a320095fa2db9e url: "https://pub.dev" source: hosted - version: "8.1.4" + version: "8.1.3" boolean_selector: dependency: transitive description: @@ -45,26 +45,26 @@ packages: dependency: "direct main" description: name: cached_network_image - sha256: "4a5d8d2c728b0f3d0245f69f921d7be90cae4c2fd5288f773088672c0893f819" + sha256: "28ea9690a8207179c319965c13cd8df184d5ee721ae2ce60f398ced1219cea1f" url: "https://pub.dev" source: hosted - version: "3.4.0" + version: "3.3.1" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface - sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" + sha256: "9e90e78ae72caa874a323d78fa6301b3fb8fa7ea76a8f96dc5b5bf79f283bf2f" url: "https://pub.dev" source: hosted - version: "4.1.1" + version: "4.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web - sha256: "6322dde7a5ad92202e64df659241104a43db20ed594c41ca18de1014598d7996" + sha256: "42a835caa27c220d1294311ac409a43361088625a4f23c820b006dd9bffb3316" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.1.1" characters: dependency: transitive description: @@ -93,18 +93,18 @@ packages: dependency: transitive description: name: cross_file - sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" + sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32" url: "https://pub.dev" source: hosted - version: "0.3.4+2" + version: "0.3.4+1" crypto: dependency: transitive description: name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.0.3" csslib: dependency: transitive description: @@ -117,10 +117,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d url: "https://pub.dev" source: hosted - version: "1.0.8" + version: "1.0.6" day_picker: dependency: "direct main" description: @@ -133,34 +133,26 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: a7fd703482b391a87d60b6061d04dfdeab07826b96f9abd8f5ed98068acc0074 + sha256: eead12d1a1ed83d8283ab4c2f3fca23ac4082f29f25f29dff0f758f57d06ec91 url: "https://pub.dev" source: hosted - version: "10.1.2" + version: "10.1.0" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface - sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba" + sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "7.0.0" dio: dependency: "direct main" description: name: dio - sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260" + sha256: "49af28382aefc53562459104f64d16b9dfd1e8ef68c862d5af436cc8356ce5a8" url: "https://pub.dev" source: hosted - version: "5.7.0" - dio_web_adapter: - dependency: transitive - description: - name: dio_web_adapter - sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8" - url: "https://pub.dev" - source: hosted - version: "2.0.0" + version: "5.4.1" equatable: dependency: "direct main" description: @@ -181,34 +173,34 @@ packages: dependency: transitive description: name: ffi - sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.0" file: dependency: transitive description: name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "7.0.0" file_selector_linux: dependency: transitive description: name: file_selector_linux - sha256: "712ce7fab537ba532c8febdb1a8f167b32441e74acd68c3ccb2e36dcb52c4ab2" + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" url: "https://pub.dev" source: hosted - version: "0.9.3" + version: "0.9.2+1" file_selector_macos: dependency: transitive description: name: file_selector_macos - sha256: "271ab9986df0c135d45c3cdb6bd0faa5db6f4976d3e4b437cf7d0f258d941bfc" + sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 url: "https://pub.dev" source: hosted - version: "0.9.4+2" + version: "0.9.4" file_selector_platform_interface: dependency: transitive description: @@ -221,34 +213,34 @@ packages: dependency: transitive description: name: file_selector_windows - sha256: "8f5d2f6590d51ecd9179ba39c64f722edc15226cc93dcc8698466ad36a4a85a4" + sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 url: "https://pub.dev" source: hosted - version: "0.9.3+3" + version: "0.9.3+1" firebase_analytics: dependency: "direct main" description: name: firebase_analytics - sha256: dbf1e7ab22cfb1f4a4adb103b46a26276b4edc593d4a78ef6fb942bafc92e035 + sha256: c6220b23397f9302a42617227ee8fb1c5d718097a5351fcce53561d73fc10339 url: "https://pub.dev" source: hosted - version: "10.10.7" + version: "10.8.7" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface - sha256: "3729b74f8cf1d974a27ba70332ecb55ff5ff560edc8164a6469f4a055b429c37" + sha256: "7f1c02cdd93a5e0a561af2f551465ffb6abdd541dbd0c8a9b8628d9ae0a5d024" url: "https://pub.dev" source: hosted - version: "3.10.8" + version: "3.9.7" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web - sha256: "019cd7eee74254d33fbd2e29229367ce33063516bf6b3258a341d89e3b0f1655" + sha256: ebb857c23f35fed52220b6c3271c12eeb6137de3930845223e3d0590b6fd0649 url: "https://pub.dev" source: hosted - version: "0.5.7+7" + version: "0.5.5+19" firebase_core: dependency: "direct main" description: @@ -261,34 +253,34 @@ packages: dependency: transitive description: name: firebase_core_platform_interface - sha256: e30da58198a6d4b49d5bce4e852f985c32cb10db329ebef9473db2b9f09ce810 + sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 url: "https://pub.dev" source: hosted - version: "5.3.0" + version: "5.0.0" firebase_core_web: dependency: transitive description: name: firebase_core_web - sha256: "362e52457ed2b7b180964769c1e04d1e0ea0259fdf7025fdfedd019d4ae2bd88" + sha256: "22fcb352744908224fc7be3caae254836099786acfe5df6e9fe901e9c2575a41" url: "https://pub.dev" source: hosted - version: "2.17.5" + version: "2.17.1" firebase_crashlytics: dependency: "direct main" description: name: firebase_crashlytics - sha256: "9897c01efaa950d2f6da8317d12452749a74dc45f33b46390a14cfe28067f271" + sha256: "0126fa101b74fb981796b3e6f47ccf7fc40237ec918327aaec7c0a06fd1bb4c1" url: "https://pub.dev" source: hosted - version: "3.5.7" + version: "3.4.16" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface - sha256: "16a71e08fbf6e00382816e1b13397898c29a54fa0ad969c2c2a3b82a704877f0" + sha256: cdfa0a20d66e1b32de542883c0ddf651ee9b66b12cebf73067e4d2cdc0865d17 url: "https://pub.dev" source: hosted - version: "3.6.35" + version: "3.6.23" firebase_database: dependency: "direct main" description: @@ -317,18 +309,18 @@ packages: dependency: transitive description: name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.0" fl_chart: dependency: "direct main" description: name: fl_chart - sha256: "00b74ae680df6b1135bdbea00a7d1fc072a9180b7c3f3702e4b19a9943f5ed7d" + sha256: "94307bef3a324a0d329d3ab77b2f0c6e5ed739185ffc029ed28c0f9b019ea7ef" url: "https://pub.dev" source: hosted - version: "0.66.2" + version: "0.69.0" flutter: dependency: "direct main" description: flutter @@ -346,90 +338,90 @@ packages: dependency: "direct main" description: name: flutter_bloc - sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a + sha256: "87325da1ac757fcc4813e6b34ed5dd61169973871fdf181d6c2109dd6935ece1" url: "https://pub.dev" source: hosted - version: "8.1.6" + version: "8.1.4" flutter_cache_manager: dependency: transitive description: name: flutter_cache_manager - sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" + sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba" url: "https://pub.dev" source: hosted - version: "3.4.1" + version: "3.3.1" flutter_dotenv: dependency: "direct main" description: name: flutter_dotenv - sha256: b7c7be5cd9f6ef7a78429cabd2774d3c4af50e79cb2b7593e3d5d763ef95c61b + sha256: "9357883bdd153ab78cbf9ffa07656e336b8bbb2b5a3ca596b0b27e119f7c7d77" url: "https://pub.dev" source: hosted - version: "5.2.1" + version: "5.1.0" flutter_lints: dependency: "direct dev" description: name: flutter_lints - sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.1" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "9b78450b89f059e96c9ebb355fa6b3df1d6b330436e0b885fb49594c41721398" + sha256: c6b0b4c05c458e1c01ad9bcc14041dd7b1f6783d487be4386f793f47a8a4d03e url: "https://pub.dev" source: hosted - version: "2.0.23" + version: "2.0.20" flutter_secure_storage: dependency: "direct main" description: name: flutter_secure_storage - sha256: "165164745e6afb5c0e3e3fcc72a012fb9e58496fb26ffb92cf22e16a821e85d0" + sha256: ffdbb60130e4665d2af814a0267c481bcf522c41ae2e43caf69fa0146876d685 url: "https://pub.dev" source: hosted - version: "9.2.2" + version: "9.0.0" flutter_secure_storage_linux: dependency: transitive description: name: flutter_secure_storage_linux - sha256: "4d91bfc23047422cbcd73ac684bc169859ee766482517c22172c86596bf1464b" + sha256: "3d5032e314774ee0e1a7d0a9f5e2793486f0dff2dd9ef5a23f4e3fb2a0ae6a9e" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.2.0" flutter_secure_storage_macos: dependency: transitive description: name: flutter_secure_storage_macos - sha256: "1693ab11121a5f925bbea0be725abfcfbbcf36c1e29e571f84a0c0f436147a81" + sha256: bd33935b4b628abd0b86c8ca20655c5b36275c3a3f5194769a7b3f37c905369c url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.0.1" flutter_secure_storage_platform_interface: dependency: transitive description: name: flutter_secure_storage_platform_interface - sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 + sha256: "0d4d3a5dd4db28c96ae414d7ba3b8422fd735a8255642774803b2532c9a61d7e" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.0.2" flutter_secure_storage_web: dependency: transitive description: name: flutter_secure_storage_web - sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 + sha256: "30f84f102df9dcdaa2241866a958c2ec976902ebdaa8883fbfe525f1f2f3cf20" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.1.2" flutter_secure_storage_windows: dependency: transitive description: name: flutter_secure_storage_windows - sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 + sha256: "5809c66f9dd3b4b93b0a6e2e8561539405322ee767ac2f64d084e2ab5429d108" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.0.0" flutter_svg: dependency: "direct main" description: @@ -452,10 +444,10 @@ packages: dependency: "direct main" description: name: get_it - sha256: d85128a5dae4ea777324730dc65edd9c9f43155c109d5cc0a69cab74139fbac1 + sha256: e6017ce7fdeaf218dc51a100344d8cb70134b80e28b760f8bb23c242437bafd7 url: "https://pub.dev" source: hosted - version: "7.7.0" + version: "7.6.7" html: dependency: "direct main" description: @@ -468,10 +460,10 @@ packages: dependency: transitive description: name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.2.1" http_parser: dependency: transitive description: @@ -492,26 +484,26 @@ packages: dependency: transitive description: name: image_picker_android - sha256: d34e0d9e024e81321b2aeed7b202ec6181cc282e6a1c0c0b4e6ad07ef1065d82 + sha256: "4161e1f843d8480d2e9025ee22411778c3c9eb7e40076dcf2da23d8242b7b51c" url: "https://pub.dev" source: hosted - version: "0.8.12+16" + version: "0.8.12+3" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: "717eb042ab08c40767684327be06a5d8dbb341fe791d514e4b92c7bbe1b7bb83" + sha256: "5d6eb13048cd47b60dbf1a5495424dea226c5faf3950e20bf8120a58efb5b5f3" url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.0.4" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: "4f0568120c6fcc0aaa04511cb9f9f4d29fc3d0139884b1d06be88dcec7641d6b" + sha256: "6703696ad49f5c3c8356d576d7ace84d1faf459afb07accbb0fae780753ff447" url: "https://pub.dev" source: hosted - version: "0.8.12+1" + version: "0.8.12" image_picker_linux: dependency: transitive description: @@ -564,18 +556,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: @@ -604,26 +596,26 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.12.0" mime: dependency: transitive description: name: mime - sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.5" nested: dependency: transitive description: @@ -636,18 +628,18 @@ packages: dependency: transitive description: name: octo_image - sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" + sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.0.0" onesignal_flutter: dependency: "direct main" description: name: onesignal_flutter - sha256: "28e8295c1e79b029d010c6af6459683b1e1485246d95d42f13bba15ca35a94ae" + sha256: f3940387d6c7033a9c341aa0548f24d98217fce9182f9ad80bf2554b9dd3dc1a url: "https://pub.dev" source: hosted - version: "5.2.6" + version: "5.2.0" path: dependency: transitive description: @@ -668,26 +660,26 @@ packages: dependency: transitive description: name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.2" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" url: "https://pub.dev" source: hosted - version: "2.2.12" + version: "2.2.2" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.3.2" path_provider_linux: dependency: transitive description: @@ -708,10 +700,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.2.1" permission_handler: dependency: "direct main" description: @@ -724,34 +716,34 @@ packages: dependency: transitive description: name: permission_handler_android - sha256: "71bbecfee799e65aff7c744761a57e817e73b738fedf62ab7afd5593da21f9f1" + sha256: "8bb852cd759488893805c3161d0b2b5db55db52f773dbb014420b304055ba2c5" url: "https://pub.dev" source: hosted - version: "12.0.13" + version: "12.0.6" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: e6f6d73b12438ef13e648c4ae56bd106ec60d17e90a59c4545db6781229082a0 + sha256: e9ad66020b89ff1b63908f247c2c6f931c6e62699b756ef8b3c4569350cd8662 url: "https://pub.dev" source: hosted - version: "9.4.5" + version: "9.4.4" permission_handler_html: dependency: transitive description: name: permission_handler_html - sha256: af26edbbb1f2674af65a8f4b56e1a6f526156bc273d0e65dd8075fab51c78851 + sha256: "54bf176b90f6eddd4ece307e2c06cf977fb3973719c35a93b85cc7093eb6070d" url: "https://pub.dev" source: hosted - version: "0.1.3+2" + version: "0.1.1" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - sha256: e9c8eadee926c4532d0305dff94b85bf961f16759c3af791486613152af4b4f9 + sha256: "48d4fcf201a1dad93ee869ab0d4101d084f49136ec82a8a06ed9cfeacab9fd20" url: "https://pub.dev" source: hosted - version: "4.2.3" + version: "4.2.1" permission_handler_windows: dependency: transitive description: @@ -780,10 +772,10 @@ packages: dependency: transitive description: name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.6" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: @@ -796,18 +788,18 @@ packages: dependency: transitive description: name: provider - sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" url: "https://pub.dev" source: hosted - version: "6.1.2" + version: "6.1.1" rxdart: dependency: transitive description: name: rxdart - sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" url: "https://pub.dev" source: hosted - version: "0.28.0" + version: "0.27.7" share_plus: dependency: "direct main" description: @@ -828,58 +820,58 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" + sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.2.2" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "3b9febd815c9ca29c9e3520d50ec32f49157711e143b7a4ca039eb87e8ade5ab" + sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.2.1" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "07e050c7cd39bad516f8d64c455f04508d09df104be326d8c02551590a0d513d" + sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.3.5" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.3.2" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.3.2" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e + sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.3.0" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.3.2" sky_engine: dependency: transitive description: flutter @@ -897,10 +889,10 @@ packages: dependency: "direct main" description: name: smooth_page_indicator - sha256: "3b28b0c545fa67ed9e5997d9f9720d486f54c0c607e056a1094544e36934dff3" + sha256: "725bc638d5e79df0c84658e1291449996943f93bacbc2cec49963dbbab48d8ae" url: "https://pub.dev" source: hosted - version: "1.2.0+3" + version: "1.1.0" source_span: dependency: transitive description: @@ -921,42 +913,18 @@ packages: dependency: transitive description: name: sqflite - sha256: "79a297dc3cc137e758c6a4baf83342b039e5a6d2436fcdf3f96a00adaaf2ad62" + sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6 url: "https://pub.dev" source: hosted - version: "2.4.0" - sqflite_android: - dependency: transitive - description: - name: sqflite_android - sha256: "78f489aab276260cdd26676d2169446c7ecd3484bbd5fead4ca14f3ed4dd9ee3" - url: "https://pub.dev" - source: hosted - version: "2.4.0" + version: "2.3.2" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "4468b24876d673418a7b7147e5a08a715b4998a7ae69227acafaab762e0e5490" + sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" url: "https://pub.dev" source: hosted - version: "2.5.4+5" - sqflite_darwin: - dependency: transitive - description: - name: sqflite_darwin - sha256: "769733dddf94622d5541c73e4ddc6aa7b252d865285914b6fcd54a63c4b4f027" - url: "https://pub.dev" - source: hosted - version: "2.4.1-1" - sqflite_platform_interface: - dependency: transitive - description: - name: sqflite_platform_interface - sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" - url: "https://pub.dev" - source: hosted - version: "2.4.0" + version: "2.5.3" stack_trace: dependency: transitive description: @@ -985,10 +953,10 @@ packages: dependency: transitive description: name: synchronized - sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225" + sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" url: "https://pub.dev" source: hosted - version: "3.3.0+3" + version: "3.1.0+1" term_glyph: dependency: transitive description: @@ -1001,10 +969,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.0" time_picker_spinner: dependency: "direct main" description: @@ -1017,82 +985,82 @@ packages: dependency: transitive description: name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.3.2" url_launcher: dependency: "direct main" description: name: url_launcher - sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" + sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e" url: "https://pub.dev" source: hosted - version: "6.3.1" + version: "6.2.5" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "8fc3bae0b68c02c47c5c86fa8bfa74471d42687b0eded01b78de87872db745e2" + sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 url: "https://pub.dev" source: hosted - version: "6.3.12" + version: "6.3.0" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" url: "https://pub.dev" source: hosted - version: "6.3.1" + version: "6.2.4" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.1.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: "769549c999acdb42b8bcfa7c43d72bf79a382ca7441ab18a808e101149daf672" + sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "3.1.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.1" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" + sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.3.1" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "44cf3aabcedde30f2dba119a9dea3b0f2672fbe6fa96e85536251d678216b3c4" + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "3.1.1" uuid: dependency: "direct main" description: name: uuid - sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" url: "https://pub.dev" source: hosted - version: "4.5.1" + version: "4.4.0" vector_graphics: dependency: transitive description: @@ -1129,10 +1097,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "14.2.1" web: dependency: transitive description: @@ -1145,26 +1113,26 @@ packages: dependency: transitive description: name: win32 - sha256: e1d0cc62e65dc2561f5071fcbccecf58ff20c344f8f3dc7d4922df372a11df1f + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" url: "https://pub.dev" source: hosted - version: "5.7.1" + version: "5.2.0" win32_registry: dependency: transitive description: name: win32_registry - sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852" + sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a" url: "https://pub.dev" source: hosted - version: "1.1.5" + version: "1.1.2" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.0.4" xml: dependency: transitive description: @@ -1174,5 +1142,5 @@ packages: source: hosted version: "6.5.0" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.24.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" From 995fd8d0a64ad08a8e3cc291a4f132cf62002392 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 31 Oct 2024 10:40:05 +0400 Subject: [PATCH 11/26] revert --- pubspec.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 4b11f46..ba929a2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -317,10 +317,10 @@ packages: dependency: "direct main" description: name: fl_chart - sha256: "94307bef3a324a0d329d3ab77b2f0c6e5ed739185ffc029ed28c0f9b019ea7ef" + sha256: "00b74ae680df6b1135bdbea00a7d1fc072a9180b7c3f3702e4b19a9943f5ed7d" url: "https://pub.dev" source: hosted - version: "0.69.0" + version: "0.66.2" flutter: dependency: "direct main" description: flutter From 7571e35a701b5a5d0d1b03aeecff47d48bb83bea Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 31 Oct 2024 10:40:29 +0400 Subject: [PATCH 12/26] revert --- pubspec.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.lock b/pubspec.lock index ba929a2..935996a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -317,7 +317,7 @@ packages: dependency: "direct main" description: name: fl_chart - sha256: "00b74ae680df6b1135bdbea00a7d1fc072a9180b7c3f3702e4b19a9943f5ed7d" + sha256: "00b74ae680df6b1135bdbea00a7d1fc072a9180b7c3f3702e4b19a9943f5ed7d" url: "https://pub.dev" source: hosted version: "0.66.2" From dcccc4db3a5fd757d6efc15fae08402b50f75b10 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 31 Oct 2024 11:30:35 +0400 Subject: [PATCH 13/26] create subspace --- ios/Podfile.lock | 60 ++++++++-------- .../create_unit_bloc/create_unit_bloc.dart | 69 ++++++++++++++----- .../manage_unit_bloc/manage_unit_bloc.dart | 7 +- .../view/widgets/manage_home/room_screen.dart | 2 +- lib/services/api/api_links_endpoints.dart | 11 ++- lib/services/api/devices_api.dart | 3 +- lib/services/api/home_creation_api.dart | 39 +++++++---- lib/services/api/home_management_api.dart | 6 -- 8 files changed, 123 insertions(+), 74 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index de7dea4..064c37d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -14,14 +14,14 @@ PODS: - Firebase/Database (10.25.0): - Firebase/CoreOnly - FirebaseDatabase (~> 10.25.0) - - firebase_analytics (10.8.7): + - firebase_analytics (10.10.7): - Firebase/Analytics (= 10.25.0) - firebase_core - Flutter - firebase_core (2.32.0): - Firebase/CoreOnly (= 10.25.0) - Flutter - - firebase_crashlytics (3.4.16): + - firebase_crashlytics (3.5.7): - Firebase/Crashlytics (= 10.25.0) - firebase_core - Flutter @@ -150,12 +150,12 @@ PODS: - nanopb/encode (= 2.30910.0) - nanopb/decode (2.30910.0) - nanopb/encode (2.30910.0) - - onesignal_flutter (5.2.0): + - onesignal_flutter (5.2.6): - Flutter - - OneSignalXCFramework (= 5.2.0) - - OneSignalXCFramework (5.2.0): - - OneSignalXCFramework/OneSignalComplete (= 5.2.0) - - OneSignalXCFramework/OneSignal (5.2.0): + - OneSignalXCFramework (= 5.2.5) + - OneSignalXCFramework (5.2.5): + - OneSignalXCFramework/OneSignalComplete (= 5.2.5) + - OneSignalXCFramework/OneSignal (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalLiveActivities @@ -163,38 +163,38 @@ PODS: - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalComplete (5.2.0): + - OneSignalXCFramework/OneSignalComplete (5.2.5): - OneSignalXCFramework/OneSignal - OneSignalXCFramework/OneSignalInAppMessages - OneSignalXCFramework/OneSignalLocation - - OneSignalXCFramework/OneSignalCore (5.2.0) - - OneSignalXCFramework/OneSignalExtension (5.2.0): + - OneSignalXCFramework/OneSignalCore (5.2.5) + - OneSignalXCFramework/OneSignalExtension (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalInAppMessages (5.2.0): + - OneSignalXCFramework/OneSignalInAppMessages (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLiveActivities (5.2.0): + - OneSignalXCFramework/OneSignalLiveActivities (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLocation (5.2.0): + - OneSignalXCFramework/OneSignalLocation (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalNotifications (5.2.0): + - OneSignalXCFramework/OneSignalNotifications (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalOSCore (5.2.0): + - OneSignalXCFramework/OneSignalOSCore (5.2.5): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalOutcomes (5.2.0): + - OneSignalXCFramework/OneSignalOutcomes (5.2.5): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalUser (5.2.0): + - OneSignalXCFramework/OneSignalUser (5.2.5): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore @@ -212,7 +212,7 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - sqflite (0.0.3): + - sqflite_darwin (0.0.4): - Flutter - FlutterMacOS - url_launcher_ios (0.0.1): @@ -232,7 +232,7 @@ DEPENDENCIES: - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite (from `.symlinks/plugins/sqflite/darwin`) + - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) SPEC REPOS: @@ -285,17 +285,17 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/share_plus/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" - sqflite: - :path: ".symlinks/plugins/sqflite/darwin" + sqflite_darwin: + :path: ".symlinks/plugins/sqflite_darwin/darwin" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d Firebase: 0312a2352584f782ea56f66d91606891d4607f06 - firebase_analytics: 3a9263fedec72970e6bd30a7132bbdd386de2c14 + firebase_analytics: cc06e24d6a2343c44f845b3112143db72d10ef78 firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197 - firebase_crashlytics: 0b7cb41f5fb3b6889d0fb408cfce3cc7a4247061 + firebase_crashlytics: 17e856fabec68d993662abaf2f6fe2413f0abece firebase_database: 2713033e426b176d4fe5e7195f3d19aa1b549a91 FirebaseAnalytics: ec00fe8b93b41dc6fe4a28784b8e51da0647a248 FirebaseAppCheckInterop: 6a1757cfd4067d8e00fccd14fcc1b8fd78cfac07 @@ -309,23 +309,23 @@ SPEC CHECKSUMS: FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be + flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12 GoogleAppMeasurement: 9abf64b682732fed36da827aa2a68f0221fd2356 GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 leveldb-library: e8eadf9008a61f9e1dde3978c086d2b6d9b9dc28 nanopb: 438bc412db1928dac798aa6fd75726007be04262 - onesignal_flutter: 5ce68a29861960168e81101cb1bd685d264361de - OneSignalXCFramework: bdf74fdc06888f9466dc21e826fe1549ed143095 - path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + onesignal_flutter: f441aaefa112988a1e786c695a30695ad0291763 + OneSignalXCFramework: 76ca508fc2b941317729d13fdec96817f8ef5b3b + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad - shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 - sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec - url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 + sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13 + url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe PODFILE CHECKSUM: 4243bd7f9184f79552dd731a7c9d5cad03bd2706 diff --git a/lib/features/menu/bloc/create_unit_bloc/create_unit_bloc.dart b/lib/features/menu/bloc/create_unit_bloc/create_unit_bloc.dart index e31fd2b..23a1e59 100644 --- a/lib/features/menu/bloc/create_unit_bloc/create_unit_bloc.dart +++ b/lib/features/menu/bloc/create_unit_bloc/create_unit_bloc.dart @@ -61,7 +61,9 @@ class CreateUnitBloc extends Bloc { var storage = const FlutterSecureStorage(); var userId = await storage.read(key: UserModel.userUuidKey) ?? ''; - Map communityBody = {'communityName': event.communityName}; + Map communityBody = { + 'communityName': event.communityName + }; final response = await HomeCreation.createCommunity(communityBody); if (response['data']['uuid'] != '') { // final result = @@ -75,15 +77,22 @@ class CreateUnitBloc extends Bloc { if (buildingId.isNotEmpty) { final floorId = await _createFloor( - floorName: event.floorName, buildingId: buildingId, userId: userId); + floorName: event.floorName, + buildingId: buildingId, + userId: userId); if (floorId.isNotEmpty) { - final unitId = - await _createUnit(unitName: event.unitName, floorId: floorId, userId: userId); + final unitId = await _createUnit( + unitName: event.unitName, floorId: floorId, userId: userId); if (unitId.isNotEmpty && rooms.isNotEmpty) { rooms.forEach((room) async { - await _createNewRoom(roomName: room, unitId: unitId, userId: userId); + await _createNewRoom( + roomName: room, + unitId: unitId, + userId: userId, + communityId: response['data']['uuid'], + ); }); } } @@ -99,7 +108,8 @@ class CreateUnitBloc extends Bloc { } } -Future _assignToCommunity({required String communityId, required String userId}) async { +Future _assignToCommunity( + {required String communityId, required String userId}) async { try { Map body = { 'communityUuid': communityId, @@ -114,9 +124,14 @@ Future _assignToCommunity({required String communityId, required String us } Future _createBuilding( - {required String buildingName, required String communityId, required String userId}) async { + {required String buildingName, + required String communityId, + required String userId}) async { try { - Map body = {'buildingName': buildingName, 'communityUuid': communityId}; + Map body = { + 'buildingName': buildingName, + 'communityUuid': communityId + }; final response = await HomeCreation.createBuilding(body); // if (response['data']['uuid'] != '') { // final result = await _assignToBuilding(buildingId: response['data']['uuid'], userId: userId); @@ -130,7 +145,8 @@ Future _createBuilding( } } -Future _assignToBuilding({required String buildingId, required String userId}) async { +Future _assignToBuilding( + {required String buildingId, required String userId}) async { try { Map body = { 'buildingUuid': buildingId, @@ -145,9 +161,14 @@ Future _assignToBuilding({required String buildingId, required String user } Future _createFloor( - {required String floorName, required String buildingId, required String userId}) async { + {required String floorName, + required String buildingId, + required String userId}) async { try { - Map body = {'floorName': floorName, 'buildingUuid': buildingId}; + Map body = { + 'floorName': floorName, + 'buildingUuid': buildingId + }; final response = await HomeCreation.createFloor(body); // if (response['data']['uuid'] != '') { // final result = await _assignToFloor(buildingId: response['data']['uuid'], userId: userId); @@ -161,7 +182,8 @@ Future _createFloor( } } -Future _assignToFloor({required String buildingId, required String userId}) async { +Future _assignToFloor( + {required String buildingId, required String userId}) async { try { Map body = { 'floorUuid': buildingId, @@ -176,12 +198,15 @@ Future _assignToFloor({required String buildingId, required String userId} } Future _createUnit( - {required String unitName, required String floorId, required String userId}) async { + {required String unitName, + required String floorId, + required String userId}) async { try { Map body = {'unitName': unitName, 'floorUuid': floorId}; final response = await HomeCreation.createUnit(body); if (response['data']['uuid'] != '') { - final result = await _assignToUnit(unitId: response['data']['uuid'], userId: userId); + final result = + await _assignToUnit(unitId: response['data']['uuid'], userId: userId); return result ? response['data']['uuid'] : ''; } else { @@ -192,7 +217,8 @@ Future _createUnit( } } -Future _assignToUnit({required String unitId, required String userId}) async { +Future _assignToUnit( + {required String unitId, required String userId}) async { try { Map body = { 'unitUuid': unitId, @@ -207,10 +233,14 @@ Future _assignToUnit({required String unitId, required String userId}) asy } Future _createNewRoom( - {required String roomName, required String unitId, required String userId}) async { + {required String roomName, + required String unitId, + required String userId, + required String communityId}) async { try { - Map body = {'roomName': roomName, 'unitUuid': unitId}; - final response = await HomeCreation.createRoom(body); + Map body = {'subspaceName': roomName}; + final response = await HomeCreation.createRoom( + communityId: communityId, spaceId: unitId, body: body); // if (response['data']['uuid'] != '') { // final result = await _assignToRoom(roomId: response['data']['uuid'], userId: userId); @@ -223,7 +253,8 @@ Future _createNewRoom( } } -Future _assignToRoom({required String roomId, required String userId}) async { +Future _assignToRoom( + {required String roomId, required String userId}) async { try { Map body = { 'roomUuid': roomId, diff --git a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart index f225077..359d7bb 100644 --- a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart +++ b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart @@ -107,10 +107,13 @@ class ManageUnitBloc extends Bloc { } _addNewRoom(AddNewRoom event, Emitter emit) async { - Map body = {'roomName': event.roomName}; + Map body = {'subspaceName': event.roomName}; try { emit(LoadingState()); - final response = await HomeCreation.createRoom(body); + final response = await HomeCreation.createRoom( + communityId: event.unit.community.uuid, + spaceId: event.unit.id, + body: body); if (response['data']['uuid'] != '') { final roomsList = await SpacesAPI.getSubSpaceBySpaceId( event.unit.community.uuid, event.unit.id); diff --git a/lib/features/menu/view/widgets/manage_home/room_screen.dart b/lib/features/menu/view/widgets/manage_home/room_screen.dart index 1ab85ab..f8fe951 100644 --- a/lib/features/menu/view/widgets/manage_home/room_screen.dart +++ b/lib/features/menu/view/widgets/manage_home/room_screen.dart @@ -109,7 +109,7 @@ class RoomsView extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ BodyMedium( - text: 'Add Space', + text: 'Add Room', fontColor: ColorsManager.primaryColor, ), ], diff --git a/lib/services/api/api_links_endpoints.dart b/lib/services/api/api_links_endpoints.dart index 26b4279..3338fac 100644 --- a/lib/services/api/api_links_endpoints.dart +++ b/lib/services/api/api_links_endpoints.dart @@ -65,6 +65,11 @@ abstract class ApiEndpoints { //PUT static const String renameUnit = '/unit/{unitUuid}'; + //Subspace Module +//POST + static const String addSubSpace = + '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; + ///Room Module //POST static const String addRoom = '/room'; @@ -113,8 +118,10 @@ abstract class ApiEndpoints { static const String deviceByUuid = '/device/{deviceUuid}'; static const String deviceFunctions = '/device/{deviceUuid}/functions'; static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices'; - static const String deviceFunctionsStatus = '/device/{deviceUuid}/functions/status'; - static const String powerClamp = '/device/{powerClampUuid}/power-clamp/status'; + static const String deviceFunctionsStatus = + '/device/{deviceUuid}/functions/status'; + static const String powerClamp = + '/device/{powerClampUuid}/power-clamp/status'; ///Device Permission Module //POST diff --git a/lib/services/api/devices_api.dart b/lib/services/api/devices_api.dart index c039588..319bdef 100644 --- a/lib/services/api/devices_api.dart +++ b/lib/services/api/devices_api.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:convert'; +import 'dart:developer'; 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_model.dart'; @@ -174,8 +175,6 @@ class DevicesAPI { return response; } catch (e) { // Log the error if needed - print("Error fetching devices for room: $e"); - // Return an empty list in case of error return []; } diff --git a/lib/services/api/home_creation_api.dart b/lib/services/api/home_creation_api.dart index 9c2e3b4..5b2816b 100644 --- a/lib/services/api/home_creation_api.dart +++ b/lib/services/api/home_creation_api.dart @@ -4,7 +4,8 @@ import 'package:syncrow_app/services/api/http_service.dart'; class HomeCreation { static final HTTPService _httpService = HTTPService(); - static Future> createCommunity(Map body) async { + static Future> createCommunity( + Map body) async { try { final response = await _httpService.post( path: ApiEndpoints.addCommunity, @@ -20,7 +21,8 @@ class HomeCreation { } } - static Future> assignUserToCommunity(Map body) async { + static Future> assignUserToCommunity( + Map body) async { try { final response = await _httpService.post( path: ApiEndpoints.addCommunityToUser, @@ -36,7 +38,8 @@ class HomeCreation { } } - static Future> createBuilding(Map body) async { + static Future> createBuilding( + Map body) async { try { final response = await _httpService.post( path: ApiEndpoints.addBuilding, @@ -52,7 +55,8 @@ class HomeCreation { } } - static Future> assignUserToBuilding(Map body) async { + static Future> assignUserToBuilding( + Map body) async { try { final response = await _httpService.post( path: ApiEndpoints.addBuildingToUser, @@ -68,7 +72,8 @@ class HomeCreation { } } - static Future> createFloor(Map body) async { + static Future> createFloor( + Map body) async { try { final response = await _httpService.post( path: ApiEndpoints.addFloor, @@ -84,7 +89,8 @@ class HomeCreation { } } - static Future> assignUserToFloor(Map body) async { + static Future> assignUserToFloor( + Map body) async { try { final response = await _httpService.post( path: ApiEndpoints.addBuildingToUser, @@ -100,7 +106,8 @@ class HomeCreation { } } - static Future> createUnit(Map body) async { + static Future> createUnit( + Map body) async { try { final response = await _httpService.post( path: ApiEndpoints.addUnit, @@ -116,7 +123,8 @@ class HomeCreation { } } - static Future> assignUserToUnit(Map body) async { + static Future> assignUserToUnit( + Map body) async { try { final response = await _httpService.post( path: ApiEndpoints.addUnitToUser, @@ -132,10 +140,17 @@ class HomeCreation { } } - static Future> createRoom(Map body) async { + static Future> createRoom({ + required String communityId, + required String spaceId, + required Map body, + }) async { try { + final fullPath = ApiEndpoints.addSubSpace + .replaceAll('{communityUuid}', communityId) + .replaceAll('{spaceUuid}', spaceId); final response = await _httpService.post( - path: ApiEndpoints.addRoom, + path: fullPath, body: body, showServerMessage: false, expectedResponseModel: (json) { @@ -148,8 +163,8 @@ class HomeCreation { } } - - static Future> assignUserToRoom(Map body) async { + static Future> assignUserToRoom( + Map body) async { try { final response = await _httpService.post( path: ApiEndpoints.addRoomToUser, diff --git a/lib/services/api/home_management_api.dart b/lib/services/api/home_management_api.dart index c9183b7..63b5f22 100644 --- a/lib/services/api/home_management_api.dart +++ b/lib/services/api/home_management_api.dart @@ -39,10 +39,6 @@ class HomeManagementAPI { final path = ApiEndpoints.spaceDevices .replaceAll("{communityUuid}", communityUuid) .replaceAll("{spaceUuid}", spaceUuid); - - // Debugging: Log the path - print("Fetching devices with path: $path"); - await _httpService.get( path: path, showServerMessage: false, @@ -54,10 +50,8 @@ class HomeManagementAPI { ); // Debugging: Log successful fetch - print("Successfully fetched ${list.length} devices."); } catch (e) { // Log the error for debugging - print("Error fetching devices for the unit: $e"); } return list; From 87a4a8841735647c8afdbe88c943d99b55920a0f Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Sat, 2 Nov 2024 23:10:24 +0400 Subject: [PATCH 14/26] fixed automation --- .../device_manager_bloc.dart | 1 + .../bloc/create_scene/create_scene_bloc.dart | 97 +++++++++++++------ .../scene/bloc/scene_bloc/scene_bloc.dart | 23 +++-- .../scene/bloc/scene_bloc/scene_event.dart | 4 +- .../scene/model/create_automation_model.dart | 4 +- .../scene/model/scene_details_model.dart | 58 ++++++----- lib/features/scene/model/scenes_model.dart | 30 +++--- lib/features/scene/view/scene_view.dart | 77 ++++++++++----- .../scene/widgets/delete_routine_b.dart | 2 +- .../smart_enable_tab_run.dart | 2 +- lib/services/api/devices_api.dart | 6 +- lib/services/api/home_management_api.dart | 12 ++- lib/services/api/scene_api.dart | 56 +++++++---- 13 files changed, 240 insertions(+), 132 deletions(-) diff --git a/lib/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart b/lib/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart index 2824ef0..41cab5f 100644 --- a/lib/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart +++ b/lib/features/devices/bloc/device_manager_bloc/device_manager_bloc.dart @@ -32,6 +32,7 @@ class DeviceManagerBloc extends Bloc { final allDevices = await HomeManagementAPI.fetchDevicesByUnitId(); emit(state.copyWith(devices: allDevices, loading: false)); } catch (e) { + print(e); emit(state.copyWith(error: e.toString(), loading: false)); } } diff --git a/lib/features/scene/bloc/create_scene/create_scene_bloc.dart b/lib/features/scene/bloc/create_scene/create_scene_bloc.dart index 024faf4..ac6072e 100644 --- a/lib/features/scene/bloc/create_scene/create_scene_bloc.dart +++ b/lib/features/scene/bloc/create_scene/create_scene_bloc.dart @@ -60,7 +60,8 @@ class CreateSceneBloc extends Bloc String selectedIcon = ''; bool showInDeviceScreen = false; - FutureOr _onAddSceneTask(AddTaskEvent event, Emitter emit) { + FutureOr _onAddSceneTask( + AddTaskEvent event, Emitter emit) { emit(CreateSceneLoading()); if (event.isAutomation == true) { final copyList = List.from(automationTempTasksList); @@ -95,7 +96,8 @@ class CreateSceneBloc extends Bloc } } - void addToTempTaskList(TempHoldSceneTasksEvent event, Emitter emit) { + void addToTempTaskList( + TempHoldSceneTasksEvent event, Emitter emit) { emit(CreateSceneLoading()); bool updated = false; @@ -180,7 +182,8 @@ class CreateSceneBloc extends Bloc )); } - void addToTempAutomationTaskList(TempHoldSceneTasksEvent event, Emitter emit) { + void addToTempAutomationTaskList( + TempHoldSceneTasksEvent event, Emitter emit) { emit(CreateSceneLoading()); bool updated = false; for (var element in automationTempTasksList) { @@ -202,8 +205,10 @@ class CreateSceneBloc extends Bloc ], comparator: automationComparatorValues[element.code], ); - automationTempTasksList[automationTempTasksList.indexOf(element)] = updatedElement; - automationSelectedValues[updatedElement.code] = event.deviceControlModel.value; + automationTempTasksList[automationTempTasksList.indexOf(element)] = + updatedElement; + automationSelectedValues[updatedElement.code] = + event.deviceControlModel.value; updated = true; break; } @@ -223,10 +228,12 @@ class CreateSceneBloc extends Bloc icon: '', ), ], - comparator: automationComparatorValues[event.deviceControlModel.code] ?? '==', + comparator: + automationComparatorValues[event.deviceControlModel.code] ?? '==', ); automationTempTasksList.add(newElement); - automationSelectedValues[newElement.code] = event.deviceControlModel.value; + automationSelectedValues[newElement.code] = + event.deviceControlModel.value; } emit(AddSceneTask( tasksList: tasksList, @@ -235,7 +242,8 @@ class CreateSceneBloc extends Bloc )); } - FutureOr _selectedValue(SelectedValueEvent event, Emitter emit) { + FutureOr _selectedValue( + SelectedValueEvent event, Emitter emit) { if (event.isAutomation == true) { automationSelectedValues[event.code] = event.value; automationComparatorValues[event.code] = event.comparator ?? '=='; @@ -272,7 +280,8 @@ class CreateSceneBloc extends Bloc )); } - FutureOr _removeTaskById(RemoveTaskByIdEvent event, Emitter emit) { + FutureOr _removeTaskById( + RemoveTaskByIdEvent event, Emitter emit) { emit(CreateSceneLoading()); if (event.isAutomation == true) { for (var element in automationTasksList) { @@ -345,7 +354,8 @@ class CreateSceneBloc extends Bloc : await SceneApi.createScene(event.createSceneModel!); } else if (event.createAutomationModel != null) { response = event.updateScene - ? await SceneApi.updateAutomation(event.createAutomationModel!, event.sceneId) + ? await SceneApi.updateAutomation( + event.createAutomationModel!, event.sceneId) : await SceneApi.createAutomation(event.createAutomationModel!); } @@ -359,12 +369,14 @@ class CreateSceneBloc extends Bloc automationComparatorValues.clear(); selectedIcon = ''; showInDeviceScreen = false; - effectiveTime = EffectiveTime(start: '00:00', end: '23:59', loops: '1111111'); + effectiveTime = + EffectiveTime(start: '00:00', end: '23:59', loops: '1111111'); sceneType = CreateSceneEnum.none; conditionRule = 'or'; emit(const CreateSceneWithTasks(success: true)); - CustomSnackBar.greenSnackBar( - event.updateScene ? 'Scene updated successfully' : 'Scene created successfully'); + CustomSnackBar.greenSnackBar(event.updateScene + ? 'Scene updated successfully' + : 'Scene created successfully'); } else { emit(const CreateSceneError(message: 'Something went wrong')); } @@ -378,7 +390,8 @@ class CreateSceneBloc extends Bloc } } - FutureOr _clearTaskList(ClearTaskListEvent event, Emitter emit) { + FutureOr _clearTaskList( + ClearTaskListEvent event, Emitter emit) { emit(CreateSceneLoading()); automationTasksList.clear(); tasksList.clear(); @@ -389,7 +402,8 @@ class CreateSceneBloc extends Bloc )); } - FutureOr _clearTabToRunSetting(ClearTabToRunSetting event, Emitter emit) { + FutureOr _clearTabToRunSetting( + ClearTabToRunSetting event, Emitter emit) { emit(CreateSceneLoading()); selectedIcon = ''; showInDeviceScreen = false; @@ -416,7 +430,8 @@ class CreateSceneBloc extends Bloc automationComparatorValues.clear(); selectedIcon = ''; showInDeviceScreen = false; - effectiveTime = EffectiveTime(start: '00:00', end: '23:59', loops: '1111111'); + effectiveTime = + EffectiveTime(start: '00:00', end: '23:59', loops: '1111111'); sceneType = CreateSceneEnum.none; conditionRule = 'or'; @@ -425,10 +440,14 @@ class CreateSceneBloc extends Bloc : await SceneApi.getSceneDetails(event.sceneId); if (response.id.isNotEmpty) { if (event.isAutomation) { - automationTasksList = List.from(getTaskListFunctionsFromApi( - actions: [], isAutomation: true, conditions: response.conditions)); + automationTasksList = List.from( + getTaskListFunctionsFromApi( + actions: [], + isAutomation: true, + conditions: response.conditions)); tasksList = List.from( - getTaskListFunctionsFromApi(actions: response.actions, isAutomation: false)); + getTaskListFunctionsFromApi( + actions: response.actions, isAutomation: false)); conditionRule = response.decisionExpr ?? conditionRule; @@ -441,11 +460,13 @@ class CreateSceneBloc extends Bloc : EffectiveTime(start: '00:00', end: '23:59', loops: '1111111'); // Set the days directly from the API response - BlocProvider.of(NavigationService.navigatorKey.currentContext!) + BlocProvider.of( + NavigationService.navigatorKey.currentContext!) .add(SetDays(response.effectiveTime?.loops ?? '1111111')); // Set Custom Time and reset days first - BlocProvider.of(NavigationService.navigatorKey.currentContext!) + BlocProvider.of( + NavigationService.navigatorKey.currentContext!) .add(SetCustomTime(effectiveTime!.start, effectiveTime!.end)); emit(AddSceneTask( @@ -457,7 +478,8 @@ class CreateSceneBloc extends Bloc showInDevice: showInDeviceScreen)); } else { tasksList = List.from( - getTaskListFunctionsFromApi(actions: response.actions, isAutomation: false)); + getTaskListFunctionsFromApi( + actions: response.actions, isAutomation: false)); selectedIcon = response.icon!; showInDeviceScreen = response.showInDevice!; emit(AddSceneTask( @@ -475,7 +497,8 @@ class CreateSceneBloc extends Bloc } } - FutureOr _fetchIconScene(SceneIconEvent event, Emitter emit) async { + FutureOr _fetchIconScene( + SceneIconEvent event, Emitter emit) async { emit(CreateSceneLoading()); try { iconModelList = await SceneApi.getIcon(); @@ -491,7 +514,8 @@ class CreateSceneBloc extends Bloc } } - FutureOr _iconSelected(IconSelected event, Emitter emit) async { + FutureOr _iconSelected( + IconSelected event, Emitter emit) async { try { if (event.confirmSelection) { selectedIcon = event.iconId; @@ -531,7 +555,8 @@ class CreateSceneBloc extends Bloc return days[index]; } - FutureOr _clearTempTaskList(ClearTempTaskListEvent event, Emitter emit) { + FutureOr _clearTempTaskList( + ClearTempTaskListEvent event, Emitter emit) { emit(CreateSceneLoading()); if (event.isAutomation == true) { automationTempTasksList.clear(); @@ -575,13 +600,18 @@ class CreateSceneBloc extends Bloc } } - FutureOr _deleteScene(DeleteSceneEvent event, Emitter emit) async { + FutureOr _deleteScene( + DeleteSceneEvent event, Emitter emit) async { emit(DeleteSceneLoading()); try { - final response = sceneType.name == CreateSceneEnum.deviceStatusChanges.name - ? await SceneApi.deleteAutomation(automationId: event.sceneId, unitUuid: event.unitUuid) - : await SceneApi.deleteScene(sceneId: event.sceneId, unitUuid: event.unitUuid); + final response = + sceneType.name == CreateSceneEnum.deviceStatusChanges.name + ? await SceneApi.deleteAutomation( + automationId: event.sceneId, unitUuid: event.unitUuid) + : await SceneApi.deleteScene( + sceneId: event.sceneId, + ); if (response == true) { emit(const DeleteSceneSuccess(true)); } else { @@ -592,7 +622,8 @@ class CreateSceneBloc extends Bloc } } - FutureOr _updateTaskValue(UpdateTaskEvent event, Emitter emit) { + FutureOr _updateTaskValue( + UpdateTaskEvent event, Emitter emit) { emit(CreateSceneLoading()); if (event.isAutomation == true) { for (var i = 0; i < automationTasksList.length; i++) { @@ -628,7 +659,8 @@ class CreateSceneBloc extends Bloc )); } - FutureOr _selectConditionRule(SelectConditionEvent event, Emitter emit) { + FutureOr _selectConditionRule( + SelectConditionEvent event, Emitter emit) { emit(CreateSceneInitial()); if (event.condition.contains('any')) { conditionRule = 'or'; @@ -643,7 +675,8 @@ class CreateSceneBloc extends Bloc )); } - FutureOr _sceneTypeEvent(SceneTypeEvent event, Emitter emit) { + FutureOr _sceneTypeEvent( + SceneTypeEvent event, Emitter emit) { // emit(CreateSceneInitial()); if (event.type == CreateSceneEnum.tabToRun) { diff --git a/lib/features/scene/bloc/scene_bloc/scene_bloc.dart b/lib/features/scene/bloc/scene_bloc/scene_bloc.dart index 701e30a..35bdbd6 100644 --- a/lib/features/scene/bloc/scene_bloc/scene_bloc.dart +++ b/lib/features/scene/bloc/scene_bloc/scene_bloc.dart @@ -24,7 +24,9 @@ class SceneBloc extends Bloc { try { if (event.unitId.isNotEmpty) { - scenes = await SceneApi.getScenesByUnitId(event.unitId, showInDevice: event.showInDevice); + scenes = await SceneApi.getScenesByUnitId( + event.unitId, event.unit.community.uuid, + showInDevice: event.showInDevice); emit(SceneLoaded(scenes, automationList)); } else { emit(const SceneError(message: 'Unit ID is empty')); @@ -34,7 +36,8 @@ class SceneBloc extends Bloc { } } - Future _onLoadAutomation(LoadAutomation event, Emitter emit) async { + Future _onLoadAutomation( + LoadAutomation event, Emitter emit) async { emit(SceneLoading()); try { @@ -49,7 +52,8 @@ class SceneBloc extends Bloc { } } - Future _onSceneTrigger(SceneTrigger event, Emitter emit) async { + Future _onSceneTrigger( + SceneTrigger event, Emitter emit) async { final currentState = state; if (currentState is SceneLoaded) { emit(SceneLoaded( @@ -76,8 +80,9 @@ class SceneBloc extends Bloc { UpdateAutomationStatus event, Emitter emit) async { final currentState = state; if (currentState is SceneLoaded) { - final newLoadingStates = Map.from(currentState.loadingStates) - ..[event.automationId] = true; + final newLoadingStates = + Map.from(currentState.loadingStates) + ..[event.automationId] = true; emit(SceneLoaded( currentState.scenes, @@ -86,11 +91,11 @@ class SceneBloc extends Bloc { )); try { - final success = - await SceneApi.updateAutomationStatus(event.automationId, event.automationStatusUpdate); + final success = await SceneApi.updateAutomationStatus( + event.automationId, event.automationStatusUpdate); if (success) { - automationList = - await SceneApi.getAutomationByUnitId(event.automationStatusUpdate.unitUuid); + automationList = await SceneApi.getAutomationByUnitId( + event.automationStatusUpdate.unitUuid); newLoadingStates[event.automationId] = false; emit(SceneLoaded( currentState.scenes, diff --git a/lib/features/scene/bloc/scene_bloc/scene_event.dart b/lib/features/scene/bloc/scene_bloc/scene_event.dart index d72f3a7..7807bbb 100644 --- a/lib/features/scene/bloc/scene_bloc/scene_event.dart +++ b/lib/features/scene/bloc/scene_bloc/scene_event.dart @@ -1,4 +1,5 @@ import 'package:equatable/equatable.dart'; +import 'package:syncrow_app/features/app_layout/model/space_model.dart'; import 'package:syncrow_app/features/scene/model/update_automation.dart'; abstract class SceneEvent extends Equatable { @@ -11,8 +12,9 @@ abstract class SceneEvent extends Equatable { class LoadScenes extends SceneEvent { final String unitId; final bool showInDevice; + final SpaceModel unit; - const LoadScenes(this.unitId, {this.showInDevice = false}); + const LoadScenes(this.unitId, this.unit, {this.showInDevice = false}); @override List get props => [unitId, showInDevice]; diff --git a/lib/features/scene/model/create_automation_model.dart b/lib/features/scene/model/create_automation_model.dart index a349dc2..e54c3e4 100644 --- a/lib/features/scene/model/create_automation_model.dart +++ b/lib/features/scene/model/create_automation_model.dart @@ -39,7 +39,7 @@ class CreateAutomationModel { Map toMap([String? automationId]) { return { - if (automationId == null) 'unitUuid': unitUuid, + if (automationId == null) 'spaceUuid': unitUuid, 'automationName': automationName, 'decisionExpr': decisionExpr, 'effectiveTime': effectiveTime.toMap(), @@ -50,7 +50,7 @@ class CreateAutomationModel { factory CreateAutomationModel.fromMap(Map map) { return CreateAutomationModel( - unitUuid: map['unitUuid'] ?? '', + unitUuid: map['spaceUuid'] ?? '', automationName: map['automationName'] ?? '', decisionExpr: map['decisionExpr'] ?? '', effectiveTime: EffectiveTime.fromMap(map['effectiveTime']), diff --git a/lib/features/scene/model/scene_details_model.dart b/lib/features/scene/model/scene_details_model.dart index 99a2c5f..05453f7 100644 --- a/lib/features/scene/model/scene_details_model.dart +++ b/lib/features/scene/model/scene_details_model.dart @@ -25,28 +25,34 @@ class SceneDetailsModel { this.effectiveTime, }); - factory SceneDetailsModel.fromRawJson(String str) => SceneDetailsModel.fromJson(json.decode(str)); + factory SceneDetailsModel.fromRawJson(String str) => + SceneDetailsModel.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); - factory SceneDetailsModel.fromJson(Map json) => SceneDetailsModel( - id: json["id"], - name: json["name"], - status: json["status"], - type: json["type"], - actions: (json["actions"] as List) - .map((x) => Action.fromJson(x)) - .where((x) => x != null) - .toList() - .cast(), - conditions: json["conditions"] != null - ? (json["conditions"] as List).map((x) => Condition.fromJson(x)).toList() - : null, - decisionExpr: json["decisionExpr"], - effectiveTime: - json["effectiveTime"] != null ? EffectiveTime.fromJson(json["effectiveTime"]) : null, - icon: json["iconUuid"] != null ? json["iconUuid"] ?? '' : '', - showInDevice: json['showInHome'] != null ? json['showInHome'] ?? false : false); + factory SceneDetailsModel.fromJson(Map json) => + SceneDetailsModel( + id: json["uuid"], + name: json["name"], + status: json["status"], + type: json["type"], + actions: (json["actions"] as List) + .map((x) => Action.fromJson(x)) + .where((x) => x != null) + .toList() + .cast(), + conditions: json["conditions"] != null + ? (json["conditions"] as List) + .map((x) => Condition.fromJson(x)) + .toList() + : null, + decisionExpr: json["decisionExpr"], + effectiveTime: json["effectiveTime"] != null + ? EffectiveTime.fromJson(json["effectiveTime"]) + : null, + icon: json["iconUuid"] != null ? json["iconUuid"] ?? '' : '', + showInDevice: + json['showInHome'] != null ? json['showInHome'] ?? false : false); Map toJson() => { "id": id, @@ -54,8 +60,9 @@ class SceneDetailsModel { "status": status, "type": type, "actions": List.from(actions.map((x) => x.toJson())), - "conditions": - conditions != null ? List.from(conditions!.map((x) => x.toJson())) : null, + "conditions": conditions != null + ? List.from(conditions!.map((x) => x.toJson())) + : null, "decisionExpr": decisionExpr, "effectiveTime": effectiveTime?.toJson(), }; @@ -116,7 +123,8 @@ class ExecutorProperty { this.delaySeconds, }); - factory ExecutorProperty.fromJson(Map json) => ExecutorProperty( + factory ExecutorProperty.fromJson(Map json) => + ExecutorProperty( functionCode: json["functionCode"] ?? '', functionValue: json["functionValue"] ?? '', delaySeconds: json["delaySeconds"] ?? 0, @@ -142,7 +150,8 @@ class Condition { required this.expr, }); - factory Condition.fromRawJson(String str) => Condition.fromJson(json.decode(str)); + factory Condition.fromRawJson(String str) => + Condition.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); @@ -200,7 +209,8 @@ class EffectiveTime { required this.loops, }); - factory EffectiveTime.fromRawJson(String str) => EffectiveTime.fromJson(json.decode(str)); + factory EffectiveTime.fromRawJson(String str) => + EffectiveTime.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); diff --git a/lib/features/scene/model/scenes_model.dart b/lib/features/scene/model/scenes_model.dart index 8f4b2fd..7f9d654 100644 --- a/lib/features/scene/model/scenes_model.dart +++ b/lib/features/scene/model/scenes_model.dart @@ -3,32 +3,40 @@ import 'dart:typed_data'; class ScenesModel { final String id; + final String? sceneTuyaId; final String name; final String status; final String type; - final String icon; + final String? icon; ScenesModel( {required this.id, + this.sceneTuyaId, required this.name, required this.status, required this.type, - required this.icon}); + this.icon}); - factory ScenesModel.fromRawJson(String str) => ScenesModel.fromJson(json.decode(str)); + factory ScenesModel.fromRawJson(String str) => + ScenesModel.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); - Uint8List get iconInBytes => base64Decode(icon); - - factory ScenesModel.fromJson(Map json) => ScenesModel( - id: json["uuid"], - name: json["name"] ?? '', - status: json["status"] ?? '', - type: json["type"] ?? '', - icon: json["icon"] ?? ''); + Uint8List get iconInBytes => base64Decode(icon ?? ''); + factory ScenesModel.fromJson(Map json) { + return ScenesModel( + id: json["id"] ?? json["uuid"] ?? '', // Fallback to empty string if id is null + sceneTuyaId: json["sceneTuyaId"] as String?, // Nullable + name: json["name"] ?? '', // Fallback to empty string if name is null + status: + json["status"] ?? '', // Fallback to empty string if status is null + type: json["type"] ?? '', // Fallback to empty string if type is null + icon: json["icon"] as String?, // Nullable + ); + } Map toJson() => { "id": id, + "sceneTuyaId": sceneTuyaId ?? '', "name": name, "status": status, "type": type, diff --git a/lib/features/scene/view/scene_view.dart b/lib/features/scene/view/scene_view.dart index a2d1881..41d1fdd 100644 --- a/lib/features/scene/view/scene_view.dart +++ b/lib/features/scene/view/scene_view.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.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/model/community_model.dart'; +import 'package:syncrow_app/features/app_layout/model/space_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/scene_listview.dart'; import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart'; import 'package:syncrow_app/features/scene/bloc/scene_bloc/scene_bloc.dart'; @@ -21,32 +23,47 @@ class SceneView extends StatelessWidget { Widget build(BuildContext context) { return BlocProvider( create: (BuildContext context) => SceneBloc() - ..add(LoadScenes(HomeCubit.getInstance().selectedSpace?.id ?? '', showInDevice: pageType)) + ..add(LoadScenes( + HomeCubit.getInstance().selectedSpace?.id ?? '', + HomeCubit.getInstance().selectedSpace ?? + SpaceModel( + id: '-1', + name: '', + community: Community( + uuid: '-1', + name: '', + )), + showInDevice: pageType)) ..add(LoadAutomation(HomeCubit.getInstance().selectedSpace?.id ?? '')), child: BlocBuilder( builder: (context, state) { if (state is DeleteSceneSuccess) { if (state.success) { + BlocProvider.of(context).add(LoadScenes( + HomeCubit.getInstance().selectedSpace!.id!,HomeCubit.getInstance().selectedSpace!, + showInDevice: pageType)); BlocProvider.of(context).add( - LoadScenes(HomeCubit.getInstance().selectedSpace!.id!, showInDevice: pageType)); - BlocProvider.of(context) - .add(LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!)); + LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!)); } } if (state is CreateSceneWithTasks) { if (state.success == true) { + BlocProvider.of(context).add(LoadScenes( + HomeCubit.getInstance().selectedSpace!.id!,HomeCubit.getInstance().selectedSpace!, + showInDevice: pageType)); BlocProvider.of(context).add( - LoadScenes(HomeCubit.getInstance().selectedSpace!.id!, showInDevice: pageType)); - BlocProvider.of(context) - .add(LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!)); - context.read().add(const SmartSceneClearEvent()); + LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!)); + context + .read() + .add(const SmartSceneClearEvent()); } } return BlocListener( listener: (context, state) { if (state is SceneTriggerSuccess) { context.showCustomSnackbar( - message: 'Scene ${state.sceneName} triggered successfully!'); + message: + 'Scene ${state.sceneName} triggered successfully!'); } }, child: HomeCubit.getInstance().spaces?.isEmpty ?? true @@ -83,25 +100,30 @@ class SceneView extends StatelessWidget { child: ListView( children: [ Theme( - data: ThemeData() - .copyWith(dividerColor: Colors.transparent), + data: ThemeData().copyWith( + dividerColor: Colors.transparent), child: ExpansionTile( - tilePadding: const EdgeInsets.symmetric(horizontal: 6), + tilePadding: + const EdgeInsets.symmetric( + horizontal: 6), initiallyExpanded: true, iconColor: ColorsManager.grayColor, - title: const BodyMedium(text: 'Tap to run routines'), + title: const BodyMedium( + text: 'Tap to run routines'), children: [ scenes.isNotEmpty ? SceneGrid( scenes: scenes, - loadingSceneId: state.loadingSceneId, + loadingSceneId: + state.loadingSceneId, disablePlayButton: false, - loadingStates: - state.loadingStates, // Add this line + loadingStates: state + .loadingStates, // Add this line ) : const Center( child: BodyMedium( - text: 'No scenes have been added yet', + text: + 'No scenes have been added yet', ), ), const SizedBox( @@ -111,25 +133,30 @@ class SceneView extends StatelessWidget { ), ), Theme( - data: ThemeData() - .copyWith(dividerColor: Colors.transparent), + data: ThemeData().copyWith( + dividerColor: Colors.transparent), child: ExpansionTile( initiallyExpanded: true, iconColor: ColorsManager.grayColor, - tilePadding: const EdgeInsets.symmetric(horizontal: 6), - title: const BodyMedium(text: 'Automation'), + tilePadding: + const EdgeInsets.symmetric( + horizontal: 6), + title: const BodyMedium( + text: 'Automation'), children: [ automationList.isNotEmpty ? SceneGrid( scenes: automationList, - loadingSceneId: state.loadingSceneId, + loadingSceneId: + state.loadingSceneId, disablePlayButton: true, - loadingStates: - state.loadingStates, // Add this line + loadingStates: state + .loadingStates, // Add this line ) : const Center( child: BodyMedium( - text: 'No automations have been added yet', + text: + 'No automations have been added yet', ), ), const SizedBox( diff --git a/lib/features/scene/widgets/delete_routine_b.dart b/lib/features/scene/widgets/delete_routine_b.dart index 18293b1..b344683 100644 --- a/lib/features/scene/widgets/delete_routine_b.dart +++ b/lib/features/scene/widgets/delete_routine_b.dart @@ -24,7 +24,7 @@ class DeleteRoutineButton extends StatelessWidget { if (state.success) { navigateToRoute(context, Routes.homeRoute); BlocProvider.of(context) - .add(LoadScenes(HomeCubit.getInstance().selectedSpace!.id!)); + .add(LoadScenes(HomeCubit.getInstance().selectedSpace!.id!,HomeCubit.getInstance().selectedSpace!)); BlocProvider.of(context).add( LoadAutomation(HomeCubit.getInstance().selectedSpace!.id!)); } diff --git a/lib/features/scene/widgets/select_smart_scene/smart_enable_tab_run.dart b/lib/features/scene/widgets/select_smart_scene/smart_enable_tab_run.dart index 37a5e7c..a50aa6f 100644 --- a/lib/features/scene/widgets/select_smart_scene/smart_enable_tab_run.dart +++ b/lib/features/scene/widgets/select_smart_scene/smart_enable_tab_run.dart @@ -17,7 +17,7 @@ class SmartEnableTabRun extends StatelessWidget { width: double.infinity, child: BlocBuilder( bloc: context.read() - ..add(LoadScenes(HomeCubit.getInstance().selectedSpace?.id ?? '')), + ..add(LoadScenes(HomeCubit.getInstance().selectedSpace?.id ?? '',HomeCubit.getInstance().selectedSpace!)), builder: (context, state) { if (state is SceneLoading) { return const Align( diff --git a/lib/services/api/devices_api.dart b/lib/services/api/devices_api.dart index 319bdef..fe6cc56 100644 --- a/lib/services/api/devices_api.dart +++ b/lib/services/api/devices_api.dart @@ -150,9 +150,9 @@ class DevicesAPI { }) async { try { final String path = ApiEndpoints.deviceByRoom - .replaceAll(':communityUuid', communityUuid) - .replaceAll(':spaceUuid', spaceUuid) - .replaceAll(':subSpaceUuid', roomId); + .replaceAll('{communityUuid}', communityUuid) + .replaceAll('{spaceUuid}', spaceUuid) + .replaceAll('{subSpaceUuid}', roomId); final response = await _httpService.get( path: path, diff --git a/lib/services/api/home_management_api.dart b/lib/services/api/home_management_api.dart index 63b5f22..faf92d4 100644 --- a/lib/services/api/home_management_api.dart +++ b/lib/services/api/home_management_api.dart @@ -37,15 +37,17 @@ class HomeManagementAPI { // Ensure both placeholders are replaced final path = ApiEndpoints.spaceDevices - .replaceAll("{communityUuid}", communityUuid) - .replaceAll("{spaceUuid}", spaceUuid); + .replaceAll('{communityUuid}', communityUuid) + .replaceAll('{spaceUuid}', spaceUuid); await _httpService.get( path: path, showServerMessage: false, expectedResponseModel: (json) { - json.forEach((value) { - list.add(DeviceModel.fromJson(value)); - }); + if (json['data'] != null) { + json['data'].forEach((value) { + list.add(DeviceModel.fromJson(value)); + }); + } }, ); diff --git a/lib/services/api/scene_api.dart b/lib/services/api/scene_api.dart index 6e0d981..65e4382 100644 --- a/lib/services/api/scene_api.dart +++ b/lib/services/api/scene_api.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:syncrow_app/features/scene/model/create_automation_model.dart'; import 'package:syncrow_app/features/scene/model/create_scene_model.dart'; import 'package:syncrow_app/features/scene/model/icon_model.dart'; @@ -11,7 +13,8 @@ class SceneApi { static final HTTPService _httpService = HTTPService(); //create scene - static Future> createScene(CreateSceneModel createSceneModel) async { + static Future> createScene( + CreateSceneModel createSceneModel) async { try { final response = await _httpService.post( path: ApiEndpoints.createScene, @@ -47,15 +50,21 @@ class SceneApi { //get scene by unit id - static Future> getScenesByUnitId(String unitId, {showInDevice = false}) async { + static Future> getScenesByUnitId( + String unitId, String communityId, + {showInDevice = false}) async { try { final response = await _httpService.get( - path: ApiEndpoints.getUnitScenes.replaceAll('{unitUuid}', unitId), + path: ApiEndpoints.getUnitScenes + .replaceAll('{spaceUuid}', unitId) + .replaceAll('{communityUuid}', communityId), queryParameters: {'showInHomePage': showInDevice}, showServerMessage: false, expectedResponseModel: (json) { + final scenesJson = json['data'] as List; + List scenes = []; - for (var scene in json) { + for (var scene in scenesJson) { scenes.add(ScenesModel.fromJson(scene)); } return scenes; @@ -102,10 +111,12 @@ class SceneApi { } //automation details - static Future getAutomationDetails(String automationId) async { + static Future getAutomationDetails( + String automationId) async { try { final response = await _httpService.get( - path: ApiEndpoints.getAutomationDetails.replaceAll('{automationId}', automationId), + path: ApiEndpoints.getAutomationDetails + .replaceAll('{automationId}', automationId), showServerMessage: false, expectedResponseModel: (json) => SceneDetailsModel.fromJson(json), ); @@ -116,11 +127,12 @@ class SceneApi { } //updateAutomationStatus - static Future updateAutomationStatus( - String automationId, AutomationStatusUpdate createAutomationEnable) async { + static Future updateAutomationStatus(String automationId, + AutomationStatusUpdate createAutomationEnable) async { try { final response = await _httpService.put( - path: ApiEndpoints.updateAutomationStatus.replaceAll('{automationId}', automationId), + path: ApiEndpoints.updateAutomationStatus + .replaceAll('{automationId}', automationId), body: createAutomationEnable.toMap(), expectedResponseModel: (json) => json['success'], ); @@ -135,7 +147,13 @@ class SceneApi { final response = await _httpService.get( path: ApiEndpoints.getScene.replaceAll('{sceneId}', sceneId), showServerMessage: false, - expectedResponseModel: (json) => SceneDetailsModel.fromJson(json), + expectedResponseModel: (json) { + if (json != null && json['data'] != null) { + return SceneDetailsModel.fromJson(json['data']); + } else { + throw Exception('Data field is null'); + } + }, ); return response; } catch (e) { @@ -163,7 +181,8 @@ class SceneApi { try { final response = await _httpService.put( path: ApiEndpoints.updateScene.replaceAll('{sceneId}', sceneId), - body: createSceneModel.toJson(sceneId.isNotEmpty == true ? sceneId : null), + body: createSceneModel + .toJson(sceneId.isNotEmpty == true ? sceneId : null), expectedResponseModel: (json) { return json; }, @@ -175,11 +194,14 @@ class SceneApi { } //update automation - static updateAutomation(CreateAutomationModel createAutomationModel, String automationId) async { + static updateAutomation( + CreateAutomationModel createAutomationModel, String automationId) async { try { final response = await _httpService.put( - path: ApiEndpoints.updateAutomation.replaceAll('{automationId}', automationId), - body: createAutomationModel.toJson(automationId.isNotEmpty == true ? automationId : null), + path: ApiEndpoints.updateAutomation + .replaceAll('{automationId}', automationId), + body: createAutomationModel + .toJson(automationId.isNotEmpty == true ? automationId : null), expectedResponseModel: (json) { return json; }, @@ -192,12 +214,10 @@ class SceneApi { //delete Scene - static Future deleteScene({required String unitUuid, required String sceneId}) async { + static Future deleteScene({required String sceneId}) async { try { final response = await _httpService.delete( - path: ApiEndpoints.deleteScene - .replaceAll('{sceneId}', sceneId) - .replaceAll('{unitUuid}', unitUuid), + path: ApiEndpoints.deleteScene.replaceAll('{sceneId}', sceneId), showServerMessage: false, expectedResponseModel: (json) => json['statusCode'] == 200, ); From 29f82945a6002e4abc75234e74cd3b73c92ebdb0 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Mon, 4 Nov 2024 10:19:36 +0400 Subject: [PATCH 15/26] revert back --- pubspec.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.lock b/pubspec.lock index 4b11f46..5078799 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1143,4 +1143,4 @@ packages: version: "6.5.0" sdks: dart: ">=3.4.0 <4.0.0" - flutter: ">=3.22.0" + flutter: ">=3.22.0" \ No newline at end of file From e4a3d4c50b060573b40838024850e2e97490fbc4 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Mon, 4 Nov 2024 10:28:16 +0400 Subject: [PATCH 16/26] delete scene --- lib/services/api/api_links_endpoints.dart | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/services/api/api_links_endpoints.dart b/lib/services/api/api_links_endpoints.dart index 3338fac..b6aa0bf 100644 --- a/lib/services/api/api_links_endpoints.dart +++ b/lib/services/api/api_links_endpoints.dart @@ -114,7 +114,7 @@ abstract class ApiEndpoints { //GET static const String deviceByRoom = - '/communities/:communityUuid/spaces/:spaceUuid/subspaces/:subSpaceUuid/devices'; + '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices'; static const String deviceByUuid = '/device/{deviceUuid}'; static const String deviceFunctions = '/device/{deviceUuid}/functions'; static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices'; @@ -136,13 +136,14 @@ abstract class ApiEndpoints { /// Scene & Automation API //////////////////// /// POST static const String createScene = '/scene/tap-to-run'; - static const String triggerScene = '/scene/tap-to-run/trigger/{sceneId}'; + static const String triggerScene = '/scene/tap-to-run/{sceneId}/trigger'; static const String createAutomation = '/automation'; /// GET - static const String getUnitScenes = '/scene/tap-to-run/{unitUuid}'; + static const String getUnitScenes = + '/communities/{communityUuid}/spaces/{spaceUuid}/scenes'; - static const String getScene = '/scene/tap-to-run/details/{sceneId}'; + static const String getScene = '/scene/tap-to-run/{sceneId}'; static const String getIconScene = '/scene/icon'; static const String getUnitAutomation = '/automation/{unitUuid}'; @@ -159,7 +160,7 @@ abstract class ApiEndpoints { '/automation/status/{automationId}'; /// DELETE - static const String deleteScene = '/scene/tap-to-run/{unitUuid}/{sceneId}'; + static const String deleteScene = '/scene/tap-to-run/{sceneId}'; static const String deleteAutomation = '/automation/{unitUuid}/{automationId}'; From 977fd12721f361eb914b36d08902829c23ab39c7 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Mon, 4 Nov 2024 10:30:50 +0400 Subject: [PATCH 17/26] podfile revert --- ios/Podfile.lock | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 064c37d..de7dea4 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -14,14 +14,14 @@ PODS: - Firebase/Database (10.25.0): - Firebase/CoreOnly - FirebaseDatabase (~> 10.25.0) - - firebase_analytics (10.10.7): + - firebase_analytics (10.8.7): - Firebase/Analytics (= 10.25.0) - firebase_core - Flutter - firebase_core (2.32.0): - Firebase/CoreOnly (= 10.25.0) - Flutter - - firebase_crashlytics (3.5.7): + - firebase_crashlytics (3.4.16): - Firebase/Crashlytics (= 10.25.0) - firebase_core - Flutter @@ -150,12 +150,12 @@ PODS: - nanopb/encode (= 2.30910.0) - nanopb/decode (2.30910.0) - nanopb/encode (2.30910.0) - - onesignal_flutter (5.2.6): + - onesignal_flutter (5.2.0): - Flutter - - OneSignalXCFramework (= 5.2.5) - - OneSignalXCFramework (5.2.5): - - OneSignalXCFramework/OneSignalComplete (= 5.2.5) - - OneSignalXCFramework/OneSignal (5.2.5): + - OneSignalXCFramework (= 5.2.0) + - OneSignalXCFramework (5.2.0): + - OneSignalXCFramework/OneSignalComplete (= 5.2.0) + - OneSignalXCFramework/OneSignal (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalLiveActivities @@ -163,38 +163,38 @@ PODS: - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalComplete (5.2.5): + - OneSignalXCFramework/OneSignalComplete (5.2.0): - OneSignalXCFramework/OneSignal - OneSignalXCFramework/OneSignalInAppMessages - OneSignalXCFramework/OneSignalLocation - - OneSignalXCFramework/OneSignalCore (5.2.5) - - OneSignalXCFramework/OneSignalExtension (5.2.5): + - OneSignalXCFramework/OneSignalCore (5.2.0) + - OneSignalXCFramework/OneSignalExtension (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalInAppMessages (5.2.5): + - OneSignalXCFramework/OneSignalInAppMessages (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLiveActivities (5.2.5): + - OneSignalXCFramework/OneSignalLiveActivities (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLocation (5.2.5): + - OneSignalXCFramework/OneSignalLocation (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalNotifications (5.2.5): + - OneSignalXCFramework/OneSignalNotifications (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalOSCore (5.2.5): + - OneSignalXCFramework/OneSignalOSCore (5.2.0): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalOutcomes (5.2.5): + - OneSignalXCFramework/OneSignalOutcomes (5.2.0): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalUser (5.2.5): + - OneSignalXCFramework/OneSignalUser (5.2.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore @@ -212,7 +212,7 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - sqflite_darwin (0.0.4): + - sqflite (0.0.3): - Flutter - FlutterMacOS - url_launcher_ios (0.0.1): @@ -232,7 +232,7 @@ DEPENDENCIES: - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) + - sqflite (from `.symlinks/plugins/sqflite/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) SPEC REPOS: @@ -285,17 +285,17 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/share_plus/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" - sqflite_darwin: - :path: ".symlinks/plugins/sqflite_darwin/darwin" + sqflite: + :path: ".symlinks/plugins/sqflite/darwin" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d Firebase: 0312a2352584f782ea56f66d91606891d4607f06 - firebase_analytics: cc06e24d6a2343c44f845b3112143db72d10ef78 + firebase_analytics: 3a9263fedec72970e6bd30a7132bbdd386de2c14 firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197 - firebase_crashlytics: 17e856fabec68d993662abaf2f6fe2413f0abece + firebase_crashlytics: 0b7cb41f5fb3b6889d0fb408cfce3cc7a4247061 firebase_database: 2713033e426b176d4fe5e7195f3d19aa1b549a91 FirebaseAnalytics: ec00fe8b93b41dc6fe4a28784b8e51da0647a248 FirebaseAppCheckInterop: 6a1757cfd4067d8e00fccd14fcc1b8fd78cfac07 @@ -309,23 +309,23 @@ SPEC CHECKSUMS: FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12 + flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be GoogleAppMeasurement: 9abf64b682732fed36da827aa2a68f0221fd2356 GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 leveldb-library: e8eadf9008a61f9e1dde3978c086d2b6d9b9dc28 nanopb: 438bc412db1928dac798aa6fd75726007be04262 - onesignal_flutter: f441aaefa112988a1e786c695a30695ad0291763 - OneSignalXCFramework: 76ca508fc2b941317729d13fdec96817f8ef5b3b - path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + onesignal_flutter: 5ce68a29861960168e81101cb1bd685d264361de + OneSignalXCFramework: bdf74fdc06888f9466dc21e826fe1549ed143095 + path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad - shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 - sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13 - url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe + shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec + url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 PODFILE CHECKSUM: 4243bd7f9184f79552dd731a7c9d5cad03bd2706 From ab4f8c593deede2eabf79202bbf494c21b8a00aa Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Mon, 4 Nov 2024 10:32:13 +0400 Subject: [PATCH 18/26] revert --- pubspec.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.lock b/pubspec.lock index 5078799..4b11f46 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1143,4 +1143,4 @@ packages: version: "6.5.0" sdks: dart: ">=3.4.0 <4.0.0" - flutter: ">=3.22.0" \ No newline at end of file + flutter: ">=3.22.0" From 944de7b373972dea478207dd3d647036b406a782 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Mon, 4 Nov 2024 17:45:29 +0400 Subject: [PATCH 19/26] reformat --- lib/services/api/spaces_api.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/services/api/spaces_api.dart b/lib/services/api/spaces_api.dart index 15122cb..9dbb39f 100644 --- a/lib/services/api/spaces_api.dart +++ b/lib/services/api/spaces_api.dart @@ -37,13 +37,11 @@ class SpacesAPI { .replaceFirst('{communityUuid}', communityId) .replaceFirst('{spaceUuid}', spaceId); - final response = await _httpService.get( path: path, queryParameters: {"page": 1, "pageSize": 10}, showServerMessage: false, expectedResponseModel: (json) { - List rooms = []; if (json['data'] != null) { for (var subspace in json['data']) { From ff31c54e7bebabd990bc51e0e00e1e352a684a01 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Mon, 4 Nov 2024 17:59:55 +0400 Subject: [PATCH 20/26] reformat --- lib/features/app_layout/bloc/home_cubit.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart index db35135..777dce6 100644 --- a/lib/features/app_layout/bloc/home_cubit.dart +++ b/lib/features/app_layout/bloc/home_cubit.dart @@ -279,7 +279,6 @@ class HomeCubit extends Cubit { space.subspaces = await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id); } catch (failure) { - emitSafe(GetSpaceRoomsError(failure.toString())); return; } From 7d51ca1f1278432bd27df037ecdbeb346cdac55d Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 5 Nov 2024 00:52:38 +0400 Subject: [PATCH 21/26] Fixed bugs in automation --- lib/features/scene/bloc/scene_bloc/scene_bloc.dart | 2 +- lib/features/scene/model/scene_details_model.dart | 2 +- lib/features/scene/model/update_automation.dart | 12 ++++++------ .../scene/widgets/scene_view_widget/scene_item.dart | 2 +- lib/services/api/api_links_endpoints.dart | 2 +- lib/services/api/scene_api.dart | 3 +-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/features/scene/bloc/scene_bloc/scene_bloc.dart b/lib/features/scene/bloc/scene_bloc/scene_bloc.dart index 35bdbd6..4837d32 100644 --- a/lib/features/scene/bloc/scene_bloc/scene_bloc.dart +++ b/lib/features/scene/bloc/scene_bloc/scene_bloc.dart @@ -95,7 +95,7 @@ class SceneBloc extends Bloc { event.automationId, event.automationStatusUpdate); if (success) { automationList = await SceneApi.getAutomationByUnitId( - event.automationStatusUpdate.unitUuid); + event.automationStatusUpdate.spaceUuid); newLoadingStates[event.automationId] = false; emit(SceneLoaded( currentState.scenes, diff --git a/lib/features/scene/model/scene_details_model.dart b/lib/features/scene/model/scene_details_model.dart index 05453f7..d356d43 100644 --- a/lib/features/scene/model/scene_details_model.dart +++ b/lib/features/scene/model/scene_details_model.dart @@ -32,7 +32,7 @@ class SceneDetailsModel { factory SceneDetailsModel.fromJson(Map json) => SceneDetailsModel( - id: json["uuid"], + id: json["uuid"] ?? json["id"], name: json["name"], status: json["status"], type: json["type"], diff --git a/lib/features/scene/model/update_automation.dart b/lib/features/scene/model/update_automation.dart index d15d191..86aefbb 100644 --- a/lib/features/scene/model/update_automation.dart +++ b/lib/features/scene/model/update_automation.dart @@ -1,11 +1,11 @@ import 'dart:convert'; class AutomationStatusUpdate { - final String unitUuid; + final String spaceUuid; final bool isEnable; AutomationStatusUpdate({ - required this.unitUuid, + required this.spaceUuid, required this.isEnable, }); @@ -16,23 +16,23 @@ class AutomationStatusUpdate { factory AutomationStatusUpdate.fromJson(Map json) => AutomationStatusUpdate( - unitUuid: json["unitUuid"], + spaceUuid: json["spaceUuid"], isEnable: json["isEnable"], ); Map toJson() => { - "unitUuid": unitUuid, + "spaceUuid": spaceUuid, "isEnable": isEnable, }; factory AutomationStatusUpdate.fromMap(Map map) => AutomationStatusUpdate( - unitUuid: map["unitUuid"], + spaceUuid: map["spaceUuid"], isEnable: map["isEnable"], ); Map toMap() => { - "unitUuid": unitUuid, + "spaceUuid": spaceUuid, "isEnable": isEnable, }; } diff --git a/lib/features/scene/widgets/scene_view_widget/scene_item.dart b/lib/features/scene/widgets/scene_view_widget/scene_item.dart index 78f4200..be2be1b 100644 --- a/lib/features/scene/widgets/scene_view_widget/scene_item.dart +++ b/lib/features/scene/widgets/scene_view_widget/scene_item.dart @@ -113,7 +113,7 @@ class SceneItem extends StatelessWidget { context.read().add(UpdateAutomationStatus( automationStatusUpdate: AutomationStatusUpdate( isEnable: value, - unitUuid: HomeCubit.getInstance().selectedSpace!.id!), + spaceUuid: HomeCubit.getInstance().selectedSpace!.id!), automationId: scene.id)); }, ), diff --git a/lib/services/api/api_links_endpoints.dart b/lib/services/api/api_links_endpoints.dart index b6aa0bf..a1277a2 100644 --- a/lib/services/api/api_links_endpoints.dart +++ b/lib/services/api/api_links_endpoints.dart @@ -163,7 +163,7 @@ abstract class ApiEndpoints { static const String deleteScene = '/scene/tap-to-run/{sceneId}'; static const String deleteAutomation = - '/automation/{unitUuid}/{automationId}'; + '/automation/{automationId}'; //////////////////////Door Lock ////////////////////// //online diff --git a/lib/services/api/scene_api.dart b/lib/services/api/scene_api.dart index 65e4382..e2040e9 100644 --- a/lib/services/api/scene_api.dart +++ b/lib/services/api/scene_api.dart @@ -233,8 +233,7 @@ class SceneApi { try { final response = await _httpService.delete( path: ApiEndpoints.deleteAutomation - .replaceAll('{automationId}', automationId) - .replaceAll('{unitUuid}', unitUuid), + .replaceAll('{automationId}', automationId), showServerMessage: false, expectedResponseModel: (json) => json['statusCode'] == 200, ); From 34536e65848987ea6771050c6d1dc6063666300c Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 5 Nov 2024 11:01:49 +0400 Subject: [PATCH 22/26] updated invitation code api --- lib/features/app_layout/bloc/home_cubit.dart | 5 +++-- .../view/widgets/manage_home/home_settings.dart | 2 +- lib/services/api/spaces_api.dart | 15 +++++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart index 777dce6..c9bc4e6 100644 --- a/lib/features/app_layout/bloc/home_cubit.dart +++ b/lib/features/app_layout/bloc/home_cubit.dart @@ -220,9 +220,10 @@ class HomeCubit extends Cubit { } //////////////////////////////////////// API //////////////////////////////////////// - generateInvitation(String unitId) async { + generateInvitation(SpaceModel unit) async { try { - final invitationCode = await SpacesAPI.generateInvitationCode(unitId); + final invitationCode = + await SpacesAPI.generateInvitationCode(unit.id, unit.community.uuid); if (invitationCode.isNotEmpty) { Share.share('The invitation code is $invitationCode'); CustomSnackBar.displaySnackBar( diff --git a/lib/features/menu/view/widgets/manage_home/home_settings.dart b/lib/features/menu/view/widgets/manage_home/home_settings.dart index 54b87a4..8584479 100644 --- a/lib/features/menu/view/widgets/manage_home/home_settings.dart +++ b/lib/features/menu/view/widgets/manage_home/home_settings.dart @@ -112,7 +112,7 @@ class HomeSettingsView extends StatelessWidget { padding: const EdgeInsets.only(bottom: 10), child: GestureDetector( onTap: () async { - await HomeCubit.getInstance().generateInvitation(space?.id ?? ''); + await HomeCubit.getInstance().generateInvitation(space!); }, child: const Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/services/api/spaces_api.dart b/lib/services/api/spaces_api.dart index 9dbb39f..3a9a283 100644 --- a/lib/services/api/spaces_api.dart +++ b/lib/services/api/spaces_api.dart @@ -61,12 +61,19 @@ class SpacesAPI { } static Future generateInvitationCode( - String unitId, - ) async { + String unitId, String communityId) async { final response = await _httpService.get( - path: ApiEndpoints.invitationCode.replaceAll('{unitUuid}', unitId), + path: ApiEndpoints.invitationCode + .replaceAll('{unitUuid}', unitId) + .replaceAll('{communityUuid}', communityId), showServerMessage: false, - expectedResponseModel: (json) => json['invitationCode'], + expectedResponseModel: (json) { + if (json != null && json['data'] != null) { + return json['data']['invitationCode']; + } else { + throw Exception('Data field is null'); + } + }, ); return response; } From 52f6be3db00a6a3c4cfad883888ee75078096a95 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 5 Nov 2024 12:27:27 +0400 Subject: [PATCH 23/26] updated add to room, and verify to space --- lib/features/app_layout/bloc/home_cubit.dart | 6 +-- .../manage_unit_bloc/manage_unit_bloc.dart | 48 +++++++++++++++++-- .../manage_unit_bloc/manage_unit_event.dart | 12 +++++ .../widgets/join_home/join_home_view.dart | 9 ++-- .../widgets/manage_home/assign_devices.dart | 23 +++++++-- lib/services/api/api_links_endpoints.dart | 13 +++-- lib/services/api/home_management_api.dart | 33 +++++++++++-- lib/services/api/spaces_api.dart | 3 +- 8 files changed, 121 insertions(+), 26 deletions(-) diff --git a/lib/features/app_layout/bloc/home_cubit.dart b/lib/features/app_layout/bloc/home_cubit.dart index c9bc4e6..45f2398 100644 --- a/lib/features/app_layout/bloc/home_cubit.dart +++ b/lib/features/app_layout/bloc/home_cubit.dart @@ -239,12 +239,12 @@ class HomeCubit extends Cubit { Future joinAUnit(String code) async { try { - var uuid = + var userUuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? ''; - Map body = {'userUuid': uuid, 'inviteCode': code}; + Map body = {'inviteCode': code}; - final success = await SpacesAPI.joinUnit(body); + final success = await SpacesAPI.joinUnit(userUuid, body); if (success) { await fetchUnitsByUserId(); CustomSnackBar.displaySnackBar('Done successfully'); diff --git a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart index 359d7bb..bd6b653 100644 --- a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart +++ b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_bloc.dart @@ -17,6 +17,7 @@ class ManageUnitBloc extends Bloc { on(_fetchDevicesByRoomId); on(_assignDevice); on(_addNewRoom); + on(_unassignDevice); } void _fetchRoomsAndDevices( @@ -72,11 +73,9 @@ class ManageUnitBloc extends Bloc { try { Map roomDevicesId = {}; emit(LoadingState()); - Map body = { - "deviceUuid": event.deviceId, - "roomUuid": event.roomId - }; - await HomeManagementAPI.assignDeviceToRoom(body); + + await HomeManagementAPI.assignDeviceToRoom( + event.unit.community.uuid, event.unit.id, event.roomId, event.deviceId); final devicesList = await DevicesAPI.getDevicesByRoomId( communityUuid: event.unit.community.uuid, spaceUuid: event.unit.id, @@ -106,6 +105,45 @@ class ManageUnitBloc extends Bloc { } } + + void _unassignDevice( + UnassignRoomEvent event, Emitter emit) async { + try { + Map roomDevicesId = {}; + emit(LoadingState()); + + await HomeManagementAPI.unAssignDeviceToRoom( + event.unit.community.uuid, event.unit.id, event.roomId, event.deviceId); + final devicesList = await DevicesAPI.getDevicesByRoomId( + communityUuid: event.unit.community.uuid, + spaceUuid: event.unit.id, + roomId: event.roomId); + + List allDevicesIds = []; + + allDevices.forEach((element) { + allDevicesIds.add(element.uuid!); + }); + + devicesList.forEach((e) { + if (allDevicesIds.contains(e.uuid!)) { + roomDevicesId[e.uuid!] = true; + } else { + roomDevicesId[e.uuid!] = false; + } + }); + emit(FetchDeviceByRoomIdState( + roomDevices: devicesList, + allDevices: allDevices, + roomDevicesId: roomDevicesId, + roomId: event.roomId)); + } catch (e) { + emit(const ErrorState(message: 'Something went wrong')); + return; + } + } + + _addNewRoom(AddNewRoom event, Emitter emit) async { Map body = {'subspaceName': event.roomName}; try { diff --git a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart index 4db0ea3..08411c1 100644 --- a/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart +++ b/lib/features/menu/bloc/manage_unit_bloc/manage_unit_event.dart @@ -52,3 +52,15 @@ class AssignRoomEvent extends ManageUnitEvent { @override List get props => [roomId, unit]; } + +class UnassignRoomEvent extends ManageUnitEvent { + final String roomId; + final String deviceId; + final SpaceModel unit; + + const UnassignRoomEvent( + {required this.roomId, required this.deviceId, required this.unit}); + + @override + List get props => [roomId, unit]; +} diff --git a/lib/features/menu/view/widgets/join_home/join_home_view.dart b/lib/features/menu/view/widgets/join_home/join_home_view.dart index 69952c9..5ce6c8f 100644 --- a/lib/features/menu/view/widgets/join_home/join_home_view.dart +++ b/lib/features/menu/view/widgets/join_home/join_home_view.dart @@ -44,7 +44,8 @@ class JoinHomeView extends StatelessWidget { controller: textEditingController, decoration: InputDecoration( hintText: 'Invitatoin code', - hintStyle: context.bodyMedium.copyWith(color: Colors.grey), + hintStyle: + context.bodyMedium.copyWith(color: Colors.grey), border: InputBorder.none, ), ), @@ -52,10 +53,12 @@ class JoinHomeView extends StatelessWidget { IconButton( onPressed: () async { if (textEditingController.text.isEmpty) { - CustomSnackBar.displaySnackBar('Please enter the invitation code'); + CustomSnackBar.displaySnackBar( + 'Please enter the invitation code'); return; } - if (await HomeCubit.getInstance().joinAUnit(textEditingController.text)) { + if (await HomeCubit.getInstance() + .joinAUnit(textEditingController.text)) { CustomSnackBar.displaySnackBar('Done successfully'); Navigator.of(context).pop(); } else { diff --git a/lib/features/menu/view/widgets/manage_home/assign_devices.dart b/lib/features/menu/view/widgets/manage_home/assign_devices.dart index e8002ab..12421aa 100644 --- a/lib/features/menu/view/widgets/manage_home/assign_devices.dart +++ b/lib/features/menu/view/widgets/manage_home/assign_devices.dart @@ -77,10 +77,25 @@ class AssignDeviceView extends StatelessWidget { ), GestureDetector( onTap: () { - if (state.roomDevicesId[state - .allDevices[index] - .uuid!] ?? - false == false) { + bool isAssigned = + state.roomDevicesId[state + .allDevices[index] + .uuid!] ?? + false; + if (isAssigned) { + BlocProvider.of< + ManageUnitBloc>( + context) + .add(UnassignRoomEvent( + deviceId: state + .allDevices[ + index] + .uuid ?? + '', + unit: unit, + roomId: roomId)); + } else { + // Tick (assign) the device BlocProvider.of< ManageUnitBloc>( context) diff --git a/lib/services/api/api_links_endpoints.dart b/lib/services/api/api_links_endpoints.dart index a1277a2..5d9528a 100644 --- a/lib/services/api/api_links_endpoints.dart +++ b/lib/services/api/api_links_endpoints.dart @@ -53,14 +53,17 @@ abstract class ApiEndpoints { //POST static const String addUnit = '/unit'; static const String addUnitToUser = '/unit/user'; + static const String verifyInvitationCode = + '/user/{userUuid}/spaces/verify-code'; + //GET static const String unitByUuid = '/unit/'; static const String listSubspace = '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; static const String unitParent = '/unit/parent/{unitUuid}'; static const String unitUser = '/unit/user/'; - static const String invitationCode = '/unit/{unitUuid}/invitation-code'; - static const String verifyInvitationCode = '/unit/user/verify-code'; + static const String invitationCode = + '/communities/{communityUuid}/spaces/{unitUuid}/invitation-code'; //PUT static const String renameUnit = '/unit/{unitUuid}'; @@ -131,7 +134,8 @@ abstract class ApiEndpoints { //PUT static const String editDevicePermission = '/device-permission/edit/{userId}'; - static const String assignDeviceToRoom = '/device/room'; + static const String assignDeviceToRoom = + '/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices/{deviceUuid}'; /// Scene & Automation API //////////////////// /// POST @@ -162,8 +166,7 @@ abstract class ApiEndpoints { /// DELETE static const String deleteScene = '/scene/tap-to-run/{sceneId}'; - static const String deleteAutomation = - '/automation/{automationId}'; + static const String deleteAutomation = '/automation/{automationId}'; //////////////////////Door Lock ////////////////////// //online diff --git a/lib/services/api/home_management_api.dart b/lib/services/api/home_management_api.dart index faf92d4..4151d0f 100644 --- a/lib/services/api/home_management_api.dart +++ b/lib/services/api/home_management_api.dart @@ -59,12 +59,15 @@ class HomeManagementAPI { return list; } - static Future> assignDeviceToRoom( - Map body) async { + static Future> assignDeviceToRoom(String communityId, + String spaceId, String subSpaceId, String deviceId) async { try { - final response = await _httpService.put( - path: ApiEndpoints.assignDeviceToRoom, - body: body, + final response = await _httpService.post( + path: ApiEndpoints.assignDeviceToRoom + .replaceAll('{communityUuid}', communityId) + .replaceAll('{spaceUuid}', spaceId) + .replaceAll('{subSpaceUuid}', subSpaceId) + .replaceAll('{deviceUuid}', deviceId), expectedResponseModel: (json) { return json; }, @@ -74,4 +77,24 @@ class HomeManagementAPI { rethrow; } } + + static Future> unAssignDeviceToRoom(String communityId, + String spaceId, String subSpaceId, String deviceId) async { + try { + final response = await _httpService.delete( + path: ApiEndpoints.assignDeviceToRoom + .replaceAll('{communityUuid}', communityId) + .replaceAll('{spaceUuid}', spaceId) + .replaceAll('{subSpaceUuid}', subSpaceId) + .replaceAll('{deviceUuid}', deviceId), + expectedResponseModel: (json) { + return json; + }, + ); + return response; + } catch (e) { + rethrow; + } + } + } diff --git a/lib/services/api/spaces_api.dart b/lib/services/api/spaces_api.dart index 3a9a283..7a27bf1 100644 --- a/lib/services/api/spaces_api.dart +++ b/lib/services/api/spaces_api.dart @@ -79,10 +79,11 @@ class SpacesAPI { } static Future joinUnit( + String userId, Map body, ) async { final response = await _httpService.post( - path: ApiEndpoints.verifyInvitationCode, + path: ApiEndpoints.verifyInvitationCode.replaceAll('{userUuid}', userId), showServerMessage: false, body: body, expectedResponseModel: (json) => json['success'], From e9615cd351334327162b69ad6465797fdaf5bd0d Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 5 Nov 2024 12:52:11 +0400 Subject: [PATCH 24/26] Fixed show in device bug --- lib/features/scene/model/create_scene_model.dart | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/features/scene/model/create_scene_model.dart b/lib/features/scene/model/create_scene_model.dart index ee7c6b2..c669aa9 100644 --- a/lib/features/scene/model/create_scene_model.dart +++ b/lib/features/scene/model/create_scene_model.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'dart:ffi'; import 'package:flutter/foundation.dart'; @@ -10,7 +9,6 @@ class CreateSceneModel { String sceneName; String decisionExpr; List actions; - bool showInHomePage; CreateSceneModel({ required this.spaceUuid, @@ -19,7 +17,6 @@ class CreateSceneModel { required this.sceneName, required this.decisionExpr, required this.actions, - this.showInHomePage = false, }); CreateSceneModel copyWith({ @@ -38,7 +35,6 @@ class CreateSceneModel { sceneName: sceneName ?? this.sceneName, decisionExpr: decisionExpr ?? this.decisionExpr, actions: actions ?? this.actions, - showInHomePage: showInHomePage ?? this.showInHomePage, ); } @@ -50,16 +46,14 @@ class CreateSceneModel { 'sceneName': sceneName, 'decisionExpr': decisionExpr, 'actions': actions.map((x) => x.toMap()).toList(), - 'showInHomePage': showInHomePage, }; } factory CreateSceneModel.fromMap(Map map) { return CreateSceneModel( spaceUuid: map['spaceUuid'] ?? '', - showInHomePage: map['showInHomePage'] ?? false, - iconId: map['iconUuid'] ?? '', showInDevice: map['showInHomePage'] ?? false, + iconId: map['iconUuid'] ?? '', sceneName: map['sceneName'] ?? '', decisionExpr: map['decisionExpr'] ?? '', actions: List.from( @@ -87,8 +81,7 @@ class CreateSceneModel { other.showInDevice == showInDevice && other.sceneName == sceneName && other.decisionExpr == decisionExpr && - listEquals(other.actions, actions) && - other.showInHomePage == showInHomePage; + listEquals(other.actions, actions); } @override From 9c873fb0c5b88f0c2ba32b52f100de5877c03a27 Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 5 Nov 2024 15:53:31 +0400 Subject: [PATCH 25/26] fixed icon assets issue --- .../devices/view/widgets/scene_listview.dart | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/features/devices/view/widgets/scene_listview.dart b/lib/features/devices/view/widgets/scene_listview.dart index 4fa2031..5a19bc5 100644 --- a/lib/features/devices/view/widgets/scene_listview.dart +++ b/lib/features/devices/view/widgets/scene_listview.dart @@ -40,10 +40,13 @@ class SceneListview extends StatelessWidget { sceneName: scene.name, ), ); - context.read().add(const SmartSceneClearEvent()); + context + .read() + .add(const SmartSceneClearEvent()); - BlocProvider.of(context) - .add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false)); + BlocProvider.of(context).add( + FetchSceneTasksEvent( + sceneId: scene.id, isAutomation: false)); /// the state to set the scene type must be after the fetch BlocProvider.of(context) @@ -56,14 +59,27 @@ class SceneListview extends StatelessWidget { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: Image.memory( - height: 32, - width: 32, - scene.iconInBytes, - fit: BoxFit.fill, - errorBuilder: (context, error, stackTrace) => Image.asset( - height: 32, width: 32, fit: BoxFit.fill, Assets.assetsIconsLogo), - ), + child: scene.iconInBytes != null && + scene.iconInBytes.isNotEmpty + ? Image.memory( + scene.iconInBytes, + height: 32, + width: 32, + fit: BoxFit.fill, + errorBuilder: (context, error, stackTrace) => + Image.asset( + Assets.assetsIconsLogo, + height: 32, + width: 32, + fit: BoxFit.fill, + ), + ) + : Image.asset( + Assets.assetsIconsLogo, + height: 32, + width: 32, + fit: BoxFit.fill, + ), ), Expanded( child: BodyMedium( From 391d6349ccbae5972ee46b8bd2b7d2e34c32319b Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Tue, 5 Nov 2024 15:54:48 +0400 Subject: [PATCH 26/26] Fixed the assets order --- .../widgets/scene_view_widget/scene_item.dart | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/lib/features/scene/widgets/scene_view_widget/scene_item.dart b/lib/features/scene/widgets/scene_view_widget/scene_item.dart index be2be1b..220cd96 100644 --- a/lib/features/scene/widgets/scene_view_widget/scene_item.dart +++ b/lib/features/scene/widgets/scene_view_widget/scene_item.dart @@ -38,8 +38,8 @@ class SceneItem extends StatelessWidget { onTap: () { context.read().add(const SmartSceneClearEvent()); if (disablePlayButton == false) { - BlocProvider.of(context) - .add(FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false)); + BlocProvider.of(context).add( + FetchSceneTasksEvent(sceneId: scene.id, isAutomation: false)); /// the state to set the scene type must be after the fetch BlocProvider.of(context) @@ -73,22 +73,32 @@ class SceneItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - if (!disablePlayButton) + if (!disablePlayButton && scene.iconInBytes != null && scene.iconInBytes.isNotEmpty) Image.memory( + scene.iconInBytes, + height: 32, + width: 32, + fit: BoxFit.fill, + errorBuilder: (context, error, stackTrace) => Image.asset( + Assets.assetsIconsLogo, + height: 32, + width: 32, + fit: BoxFit.fill), + ), + if (disablePlayButton || scene.iconInBytes == null || scene.iconInBytes.isEmpty) + SvgPicture.asset( + Assets.automationIcon, height: 32, width: 32, - scene.iconInBytes, fit: BoxFit.fill, - errorBuilder: (context, error, stackTrace) => - Image.asset(height: 32, width: 32, fit: BoxFit.fill, Assets.assetsIconsLogo), ), - if (disablePlayButton) - SvgPicture.asset(height: 32, width: 32, fit: BoxFit.fill, Assets.automationIcon), disablePlayButton == false ? IconButton( padding: EdgeInsets.zero, onPressed: () { - context.read().add(SceneTrigger(scene.id, scene.name)); + context + .read() + .add(SceneTrigger(scene.id, scene.name)); }, icon: isLoading ? const Center( @@ -110,11 +120,15 @@ class SceneItem extends StatelessWidget { activeColor: ColorsManager.primaryColor, value: scene.status == 'enable' ? true : false, onChanged: (value) { - context.read().add(UpdateAutomationStatus( - automationStatusUpdate: AutomationStatusUpdate( - isEnable: value, - spaceUuid: HomeCubit.getInstance().selectedSpace!.id!), - automationId: scene.id)); + context.read().add( + UpdateAutomationStatus( + automationStatusUpdate: + AutomationStatusUpdate( + isEnable: value, + spaceUuid: HomeCubit.getInstance() + .selectedSpace! + .id!), + automationId: scene.id)); }, ), ],