mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-16 01:56:24 +00:00
push connecting to automation api
This commit is contained in:
@ -94,20 +94,21 @@ class ThenContainer extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
},
|
||||
onWillAcceptWithDetails: (data) {
|
||||
if (data == null) return false;
|
||||
// onWillAcceptWithDetails: (data) {
|
||||
// if (data == null) return false;
|
||||
// return data.data;
|
||||
|
||||
if (state.isTabToRun) {
|
||||
return data.data['type'] == 'automation';
|
||||
}
|
||||
// // if (state.isTabToRun) {
|
||||
// // return data.data['type'] == 'automation';
|
||||
// // }
|
||||
|
||||
if (state.isAutomation) {
|
||||
return data.data['type'] == 'scene' ||
|
||||
data.data['type'] == 'automation';
|
||||
}
|
||||
// // if (state.isAutomation) {
|
||||
// // return data.data['type'] == 'scene' ||
|
||||
// // data.data['type'] == 'automation';
|
||||
// // }
|
||||
|
||||
return data.data['deviceId'] != null;
|
||||
},
|
||||
// // return data.data['deviceId'] != null;
|
||||
// },
|
||||
onAcceptWithDetails: (data) async {
|
||||
final uniqueCustomId = const Uuid().v4();
|
||||
final mutableData = Map<String, dynamic>.from(data.data);
|
||||
@ -124,13 +125,16 @@ class ThenContainer extends StatelessWidget {
|
||||
builder: (BuildContext context) => AutomationDialog(
|
||||
automationName: mutableData['name'] ?? 'Automation',
|
||||
automationId: mutableData['deviceId'] ?? '',
|
||||
uniqueCustomId: uniqueCustomId,
|
||||
),
|
||||
);
|
||||
|
||||
if (result != null) {
|
||||
context
|
||||
.read<RoutineBloc>()
|
||||
.add(AddToThenContainer(mutableData));
|
||||
context.read<RoutineBloc>().add(AddToThenContainer({
|
||||
...mutableData,
|
||||
'imagePath': Assets.automation,
|
||||
'title': mutableData['name'],
|
||||
}));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user