mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Ignore friend request messages before restoration,
This commit is contained in:
parent
fdba9023fc
commit
e285ede03d
@ -281,6 +281,12 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
cipher.validateBackgroundMessage(envelope, envelope.getContent());
|
||||
}
|
||||
|
||||
// Loki - Ignore any friend requests that we got before restoration
|
||||
if (envelope.isFriendRequest() && envelope.getTimestamp() < TextSecurePreferences.getRestorationTime(context)) {
|
||||
Log.i(TAG, "Ignoring friend request that was received before restoration");
|
||||
return;
|
||||
}
|
||||
|
||||
SignalServiceContent content = cipher.decrypt(envelope);
|
||||
|
||||
if (shouldIgnore(content)) {
|
||||
|
@ -206,6 +206,9 @@ class SeedActivity : BaseActionBarActivity(), DeviceLinkingDelegate, ScanListene
|
||||
DatabaseFactory.getIdentityDatabase(this).saveIdentity(Address.fromSerialized(userHexEncodedPublicKey), keyPair.publicKey,
|
||||
IdentityDatabase.VerifiedStatus.VERIFIED, true, System.currentTimeMillis(), true)
|
||||
TextSecurePreferences.setLocalNumber(this, userHexEncodedPublicKey)
|
||||
if (mode == Mode.Restore) {
|
||||
TextSecurePreferences.setRestorationTime(this, System.currentTimeMillis())
|
||||
}
|
||||
when (mode) {
|
||||
Mode.Register -> Analytics.shared.track("Seed Created")
|
||||
Mode.Restore -> Analytics.shared.track("Seed Restored")
|
||||
|
@ -1220,6 +1220,14 @@ public class TextSecurePreferences {
|
||||
public static boolean needsRevocationCheck(Context context) {
|
||||
return getBooleanPreference(context, "needs_revocation", false);
|
||||
}
|
||||
|
||||
public static void setRestorationTime(Context context, long time) {
|
||||
setLongPreference(context, "restoration_time", time);
|
||||
}
|
||||
|
||||
public static long getRestorationTime(Context context) {
|
||||
return getLongPreference(context, "restoration_time", 0);
|
||||
}
|
||||
// endregion
|
||||
|
||||
public static void clearAll(Context context) {
|
||||
|
Loading…
Reference in New Issue
Block a user