mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 11:08:31 +00:00
Remove deprecated storage service fields.
This commit is contained in:
@@ -76,7 +76,6 @@ import org.thoughtcrime.securesms.migrations.StickerMyDailyLifeMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.StorageCapabilityMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.StorageServiceMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.StorageServiceSystemNameMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.StoryReadStateMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.StoryViewedReceiptsStateMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.Svr2MirrorMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.SyncDistributionListsMigrationJob;
|
||||
@@ -262,7 +261,6 @@ public final class JobManagerFactories {
|
||||
put(StorageCapabilityMigrationJob.KEY, new StorageCapabilityMigrationJob.Factory());
|
||||
put(StorageServiceMigrationJob.KEY, new StorageServiceMigrationJob.Factory());
|
||||
put(StorageServiceSystemNameMigrationJob.KEY, new StorageServiceSystemNameMigrationJob.Factory());
|
||||
put(StoryReadStateMigrationJob.KEY, new StoryReadStateMigrationJob.Factory());
|
||||
put(StoryViewedReceiptsStateMigrationJob.KEY, new StoryViewedReceiptsStateMigrationJob.Factory());
|
||||
put(Svr2MirrorMigrationJob.KEY, new Svr2MirrorMigrationJob.Factory());
|
||||
put(SyncDistributionListsMigrationJob.KEY, new SyncDistributionListsMigrationJob.Factory());
|
||||
@@ -306,6 +304,7 @@ public final class JobManagerFactories {
|
||||
put("MmsReceiveJob", new FailingJob.Factory());
|
||||
put("MmsDownloadJob", new FailingJob.Factory());
|
||||
put("SmsReceiveJob", new FailingJob.Factory());
|
||||
put("StoryReadStateMigrationJob", new PassingMigrationJob.Factory());
|
||||
}};
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,6 @@ internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
*/
|
||||
private const val USER_HAS_VIEWED_ONBOARDING_STORY = "stories.user.has.seen.onboarding"
|
||||
|
||||
/**
|
||||
* Marks whether the user has seen the onboarding story in the stories landing page
|
||||
*/
|
||||
private const val USER_HAS_READ_ONBOARDING_STORY = "stories.user.has.read.onboarding"
|
||||
|
||||
/**
|
||||
* Whether or not the user will send and receive viewed receipts for stories
|
||||
*/
|
||||
@@ -66,7 +61,6 @@ internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
USER_HAS_SEEN_FIRST_NAV_VIEW,
|
||||
HAS_DOWNLOADED_ONBOARDING_STORY,
|
||||
USER_HAS_VIEWED_ONBOARDING_STORY,
|
||||
USER_HAS_READ_ONBOARDING_STORY,
|
||||
STORY_VIEWED_RECEIPTS,
|
||||
USER_HAS_SEEN_GROUP_STORY_EDUCATION_SHEET
|
||||
)
|
||||
@@ -83,8 +77,6 @@ internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
|
||||
var userHasViewedOnboardingStory: Boolean by booleanValue(USER_HAS_VIEWED_ONBOARDING_STORY, false)
|
||||
|
||||
var userHasReadOnboardingStory: Boolean by booleanValue(USER_HAS_READ_ONBOARDING_STORY, false)
|
||||
|
||||
var viewedReceiptsEnabled: Boolean by booleanValue(STORY_VIEWED_RECEIPTS, false)
|
||||
|
||||
var userHasSeenGroupStoryEducationSheet: Boolean by booleanValue(USER_HAS_SEEN_GROUP_STORY_EDUCATION_SHEET, false)
|
||||
@@ -93,10 +85,6 @@ internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
return store.containsKey(STORY_VIEWED_RECEIPTS)
|
||||
}
|
||||
|
||||
fun hasUserOnboardingStoryReadBeenSet(): Boolean {
|
||||
return store.containsKey(USER_HAS_READ_ONBOARDING_STORY)
|
||||
}
|
||||
|
||||
fun setLatestStorySend(storySend: StorySend) {
|
||||
synchronized(this) {
|
||||
val storySends: List<StorySend> = getList(LATEST_STORY_SENDS, StorySendSerializer)
|
||||
|
||||
@@ -110,7 +110,7 @@ public class ApplicationMigrations {
|
||||
static final int PNI_2 = 66;
|
||||
static final int SYSTEM_NAME_SYNC = 67;
|
||||
static final int STORY_VIEWED_STATE = 68;
|
||||
static final int STORY_READ_STATE = 69;
|
||||
// static final int STORY_READ_STATE = 69;
|
||||
static final int THREAD_MESSAGE_SCHEMA_CHANGE = 70;
|
||||
static final int SMS_MMS_MERGE = 71;
|
||||
static final int REBUILD_MESSAGE_FTS_INDEX = 72;
|
||||
@@ -517,9 +517,9 @@ public class ApplicationMigrations {
|
||||
jobs.put(Version.STORY_VIEWED_STATE, new StoryViewedReceiptsStateMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.STORY_READ_STATE) {
|
||||
jobs.put(Version.STORY_READ_STATE, new StoryReadStateMigrationJob());
|
||||
}
|
||||
// if (lastSeenVersion < Version.STORY_READ_STATE) {
|
||||
// jobs.put(Version.STORY_READ_STATE, new StoryReadStateMigrationJob());
|
||||
// }
|
||||
|
||||
if (lastSeenVersion < Version.THREAD_MESSAGE_SCHEMA_CHANGE) {
|
||||
jobs.put(Version.THREAD_MESSAGE_SCHEMA_CHANGE, new DatabaseMigrationJob());
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
package org.thoughtcrime.securesms.migrations
|
||||
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase.Companion.recipients
|
||||
import org.thoughtcrime.securesms.jobmanager.Job
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||
|
||||
/**
|
||||
* Added to initialize whether the user has seen the onboarding story
|
||||
*/
|
||||
internal class StoryReadStateMigrationJob(
|
||||
parameters: Parameters = Parameters.Builder().build()
|
||||
) : MigrationJob(parameters) {
|
||||
|
||||
companion object {
|
||||
const val KEY = "StoryReadStateMigrationJob"
|
||||
}
|
||||
|
||||
override fun getFactoryKey(): String = KEY
|
||||
|
||||
override fun isUiBlocking(): Boolean = false
|
||||
|
||||
override fun performMigration() {
|
||||
if (!SignalStore.storyValues().hasUserOnboardingStoryReadBeenSet()) {
|
||||
SignalStore.storyValues().userHasReadOnboardingStory = SignalStore.storyValues().userHasReadOnboardingStory
|
||||
SignalDatabase.messages.markOnboardingStoryRead()
|
||||
|
||||
if (SignalStore.account().isRegistered) {
|
||||
recipients.markNeedsSync(Recipient.self().id)
|
||||
StorageSyncHelper.scheduleSyncForDataChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun shouldRetry(e: Exception): Boolean = false
|
||||
|
||||
class Factory : Job.Factory<StoryReadStateMigrationJob> {
|
||||
override fun create(parameters: Parameters, serializedData: ByteArray?): StoryReadStateMigrationJob {
|
||||
return StoryReadStateMigrationJob(parameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,12 +124,11 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor<Signal
|
||||
boolean hasSetMyStoriesPrivacy = remote.hasSetMyStoriesPrivacy();
|
||||
boolean hasViewedOnboardingStory = remote.hasViewedOnboardingStory() || local.hasViewedOnboardingStory();
|
||||
boolean storiesDisabled = remote.isStoriesDisabled();
|
||||
boolean hasReadOnboardingStory = remote.hasReadOnboardingStory() || remote.hasViewedOnboardingStory() || local.hasReadOnboardingStory() || local.hasViewedOnboardingStory() ;
|
||||
boolean hasSeenGroupStoryEducation = remote.hasSeenGroupStoryEducationSheet() || local.hasSeenGroupStoryEducationSheet();
|
||||
String username = !StringUtil.isEmpty(remote.getUsername()) ? remote.getUsername() : local.getUsername();
|
||||
AccountRecord.UsernameLink usernameLink = remote.getUsernameLink() != null ? remote.getUsernameLink() : local.getUsernameLink();
|
||||
boolean matchesRemote = doParamsMatch(remote, unknownFields, givenName, familyName, avatarUrlPath, profileKey, noteToSelfArchived, noteToSelfForcedUnread, readReceipts, typingIndicators, sealedSenderIndicators, linkPreviews, phoneNumberSharingMode, unlisted, pinnedConversations, preferContactAvatars, payments, universalExpireTimer, primarySendsSms, e164, defaultReactions, subscriber, displayBadgesOnProfile, subscriptionManuallyCancelled, keepMutedChatsArchived, hasSetMyStoriesPrivacy, hasViewedOnboardingStory, storiesDisabled, storyViewReceiptsState, hasReadOnboardingStory, username, usernameLink);
|
||||
boolean matchesLocal = doParamsMatch(local, unknownFields, givenName, familyName, avatarUrlPath, profileKey, noteToSelfArchived, noteToSelfForcedUnread, readReceipts, typingIndicators, sealedSenderIndicators, linkPreviews, phoneNumberSharingMode, unlisted, pinnedConversations, preferContactAvatars, payments, universalExpireTimer, primarySendsSms, e164, defaultReactions, subscriber, displayBadgesOnProfile, subscriptionManuallyCancelled, keepMutedChatsArchived, hasSetMyStoriesPrivacy, hasViewedOnboardingStory, storiesDisabled, storyViewReceiptsState, hasReadOnboardingStory, username, usernameLink);
|
||||
boolean matchesRemote = doParamsMatch(remote, unknownFields, givenName, familyName, avatarUrlPath, profileKey, noteToSelfArchived, noteToSelfForcedUnread, readReceipts, typingIndicators, sealedSenderIndicators, linkPreviews, phoneNumberSharingMode, unlisted, pinnedConversations, preferContactAvatars, payments, universalExpireTimer, primarySendsSms, e164, defaultReactions, subscriber, displayBadgesOnProfile, subscriptionManuallyCancelled, keepMutedChatsArchived, hasSetMyStoriesPrivacy, hasViewedOnboardingStory, storiesDisabled, storyViewReceiptsState, username, usernameLink);
|
||||
boolean matchesLocal = doParamsMatch(local, unknownFields, givenName, familyName, avatarUrlPath, profileKey, noteToSelfArchived, noteToSelfForcedUnread, readReceipts, typingIndicators, sealedSenderIndicators, linkPreviews, phoneNumberSharingMode, unlisted, pinnedConversations, preferContactAvatars, payments, universalExpireTimer, primarySendsSms, e164, defaultReactions, subscriber, displayBadgesOnProfile, subscriptionManuallyCancelled, keepMutedChatsArchived, hasSetMyStoriesPrivacy, hasViewedOnboardingStory, storiesDisabled, storyViewReceiptsState, username, usernameLink);
|
||||
|
||||
if (matchesRemote) {
|
||||
return remote;
|
||||
@@ -163,7 +162,6 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor<Signal
|
||||
.setHasSetMyStoriesPrivacy(hasSetMyStoriesPrivacy)
|
||||
.setHasViewedOnboardingStory(hasViewedOnboardingStory)
|
||||
.setStoriesDisabled(storiesDisabled)
|
||||
.setHasReadOnboardingStory(hasReadOnboardingStory)
|
||||
.setHasSeenGroupStoryEducationSheet(hasSeenGroupStoryEducation)
|
||||
.setUsername(username)
|
||||
.setUsernameLink(usernameLink);
|
||||
@@ -220,7 +218,6 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor<Signal
|
||||
boolean hasViewedOnboardingStory,
|
||||
boolean storiesDisabled,
|
||||
@NonNull OptionalBool storyViewReceiptsState,
|
||||
boolean hasReadOnboardingStory,
|
||||
@Nullable String username,
|
||||
@Nullable AccountRecord.UsernameLink usernameLink)
|
||||
{
|
||||
@@ -252,7 +249,6 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor<Signal
|
||||
contact.hasViewedOnboardingStory() == hasViewedOnboardingStory &&
|
||||
contact.isStoriesDisabled() == storiesDisabled &&
|
||||
contact.getStoryViewReceiptsState().equals(storyViewReceiptsState) &&
|
||||
contact.hasReadOnboardingStory() == hasReadOnboardingStory &&
|
||||
Objects.equals(contact.getUsername(), username) &&
|
||||
Objects.equals(contact.getUsernameLink(), usernameLink);
|
||||
}
|
||||
|
||||
@@ -133,8 +133,6 @@ public final class StorageSyncHelper {
|
||||
Log.w(TAG, "[buildAccountRecord] StorageId on RecipientRecord did not match self! ID: " + self.getId());
|
||||
}
|
||||
|
||||
final boolean hasReadOnboardingStory = SignalStore.storyValues().getUserHasViewedOnboardingStory() || SignalStore.storyValues().getUserHasReadOnboardingStory();
|
||||
|
||||
byte[] storageId = record != null && record.getStorageId() != null ? record.getStorageId() : self.getStorageServiceId();
|
||||
|
||||
SignalAccountRecord.Builder account = new SignalAccountRecord.Builder(storageId, record != null ? record.getSyncExtras().getStorageProto() : null)
|
||||
@@ -164,7 +162,6 @@ public final class StorageSyncHelper {
|
||||
.setHasViewedOnboardingStory(SignalStore.storyValues().getUserHasViewedOnboardingStory())
|
||||
.setStoriesDisabled(SignalStore.storyValues().isFeatureDisabled())
|
||||
.setStoryViewReceiptsState(storyViewReceiptsState)
|
||||
.setHasReadOnboardingStory(hasReadOnboardingStory)
|
||||
.setHasSeenGroupStoryEducationSheet(SignalStore.storyValues().getUserHasSeenGroupStoryEducationSheet())
|
||||
.setUsername(SignalStore.account().getUsername());
|
||||
|
||||
@@ -209,7 +206,6 @@ public final class StorageSyncHelper {
|
||||
SignalStore.storyValues().setUserHasBeenNotifiedAboutStories(update.getNew().hasSetMyStoriesPrivacy());
|
||||
SignalStore.storyValues().setUserHasViewedOnboardingStory(update.getNew().hasViewedOnboardingStory());
|
||||
SignalStore.storyValues().setFeatureDisabled(update.getNew().isStoriesDisabled());
|
||||
SignalStore.storyValues().setUserHasReadOnboardingStory(update.getNew().hasReadOnboardingStory());
|
||||
SignalStore.storyValues().setUserHasSeenGroupStoryEducationSheet(update.getNew().hasSeenGroupStoryEducationSheet());
|
||||
SignalStore.account().setUsername(update.getNew().getUsername());
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientForeverObserver
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.sms.MessageSender
|
||||
import org.thoughtcrime.securesms.stories.Stories
|
||||
|
||||
class StoriesLandingRepository(context: Context) {
|
||||
|
||||
@@ -169,11 +168,6 @@ class StoriesLandingRepository(context: Context) {
|
||||
val releaseThread: Long? = SignalStore.releaseChannelValues().releaseChannelRecipientId?.let { SignalDatabase.threads.getThreadIdIfExistsFor(it) }
|
||||
|
||||
MultiDeviceReadUpdateJob.enqueue(messageInfos.filter { it.threadId == releaseThread }.map { it.syncMessageId })
|
||||
|
||||
if (messageInfos.any { it.threadId == releaseThread }) {
|
||||
SignalStore.storyValues().userHasReadOnboardingStory = true
|
||||
Stories.onStorySettingsChanged(Recipient.self().id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -195,10 +195,6 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
diff.add("StoryViewedReceipts");
|
||||
}
|
||||
|
||||
if (hasReadOnboardingStory() != that.hasReadOnboardingStory()) {
|
||||
diff.add("HasReadOnboardingStory");
|
||||
}
|
||||
|
||||
if (hasSeenGroupStoryEducationSheet() != that.hasSeenGroupStoryEducationSheet()) {
|
||||
diff.add("HasSeenGroupStoryEducationSheet");
|
||||
}
|
||||
@@ -329,10 +325,6 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
return proto.storyViewReceiptsEnabled;
|
||||
}
|
||||
|
||||
public boolean hasReadOnboardingStory() {
|
||||
return proto.hasReadOnboardingStory;
|
||||
}
|
||||
|
||||
public boolean hasSeenGroupStoryEducationSheet() {
|
||||
return proto.hasSeenGroupStoryEducationSheet;
|
||||
}
|
||||
@@ -701,11 +693,6 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setHasReadOnboardingStory(boolean hasReadOnboardingStory) {
|
||||
builder.hasReadOnboardingStory(hasReadOnboardingStory);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setHasSeenGroupStoryEducationSheet(boolean hasSeenGroupStoryEducationSheet) {
|
||||
builder.hasSeenGroupStoryEducationSheet(hasSeenGroupStoryEducationSheet);
|
||||
return this;
|
||||
|
||||
@@ -182,7 +182,7 @@ message AccountRecord {
|
||||
bool readReceipts = 6;
|
||||
bool sealedSenderIndicators = 7;
|
||||
bool typingIndicators = 8;
|
||||
bool proxiedLinkPreviews = 9;
|
||||
reserved /* proxiedLinkPreviews */ 9;
|
||||
bool noteToSelfMarkedUnread = 10;
|
||||
bool linkPreviews = 11;
|
||||
PhoneNumberSharingMode phoneNumberSharingMode = 12;
|
||||
@@ -204,7 +204,7 @@ message AccountRecord {
|
||||
reserved /* storiesDisabled */ 28;
|
||||
bool storiesDisabled = 29;
|
||||
OptionalBool storyViewReceiptsEnabled = 30;
|
||||
bool hasReadOnboardingStory = 31;
|
||||
reserved /* hasReadOnboardingStory */ 31;
|
||||
bool hasSeenGroupStoryEducationSheet = 32;
|
||||
string username = 33;
|
||||
bool hasCompletedUsernameOnboarding = 34;
|
||||
|
||||
Reference in New Issue
Block a user