Skip to content

Commit

Permalink
Remove use of oldType in notification settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchung committed Sep 22, 2024
1 parent 8cb3352 commit 601ce5f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
7 changes: 1 addition & 6 deletions src/notifications/settings/__tests__/initialization.test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,9 @@ describe('Notification settings initialization', () => {
initState
);

// changed the current type to "owned" and old to "watched" (previous state), also wallet now is not initialized since it needs to re-subscribe
// changed the current type to "owned", also wallet now is not initialized since it needs to re-subscribe
const changedState = {
type: WalletNotificationRelationship.OWNER,
oldType: WalletNotificationRelationship.WATCHER,
successfullyFinishedInitialSubscription: false,
};

Expand Down Expand Up @@ -461,8 +460,6 @@ describe('Notification settings initialization', () => {
const stateBefore = {
address: TEST_ADDRESS_1,
type: WalletNotificationRelationship.OWNER,
// has old type as "watcher" which signifies that it was previously watched
oldType: WalletNotificationRelationship.WATCHER,
successfullyFinishedInitialSubscription: false,
topics: DEFAULT_ENABLED_TOPIC_SETTINGS,
enabled: false,
Expand All @@ -477,7 +474,6 @@ describe('Notification settings initialization', () => {
...stateBefore,
successfullyFinishedInitialSubscription: true,
enabled: true,
oldType: undefined,
};
expect(
JSON.parse(
Expand Down Expand Up @@ -532,7 +528,6 @@ describe('Notification settings initialization', () => {
{
address: TEST_ADDRESS_2,
type: WalletNotificationRelationship.OWNER,
oldType: WalletNotificationRelationship.WATCHER,
successfullyFinishedInitialSubscription: false,
topics: DEFAULT_ENABLED_TOPIC_SETTINGS,
enabled: false,
Expand Down
11 changes: 3 additions & 8 deletions src/notifications/settings/initialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,9 @@ export const initializeNotificationSettingsForAllAddressesAndCleanupSettingsForR
}
});

const proposedSettingsWithRemovedWallets = proposedSettings.filter(
setting => {
return !removedWalletsThatWereNotUnsubscribedProperly.get(
setting.address
);
}
);
const proposedSettingsWithRemovedWallets = proposedSettings.filter(setting => {
return !removedWalletsThatWereNotUnsubscribedProperly.get(setting.address);
});

InteractionManager.runAfterInteractions(() => {
publishAndSaveWalletSettings(proposedSettingsWithRemovedWallets, true);
Expand Down Expand Up @@ -114,7 +110,6 @@ export const _prepareSubscriptionQueueAndCreateInitialSettings = (
topics: DEFAULT_ENABLED_TOPIC_SETTINGS,
type: entry.relationship,
successfullyFinishedInitialSubscription: false,
oldType: alreadySavedEntry.settings.type,
};
newSettings[alreadySavedEntry.index] = updatedSettingsEntry;
}
Expand Down
2 changes: 0 additions & 2 deletions src/notifications/settings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export type WalletNotificationSettings = {
enabled: boolean;
type: WalletNotificationRelationshipType;
successfullyFinishedInitialSubscription: boolean;
// only set in cases when the user imported an already watched wallet
oldType?: WalletNotificationRelationshipType;
};

export type GroupSettings = {
Expand Down

0 comments on commit 601ce5f

Please sign in to comment.