finish sender_list && plain-text-search
This commit is contained in:
@@ -30,6 +30,7 @@ class _MessageListPageState extends State<MessageListPage> with RouteAware {
|
||||
PagingController<String, SCNMessage> _pagingController = PagingController.fromValue(PagingState(nextPageKey: null, itemList: [], error: null), firstPageKey: '@start');
|
||||
|
||||
Map<String, Channel>? _channels = null;
|
||||
bool _channelsFetched = false;
|
||||
|
||||
bool _isInitialized = false;
|
||||
|
||||
@@ -135,9 +136,12 @@ class _MessageListPageState extends State<MessageListPage> with RouteAware {
|
||||
}
|
||||
|
||||
try {
|
||||
if (_channels == null) {
|
||||
if (_channels == null || !_channelsFetched) {
|
||||
final channels = await APIClient.getChannelList(acc, ChannelSelector.allAny);
|
||||
_channels = <String, Channel>{for (var v in channels) v.channel.channelID: v.channel};
|
||||
setState(() {
|
||||
_channels = <String, Channel>{for (var v in channels) v.channel.channelID: v.channel};
|
||||
_channelsFetched = true;
|
||||
});
|
||||
|
||||
SCNDataCache().setChannelCache(channels); // no await
|
||||
}
|
||||
@@ -314,6 +318,11 @@ class _MessageListPageState extends State<MessageListPage> with RouteAware {
|
||||
filter.searchFilter = chipletsSearch.map((p) => p.value as String).toList();
|
||||
}
|
||||
|
||||
var chipletsPlainSearch = _filterChiplets.where((p) => p.type == MessageFilterChipletType.plainSearch).toList();
|
||||
if (chipletsPlainSearch.isNotEmpty) {
|
||||
filter.plainSearchFilter = chipletsPlainSearch.map((p) => p.value as String).toList();
|
||||
}
|
||||
|
||||
var chipletsKeyTokens = _filterChiplets.where((p) => p.type == MessageFilterChipletType.sendkey).toList();
|
||||
if (chipletsKeyTokens.isNotEmpty) {
|
||||
filter.usedKeys = chipletsKeyTokens.map((p) => p.value as String).toList();
|
||||
@@ -329,6 +338,13 @@ class _MessageListPageState extends State<MessageListPage> with RouteAware {
|
||||
filter.senderNames = chipletSender.map((p) => p.value as String).toList();
|
||||
}
|
||||
|
||||
var chipletsTimeRange = _filterChiplets.where((p) => p.type == MessageFilterChipletType.timeRange).toList();
|
||||
if (chipletsTimeRange.isNotEmpty) {
|
||||
//TODO
|
||||
//filter.timeAfter = chipletsTimeRange[0].value1 as DateTime;
|
||||
//filter.timeBefore = chipletsTimeRange[0].value2 as DateTime;
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user