@Override
 public Observable<List<MessageEntity>> importMessage() {
   return Observable.defer(
       () -> {
         ProcessSms processSms = mPostMessage.getProcessSms();
         List<SmsMessage> smsMessages = processSms.importMessages();
         List<Message> messages = new ArrayList<>();
         for (SmsMessage smsMessage : smsMessages) {
           messages.add(mPostMessage.map(smsMessage));
         }
         return Observable.just(mMessageDataMapper.map(messages));
       });
 }
Esempio n. 2
0
  protected boolean sendTaskSms(Message message) {

    if (message.messageDate == null || !TextUtils.isEmpty(message.messageUuid)) {
      final Long timeMills = System.currentTimeMillis();
      message.messageDate = new Date(timeMills);
    }
    if (message.messageUuid == null || TextUtils.isEmpty(message.messageUuid)) {
      message.messageUuid = mProcessSms.getUuid();
    }
    message.messageType = Message.Type.TASK;
    if (mPrefsFactory.smsReportDelivery().get()) {
      mProcessSms.sendSms(map(message), true);
    }
    mProcessSms.sendSms(map(message), false);
    return true;
  }
Esempio n. 3
0
 protected void deleteFromSmsInbox(Message message) {
   if (mPrefsFactory.autoDelete().get()) {
     mProcessSms.delSmsFromInbox(map(message));
     mFileManager.appendAndClose(
         mContext.getString(R.string.auto_message_deleted, message.messageBody));
   }
 }