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 { var emailReceiverList = [].obs; var phoneReceiverList = [].obs; var countryName = '中国'.obs; var countryCode = 86.obs; var familyData = DataList().obs; var msgNoticeInfo = MsgNoticeData().obs; NotificationModeState() { Map map = Get.arguments; if (map['familyData'] != null) { familyData.value = map['familyData']; if (familyData.value.settingValue != null) { for (NoticeWay item in familyData.value.settingValue!.noticeWayList!) { if (item.type == 'mail' && item.accounts != null) { for (Accounts account in item.accounts!) { if (account.account != null) { MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData(); msgNoticeModeData.receiveEmail = account.account!; emailReceiverList.value.add(msgNoticeModeData); } } } else if (item.type == 'sms' && item.accounts != null) { for (Accounts account in item.accounts!) { if (account.account != null && account.countryCode != null) { 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 (NoticeWay item in msgNoticeInfo.value.dayNotOpenDoorNoticeWayList!) { if (item.type == 'mail' && item.accounts != null) { for (Accounts account in item.accounts!) { if (account.account != null) { MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData(); msgNoticeModeData.receiveEmail = account.account!; emailReceiverList.value.add(msgNoticeModeData); } } } else if (item.type == 'sms' && item.accounts != null) { for (Accounts account in item.accounts!) { if (account.account != null && account.countryCode != null) { MsgNoticeModeData msgNoticeModeData = MsgNoticeModeData(); msgNoticeModeData.receivePhone = account.account!; msgNoticeModeData.countryCode = account.countryCode!; phoneReceiverList.value.add(msgNoticeModeData); } } } } } } } }