A local-first personal finance app
Remove upgrade notifications code (#1156)
Jed Foxc6443f24b274
diff --git a/packages/desktop-client/src/components/FinancesApp.js b/packages/desktop-client/src/components/FinancesApp.jsindex 74e592dd76..c82f1524f8 100644--- a/packages/desktop-client/src/components/FinancesApp.js+++ b/packages/desktop-client/src/components/FinancesApp.js@@ -20,7 +20,6 @@ import { AccountsProvider } from 'loot-core/src/client/data-hooks/accounts';import { PayeesProvider } from 'loot-core/src/client/data-hooks/payees';import { SpreadsheetProvider } from 'loot-core/src/client/SpreadsheetProvider';import checkForUpdateNotification from 'loot-core/src/client/update-notification';-import checkForUpgradeNotifications from 'loot-core/src/client/upgrade-notifications';import * as undo from 'loot-core/src/platform/client/undo';import Cog from '../icons/v1/Cog';@@ -263,15 +262,6 @@ function FinancesApp(props) {setTimeout(async () => {await props.sync();- // Check for upgrade notifications. We do this after syncing- // because these states are synced across devices, so they will- // only see it once for this file- checkForUpgradeNotifications(- props.addNotification,- props.resetSync,- patchedHistory,- );-await checkForUpdateNotification(props.addNotification,getIsOutdated,diff --git a/packages/loot-core/src/client/upgrade-notifications.ts b/packages/loot-core/src/client/upgrade-notifications.tsdeleted file mode 100644index c2eca0d2a1..0000000000--- a/packages/loot-core/src/client/upgrade-notifications.ts+++ /dev/null@@ -1,76 +0,0 @@-import { send } from '../platform/client/fetch';--import * as Platform from './platform';--export default function checkForUpgradeNotifications(- addNotification,- resetSync,- // Note: history is only available on desktop- history,-) {- // TODO: Probably should only show one of these at at time?- send('get-upgrade-notifications').then(types => {- types.forEach(type => {- switch (type) {- case 'schedules': {- let message =- 'Track bills and subscriptions and much more with scheduled transactions. We can search all your existing transactions and try to find existing schedules.\n\n' +- (global.IS_BETA- ? 'NOTE: You are using the beta version, and this will not reset your sync data. This is safe to do.'- : '');-- if (Platform.env === 'mobile') {- message =- 'Track bills and subscriptions and much more with scheduled transactions. Upcoming transactions will be shown in the accounts screen. Use the desktop app to create schedules.';- }-- addNotification({- type: 'message',- title: 'Scheduled transactions are now available!',- message,- sticky: true,- id: 'find-schedules',- button: Platform.env !== 'mobile' && {- title: 'Find schedules',- action: async () => {- window.__history &&- window.__history.push('/schedule/discover', {- locationPtr: window.__history.location,- });- },- },- onClose: () => {- send('seen-upgrade-notification', { type: 'schedules' });- },- });- break;- }-- case 'repair-splits':- if (history) {- addNotification({- type: 'message',- title: 'Split transactions now support transfers & payees',- message:- 'The payee field is now available on split transactions, allowing you to perform transfers on individual split transactions.\n\nAll existing split transactions have a blank payee and we recommend using the tool below to set the payee from the parent. [View a video walkthrough](https://www.youtube.com/watch?v=5kTtAsB0Oqk)',- sticky: true,- id: 'repair-splits',- button: {- title: 'Repair splits...',- action: () =>- history.push('/tools/fix-splits', {- locationPtr: history.location,- }),- },- onClose: () => {- send('seen-upgrade-notification', { type: 'repair-splits' });- },- });- }- break;-- default:- }- });- });-}diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.tsindex e003bd7c06..fa0015087c 100644--- a/packages/loot-core/src/server/main.ts+++ b/packages/loot-core/src/server/main.ts@@ -2266,30 +2266,6 @@ async function loadBudget(id) {return {};}-handlers['get-upgrade-notifications'] = async function () {- let { id } = prefs.getPrefs();- if (id === TEST_BUDGET_ID || id === DEMO_BUDGET_ID) {- return [];- }-- let types = ['schedules', 'repair-splits'];- let unseen = [];-- for (let type of types) {- let key = `notifications.${type}`;- if (prefs.getPrefs()[key] == null) {- unseen.push(type);- }- }-- return unseen;-};--handlers['seen-upgrade-notification'] = async function ({ type }) {- let key = `notifications.${type}`;- prefs.savePrefs({ [key]: true });-};-handlers['upload-file-web'] = async function ({ filename, contents }) {if (!Platform.isWeb) {return null;diff --git a/packages/loot-core/src/server/prefs.ts b/packages/loot-core/src/server/prefs.tsindex ba62c9a41e..46ced65dda 100644--- a/packages/loot-core/src/server/prefs.ts+++ b/packages/loot-core/src/server/prefs.ts@@ -23,6 +23,19 @@ export async function loadPrefs(id?) {prefs = { id, budgetName: id };}+ // delete released feature flags+ let releasedFeatures = ['syncAccount'];+ for (const feature of releasedFeatures) {+ delete prefs[`flags.${feature}`];+ }++ // delete legacy notifications+ for (const key of Object.keys(prefs)) {+ if (key.startsWith('notifications.')) {+ delete prefs[key];+ }+ }+// No matter what is in `id` field, force it to be the current id.// This makes it resilient to users moving around folders, etcprefs.id = id;@@ -69,14 +82,7 @@ export function getPrefs() {}export function getDefaultPrefs(id, budgetName) {- // Add any notifications in here that new users shouldn't see.- // Without them, a popup will show to explain a new feature.- return {- id,- budgetName,- 'notifications.schedules': true,- 'notifications.repair-splits': true,- };+ return { id, budgetName };}export async function readPrefs(id) {diff --git a/packages/loot-core/src/types/main-handlers.d.ts b/packages/loot-core/src/types/main-handlers.d.tsindex 79ff5d41db..3925c8d8d6 100644--- a/packages/loot-core/src/types/main-handlers.d.ts+++ b/packages/loot-core/src/types/main-handlers.d.ts@@ -306,10 +306,6 @@ export interface MainHandlers {'export-budget': () => Promise<unknown>;- 'get-upgrade-notifications': () => Promise<unknown[]>;-- 'seen-upgrade-notification': (arg: { type }) => Promise<unknown>;-'upload-file-web': (arg: { filename; contents }) => Promise<'ok'>;'backups-get': (arg: { id }) => Promise<unknown>;diff --git a/upcoming-release-notes/1156.md b/upcoming-release-notes/1156.mdnew file mode 100644index 0000000000..d3e9c168e1--- /dev/null+++ b/upcoming-release-notes/1156.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [j-f1]+---++Remove unused code for notifying about major new features when updating