diff --git a/app/lib/services/connect.ts b/app/lib/services/connect.ts index bdecc4aa1..b04f75f8f 100644 --- a/app/lib/services/connect.ts +++ b/app/lib/services/connect.ts @@ -265,7 +265,14 @@ function stopListener(listener: any): boolean { async function login(credentials: ICredentials, isFromWebView = false): Promise { // RC 0.64.0 await sdk.current.login(credentials); + const serverVersion = store.getState().server.version; const result = sdk.current.currentLogin?.result; + + let enableMessageParserEarlyAdoption = true; + if (compareServerVersion(serverVersion, 'lowerThan', '5.0.0')) { + enableMessageParserEarlyAdoption = result.me.settings?.preferences?.enableMessageParserEarlyAdoption ?? true; + } + if (result) { const user: ILoggedUser = { id: result.userId, @@ -282,7 +289,7 @@ async function login(credentials: ICredentials, isFromWebView = false): Promise< avatarETag: result.me.avatarETag, isFromWebView, showMessageInMainThread: result.me.settings?.preferences?.showMessageInMainThread ?? true, - enableMessageParserEarlyAdoption: result.me.settings?.preferences?.enableMessageParserEarlyAdoption ?? true + enableMessageParserEarlyAdoption }; return user; } diff --git a/app/views/UserPreferencesView/index.tsx b/app/views/UserPreferencesView/index.tsx index e206f1e2d..fed7c5c7c 100644 --- a/app/views/UserPreferencesView/index.tsx +++ b/app/views/UserPreferencesView/index.tsx @@ -6,6 +6,7 @@ import { useDispatch } from 'react-redux'; import { setUser } from '../../actions/login'; import I18n from '../../i18n'; import log, { logEvent, events } from '../../lib/methods/helpers/log'; +import { compareServerVersion } from '../../lib/methods/helpers'; import SafeAreaView from '../../containers/SafeAreaView'; import StatusBar from '../../containers/StatusBar'; import * as List from '../../containers/List'; @@ -21,6 +22,7 @@ interface IUserPreferencesViewProps { const UserPreferencesView = ({ navigation }: IUserPreferencesViewProps): JSX.Element => { const { enableMessageParserEarlyAdoption, id } = useAppSelector(state => getUserSelector(state)); + const serverVersion = useAppSelector(state => state.server.version); const dispatch = useDispatch(); useEffect(() => { @@ -61,15 +63,17 @@ const UserPreferencesView = ({ navigation }: IUserPreferencesViewProps): JSX.Ele /> - - - renderMessageParserSwitch(enableMessageParserEarlyAdoption)} - /> - - + {compareServerVersion(serverVersion, 'lowerThan', '5.0.0') ? ( + + + renderMessageParserSwitch(enableMessageParserEarlyAdoption)} + /> + + + ) : null} );