diff --git a/src/usecase/Root.tsx b/src/usecase/Root.tsx index 3aff400..954057e 100644 --- a/src/usecase/Root.tsx +++ b/src/usecase/Root.tsx @@ -116,11 +116,6 @@ export default class WeechatNative extends React.Component { ); } - componentDidMount(): void { - const { hostname, password, ssl } = store.getState().connection; - if (hostname && password) this.onConnect(hostname, password, ssl); - } - componentWillUnmount(): void { this.connection?.disconnect(); this.appStateListener.remove(); @@ -130,6 +125,11 @@ export default class WeechatNative extends React.Component { this.unsubscribeFetchBuffersDispatchListener(); } + onBeforeLift = (): void => { + const { hostname, password, ssl } = store.getState().connection; + if (hostname && password) this.onConnect(hostname, password, ssl); + }; + setNotificationToken = async (): Promise => { const token = await getPushNotificationStatusAsync(); if (token) this.sendMessageToBuffer('core.weechat', '/weechatrn ' + token); @@ -218,7 +218,11 @@ export default class WeechatNative extends React.Component { return ( - +