use of org.whispersystems.signalservice.internal.storage.protos.AccountRecord in project Signal-Android by WhisperSystems.
the class ApplyUnknownFieldsToSelfMigrationJob method performMigration.
@Override
public void performMigration() {
if (!SignalStore.account().isRegistered() || SignalStore.account().getAci() == null) {
Log.w(TAG, "Not registered!");
return;
}
Recipient self;
RecipientRecord settings;
try {
self = Recipient.self();
settings = SignalDatabase.recipients().getRecordForSync(self.getId());
} catch (RecipientDatabase.MissingRecipientException e) {
Log.w(TAG, "Unable to find self");
return;
}
if (settings == null || settings.getSyncExtras().getStorageProto() == null) {
Log.d(TAG, "No unknowns to apply");
return;
}
try {
StorageId storageId = StorageId.forAccount(self.getStorageServiceId());
AccountRecord accountRecord = AccountRecord.parseFrom(settings.getSyncExtras().getStorageProto());
SignalAccountRecord signalAccountRecord = new SignalAccountRecord(storageId, accountRecord);
Log.d(TAG, "Applying potentially now known unknowns");
StorageSyncHelper.applyAccountStorageSyncUpdates(context, self, signalAccountRecord, false);
} catch (InvalidProtocolBufferException e) {
Log.w(TAG, e);
}
}
Aggregations