mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 12:48:35 +00:00
Fix some storage service consistency issues.
This commit is contained in:
parent
33874a8866
commit
575caa53d3
@ -1174,13 +1174,9 @@ public class RecipientDatabase extends Database {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setRegistered(@NonNull RecipientId id, RegisteredState registeredState) {
|
public void setRegistered(@NonNull RecipientId id, RegisteredState registeredState) {
|
||||||
ContentValues contentValues = new ContentValues(2);
|
ContentValues contentValues = new ContentValues(1);
|
||||||
contentValues.put(REGISTERED, registeredState.getId());
|
contentValues.put(REGISTERED, registeredState.getId());
|
||||||
|
|
||||||
if (registeredState == RegisteredState.REGISTERED) {
|
|
||||||
contentValues.put(STORAGE_SERVICE_ID, Base64.encodeBytes(StorageSyncHelper.generateKey()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (update(id, contentValues)) {
|
if (update(id, contentValues)) {
|
||||||
if (registeredState == RegisteredState.REGISTERED) {
|
if (registeredState == RegisteredState.REGISTERED) {
|
||||||
markDirty(id, DirtyState.INSERT);
|
markDirty(id, DirtyState.INSERT);
|
||||||
|
@ -35,7 +35,7 @@ public class DirectoryRefreshJob extends BaseJob {
|
|||||||
boolean notifyOfNewUsers)
|
boolean notifyOfNewUsers)
|
||||||
{
|
{
|
||||||
this(new Job.Parameters.Builder()
|
this(new Job.Parameters.Builder()
|
||||||
.setQueue("DirectoryRefreshJob")
|
.setQueue(StorageSyncJob.QUEUE_KEY)
|
||||||
.addConstraint(NetworkConstraint.KEY)
|
.addConstraint(NetworkConstraint.KEY)
|
||||||
.setMaxAttempts(10)
|
.setMaxAttempts(10)
|
||||||
.build(),
|
.build(),
|
||||||
|
@ -275,7 +275,7 @@ public class StorageSyncJob extends BaseJob {
|
|||||||
case ManifestRecord.Identifier.Type.GROUPV2_VALUE:
|
case ManifestRecord.Identifier.Type.GROUPV2_VALUE:
|
||||||
RecipientSettings settings = recipientDatabase.getByStorageId(id.getRaw());
|
RecipientSettings settings = recipientDatabase.getByStorageId(id.getRaw());
|
||||||
if (settings != null) {
|
if (settings != null) {
|
||||||
|
records.add(StorageSyncModels.localToRemoteRecord(settings, archivedRecipients));
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Missing local recipient model! Type: " + id.getType());
|
Log.w(TAG, "Missing local recipient model! Type: " + id.getType());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package org.thoughtcrime.securesms.registration;
|
package org.thoughtcrime.securesms.registration;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||||
|
import org.thoughtcrime.securesms.jobs.DirectoryRefreshJob;
|
||||||
|
import org.thoughtcrime.securesms.jobs.StorageSyncJob;
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
@ -21,7 +24,9 @@ public final class RegistrationUtil {
|
|||||||
if (!SignalStore.registrationValues().isRegistrationComplete() && SignalStore.kbsValues().hasPin() && !Recipient.self().getProfileName().isEmpty()) {
|
if (!SignalStore.registrationValues().isRegistrationComplete() && SignalStore.kbsValues().hasPin() && !Recipient.self().getProfileName().isEmpty()) {
|
||||||
Log.i(TAG, "Marking registration completed.", new Throwable());
|
Log.i(TAG, "Marking registration completed.", new Throwable());
|
||||||
SignalStore.registrationValues().setRegistrationComplete();
|
SignalStore.registrationValues().setRegistrationComplete();
|
||||||
StorageSyncHelper.scheduleSyncForDataChange();
|
ApplicationDependencies.getJobManager().startChain(new StorageSyncJob())
|
||||||
|
.then(new DirectoryRefreshJob(false))
|
||||||
|
.enqueue();
|
||||||
} else if (!SignalStore.registrationValues().isRegistrationComplete()) {
|
} else if (!SignalStore.registrationValues().isRegistrationComplete()) {
|
||||||
Log.i(TAG, "Registration is not yet complete.", new Throwable());
|
Log.i(TAG, "Registration is not yet complete.", new Throwable());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user