Move ResizerNotifier into SDKContext (#30939)
* Move ResizerNotifier into SDKContext so we don't have to pass it into RoomView * Fix test * Unused import * Add tests * Remove a bunch of resizeNotifier props * Remove more resizeNotifier props * Add resizenotifier to test * Add more sdkcontext wrappers in tests * More sdkcontext wrappers * Even more sdkcontext wrappers * Add test to make sonarcloud happy * Context isn't always there unlike props * Test actual resizing too * Remove commented line
This commit is contained in:
@@ -49,7 +49,6 @@ import { _t, _td } from "../../languageHandler";
|
||||
import SettingsStore from "../../settings/SettingsStore";
|
||||
import ThemeController from "../../settings/controllers/ThemeController";
|
||||
import { startAnyRegistrationFlow } from "../../Registration";
|
||||
import ResizeNotifier from "../../utils/ResizeNotifier";
|
||||
import AutoDiscoveryUtils from "../../utils/AutoDiscoveryUtils";
|
||||
import { calculateRoomVia, makeRoomPermalink } from "../../utils/permalinks/Permalinks";
|
||||
import ThemeWatcher, { ThemeWatcherEvent } from "../../settings/watchers/ThemeWatcher";
|
||||
@@ -199,7 +198,6 @@ interface IState {
|
||||
// and disable it when there are no dialogs
|
||||
hideToSRUsers: boolean;
|
||||
syncError: Error | null;
|
||||
resizeNotifier: ResizeNotifier;
|
||||
serverConfig?: ValidatedServerConfig;
|
||||
ready: boolean;
|
||||
threepidInvite?: IThreepidInvite;
|
||||
@@ -254,7 +252,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
isMobileRegistration: false,
|
||||
|
||||
syncError: null, // If the current syncing status is ERROR, the error object, otherwise null.
|
||||
resizeNotifier: new ResizeNotifier(),
|
||||
ready: false,
|
||||
};
|
||||
|
||||
@@ -459,7 +456,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
UIStore.instance.on(UI_EVENTS.Resize, this.handleResize);
|
||||
|
||||
// For PersistentElement
|
||||
this.state.resizeNotifier.on("middlePanelResized", this.dispatchTimelineResize);
|
||||
this.stores.resizeNotifier.on("middlePanelResized", this.dispatchTimelineResize);
|
||||
|
||||
RoomNotificationStateStore.instance.on(UPDATE_STATUS_INDICATOR, this.onUpdateStatusIndicator);
|
||||
|
||||
@@ -511,7 +508,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
this.themeWatcher?.stop();
|
||||
this.fontWatcher?.stop();
|
||||
UIStore.destroy();
|
||||
this.state.resizeNotifier.removeListener("middlePanelResized", this.dispatchTimelineResize);
|
||||
this.stores.resizeNotifier.removeListener("middlePanelResized", this.dispatchTimelineResize);
|
||||
window.removeEventListener("resize", this.onWindowResized);
|
||||
}
|
||||
|
||||
@@ -828,7 +825,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
collapseLhs: true,
|
||||
},
|
||||
() => {
|
||||
this.state.resizeNotifier.notifyLeftHandleResized();
|
||||
this.stores.resizeNotifier.notifyLeftHandleResized();
|
||||
},
|
||||
);
|
||||
break;
|
||||
@@ -838,7 +835,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
collapseLhs: false,
|
||||
},
|
||||
() => {
|
||||
this.state.resizeNotifier.notifyLeftHandleResized();
|
||||
this.stores.resizeNotifier.notifyLeftHandleResized();
|
||||
},
|
||||
);
|
||||
break;
|
||||
@@ -1957,7 +1954,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
}
|
||||
|
||||
this.prevWindowWidth = width;
|
||||
this.state.resizeNotifier.notifyWindowResized();
|
||||
this.stores.resizeNotifier.notifyWindowResized();
|
||||
};
|
||||
|
||||
private dispatchTimelineResize(): void {
|
||||
|
||||
Reference in New Issue
Block a user