feat: button to refresh cloud data on support window expired screen (#5528)
This commit is contained in:
parent
50d534f71b
commit
d9dd6a3dd8
|
@ -1,17 +1,49 @@
|
|||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { View, Text, Linking } from 'react-native';
|
||||
import { useDispatch } from 'react-redux';
|
||||
|
||||
import I18n from '../../i18n';
|
||||
import { useAppSelector } from '../../lib/hooks';
|
||||
import { getServerById } from '../../lib/database/services/Server';
|
||||
import log from '../../lib/methods/helpers/log';
|
||||
import database from '../../lib/database';
|
||||
import { useTheme } from '../../theme';
|
||||
import { CustomIcon } from '../CustomIcon';
|
||||
import Button from '../Button';
|
||||
import { styles } from './styles';
|
||||
import { LEARN_MORE_URL } from './constants';
|
||||
import { selectServerRequest } from '../../actions/server';
|
||||
|
||||
const checkAgainTimeout = 3000;
|
||||
|
||||
export const SupportedVersionsExpired = () => {
|
||||
const { colors } = useTheme();
|
||||
const { name } = useAppSelector(state => state.server);
|
||||
const [checking, setChecking] = useState(false);
|
||||
const { name, server } = useAppSelector(state => state.server);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const checkAgain = async () => {
|
||||
try {
|
||||
setChecking(true);
|
||||
const serversDB = database.servers;
|
||||
const serverRecord = await getServerById(server);
|
||||
if (serverRecord) {
|
||||
await serversDB.write(async () => {
|
||||
await serverRecord.update(r => {
|
||||
r.supportedVersionsUpdatedAt = null;
|
||||
r.supportedVersionsWarningAt = null;
|
||||
});
|
||||
});
|
||||
dispatch(selectServerRequest(server));
|
||||
// forces loading state a little longer until redux is finished
|
||||
await new Promise(res => setTimeout(res, checkAgainTimeout));
|
||||
}
|
||||
} catch (e) {
|
||||
log(e);
|
||||
} finally {
|
||||
setChecking(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={[styles.container, { paddingTop: 120, backgroundColor: colors.focusedBackground }]}>
|
||||
|
@ -22,6 +54,7 @@ export const SupportedVersionsExpired = () => {
|
|||
{I18n.t('Supported_versions_expired_title', { workspace_name: name })}
|
||||
</Text>
|
||||
<Text style={[styles.description, { color: colors.bodyText }]}>{I18n.t('Supported_versions_expired_description')}</Text>
|
||||
<Button title={I18n.t('Check_again')} type='primary' onPress={checkAgain} loading={checking} />
|
||||
<Button
|
||||
title={I18n.t('Learn_more')}
|
||||
type='secondary'
|
||||
|
|
|
@ -80,8 +80,8 @@ export interface IServer {
|
|||
enterpriseModules: IEnterpriseModules;
|
||||
E2E_Enable: boolean;
|
||||
supportedVersions?: ISupportedVersionsData;
|
||||
supportedVersionsWarningAt?: Date;
|
||||
supportedVersionsUpdatedAt?: Date;
|
||||
supportedVersionsWarningAt?: Date | null;
|
||||
supportedVersionsUpdatedAt?: Date | null;
|
||||
}
|
||||
|
||||
export type TServerModel = IServer & Model;
|
||||
|
|
|
@ -805,5 +805,6 @@
|
|||
"Add_thread_reply": "Add thread reply",
|
||||
"Message_roomname": "Message {{roomName}}",
|
||||
"Microphone_access_needed_to_record_audio": "Microphone access needed to record audio",
|
||||
"Go_to_your_device_settings_and_allow_microphone": "Go to your device settings and allow microphone access for Rocket.Chat"
|
||||
"Go_to_your_device_settings_and_allow_microphone": "Go to your device settings and allow microphone access for Rocket.Chat",
|
||||
"Check_again": "Check again"
|
||||
}
|
|
@ -797,5 +797,6 @@
|
|||
"Microphone_access_needed_to_record_audio": "Acesso ao microfone necessário para gravar áudio",
|
||||
"Go_to_your_device_settings_and_allow_microphone": "Vá para as configurações do seu dispositivo e permita o acesso ao microfone pelo aplicativo Rocket.Chat",
|
||||
"In_app_message_notifications": "Notificações de mensagens in-app",
|
||||
"Vibrate": "Vibrar"
|
||||
"Vibrate": "Vibrar",
|
||||
"Check_again": "Verificar novamente"
|
||||
}
|
Loading…
Reference in New Issue