mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-29 03:07:47 +00:00
Wait to process messages until after migration when screenlocked
Fixes #7390
This commit is contained in:
parent
751cc0e86a
commit
9d5d43cf3a
@ -1318,6 +1318,8 @@
|
||||
<string name="ConversationListActivity_signal_needs_contacts_permission_in_order_to_search_your_contacts_but_it_has_been_permanently_denied">Signal needs Contacts permission in order to search your contacts, but it has been permanently denied. Please continue to app settings, select \"Permissions\", and enable \"Contacts\".</string>
|
||||
<string name="conversation_activity__enable_signal_messages">ENABLE SIGNAL MESSAGES</string>
|
||||
<string name="SQLCipherMigrationHelper_migrating_signal_database">Migrating Signal database</string>
|
||||
<string name="PushDecryptJob_new_locked_message">New locked message</string>
|
||||
<string name="PushDecryptJob_unlock_to_view_pending_messages">Unlock to view pending messages</string>
|
||||
|
||||
|
||||
<!-- EOF -->
|
||||
|
@ -275,6 +275,10 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
if (params[0] < SQLCIPHER) {
|
||||
scheduleMessagesInPushDatabase(context);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,19 @@
|
||||
package org.thoughtcrime.securesms.jobs;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.ConversationListActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
|
||||
import org.thoughtcrime.securesms.attachments.PointerAttachment;
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||
@ -112,12 +118,26 @@ public class PushDecryptJob extends ContextJob {
|
||||
|
||||
@Override
|
||||
public void onRun() throws NoSuchMessageException {
|
||||
|
||||
if (!IdentityKeyUtil.hasIdentityKey(context)) {
|
||||
Log.w(TAG, "Skipping job, waiting for migration...");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextSecurePreferences.getNeedsSqlCipherMigration(context)) {
|
||||
Log.w(TAG, "Skipping job, waiting for sqlcipher migration...");
|
||||
NotificationManagerCompat.from(context).notify(494949,
|
||||
new NotificationCompat.Builder(context)
|
||||
.setSmallIcon(R.drawable.icon_notification)
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
||||
.setContentTitle(context.getString(R.string.PushDecryptJob_new_locked_message))
|
||||
.setContentText(context.getString(R.string.PushDecryptJob_unlock_to_view_pending_messages))
|
||||
.setContentIntent(PendingIntent.getActivity(context, 0, new Intent(context, ConversationListActivity.class), 0))
|
||||
.setDefaults(NotificationCompat.DEFAULT_SOUND | NotificationCompat.DEFAULT_VIBRATE)
|
||||
.build());
|
||||
return;
|
||||
}
|
||||
|
||||
PushDatabase database = DatabaseFactory.getPushDatabase(context);
|
||||
SignalServiceEnvelope envelope = database.get(messageId);
|
||||
Optional<Long> optionalSmsMessageId = smsMessageId > 0 ? Optional.of(smsMessageId) : Optional.absent();
|
||||
|
Loading…
x
Reference in New Issue
Block a user