Reconnect on failure, with backoff; Deduping notifications
This commit is contained in:
parent
3fac1c3432
commit
1536201e9a
6 changed files with 62 additions and 45 deletions
|
@ -9,7 +9,8 @@ import DialogTitle from '@mui/material/DialogTitle';
|
|||
import {useState} from "react";
|
||||
import Subscription from "../app/Subscription";
|
||||
|
||||
const defaultBaseUrl = "https://ntfy.sh"
|
||||
const defaultBaseUrl = "http://127.0.0.1"
|
||||
//const defaultBaseUrl = "https://ntfy.sh"
|
||||
|
||||
const AddDialog = (props) => {
|
||||
const [topic, setTopic] = useState("");
|
||||
|
|
|
@ -101,7 +101,7 @@ const SubscriptionNavItem = (props) => {
|
|||
}
|
||||
|
||||
const App = () => {
|
||||
console.log("Launching App component");
|
||||
console.log(`[App] Rendering main view`);
|
||||
|
||||
const [drawerOpen, setDrawerOpen] = useState(true);
|
||||
const [subscriptions, setSubscriptions] = useState(new Subscriptions());
|
||||
|
@ -114,6 +114,7 @@ const App = () => {
|
|||
});
|
||||
};
|
||||
const handleSubscribeSubmit = (subscription) => {
|
||||
console.log(`[App] New subscription: ${subscription.id}`);
|
||||
setSubscribeDialogOpen(false);
|
||||
setSubscriptions(prev => prev.add(subscription).clone());
|
||||
setSelectedSubscription(subscription);
|
||||
|
@ -126,10 +127,11 @@ const App = () => {
|
|||
});
|
||||
};
|
||||
const handleSubscribeCancel = () => {
|
||||
console.log(`Cancel clicked`);
|
||||
console.log(`[App] Cancel clicked`);
|
||||
setSubscribeDialogOpen(false);
|
||||
};
|
||||
const handleUnsubscribe = (subscriptionId) => {
|
||||
console.log(`[App] Unsubscribing from ${subscriptionId}`);
|
||||
setSubscriptions(prev => {
|
||||
const newSubscriptions = prev.remove(subscriptionId).clone();
|
||||
setSelectedSubscription(newSubscriptions.firstOrNull());
|
||||
|
@ -137,10 +139,10 @@ const App = () => {
|
|||
});
|
||||
};
|
||||
const handleSubscriptionClick = (subscriptionId) => {
|
||||
console.log(`Selected subscription ${subscriptionId}`);
|
||||
console.log(`[App] Selected ${subscriptionId}`);
|
||||
setSelectedSubscription(subscriptions.get(subscriptionId));
|
||||
};
|
||||
const notifications = (selectedSubscription !== null) ? selectedSubscription.notifications : [];
|
||||
const notifications = (selectedSubscription !== null) ? selectedSubscription.getNotifications() : [];
|
||||
const toggleDrawer = () => {
|
||||
setDrawerOpen(!drawerOpen);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue