mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 19:56:02 +01:00
Rewrite the AppDependencies system.
This commit is contained in:
committed by
Cody Henthorne
parent
a0131bf39b
commit
b6a4e1f145
@@ -39,7 +39,7 @@ import org.thoughtcrime.securesms.database.model.GroupRecord
|
||||
import org.thoughtcrime.securesms.database.model.ProfileAvatarFileDetails
|
||||
import org.thoughtcrime.securesms.database.model.RecipientRecord
|
||||
import org.thoughtcrime.securesms.database.model.databaseprotos.RecipientExtras
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.groups.GroupId
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels
|
||||
@@ -460,7 +460,7 @@ class Recipient(
|
||||
/** The name to show for a group. It will be the group name if present, otherwise we default to a list of shortened member names. */
|
||||
fun getGroupName(context: Context): String? {
|
||||
return if (groupIdValue != null && Util.isEmpty(groupName)) {
|
||||
val selfId = ApplicationDependencies.getRecipientCache().getSelfId()
|
||||
val selfId = AppDependencies.recipientCache.getSelfId()
|
||||
val others = participantIdsValue
|
||||
.filter { id: RecipientId -> id != selfId }
|
||||
.take(MAX_MEMBER_NAMES)
|
||||
@@ -666,7 +666,7 @@ class Recipient(
|
||||
|
||||
/** Returns a live, observable copy of this recipient. */
|
||||
fun live(): LiveRecipient {
|
||||
return ApplicationDependencies.getRecipientCache().getLive(id)
|
||||
return AppDependencies.recipientCache.getLive(id)
|
||||
}
|
||||
|
||||
enum class HiddenState(private val value: Int) {
|
||||
@@ -863,7 +863,7 @@ class Recipient(
|
||||
@JvmStatic
|
||||
@AnyThread
|
||||
fun live(id: RecipientId): LiveRecipient {
|
||||
return ApplicationDependencies.getRecipientCache().getLive(id)
|
||||
return AppDependencies.recipientCache.getLive(id)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1077,11 +1077,11 @@ class Recipient(
|
||||
|
||||
@JvmStatic
|
||||
fun self(): Recipient {
|
||||
return ApplicationDependencies.getRecipientCache().getSelf()
|
||||
return AppDependencies.recipientCache.getSelf()
|
||||
}
|
||||
|
||||
/** Whether we've set a recipient for 'self' yet. We do this during registration. */
|
||||
val isSelfSet: Boolean
|
||||
get() = ApplicationDependencies.getRecipientCache().getSelfId() != null
|
||||
get() = AppDependencies.recipientCache.getSelfId() != null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.thoughtcrime.securesms.database.RecipientTable.RegisteredState;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.database.ThreadTable;
|
||||
import org.thoughtcrime.securesms.database.model.GroupRecord;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeBusyException;
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeException;
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeFailedException;
|
||||
@@ -175,12 +175,12 @@ public class RecipientUtil {
|
||||
if (recipient.isSystemContact() || recipient.isProfileSharing() || isProfileSharedViaGroup(recipient)) {
|
||||
SignalDatabase.recipients().setProfileSharing(recipient.getId(), false);
|
||||
|
||||
ApplicationDependencies.getJobManager().startChain(new RefreshOwnProfileJob())
|
||||
.then(new RotateProfileKeyJob())
|
||||
.enqueue();
|
||||
AppDependencies.getJobManager().startChain(new RefreshOwnProfileJob())
|
||||
.then(new RotateProfileKeyJob())
|
||||
.enqueue();
|
||||
}
|
||||
|
||||
ApplicationDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
|
||||
AppDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
|
||||
StorageSyncHelper.scheduleSyncForDataChange();
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class RecipientUtil {
|
||||
|
||||
SignalDatabase.recipients().setBlocked(recipient.getId(), false);
|
||||
SignalDatabase.recipients().setProfileSharing(recipient.getId(), true);
|
||||
ApplicationDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
|
||||
AppDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
|
||||
StorageSyncHelper.scheduleSyncForDataChange();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import org.thoughtcrime.securesms.database.IdentityTable
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
|
||||
class AboutSheetRepository {
|
||||
@@ -21,7 +21,7 @@ class AboutSheetRepository {
|
||||
|
||||
fun getVerified(recipientId: RecipientId): Single<Boolean> {
|
||||
return Single.fromCallable {
|
||||
val identityRecord = ApplicationDependencies.getProtocolStore().aci().identities().getIdentityRecord(recipientId)
|
||||
val identityRecord = AppDependencies.protocolStore.aci().identities().getIdentityRecord(recipientId)
|
||||
identityRecord.isPresent && identityRecord.get().verifiedStatus == IdentityTable.VerifiedStatus.VERIFIED
|
||||
}.subscribeOn(Schedulers.io())
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.thoughtcrime.securesms.database.GroupTable;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.GroupRecord;
|
||||
import org.thoughtcrime.securesms.database.model.IdentityRecord;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeException;
|
||||
import org.thoughtcrime.securesms.groups.GroupId;
|
||||
import org.thoughtcrime.securesms.groups.GroupManager;
|
||||
@@ -55,7 +55,7 @@ final class RecipientDialogRepository {
|
||||
|
||||
void getIdentity(@NonNull Consumer<IdentityRecord> callback) {
|
||||
SignalExecutors.BOUNDED.execute(
|
||||
() -> callback.accept(ApplicationDependencies.getProtocolStore().aci().identities().getIdentityRecord(recipientId).orElse(null)));
|
||||
() -> callback.accept(AppDependencies.getProtocolStore().aci().identities().getIdentityRecord(recipientId).orElse(null)));
|
||||
}
|
||||
|
||||
void getRecipient(@NonNull RecipientCallback recipientCallback) {
|
||||
|
||||
Reference in New Issue
Block a user