shounakmulay / Telephony

Flutter plugin for telephony features like query device sms directory, listen for incoming messages, retrieve various network parameters, etc.
https://telephony.shounakmulay.dev
MIT License
138 stars 126 forks source link

PlatformException while using filter #134

Open STRENCH0 opened 2 years ago

STRENCH0 commented 2 years ago

Trying to filter Conversations with inValues() have such exception:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(failed_to_fetch_sms, near "?": syntax error (code 1 SQLITE_ERROR): , while compiling: SELECT sms_restricted.body AS snippet, sms_restricted.thread_id AS thread_id, groups.msg_count AS msg_count FROM sms_restricted, (SELECT thread_id AS group_thread_id, MAX(date) AS group_date, COUNT(*) AS msg_count FROM sms_restricted GROUP BY thread_id) AS groups WHERE (sms_restricted.thread_id=groups.group_thread_id AND sms_restricted.date=groups.group_date) AND ( thread_id IN ?) ORDER BY msg_count DESC, null, null)

My code is below. List with ids is not empty

 Future<List<SmsConversation>> _getConversations(List<String> conversationIds) async {
    return _telephony.getConversations(
        filter: ConversationFilter.where(ConversationColumn.THREAD_ID).inValues(conversationIds),
        sortOrder: [OrderBy(ConversationColumn.MSG_COUNT, sort: Sort.DESC)]);
  }

At the same time equals works fine.