mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-25 20:37:32 +00:00
Feature flag automatic session reset.
This commit is contained in:
@@ -15,6 +15,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
|||||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||||
import org.thoughtcrime.securesms.transport.RetryLaterException;
|
import org.thoughtcrime.securesms.transport.RetryLaterException;
|
||||||
|
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||||
import org.whispersystems.libsignal.util.guava.Optional;
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||||
import org.whispersystems.signalservice.api.crypto.UnidentifiedAccessPair;
|
import org.whispersystems.signalservice.api.crypto.UnidentifiedAccessPair;
|
||||||
@@ -82,9 +83,13 @@ public class AutomaticSessionResetJob extends BaseJob {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRun() throws Exception {
|
protected void onRun() throws Exception {
|
||||||
SessionUtil.archiveSession(context, recipientId, deviceId);
|
if (FeatureFlags.automaticSessionReset()) {
|
||||||
insertLocalMessage();
|
SessionUtil.archiveSession(context, recipientId, deviceId);
|
||||||
sendNullMessage();
|
insertLocalMessage();
|
||||||
|
sendNullMessage();
|
||||||
|
} else {
|
||||||
|
insertLocalMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -67,6 +67,7 @@ public final class FeatureFlags {
|
|||||||
private static final String SEND_VIEWED_RECEIPTS = "android.sendViewedReceipts";
|
private static final String SEND_VIEWED_RECEIPTS = "android.sendViewedReceipts";
|
||||||
private static final String CUSTOM_VIDEO_MUXER = "android.customVideoMuxer";
|
private static final String CUSTOM_VIDEO_MUXER = "android.customVideoMuxer";
|
||||||
private static final String CDS_REFRESH_INTERVAL = "cds.syncInterval.seconds";
|
private static final String CDS_REFRESH_INTERVAL = "cds.syncInterval.seconds";
|
||||||
|
private static final String AUTOMATIC_SESSION_RESET = "android.automaticSessionReset";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||||
@@ -90,7 +91,8 @@ public final class FeatureFlags {
|
|||||||
SEND_VIEWED_RECEIPTS,
|
SEND_VIEWED_RECEIPTS,
|
||||||
CUSTOM_VIDEO_MUXER,
|
CUSTOM_VIDEO_MUXER,
|
||||||
CDS_REFRESH_INTERVAL,
|
CDS_REFRESH_INTERVAL,
|
||||||
GROUP_NAME_MAX_LENGTH
|
GROUP_NAME_MAX_LENGTH,
|
||||||
|
AUTOMATIC_SESSION_RESET
|
||||||
);
|
);
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -124,7 +126,8 @@ public final class FeatureFlags {
|
|||||||
GV1_MIGRATION_JOB,
|
GV1_MIGRATION_JOB,
|
||||||
CUSTOM_VIDEO_MUXER,
|
CUSTOM_VIDEO_MUXER,
|
||||||
CDS_REFRESH_INTERVAL,
|
CDS_REFRESH_INTERVAL,
|
||||||
GROUP_NAME_MAX_LENGTH
|
GROUP_NAME_MAX_LENGTH,
|
||||||
|
AUTOMATIC_SESSION_RESET
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -285,6 +288,11 @@ public final class FeatureFlags {
|
|||||||
return Math.max(32, getInteger(GROUP_NAME_MAX_LENGTH, -1));
|
return Math.max(32, getInteger(GROUP_NAME_MAX_LENGTH, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Whether or not to allow automatic session resets. */
|
||||||
|
public static boolean automaticSessionReset() {
|
||||||
|
return getBoolean(AUTOMATIC_SESSION_RESET, true);
|
||||||
|
}
|
||||||
|
|
||||||
/** Only for rendering debug info. */
|
/** Only for rendering debug info. */
|
||||||
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
||||||
return new TreeMap<>(REMOTE_VALUES);
|
return new TreeMap<>(REMOTE_VALUES);
|
||||||
|
Reference in New Issue
Block a user