|
...
|
...
|
@@ -3932,99 +3932,100 @@ class InvicationPageState extends State<InvicationPage> |
|
|
|
_getCallLog() async {
|
|
|
|
try {
|
|
|
|
Iterable<CallLogEntry> result = await CallLog.query();
|
|
|
|
List<Picker.PickerItem<dynamic>> data = [];
|
|
|
|
List<Picker.PickerItem<dynamic>> data = [];
|
|
|
|
|
|
|
|
List<CallLogEntry> object = Utils.removeDuplicates(result.toList());
|
|
|
|
List<CallLogEntry> object = Utils.removeDuplicates(result.toList());
|
|
|
|
|
|
|
|
print(object);
|
|
|
|
print(object);
|
|
|
|
|
|
|
|
_baseIndoProvider.userHistorys = [];
|
|
|
|
showPhoneHistory = false;
|
|
|
|
// setState(() {});
|
|
|
|
|
|
|
|
object.forEach((element) {
|
|
|
|
_baseIndoProvider.userHistorys.add(UserHistoryEntity(
|
|
|
|
'', '', element.name ?? '', '1', element.number, '', '', ''));
|
|
|
|
|
|
|
|
String title = '';
|
|
|
|
title += ' ${element.number ?? ''}';
|
|
|
|
if (element.name != null && element.name != '') {
|
|
|
|
title += ' ${element.name}';
|
|
|
|
}
|
|
|
|
|
|
|
|
String stateStr = ''; //状态
|
|
|
|
|
|
|
|
if (element.callType.name == 'incoming' ||
|
|
|
|
element.callType.name == 'wifiIncoming' ||
|
|
|
|
element.callType.name == 'answeredExternally') {
|
|
|
|
stateStr = ' 呼入';
|
|
|
|
} else if (element.callType.name == 'outgoing' ||
|
|
|
|
element.callType.name == 'wifiOutgoing' ||
|
|
|
|
element.callType.name == 'voiceMail') {
|
|
|
|
stateStr = ' 呼出';
|
|
|
|
} else if (element.callType.name == 'missed') {
|
|
|
|
stateStr = ' 未接';
|
|
|
|
} else if (element.callType.name == 'rejected') {
|
|
|
|
stateStr = ' 拒接';
|
|
|
|
} else if (element.callType.name == 'blocked') {
|
|
|
|
stateStr = ' 拦截';
|
|
|
|
}
|
|
|
|
|
|
|
|
String sunString =
|
|
|
|
Utils.formatCallLogFromMill(element.timestamp.toString());
|
|
|
|
|
|
|
|
data.add(Picker.PickerItem(
|
|
|
|
text: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(30),
|
|
|
|
Text(title ?? '',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16), color: MyColours.color_515151)),
|
|
|
|
Expanded(
|
|
|
|
child: Text(stateStr ?? '',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16),
|
|
|
|
color: MyColours.color_26000000))),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(right: w(15)),
|
|
|
|
child: Text(sunString ?? '',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16), color: MyColours.color_515151)))
|
|
|
|
],
|
|
|
|
)));
|
|
|
|
});
|
|
|
|
if (data.length > 0) {
|
|
|
|
//有记录,底部弹窗展示
|
|
|
|
// showPhoneHistory = true;
|
|
|
|
_baseIndoProvider.userHistorys = [];
|
|
|
|
showPhoneHistory = false;
|
|
|
|
// setState(() {});
|
|
|
|
DialogUtil.showSelectCusmanWidgetDialog(context, data, (value) {
|
|
|
|
if (value != null) {
|
|
|
|
UserHistoryEntity userHistoryEntity =
|
|
|
|
_baseIndoProvider.userHistorys[value[0]];
|
|
|
|
|
|
|
|
sexStr = userHistoryEntity.sexStr;
|
|
|
|
object.forEach((element) {
|
|
|
|
_baseIndoProvider.userHistorys.add(UserHistoryEntity(
|
|
|
|
'', '', element.name ?? '', '1', element.number, '', '', ''));
|
|
|
|
|
|
|
|
sexSelectIndex = sexList.indexOf(sexStr);
|
|
|
|
String title = '';
|
|
|
|
title += ' ${element.number ?? ''}';
|
|
|
|
if (element.name != null && element.name != '') {
|
|
|
|
title += ' ${element.name}';
|
|
|
|
}
|
|
|
|
|
|
|
|
_getIsMemberByPhone(userHistoryEntity.phone);
|
|
|
|
needHistory = true;
|
|
|
|
_showConfirmWidget(needHistory: true, index: value[0]);
|
|
|
|
String stateStr = ''; //状态
|
|
|
|
|
|
|
|
if (element.callType.name == 'incoming' ||
|
|
|
|
element.callType.name == 'wifiIncoming' ||
|
|
|
|
element.callType.name == 'answeredExternally') {
|
|
|
|
stateStr = ' 呼入';
|
|
|
|
} else if (element.callType.name == 'outgoing' ||
|
|
|
|
element.callType.name == 'wifiOutgoing' ||
|
|
|
|
element.callType.name == 'voiceMail') {
|
|
|
|
stateStr = ' 呼出';
|
|
|
|
} else if (element.callType.name == 'missed') {
|
|
|
|
stateStr = ' 未接';
|
|
|
|
} else if (element.callType.name == 'rejected') {
|
|
|
|
stateStr = ' 拒接';
|
|
|
|
} else if (element.callType.name == 'blocked') {
|
|
|
|
stateStr = ' 拦截';
|
|
|
|
}
|
|
|
|
}, title: '从通话记录选择客人电话', selecteds: [
|
|
|
|
// _getFirSelected(hourAndMinute, data),
|
|
|
|
// _getSecSelected(hourAndMinute)
|
|
|
|
]).then((value) {
|
|
|
|
print(value);
|
|
|
|
|
|
|
|
String sunString =
|
|
|
|
Utils.formatCallLogFromMill(element.timestamp.toString());
|
|
|
|
|
|
|
|
data.add(Picker.PickerItem(
|
|
|
|
text: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(30),
|
|
|
|
Text(title ?? '',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16), color: MyColours.color_515151)),
|
|
|
|
Expanded(
|
|
|
|
child: Text(stateStr ?? '',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16),
|
|
|
|
color: MyColours.color_26000000))),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(right: w(15)),
|
|
|
|
child: Text(sunString ?? '',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(16), color: MyColours.color_515151)))
|
|
|
|
],
|
|
|
|
)));
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
Utils.showToast('暂无通话记录!');
|
|
|
|
}
|
|
|
|
if (data.length > 0) {
|
|
|
|
//有记录,底部弹窗展示
|
|
|
|
// showPhoneHistory = true;
|
|
|
|
// setState(() {});
|
|
|
|
DialogUtil.showSelectCusmanWidgetDialog(context, data, (value) {
|
|
|
|
if (value != null) {
|
|
|
|
UserHistoryEntity userHistoryEntity =
|
|
|
|
_baseIndoProvider.userHistorys[value[0]];
|
|
|
|
|
|
|
|
sexStr = userHistoryEntity.sexStr;
|
|
|
|
|
|
|
|
sexSelectIndex = sexList.indexOf(sexStr);
|
|
|
|
|
|
|
|
_getIsMemberByPhone(userHistoryEntity.phone);
|
|
|
|
needHistory = true;
|
|
|
|
_showConfirmWidget(needHistory: true, index: value[0]);
|
|
|
|
}
|
|
|
|
}, title: '从通话记录选择客人电话', selecteds: [
|
|
|
|
// _getFirSelected(hourAndMinute, data),
|
|
|
|
// _getSecSelected(hourAndMinute)
|
|
|
|
]).then((value) {
|
|
|
|
print(value);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
Utils.showToast('暂无通话记录!');
|
|
|
|
}
|
|
|
|
} catch (e) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
_openAddressBook() async {
|
|
...
|
...
|
@@ -4057,10 +4058,6 @@ class InvicationPageState extends State<InvicationPage> |
|
|
|
} else {
|
|
|
|
_getContactData();
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_getContactData() async {
|
...
|
...
|
|