Merge pull request #5703 from urbit/po/remove-prompt-for-browser-settings-notification

Po/remove prompt for browser settings notification
This commit is contained in:
nerveharp 2022-04-08 11:52:59 -04:00 committed by GitHub
commit 662e2d23ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,6 @@ import Mousetrap from 'mousetrap';
import { BrowserRouter, Switch, Route, useHistory, useLocation } from 'react-router-dom';
import { ErrorBoundary } from 'react-error-boundary';
import FingerprintJS from '@fingerprintjs/fingerprintjs';
import { addNote } from '@urbit/api';
import { Grid } from './pages/Grid';
import useDocketState from './state/docket';
import { PermalinkRoutes } from './pages/PermalinkRoutes';
@ -12,13 +11,7 @@ import useContactState from './state/contact';
import api from './state/api';
import { useMedia } from './logic/useMedia';
import { useHarkStore } from './state/hark';
import {
useSettingsState,
useBrowserSettings,
useTheme,
setBrowserSetting,
getBrowserSetting
} from './state/settings';
import { useSettingsState, useTheme } from './state/settings';
import { useBrowserId, useLocalState } from './state/local';
import { ErrorAlert } from './components/ErrorAlert';
import { useErrorHandler } from './logic/useErrorHandler';
@ -52,8 +45,6 @@ const AppRoutes = () => {
const { search } = useLocation();
const handleError = useErrorHandler();
const browserId = useBrowserId();
const settings = useBrowserSettings();
const { loaded } = useSettingsState.getState();
useEffect(() => {
getId().then((value) => {
@ -61,42 +52,6 @@ const AppRoutes = () => {
});
}, [browserId]);
useEffect(() => {
// Check if user has previously stored settings for this browser.
// If not, send a notification prompting them to do so.
// Set both settings to false so that they're not bugged again.
if (browserId !== '' && loaded) {
const thisBrowserSettings = getBrowserSetting(settings, browserId);
if (!thisBrowserSettings) {
api.poke(
addNote(
{
path: '/browser-settings',
place: { desk: 'garden', path: '/desk/garden' }
},
{
title: [{ text: 'Browser Preferences' }],
time: Date.now(),
content: [
{ text: "You haven't set your preferences for this browser, set them now?" }
],
link: '/grid/leap/system-preferences/interface',
binned: '/desk/garden'
}
)
);
const newSettings = setBrowserSetting(
settings,
{ protocolHandling: false, browserNotifications: false },
browserId
);
useSettingsState
.getState()
.putEntry('browserSettings', 'settings', JSON.stringify(newSettings));
}
}
}, [browserId, loaded]);
useEffect(() => {
const query = new URLSearchParams(search);
if (query.has('grid-note')) {