[IMPROVE] Make message parser default (#4339)
This commit is contained in:
parent
1027b6c9e6
commit
37db9b208d
|
@ -265,7 +265,14 @@ function stopListener(listener: any): boolean {
|
||||||
async function login(credentials: ICredentials, isFromWebView = false): Promise<ILoggedUser | undefined> {
|
async function login(credentials: ICredentials, isFromWebView = false): Promise<ILoggedUser | undefined> {
|
||||||
// RC 0.64.0
|
// RC 0.64.0
|
||||||
await sdk.current.login(credentials);
|
await sdk.current.login(credentials);
|
||||||
|
const serverVersion = store.getState().server.version;
|
||||||
const result = sdk.current.currentLogin?.result;
|
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) {
|
if (result) {
|
||||||
const user: ILoggedUser = {
|
const user: ILoggedUser = {
|
||||||
id: result.userId,
|
id: result.userId,
|
||||||
|
@ -282,7 +289,7 @@ async function login(credentials: ICredentials, isFromWebView = false): Promise<
|
||||||
avatarETag: result.me.avatarETag,
|
avatarETag: result.me.avatarETag,
|
||||||
isFromWebView,
|
isFromWebView,
|
||||||
showMessageInMainThread: result.me.settings?.preferences?.showMessageInMainThread ?? true,
|
showMessageInMainThread: result.me.settings?.preferences?.showMessageInMainThread ?? true,
|
||||||
enableMessageParserEarlyAdoption: result.me.settings?.preferences?.enableMessageParserEarlyAdoption ?? true
|
enableMessageParserEarlyAdoption
|
||||||
};
|
};
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useDispatch } from 'react-redux';
|
||||||
import { setUser } from '../../actions/login';
|
import { setUser } from '../../actions/login';
|
||||||
import I18n from '../../i18n';
|
import I18n from '../../i18n';
|
||||||
import log, { logEvent, events } from '../../lib/methods/helpers/log';
|
import log, { logEvent, events } from '../../lib/methods/helpers/log';
|
||||||
|
import { compareServerVersion } from '../../lib/methods/helpers';
|
||||||
import SafeAreaView from '../../containers/SafeAreaView';
|
import SafeAreaView from '../../containers/SafeAreaView';
|
||||||
import StatusBar from '../../containers/StatusBar';
|
import StatusBar from '../../containers/StatusBar';
|
||||||
import * as List from '../../containers/List';
|
import * as List from '../../containers/List';
|
||||||
|
@ -21,6 +22,7 @@ interface IUserPreferencesViewProps {
|
||||||
|
|
||||||
const UserPreferencesView = ({ navigation }: IUserPreferencesViewProps): JSX.Element => {
|
const UserPreferencesView = ({ navigation }: IUserPreferencesViewProps): JSX.Element => {
|
||||||
const { enableMessageParserEarlyAdoption, id } = useAppSelector(state => getUserSelector(state));
|
const { enableMessageParserEarlyAdoption, id } = useAppSelector(state => getUserSelector(state));
|
||||||
|
const serverVersion = useAppSelector(state => state.server.version);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -61,6 +63,7 @@ const UserPreferencesView = ({ navigation }: IUserPreferencesViewProps): JSX.Ele
|
||||||
/>
|
/>
|
||||||
<List.Separator />
|
<List.Separator />
|
||||||
</List.Section>
|
</List.Section>
|
||||||
|
{compareServerVersion(serverVersion, 'lowerThan', '5.0.0') ? (
|
||||||
<List.Section>
|
<List.Section>
|
||||||
<List.Separator />
|
<List.Separator />
|
||||||
<List.Item
|
<List.Item
|
||||||
|
@ -70,6 +73,7 @@ const UserPreferencesView = ({ navigation }: IUserPreferencesViewProps): JSX.Ele
|
||||||
/>
|
/>
|
||||||
<List.Separator />
|
<List.Separator />
|
||||||
</List.Section>
|
</List.Section>
|
||||||
|
) : null}
|
||||||
</List.Container>
|
</List.Container>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue