Make connections react on changes of users; this works wonderfully

This commit is contained in:
Philipp Heckel 2022-03-03 20:07:35 -05:00
parent 08846e4cc2
commit 695e029147
4 changed files with 49 additions and 31 deletions

View file

@ -19,14 +19,11 @@ import pruner from "../app/Pruner";
import subscriptionManager from "../app/SubscriptionManager";
import userManager from "../app/UserManager";
// TODO subscribe dialog:
// - check/use existing user
// - add baseUrl
// TODO embed into ntfy server
// TODO subscribe dialog check/use existing user
// TODO make default server functional
// TODO business logic with callbacks
// TODO routing
// TODO embed into ntfy server
// TODO connection indicator in subscription list
// TODO connectionmanager should react on users changes
const App = () => {
console.log(`[App] Rendering main view`);
@ -53,9 +50,7 @@ const App = () => {
setSelectedSubscription(newSelected);
};
const handleRequestPermission = () => {
notificationManager.maybeRequestPermission((granted) => {
setNotificationsGranted(granted);
})
notificationManager.maybeRequestPermission(granted => setNotificationsGranted(granted));
};
const handlePrefsClick = () => {
setPrefsOpen(true);
@ -91,7 +86,7 @@ const App = () => {
console.error(`[App] Error handling notification`, e);
}
};
connectionManager.refresh(subscriptions, users, handleNotification);
connectionManager.refresh(subscriptions, users, handleNotification); // Dangle
}, [subscriptions, users]);
useEffect(() => {
const subscriptionId = (selectedSubscription) ? selectedSubscription.id : "";