kopia lustrzana https://github.com/ryukoposting/Signal-Android
Disable conversation shortcuts when screen lock is enabled.
rodzic
937a288cee
commit
59d69192c6
|
@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.jobs;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||
|
@ -11,6 +12,7 @@ import org.thoughtcrime.securesms.jobmanager.Job;
|
|||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.transport.RetryLaterException;
|
||||
import org.thoughtcrime.securesms.util.ConversationUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -23,6 +25,8 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
public class ConversationShortcutUpdateJob extends BaseJob {
|
||||
|
||||
private static final String TAG = Log.tag(ConversationShortcutUpdateJob.class);
|
||||
|
||||
public static final String KEY = "ConversationShortcutUpdateJob";
|
||||
|
||||
public ConversationShortcutUpdateJob() {
|
||||
|
@ -50,6 +54,12 @@ public class ConversationShortcutUpdateJob extends BaseJob {
|
|||
@Override
|
||||
@RequiresApi(ConversationUtil.CONVERSATION_SUPPORT_VERSION)
|
||||
protected void onRun() throws Exception {
|
||||
if (TextSecurePreferences.isScreenLockEnabled(context)) {
|
||||
Log.i(TAG, "Screen lock enabled. Clearing shortcuts.");
|
||||
ConversationUtil.clearAllShortcuts(context);
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadDatabase threadDatabase = DatabaseFactory.getThreadDatabase(context);
|
||||
int maxShortcuts = ConversationUtil.getMaxShortcuts(context);
|
||||
List<Recipient> ranked = new ArrayList<>(maxShortcuts);
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.thoughtcrime.securesms.contactshare.SimpleTextWatcher;
|
|||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.jobs.ConversationShortcutUpdateJob;
|
||||
import org.thoughtcrime.securesms.jobs.MultiDeviceConfigurationUpdateJob;
|
||||
import org.thoughtcrime.securesms.jobs.RefreshAttributesJob;
|
||||
import org.thoughtcrime.securesms.keyvalue.KbsValues;
|
||||
|
@ -239,6 +240,9 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
|||
Intent intent = new Intent(getContext(), KeyCachingService.class);
|
||||
intent.setAction(KeyCachingService.LOCK_TOGGLED_EVENT);
|
||||
getContext().startService(intent);
|
||||
|
||||
ApplicationDependencies.getJobManager().add(new ConversationShortcutUpdateJob());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue