kopia lustrzana https://github.com/ryukoposting/Signal-Android
Prevent GV2 operations after becoming unregistered.
rodzic
938b24f623
commit
309e33016a
|
@ -57,6 +57,10 @@ public final class GroupsV2Authorization {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
cache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private static int currentTimeDays() {
|
private static int currentTimeDays() {
|
||||||
return (int) TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis());
|
return (int) TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,11 @@ import androidx.core.app.NotificationCompat;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.signal.core.util.logging.Log;
|
import org.signal.core.util.logging.Log;
|
||||||
|
import org.signal.zkgroup.profiles.ProfileKey;
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
import org.thoughtcrime.securesms.backup.BackupProtos;
|
import org.thoughtcrime.securesms.backup.BackupProtos;
|
||||||
|
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
||||||
|
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraintObserver;
|
import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraintObserver;
|
||||||
import org.thoughtcrime.securesms.keyvalue.SettingsValues;
|
import org.thoughtcrime.securesms.keyvalue.SettingsValues;
|
||||||
|
@ -472,6 +475,10 @@ public class TextSecurePreferences {
|
||||||
if (previous != value) {
|
if (previous != value) {
|
||||||
Recipient.self().live().refresh();
|
Recipient.self().live().refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
clearLocalCredentials(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isUnauthorizedRecieved(Context context) {
|
public static boolean isUnauthorizedRecieved(Context context) {
|
||||||
|
@ -927,6 +934,10 @@ public class TextSecurePreferences {
|
||||||
if (previous != registered) {
|
if (previous != registered) {
|
||||||
Recipient.self().live().refresh();
|
Recipient.self().live().refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (previous && !registered) {
|
||||||
|
clearLocalCredentials(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isShowInviteReminders(Context context) {
|
public static boolean isShowInviteReminders(Context context) {
|
||||||
|
@ -1291,6 +1302,16 @@ public class TextSecurePreferences {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void clearLocalCredentials(Context context) {
|
||||||
|
TextSecurePreferences.setPushServerPassword(context, Util.getSecret(18));
|
||||||
|
|
||||||
|
ProfileKey newProfileKey = ProfileKeyUtil.createNew();
|
||||||
|
Recipient self = Recipient.self();
|
||||||
|
DatabaseFactory.getRecipientDatabase(context).setProfileKey(self.getId(), newProfileKey);
|
||||||
|
|
||||||
|
ApplicationDependencies.getGroupsV2Authorization().clear();
|
||||||
|
}
|
||||||
|
|
||||||
// NEVER rename these -- they're persisted by name
|
// NEVER rename these -- they're persisted by name
|
||||||
public enum MediaKeyboardMode {
|
public enum MediaKeyboardMode {
|
||||||
EMOJI, STICKER, GIF
|
EMOJI, STICKER, GIF
|
||||||
|
|
Ładowanie…
Reference in New Issue