Log the version in our PersistentLogger.

This commit is contained in:
Greyson Parrelli 2020-11-09 12:47:10 -05:00
parent 20ad166e0f
commit 956e3924ff
2 changed files with 8 additions and 1 deletions

View File

@ -1038,12 +1038,16 @@ public final class PushProcessMessageJob extends BaseJob {
}
private void handleSynchronizeViewOnceOpenMessage(@NonNull ViewOnceOpenMessage openMessage, long envelopeTimestamp) {
log(TAG, String.valueOf(envelopeTimestamp), "Handling a view-once open for message: " + openMessage.getTimestamp());
RecipientId author = Recipient.externalPush(context, openMessage.getSender()).getId();
long timestamp = openMessage.getTimestamp();
MessageRecord record = DatabaseFactory.getMmsSmsDatabase(context).getMessageFor(timestamp, author);
if (record != null && record.isMms()) {
DatabaseFactory.getAttachmentDatabase(context).deleteAttachmentFilesForViewOnceMessage(record.getId());
} else {
warn(TAG, String.valueOf(envelopeTimestamp), "Got a view-once open message for a message we don't have!");
}
MessageNotifier messageNotifier = ApplicationDependencies.getMessageNotifier();

View File

@ -5,6 +5,7 @@ import android.content.Context;
import androidx.annotation.AnyThread;
import androidx.annotation.WorkerThread;
import org.thoughtcrime.securesms.BuildConfig;
import org.thoughtcrime.securesms.database.NoExternalStorageException;
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
@ -34,6 +35,8 @@ public final class PersistentLogger extends Log.Logger {
private static final String LOG_E = "E";
private static final String LOG_WTF = "A";
private static final String VERSION_TAG = "[" + BuildConfig.VERSION_NAME + "]";
private static final String LOG_DIRECTORY = "log";
private static final String FILENAME_PREFIX = "log-";
private static final int MAX_LOG_FILES = 7;
@ -239,6 +242,6 @@ public final class PersistentLogger extends Log.Logger {
}
private String buildEntry(String level, String tag, String message, Date date) {
return DATE_FORMAT.format(date) + ' ' + level + ' ' + tag + ": " + message;
return VERSION_TAG + ' ' +DATE_FORMAT.format(date) + ' ' + level + ' ' + tag + ": " + message;
}
}