@@ -25,6 +25,7 @@ import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
25
25
import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePhases" ;
26
26
import { UPDATE_EVENT } from "../../../stores/AsyncStore" ;
27
27
import { NotificationColor } from "../../../stores/notifications/NotificationColor" ;
28
+ import SettingsStore from "../../../settings/SettingsStore" ;
28
29
29
30
export enum HeaderKind {
30
31
Room = "room" ,
@@ -35,13 +36,15 @@ interface IState {
35
36
phase : RightPanelPhases | null ;
36
37
threadNotificationColor : NotificationColor ;
37
38
globalNotificationColor : NotificationColor ;
39
+ notificationsEnabled ?: boolean ;
38
40
}
39
41
40
42
interface IProps { }
41
43
42
44
export default abstract class HeaderButtons < P = { } > extends React . Component < IProps & P , IState > {
43
45
private unmounted = false ;
44
46
private dispatcherRef ?: string = undefined ;
47
+ private readonly watcherRef : string ;
45
48
46
49
public constructor ( props : IProps & P , kind : HeaderKind ) {
47
50
super ( props ) ;
@@ -52,7 +55,11 @@ export default abstract class HeaderButtons<P = {}> extends React.Component<IPro
52
55
phase : rps . currentCard . phase ,
53
56
threadNotificationColor : NotificationColor . None ,
54
57
globalNotificationColor : NotificationColor . None ,
58
+ notificationsEnabled : SettingsStore . getValue ( "feature_notifications" ) ,
55
59
} ;
60
+ this . watcherRef = SettingsStore . watchSetting ( "feature_notifications" , null , ( ...[ , , , value ] ) =>
61
+ this . setState ( { notificationsEnabled : value } ) ,
62
+ ) ;
56
63
}
57
64
58
65
public componentDidMount ( ) : void {
@@ -63,6 +70,7 @@ export default abstract class HeaderButtons<P = {}> extends React.Component<IPro
63
70
this . unmounted = true ;
64
71
RightPanelStore . instance . off ( UPDATE_EVENT , this . onRightPanelStoreUpdate ) ;
65
72
if ( this . dispatcherRef ) dis . unregister ( this . dispatcherRef ) ;
73
+ if ( this . watcherRef ) SettingsStore . unwatchSetting ( this . watcherRef ) ;
66
74
}
67
75
68
76
public isPhase ( phases : string | string [ ] ) : boolean {
0 commit comments