use of org.thoughtcrime.securesms.database.model.SmsMessageRecord in project Signal-Android by WhisperSystems.
the class SmsSentJob method handleSentResult.
private void handleSentResult(long messageId, int result) {
try {
MessageDatabase database = SignalDatabase.sms();
SmsMessageRecord record = database.getSmsMessage(messageId);
switch(result) {
case Activity.RESULT_OK:
database.markAsSent(messageId, false);
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
case SmsManager.RESULT_ERROR_RADIO_OFF:
if (isMultipart) {
Log.w(TAG, "Service connectivity problem, but not retrying due to multipart");
database.markAsSentFailed(messageId);
ApplicationDependencies.getMessageNotifier().notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
} else {
Log.w(TAG, "Service connectivity problem, requeuing...");
ApplicationDependencies.getJobManager().add(new SmsSendJob(messageId, record.getIndividualRecipient(), runAttempt + 1));
}
break;
default:
database.markAsSentFailed(messageId);
ApplicationDependencies.getMessageNotifier().notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
}
} catch (NoSuchMessageException e) {
Log.w(TAG, e);
}
}
use of org.thoughtcrime.securesms.database.model.SmsMessageRecord in project Signal-Android by WhisperSystems.
the class SmsDatabase method getSmsMessage.
@Override
public SmsMessageRecord getSmsMessage(long messageId) throws NoSuchMessageException {
SQLiteDatabase db = databaseHelper.getSignalReadableDatabase();
Cursor cursor = db.query(TABLE_NAME, MESSAGE_PROJECTION, ID_WHERE, new String[] { messageId + "" }, null, null, null);
Reader reader = new Reader(cursor);
SmsMessageRecord record = reader.getNext();
reader.close();
if (record == null)
throw new NoSuchMessageException("No message for ID: " + messageId);
else
return record;
}
Aggregations