71 lines
3.0 KiB
Dart
Executable File
71 lines
3.0 KiB
Dart
Executable File
import 'package:get/get.dart';
|
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
|
|
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/openDoorNotify/openDoorNotify_entity.dart';
|
|
import 'package:star_lock/main/lockDetail/messageWarn/notificationMode/notificationMode_data.dart';
|
|
|
|
class NotificationModeState {
|
|
|
|
NotificationModeState() {
|
|
final Map map = Get.arguments;
|
|
if (map['familyData'] != null) {
|
|
familyData.value = map['familyData'];
|
|
if (familyData.value.settingValue != null) {
|
|
for (final NoticeWay item in familyData.value.settingValue!.noticeWayList!) {
|
|
if (item.type == 'mail' && item.accounts != null) {
|
|
for (final Accounts account in item.accounts!) {
|
|
if (account.account != null) {
|
|
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
|
msgNoticeModeData.receiveEmail = account.account!;
|
|
emailReceiverList.value.add(msgNoticeModeData);
|
|
}
|
|
}
|
|
} else if (item.type == 'sms' && item.accounts != null) {
|
|
for (final Accounts account in item.accounts!) {
|
|
if (account.account != null && account.countryCode != null) {
|
|
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
|
msgNoticeModeData.receivePhone = account.account!;
|
|
msgNoticeModeData.countryCode = account.countryCode!;
|
|
phoneReceiverList.value.add(msgNoticeModeData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (map['msgNoticeInfo'] != null) {
|
|
msgNoticeInfo.value = map['msgNoticeInfo'];
|
|
if (msgNoticeInfo.value.dayNotOpenDoorNoticeWayList != null) {
|
|
for (final NoticeWay item
|
|
in msgNoticeInfo.value.dayNotOpenDoorNoticeWayList!) {
|
|
if (item.type == 'mail' && item.accounts != null) {
|
|
for (final Accounts account in item.accounts!) {
|
|
if (account.account != null) {
|
|
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
|
msgNoticeModeData.receiveEmail = account.account!;
|
|
emailReceiverList.value.add(msgNoticeModeData);
|
|
}
|
|
}
|
|
} else if (item.type == 'sms' && item.accounts != null) {
|
|
for (final Accounts account in item.accounts!) {
|
|
if (account.account != null && account.countryCode != null) {
|
|
final MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData();
|
|
msgNoticeModeData.receivePhone = account.account!;
|
|
msgNoticeModeData.countryCode = account.countryCode!;
|
|
phoneReceiverList.value.add(msgNoticeModeData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
RxList emailReceiverList = [].obs;
|
|
RxList phoneReceiverList = [].obs;
|
|
|
|
RxString countryName = '中国'.tr.obs;
|
|
RxInt countryCode = 86.obs;
|
|
Rx<DataList> familyData = DataList().obs;
|
|
Rx<MsgNoticeData> msgNoticeInfo = MsgNoticeData().obs;
|
|
}
|