Add who am I job

This commit is contained in:
AsamK 2023-11-12 12:12:02 +01:00
parent d844e0f396
commit 5cac7feabe
2 changed files with 24 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import org.asamk.signal.manager.api.PhoneNumberSharingMode;
import org.asamk.signal.manager.api.Profile;
import org.asamk.signal.manager.api.TrustLevel;
import org.asamk.signal.manager.internal.SignalDependencies;
import org.asamk.signal.manager.jobs.CheckWhoAmIJob;
import org.asamk.signal.manager.jobs.DownloadProfileAvatarJob;
import org.asamk.signal.manager.storage.SignalAccount;
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
@ -251,7 +252,7 @@ public class StorageHelper {
}
if (!accountRecord.getE164().equals(account.getNumber())) {
context.getAccountHelper().checkWhoAmiI();
context.getJobExecutor().enqueueJob(new CheckWhoAmIJob());
}
account.getConfigurationStore().setReadReceipts(accountRecord.isReadReceiptsEnabled());

View file

@ -0,0 +1,22 @@
package org.asamk.signal.manager.jobs;
import org.asamk.signal.manager.helper.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
public class CheckWhoAmIJob implements Job {
private static final Logger logger = LoggerFactory.getLogger(CheckWhoAmIJob.class);
@Override
public void run(Context context) {
logger.trace("Checking whoAmI");
try {
context.getAccountHelper().checkWhoAmiI();
} catch (IOException e) {
logger.warn("Failed to check whoAmI", e);
}
}
}