mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
Ignore friend request messages before restoration,
This commit is contained in:
parent
fdba9023fc
commit
e285ede03d
3 changed files with 17 additions and 0 deletions
|
@ -281,6 +281,12 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||||
cipher.validateBackgroundMessage(envelope, envelope.getContent());
|
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);
|
SignalServiceContent content = cipher.decrypt(envelope);
|
||||||
|
|
||||||
if (shouldIgnore(content)) {
|
if (shouldIgnore(content)) {
|
||||||
|
|
|
@ -206,6 +206,9 @@ class SeedActivity : BaseActionBarActivity(), DeviceLinkingDelegate, ScanListene
|
||||||
DatabaseFactory.getIdentityDatabase(this).saveIdentity(Address.fromSerialized(userHexEncodedPublicKey), keyPair.publicKey,
|
DatabaseFactory.getIdentityDatabase(this).saveIdentity(Address.fromSerialized(userHexEncodedPublicKey), keyPair.publicKey,
|
||||||
IdentityDatabase.VerifiedStatus.VERIFIED, true, System.currentTimeMillis(), true)
|
IdentityDatabase.VerifiedStatus.VERIFIED, true, System.currentTimeMillis(), true)
|
||||||
TextSecurePreferences.setLocalNumber(this, userHexEncodedPublicKey)
|
TextSecurePreferences.setLocalNumber(this, userHexEncodedPublicKey)
|
||||||
|
if (mode == Mode.Restore) {
|
||||||
|
TextSecurePreferences.setRestorationTime(this, System.currentTimeMillis())
|
||||||
|
}
|
||||||
when (mode) {
|
when (mode) {
|
||||||
Mode.Register -> Analytics.shared.track("Seed Created")
|
Mode.Register -> Analytics.shared.track("Seed Created")
|
||||||
Mode.Restore -> Analytics.shared.track("Seed Restored")
|
Mode.Restore -> Analytics.shared.track("Seed Restored")
|
||||||
|
|
|
@ -1220,6 +1220,14 @@ public class TextSecurePreferences {
|
||||||
public static boolean needsRevocationCheck(Context context) {
|
public static boolean needsRevocationCheck(Context context) {
|
||||||
return getBooleanPreference(context, "needs_revocation", false);
|
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
|
// endregion
|
||||||
|
|
||||||
public static void clearAll(Context context) {
|
public static void clearAll(Context context) {
|
||||||
|
|
Loading…
Reference in a new issue