Рефакторинг. Добавление комментариев для импортов, вынесение общеиспользуемых констант в отдельные модули, удаление неиспользуемых файлов
This commit is contained in:
parent
c3b429f777
commit
b0adcad59e
@ -7,12 +7,12 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const { Modal, View, FlatList, Pressable, Keyboard } = require('react-native');
|
||||
const { useSafeAreaInsets } = require('react-native-safe-area-context');
|
||||
const AppText = require('../common/AppText');
|
||||
const AppButton = require('../common/AppButton');
|
||||
const styles = require('../../styles/auth/OrganizationSelectDialog.styles');
|
||||
const React = require('react'); //React
|
||||
const { Modal, View, FlatList, Pressable, Keyboard } = require('react-native'); //Модальное окно и список
|
||||
const { useSafeAreaInsets } = require('react-native-safe-area-context'); //Отступы безопасной области
|
||||
const AppText = require('../common/AppText'); //Общий текст
|
||||
const AppButton = require('../common/AppButton'); //Кнопка
|
||||
const styles = require('../../styles/auth/OrganizationSelectDialog.styles'); //Стили диалога
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,11 +7,11 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const { Switch, Pressable } = require('react-native');
|
||||
const AppText = require('./AppText');
|
||||
const styles = require('../../styles/common/AppSwitch.styles');
|
||||
const { APP_COLORS } = require('../../config/theme');
|
||||
const React = require('react'); //React
|
||||
const { Switch, Pressable } = require('react-native'); //Переключатель и нажатие
|
||||
const AppText = require('./AppText'); //Общий текст
|
||||
const styles = require('../../styles/common/AppSwitch.styles'); //Стили переключателя
|
||||
const { APP_COLORS } = require('../../config/theme'); //Цветовая схема
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const { Modal, View, ActivityIndicator } = require('react-native');
|
||||
const AppText = require('./AppText');
|
||||
const styles = require('../../styles/common/LoadingOverlay.styles');
|
||||
const React = require('react'); //React
|
||||
const { Modal, View, ActivityIndicator } = require('react-native'); //Модальное окно и индикатор
|
||||
const AppText = require('./AppText'); //Общий текст
|
||||
const styles = require('../../styles/common/LoadingOverlay.styles'); //Стили оверлея
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const { View, TextInput, Pressable } = require('react-native');
|
||||
const AppText = require('./AppText');
|
||||
const styles = require('../../styles/common/PasswordInput.styles');
|
||||
const React = require('react'); //React
|
||||
const { View, TextInput, Pressable } = require('react-native'); //Разметка и поле ввода
|
||||
const AppText = require('./AppText'); //Общий текст
|
||||
const styles = require('../../styles/common/PasswordInput.styles'); //Стили поля пароля
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const useAuth = require('../../hooks/useAuth');
|
||||
const React = require('react'); //React
|
||||
const useAuth = require('../../hooks/useAuth'); //Хук авторизации
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -13,6 +13,7 @@ const AppText = require('../common/AppText'); //Общий текстовый к
|
||||
const AppLogo = require('../common/AppLogo'); //Логотип приложения
|
||||
const { useAppModeContext } = require('./AppModeProvider'); //Контекст режима работы
|
||||
const { useAppNavigationContext } = require('./AppNavigationProvider'); //Контекст навигации
|
||||
const { SCREEN_TITLE_SETTINGS } = require('../../config/messages'); //Заголовки экранов
|
||||
const styles = require('../../styles/layout/AppHeader.styles'); //Стили заголовка
|
||||
|
||||
//-----------
|
||||
@ -60,7 +61,7 @@ function AppHeader({ title, subtitle, showMenuButton = true, onMenuPress, showBa
|
||||
case SCREENS.MAIN:
|
||||
return 'Парус© Предрейсовые осмотры';
|
||||
case SCREENS.SETTINGS:
|
||||
return 'Настройки';
|
||||
return SCREEN_TITLE_SETTINGS;
|
||||
default:
|
||||
return 'Парус© Предрейсовые осмотры';
|
||||
}
|
||||
|
||||
@ -8,9 +8,10 @@
|
||||
//---------------------
|
||||
|
||||
const React = require('react'); //React и хуки
|
||||
const { useColorScheme } = require('react-native'); //Определение темы устройства
|
||||
const { useColorScheme, View } = require('react-native'); //Определение темы устройства и разметка
|
||||
const { SafeAreaProvider } = require('react-native-safe-area-context'); //Провайдер безопасной области
|
||||
const AppShell = require('./AppShell'); //Оболочка приложения
|
||||
const styles = require('../../styles/layout/AppRoot.styles'); //Стили корневого layout
|
||||
const { useAppNavigationContext } = require('./AppNavigationProvider'); //Контекст навигации
|
||||
const { useAppAuthContext } = require('./AppAuthProvider'); //Контекст авторизации
|
||||
const { useAppLocalDbContext } = require('./AppLocalDbProvider'); //Контекст локальной БД
|
||||
@ -48,7 +49,9 @@ function AppRoot() {
|
||||
|
||||
return (
|
||||
<SafeAreaProvider>
|
||||
<View style={styles.container}>
|
||||
<AppShell isDarkMode={isDarkMode} />
|
||||
</View>
|
||||
</SafeAreaProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@ -7,11 +7,11 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const { View } = require('react-native');
|
||||
const AppText = require('../common/AppText');
|
||||
const { getModeLabel } = require('../../utils/appInfo');
|
||||
const styles = require('../../styles/menu/MenuUserInfo.styles');
|
||||
const React = require('react'); //React
|
||||
const { View } = require('react-native'); //Разметка
|
||||
const AppText = require('../common/AppText'); //Общий текст
|
||||
const { getModeLabel } = require('../../utils/appInfo'); //Подпись режима работы
|
||||
const styles = require('../../styles/menu/MenuUserInfo.styles'); //Стили блока пользователя
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -15,7 +15,7 @@ const LOGO_SIZE_KEYS = Object.freeze({
|
||||
});
|
||||
|
||||
//Изображение логотипа приложения
|
||||
const APP_LOGO = require('../../assets/icons/logo.png');
|
||||
const APP_LOGO = require('../../assets/icons/logo.png'); //Ресурс изображения
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
//---------------------
|
||||
|
||||
const { responsiveSize, isTablet } = require('../utils/responsive'); //Адаптивные утилиты
|
||||
const { Platform } = require('react-native');
|
||||
const { Platform } = require('react-native'); //Платформа (ios/android/web)
|
||||
|
||||
//---------
|
||||
//Константы
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { APP_COLORS } = require('./theme');
|
||||
const { APP_COLORS } = require('./theme'); //Цветовая схема
|
||||
|
||||
//---------
|
||||
//Константы
|
||||
|
||||
@ -13,11 +13,55 @@ const CONNECTION_LOST_MESSAGE = 'Нет связи с сервером. Прил
|
||||
//Заголовок сообщения при переходе в режим офлайн
|
||||
const OFFLINE_MODE_TITLE = 'Режим офлайн';
|
||||
|
||||
//Заголовок диалога/экрана «Информация о приложении»
|
||||
const APP_ABOUT_TITLE = 'Информация о приложении';
|
||||
|
||||
//Заголовок бокового меню
|
||||
const SIDE_MENU_TITLE = 'Меню';
|
||||
|
||||
//Заголовок диалога выбора организации
|
||||
const ORGANIZATION_SELECT_DIALOG_TITLE = 'Выберите организацию';
|
||||
|
||||
//Пункты бокового меню
|
||||
const MENU_ITEM_SETTINGS = 'Настройки';
|
||||
const MENU_ITEM_ABOUT = 'О приложении';
|
||||
const MENU_ITEM_LOGIN = 'Вход';
|
||||
const MENU_ITEM_LOGOUT = 'Выход';
|
||||
|
||||
//Экран авторизации
|
||||
const AUTH_SCREEN_TITLE = 'Вход в приложение';
|
||||
const AUTH_BUTTON_LOGIN = 'Войти';
|
||||
const AUTH_BUTTON_LOADING = 'Вход...';
|
||||
|
||||
//Сообщения об успешных действиях
|
||||
const LOGIN_SUCCESS_MESSAGE = 'Вход выполнен успешно';
|
||||
const LOGOUT_SUCCESS_MESSAGE = 'Выход выполнен';
|
||||
const SETTINGS_SERVER_SAVED_MESSAGE = 'Настройки сервера сохранены';
|
||||
const SETTINGS_RESET_SUCCESS_MESSAGE = 'Настройки сброшены';
|
||||
|
||||
//Заголовок экрана настроек
|
||||
const SCREEN_TITLE_SETTINGS = 'Настройки';
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
//----------------
|
||||
|
||||
module.exports = {
|
||||
CONNECTION_LOST_MESSAGE,
|
||||
OFFLINE_MODE_TITLE
|
||||
OFFLINE_MODE_TITLE,
|
||||
APP_ABOUT_TITLE,
|
||||
SIDE_MENU_TITLE,
|
||||
ORGANIZATION_SELECT_DIALOG_TITLE,
|
||||
MENU_ITEM_SETTINGS,
|
||||
MENU_ITEM_ABOUT,
|
||||
MENU_ITEM_LOGIN,
|
||||
MENU_ITEM_LOGOUT,
|
||||
AUTH_SCREEN_TITLE,
|
||||
AUTH_BUTTON_LOGIN,
|
||||
AUTH_BUTTON_LOADING,
|
||||
LOGIN_SUCCESS_MESSAGE,
|
||||
LOGOUT_SUCCESS_MESSAGE,
|
||||
SETTINGS_SERVER_SAVED_MESSAGE,
|
||||
SETTINGS_RESET_SUCCESS_MESSAGE,
|
||||
SCREEN_TITLE_SETTINGS
|
||||
};
|
||||
|
||||
@ -7,10 +7,8 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { open } = require('react-native-quick-sqlite');
|
||||
|
||||
//Импорт утилиты для загрузки SQL файлов
|
||||
const SQLFileLoader = require('./sql/SQLFileLoader');
|
||||
const { open } = require('react-native-quick-sqlite'); //Открытие БД SQLite
|
||||
const SQLFileLoader = require('./sql/SQLFileLoader'); //Загрузчик SQL-файлов
|
||||
const { DB_NAME } = require('../config/database'); //Имя базы данных
|
||||
|
||||
//-----------
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const SQLQueries = require('./SQLQueries');
|
||||
const SQLQueries = require('./SQLQueries'); //Индекс SQL-запросов
|
||||
|
||||
//------------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const React = require('react'); //React и хуки
|
||||
const { useAppLocalDbContext } = require('../components/layout/AppLocalDbProvider'); //Контекст локальной БД
|
||||
|
||||
//---------
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const React = require('react'); //React и хуки
|
||||
const { useAppLocalDbContext } = require('../components/layout/AppLocalDbProvider'); //Контекст локальной БД
|
||||
|
||||
//---------
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const { useAppLocalDbContext } = require('../components/layout/AppLocalDbProvider');
|
||||
const { AUTH_SETTINGS_KEYS, DEFAULT_IDLE_TIMEOUT } = require('../config/authConfig');
|
||||
const { ACTION_CODES, RESPONSE_STATES, ERROR_MESSAGES } = require('../config/authApi');
|
||||
const { generateSecretKey, encryptData, decryptData } = require('../utils/secureStorage');
|
||||
const { getPersistentDeviceId, isPersistentIdAvailable } = require('../utils/deviceId');
|
||||
const React = require('react'); //React и хуки
|
||||
const { useAppLocalDbContext } = require('../components/layout/AppLocalDbProvider'); //Контекст локальной БД
|
||||
const { AUTH_SETTINGS_KEYS, DEFAULT_IDLE_TIMEOUT } = require('../config/authConfig'); //Конфиг авторизации
|
||||
const { ACTION_CODES, RESPONSE_STATES, ERROR_MESSAGES } = require('../config/authApi'); //API авторизации
|
||||
const { generateSecretKey, encryptData, decryptData } = require('../utils/secureStorage'); //Шифрование
|
||||
const { getPersistentDeviceId, isPersistentIdAvailable } = require('../utils/deviceId'); //Идентификатор устройства
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const SQLiteDatabase = require('../database/SQLiteDatabase');
|
||||
const React = require('react'); //React и хуки
|
||||
const SQLiteDatabase = require('../database/SQLiteDatabase'); //Модуль SQLite
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,29 +7,40 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const { ScrollView, View, KeyboardAvoidingView, Platform } = require('react-native');
|
||||
const AdaptiveView = require('../components/common/AdaptiveView');
|
||||
const AppText = require('../components/common/AppText');
|
||||
const AppInput = require('../components/common/AppInput');
|
||||
const AppButton = require('../components/common/AppButton');
|
||||
const AppSwitch = require('../components/common/AppSwitch');
|
||||
const PasswordInput = require('../components/common/PasswordInput');
|
||||
const AppHeader = require('../components/layout/AppHeader');
|
||||
const AppLogo = require('../components/common/AppLogo');
|
||||
const SideMenu = require('../components/menu/SideMenu');
|
||||
const LoadingOverlay = require('../components/common/LoadingOverlay');
|
||||
const OrganizationSelectDialog = require('../components/auth/OrganizationSelectDialog');
|
||||
const { useAppMessagingContext } = require('../components/layout/AppMessagingProvider');
|
||||
const { useAppModeContext } = require('../components/layout/AppModeProvider');
|
||||
const { useAppNavigationContext } = require('../components/layout/AppNavigationProvider');
|
||||
const { useAppLocalDbContext } = require('../components/layout/AppLocalDbProvider');
|
||||
const { useAppAuthContext } = require('../components/layout/AppAuthProvider');
|
||||
const { getAppInfo } = require('../utils/appInfo');
|
||||
const { isServerUrlFieldVisible } = require('../utils/loginFormUtils');
|
||||
const { normalizeServerUrl, validateServerUrl } = require('../utils/validation');
|
||||
const { AUTH_SETTINGS_KEYS } = require('../config/authConfig');
|
||||
const styles = require('../styles/screens/AuthScreen.styles');
|
||||
const React = require('react'); //React и хуки
|
||||
const { ScrollView, View, KeyboardAvoidingView, Platform } = require('react-native'); //Базовые компоненты
|
||||
const AdaptiveView = require('../components/common/AdaptiveView'); //Адаптивный контейнер
|
||||
const AppText = require('../components/common/AppText'); //Общий текст
|
||||
const AppInput = require('../components/common/AppInput'); //Поле ввода
|
||||
const AppButton = require('../components/common/AppButton'); //Кнопка
|
||||
const AppSwitch = require('../components/common/AppSwitch'); //Переключатель
|
||||
const PasswordInput = require('../components/common/PasswordInput'); //Поле пароля
|
||||
const AppHeader = require('../components/layout/AppHeader'); //Заголовок
|
||||
const AppLogo = require('../components/common/AppLogo'); //Логотип
|
||||
const SideMenu = require('../components/menu/SideMenu'); //Боковое меню
|
||||
const LoadingOverlay = require('../components/common/LoadingOverlay'); //Оверлей загрузки
|
||||
const OrganizationSelectDialog = require('../components/auth/OrganizationSelectDialog'); //Диалог выбора организации
|
||||
const { useAppMessagingContext } = require('../components/layout/AppMessagingProvider'); //Контекст сообщений
|
||||
const { useAppModeContext } = require('../components/layout/AppModeProvider'); //Контекст режима
|
||||
const { useAppNavigationContext } = require('../components/layout/AppNavigationProvider'); //Контекст навигации
|
||||
const { useAppLocalDbContext } = require('../components/layout/AppLocalDbProvider'); //Контекст локальной БД
|
||||
const { useAppAuthContext } = require('../components/layout/AppAuthProvider'); //Контекст авторизации
|
||||
const { getAppInfo } = require('../utils/appInfo'); //Информация о приложении
|
||||
const { isServerUrlFieldVisible } = require('../utils/loginFormUtils'); //Утилиты формы входа
|
||||
const { normalizeServerUrl, validateServerUrl } = require('../utils/validation'); //Валидация
|
||||
const { AUTH_SETTINGS_KEYS } = require('../config/authConfig'); //Конфиг авторизации
|
||||
const {
|
||||
APP_ABOUT_TITLE,
|
||||
SIDE_MENU_TITLE,
|
||||
ORGANIZATION_SELECT_DIALOG_TITLE,
|
||||
MENU_ITEM_SETTINGS,
|
||||
MENU_ITEM_ABOUT,
|
||||
AUTH_SCREEN_TITLE,
|
||||
AUTH_BUTTON_LOGIN,
|
||||
AUTH_BUTTON_LOADING,
|
||||
LOGIN_SUCCESS_MESSAGE
|
||||
} = require('../config/messages'); //Сообщения
|
||||
const styles = require('../styles/screens/AuthScreen.styles'); //Стили экрана
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
@ -312,7 +323,7 @@ function AuthScreen() {
|
||||
return;
|
||||
}
|
||||
|
||||
showSuccess('Вход выполнен успешно');
|
||||
showSuccess(LOGIN_SUCCESS_MESSAGE);
|
||||
setOnline();
|
||||
clearAuthFormData();
|
||||
reset();
|
||||
@ -381,7 +392,7 @@ function AuthScreen() {
|
||||
}
|
||||
|
||||
//Успешный вход
|
||||
showSuccess('Вход выполнен успешно');
|
||||
showSuccess(LOGIN_SUCCESS_MESSAGE);
|
||||
setOnline();
|
||||
|
||||
//Очищаем временные данные
|
||||
@ -464,7 +475,7 @@ function AuthScreen() {
|
||||
});
|
||||
|
||||
showInfo(appInfo, {
|
||||
title: 'Информация о приложении'
|
||||
title: APP_ABOUT_TITLE
|
||||
});
|
||||
}, [showInfo, mode, serverUrl, isDbReady]);
|
||||
|
||||
@ -473,12 +484,12 @@ function AuthScreen() {
|
||||
return [
|
||||
{
|
||||
id: 'settings',
|
||||
title: 'Настройки',
|
||||
title: MENU_ITEM_SETTINGS,
|
||||
onPress: handleOpenSettings
|
||||
},
|
||||
{
|
||||
id: 'about',
|
||||
title: 'О приложении',
|
||||
title: MENU_ITEM_ABOUT,
|
||||
onPress: handleShowAbout
|
||||
}
|
||||
];
|
||||
@ -508,7 +519,7 @@ function AuthScreen() {
|
||||
|
||||
<View style={styles.formContainer}>
|
||||
<AppText style={styles.title} variant="h2" weight="bold">
|
||||
Вход в приложение
|
||||
{AUTH_SCREEN_TITLE}
|
||||
</AppText>
|
||||
|
||||
{shouldShowServerUrl ? (
|
||||
@ -564,7 +575,7 @@ function AuthScreen() {
|
||||
</View>
|
||||
|
||||
<AppButton
|
||||
title={isLoading ? 'Вход...' : 'Войти'}
|
||||
title={isLoading ? AUTH_BUTTON_LOADING : AUTH_BUTTON_LOGIN}
|
||||
onPress={handleLogin}
|
||||
disabled={isLoading || !isSettingsLoaded}
|
||||
style={styles.loginButton}
|
||||
@ -578,7 +589,7 @@ function AuthScreen() {
|
||||
visible={menuVisible}
|
||||
onClose={handleMenuClose}
|
||||
items={menuItems}
|
||||
title="Меню"
|
||||
title={SIDE_MENU_TITLE}
|
||||
mode={mode}
|
||||
username={session?.userName}
|
||||
organization={session?.companyName}
|
||||
@ -589,7 +600,7 @@ function AuthScreen() {
|
||||
organizations={organizations}
|
||||
onSelect={handleSelectOrganization}
|
||||
onCancel={handleCancelOrganization}
|
||||
title="Выберите организацию"
|
||||
title={ORGANIZATION_SELECT_DIALOG_TITLE}
|
||||
/>
|
||||
|
||||
<LoadingOverlay visible={isLoading} message="Выполняется вход..." />
|
||||
|
||||
@ -22,7 +22,18 @@ const InspectionList = require('../components/inspections/InspectionList'); //С
|
||||
const LoadingOverlay = require('../components/common/LoadingOverlay'); //Оверлей загрузки
|
||||
const OrganizationSelectDialog = require('../components/auth/OrganizationSelectDialog'); //Диалог выбора организации
|
||||
const { getAppInfo } = require('../utils/appInfo'); //Информация о приложении
|
||||
const { CONNECTION_LOST_MESSAGE, OFFLINE_MODE_TITLE } = require('../config/messages'); //Сообщения
|
||||
const {
|
||||
CONNECTION_LOST_MESSAGE,
|
||||
OFFLINE_MODE_TITLE,
|
||||
APP_ABOUT_TITLE,
|
||||
SIDE_MENU_TITLE,
|
||||
ORGANIZATION_SELECT_DIALOG_TITLE,
|
||||
MENU_ITEM_SETTINGS,
|
||||
MENU_ITEM_ABOUT,
|
||||
MENU_ITEM_LOGIN,
|
||||
MENU_ITEM_LOGOUT,
|
||||
LOGOUT_SUCCESS_MESSAGE
|
||||
} = require('../config/messages'); //Сообщения
|
||||
const { DIALOG_BUTTON_TYPE, DIALOG_CANCEL_BUTTON, getConfirmButtonOptions } = require('../config/dialogButtons'); //Кнопки диалогов
|
||||
const { APP_COLORS } = require('../config/theme'); //Цветовая схема
|
||||
const styles = require('../styles/screens/MainScreen.styles'); //Стили экрана
|
||||
@ -208,7 +219,7 @@ function MainScreen() {
|
||||
});
|
||||
|
||||
showInfo(appInfo, {
|
||||
title: 'Информация о приложении'
|
||||
title: APP_ABOUT_TITLE
|
||||
});
|
||||
}, [showInfo, mode, serverUrl, isLocalDbReady]);
|
||||
|
||||
@ -227,7 +238,7 @@ function MainScreen() {
|
||||
const result = await logout({ skipServerRequest: mode === 'OFFLINE' });
|
||||
|
||||
if (result.success) {
|
||||
showSuccess('Выход выполнен');
|
||||
showSuccess(LOGOUT_SUCCESS_MESSAGE);
|
||||
setNotConnected();
|
||||
setInitialScreen(SCREENS.AUTH);
|
||||
} else {
|
||||
@ -250,12 +261,12 @@ function MainScreen() {
|
||||
const items = [
|
||||
{
|
||||
id: 'settings',
|
||||
title: 'Настройки',
|
||||
title: MENU_ITEM_SETTINGS,
|
||||
onPress: handleOpenSettings
|
||||
},
|
||||
{
|
||||
id: 'about',
|
||||
title: 'О приложении',
|
||||
title: MENU_ITEM_ABOUT,
|
||||
onPress: handleShowAbout
|
||||
}
|
||||
];
|
||||
@ -270,7 +281,7 @@ function MainScreen() {
|
||||
if (mode === 'OFFLINE') {
|
||||
items.push({
|
||||
id: 'login',
|
||||
title: 'Вход',
|
||||
title: MENU_ITEM_LOGIN,
|
||||
onPress: handleLogin
|
||||
});
|
||||
}
|
||||
@ -279,7 +290,7 @@ function MainScreen() {
|
||||
if ((mode === 'ONLINE' || mode === 'OFFLINE') && isAuthenticated) {
|
||||
items.push({
|
||||
id: 'logout',
|
||||
title: 'Выход',
|
||||
title: MENU_ITEM_LOGOUT,
|
||||
onPress: handleLogout,
|
||||
textStyle: { color: APP_COLORS.error }
|
||||
});
|
||||
@ -305,7 +316,7 @@ function MainScreen() {
|
||||
visible={menuVisible}
|
||||
onClose={handleMenuClose}
|
||||
items={menuItems}
|
||||
title="Меню"
|
||||
title={SIDE_MENU_TITLE}
|
||||
mode={mode}
|
||||
username={session?.userName}
|
||||
organization={session?.companyName}
|
||||
@ -316,7 +327,7 @@ function MainScreen() {
|
||||
organizations={organizations}
|
||||
onSelect={handleSelectOrganization}
|
||||
onCancel={handleCancelOrganization}
|
||||
title="Выберите организацию"
|
||||
title={ORGANIZATION_SELECT_DIALOG_TITLE}
|
||||
/>
|
||||
|
||||
<LoadingOverlay visible={isAuthLoading} message="Выполняется операция..." />
|
||||
|
||||
@ -7,25 +7,26 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const React = require('react');
|
||||
const { ScrollView, View, Pressable } = require('react-native');
|
||||
const AdaptiveView = require('../components/common/AdaptiveView');
|
||||
const AppText = require('../components/common/AppText');
|
||||
const AppButton = require('../components/common/AppButton');
|
||||
const AppSwitch = require('../components/common/AppSwitch');
|
||||
const CopyButton = require('../components/common/CopyButton');
|
||||
const InputDialog = require('../components/common/InputDialog');
|
||||
const AppHeader = require('../components/layout/AppHeader');
|
||||
const { useAppMessagingContext } = require('../components/layout/AppMessagingProvider');
|
||||
const { useAppModeContext } = require('../components/layout/AppModeProvider');
|
||||
const { useAppNavigationContext } = require('../components/layout/AppNavigationProvider');
|
||||
const { useAppLocalDbContext } = require('../components/layout/AppLocalDbProvider');
|
||||
const { useAppAuthContext } = require('../components/layout/AppAuthProvider');
|
||||
const { AUTH_SETTINGS_KEYS, DEFAULT_IDLE_TIMEOUT } = require('../config/authConfig');
|
||||
const { DIALOG_BUTTON_TYPE, DIALOG_CANCEL_BUTTON, getConfirmButtonOptions } = require('../config/dialogButtons');
|
||||
const { getAppInfo, getModeLabel } = require('../utils/appInfo');
|
||||
const { validateServerUrlAllowEmpty, validateIdleTimeout } = require('../utils/validation');
|
||||
const styles = require('../styles/screens/SettingsScreen.styles');
|
||||
const React = require('react'); //React и хуки
|
||||
const { ScrollView, View, Pressable } = require('react-native'); //Базовые компоненты
|
||||
const AdaptiveView = require('../components/common/AdaptiveView'); //Адаптивный контейнер
|
||||
const AppText = require('../components/common/AppText'); //Общий текст
|
||||
const AppButton = require('../components/common/AppButton'); //Кнопка
|
||||
const AppSwitch = require('../components/common/AppSwitch'); //Переключатель
|
||||
const CopyButton = require('../components/common/CopyButton'); //Кнопка копирования
|
||||
const InputDialog = require('../components/common/InputDialog'); //Диалог ввода
|
||||
const AppHeader = require('../components/layout/AppHeader'); //Заголовок
|
||||
const { useAppMessagingContext } = require('../components/layout/AppMessagingProvider'); //Контекст сообщений
|
||||
const { useAppModeContext } = require('../components/layout/AppModeProvider'); //Контекст режима
|
||||
const { useAppNavigationContext } = require('../components/layout/AppNavigationProvider'); //Контекст навигации
|
||||
const { useAppLocalDbContext } = require('../components/layout/AppLocalDbProvider'); //Контекст локальной БД
|
||||
const { useAppAuthContext } = require('../components/layout/AppAuthProvider'); //Контекст авторизации
|
||||
const { AUTH_SETTINGS_KEYS, DEFAULT_IDLE_TIMEOUT } = require('../config/authConfig'); //Конфиг авторизации
|
||||
const { DIALOG_BUTTON_TYPE, DIALOG_CANCEL_BUTTON, getConfirmButtonOptions } = require('../config/dialogButtons'); //Кнопки диалогов
|
||||
const { getAppInfo, getModeLabel } = require('../utils/appInfo'); //Информация о приложении и режиме
|
||||
const { validateServerUrlAllowEmpty, validateIdleTimeout } = require('../utils/validation'); //Валидация
|
||||
const { APP_ABOUT_TITLE, SETTINGS_SERVER_SAVED_MESSAGE, SETTINGS_RESET_SUCCESS_MESSAGE, MENU_ITEM_ABOUT } = require('../config/messages'); //Сообщения
|
||||
const styles = require('../styles/screens/SettingsScreen.styles'); //Стили экрана
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
@ -140,7 +141,7 @@ function SettingsScreen() {
|
||||
|
||||
if (success) {
|
||||
setServerUrl(valueToSave);
|
||||
showSuccess('Настройки сервера сохранены');
|
||||
showSuccess(SETTINGS_SERVER_SAVED_MESSAGE);
|
||||
} else {
|
||||
showError('Не удалось сохранить настройки');
|
||||
}
|
||||
@ -249,7 +250,7 @@ function SettingsScreen() {
|
||||
setIdleTimeout(defaultValue);
|
||||
await setSetting(AUTH_SETTINGS_KEYS.IDLE_TIMEOUT, defaultValue);
|
||||
setNotConnected();
|
||||
showSuccess('Настройки сброшены');
|
||||
showSuccess(SETTINGS_RESET_SUCCESS_MESSAGE);
|
||||
} else {
|
||||
showError('Не удалось сбросить настройки');
|
||||
}
|
||||
@ -257,7 +258,7 @@ function SettingsScreen() {
|
||||
//Подключён (онлайн или офлайн): сбрасываем только время простоя
|
||||
await setSetting(AUTH_SETTINGS_KEYS.IDLE_TIMEOUT, defaultValue);
|
||||
setIdleTimeout(defaultValue);
|
||||
showSuccess('Настройки сброшены');
|
||||
showSuccess(SETTINGS_RESET_SUCCESS_MESSAGE);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Ошибка сброса настроек:', error);
|
||||
@ -304,7 +305,7 @@ function SettingsScreen() {
|
||||
}
|
||||
}, [vacuum, showSuccess, showError]);
|
||||
|
||||
//Информация о приложении
|
||||
//Показ информации о приложении
|
||||
const handleShowAppInfo = React.useCallback(() => {
|
||||
const appInfo = getAppInfo({
|
||||
mode,
|
||||
@ -313,7 +314,7 @@ function SettingsScreen() {
|
||||
});
|
||||
|
||||
showInfo(appInfo, {
|
||||
title: 'Информация о приложении'
|
||||
title: APP_ABOUT_TITLE
|
||||
});
|
||||
}, [mode, serverUrl, isDbReady, showInfo]);
|
||||
|
||||
@ -475,7 +476,7 @@ function SettingsScreen() {
|
||||
Информация
|
||||
</AppText>
|
||||
|
||||
<AppButton title="О приложении" onPress={handleShowAppInfo} style={[styles.actionButton, styles.infoButton]} />
|
||||
<AppButton title={MENU_ITEM_ABOUT} onPress={handleShowAppInfo} style={[styles.actionButton, styles.infoButton]} />
|
||||
|
||||
<View style={styles.infoRow}>
|
||||
<AppText style={styles.infoLabel} variant="body">
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { StyleSheet } = require('react-native');
|
||||
const { APP_COLORS } = require('../../config/theme');
|
||||
const { UI } = require('../../config/appConfig');
|
||||
const { responsiveSpacing, heightPercentage } = require('../../utils/responsive');
|
||||
const { StyleSheet } = require('react-native'); //StyleSheet
|
||||
const { APP_COLORS } = require('../../config/theme'); //Цветовая схема
|
||||
const { UI } = require('../../config/appConfig'); //Конфигурация UI
|
||||
const { responsiveSpacing, heightPercentage } = require('../../utils/responsive'); //Адаптивные размеры
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,9 +7,9 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { StyleSheet } = require('react-native');
|
||||
const { APP_COLORS } = require('../../config/theme');
|
||||
const { responsiveSpacing } = require('../../utils/responsive');
|
||||
const { StyleSheet } = require('react-native'); //StyleSheet
|
||||
const { APP_COLORS } = require('../../config/theme'); //Цветовая схема
|
||||
const { responsiveSpacing } = require('../../utils/responsive'); //Адаптивные отступы
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { StyleSheet } = require('react-native');
|
||||
const { APP_COLORS } = require('../../config/theme');
|
||||
const { UI } = require('../../config/appConfig');
|
||||
const { responsiveSpacing } = require('../../utils/responsive');
|
||||
const { StyleSheet } = require('react-native'); //StyleSheet
|
||||
const { APP_COLORS } = require('../../config/theme'); //Цветовая схема
|
||||
const { UI } = require('../../config/appConfig'); //Конфигурация UI
|
||||
const { responsiveSpacing } = require('../../utils/responsive'); //Адаптивные отступы
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { StyleSheet } = require('react-native');
|
||||
const { APP_COLORS } = require('../../config/theme');
|
||||
const { UI } = require('../../config/appConfig');
|
||||
const { responsiveSpacing } = require('../../utils/responsive');
|
||||
const { StyleSheet } = require('react-native'); //StyleSheet
|
||||
const { APP_COLORS } = require('../../config/theme'); //Цветовая схема
|
||||
const { UI } = require('../../config/appConfig'); //Конфигурация UI
|
||||
const { responsiveSpacing } = require('../../utils/responsive'); //Адаптивные отступы
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
Предрейсовые осмотры - мобильное приложение
|
||||
Стили провайдера авторизации (провайдер без визуальной разметки)
|
||||
*/
|
||||
|
||||
//---------
|
||||
//Константы
|
||||
//---------
|
||||
|
||||
//Провайдер не рендерит собственных View — стили не требуются
|
||||
const styles = {};
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
//----------------
|
||||
|
||||
module.exports = styles;
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
Предрейсовые осмотры - мобильное приложение
|
||||
Стили провайдера локальной БД (провайдер без визуальной разметки)
|
||||
*/
|
||||
|
||||
//---------
|
||||
//Константы
|
||||
//---------
|
||||
|
||||
//Провайдер не рендерит собственных View — стили не требуются
|
||||
const styles = {};
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
//----------------
|
||||
|
||||
module.exports = styles;
|
||||
@ -1,109 +0,0 @@
|
||||
/*
|
||||
Предрейсовые осмотры - мобильное приложение
|
||||
Стили компонента меню
|
||||
*/
|
||||
|
||||
//---------------------
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { StyleSheet } = require('react-native'); //StyleSheet React Native
|
||||
const { APP_COLORS } = require('../../config/theme'); //Цветовая схема приложения
|
||||
const { UI } = require('../../config/appConfig'); //Конфигурация UI
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
//-----------
|
||||
|
||||
//Стили меню
|
||||
const styles = StyleSheet.create({
|
||||
backdrop: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
backgroundColor: APP_COLORS.overlay,
|
||||
zIndex: 999
|
||||
},
|
||||
container: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
width: UI.SIDE_MENU_WIDTH,
|
||||
backgroundColor: APP_COLORS.surface,
|
||||
zIndex: 1000,
|
||||
shadowColor: APP_COLORS.black,
|
||||
shadowOpacity: 0.15,
|
||||
shadowRadius: 10,
|
||||
shadowOffset: {
|
||||
width: -2,
|
||||
height: 0
|
||||
},
|
||||
elevation: 10
|
||||
},
|
||||
header: {
|
||||
paddingHorizontal: UI.PADDING,
|
||||
paddingVertical: UI.PADDING,
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
borderBottomColor: APP_COLORS.borderSubtle,
|
||||
backgroundColor: APP_COLORS.primaryLight,
|
||||
height: 60,
|
||||
justifyContent: 'center'
|
||||
},
|
||||
title: {
|
||||
fontSize: 18,
|
||||
fontWeight: '600',
|
||||
color: APP_COLORS.primaryDark,
|
||||
textAlign: 'center'
|
||||
},
|
||||
content: {
|
||||
flex: 1,
|
||||
paddingTop: UI.PADDING / 2
|
||||
},
|
||||
menuItem: {
|
||||
paddingHorizontal: UI.PADDING,
|
||||
paddingVertical: UI.PADDING,
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
borderBottomColor: APP_COLORS.borderSubtle
|
||||
},
|
||||
menuItemPressed: {
|
||||
backgroundColor: APP_COLORS.primaryLight
|
||||
},
|
||||
menuItemDestructive: {
|
||||
borderBottomColor: APP_COLORS.error + '20'
|
||||
},
|
||||
menuItemContent: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center'
|
||||
},
|
||||
menuItemIcon: {
|
||||
marginRight: 12,
|
||||
width: 24,
|
||||
alignItems: 'center'
|
||||
},
|
||||
menuItemText: {
|
||||
fontSize: 16,
|
||||
color: APP_COLORS.textPrimary
|
||||
},
|
||||
menuItemTextDestructive: {
|
||||
color: APP_COLORS.error
|
||||
},
|
||||
emptyMenu: {
|
||||
padding: UI.PADDING * 2,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
emptyMenuText: {
|
||||
fontSize: 14,
|
||||
color: APP_COLORS.textSecondary,
|
||||
textAlign: 'center'
|
||||
}
|
||||
});
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
//----------------
|
||||
|
||||
module.exports = styles;
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
Предрейсовые осмотры - мобильное приложение
|
||||
Стили провайдера сообщений (провайдер без визуальной разметки)
|
||||
*/
|
||||
|
||||
//---------
|
||||
//Константы
|
||||
//---------
|
||||
|
||||
//Провайдер не рендерит собственных View — стили не требуются
|
||||
const styles = {};
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
//----------------
|
||||
|
||||
module.exports = styles;
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
Предрейсовые осмотры - мобильное приложение
|
||||
Стили провайдера режима работы (провайдер без визуальной разметки)
|
||||
*/
|
||||
|
||||
//---------
|
||||
//Константы
|
||||
//---------
|
||||
|
||||
//Провайдер не рендерит собственных View — стили не требуются
|
||||
const styles = {};
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
//----------------
|
||||
|
||||
module.exports = styles;
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
Предрейсовые осмотры - мобильное приложение
|
||||
Стили провайдера навигации (провайдер без визуальной разметки)
|
||||
*/
|
||||
|
||||
//---------
|
||||
//Константы
|
||||
//---------
|
||||
|
||||
//Провайдер не рендерит собственных View — стили не требуются
|
||||
const styles = {};
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
//----------------
|
||||
|
||||
module.exports = styles;
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
Предрейсовые осмотры - мобильное приложение
|
||||
Стили провайдера предрейсовых осмотров (провайдер без визуальной разметки)
|
||||
*/
|
||||
|
||||
//---------
|
||||
//Константы
|
||||
//---------
|
||||
|
||||
//Провайдер не рендерит собственных View — стили не требуются
|
||||
const styles = {};
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
//----------------
|
||||
|
||||
module.exports = styles;
|
||||
@ -1,17 +0,0 @@
|
||||
/*
|
||||
Предрейсовые осмотры - мобильное приложение
|
||||
Стили провайдера сервера приложений (провайдер без визуальной разметки)
|
||||
*/
|
||||
|
||||
//---------
|
||||
//Константы
|
||||
//---------
|
||||
|
||||
//Провайдер не рендерит собственных View — стили не требуются
|
||||
const styles = {};
|
||||
|
||||
//----------------
|
||||
//Интерфейс модуля
|
||||
//----------------
|
||||
|
||||
module.exports = styles;
|
||||
@ -7,10 +7,10 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { StyleSheet } = require('react-native');
|
||||
const { APP_COLORS } = require('../../config/theme');
|
||||
const { UI } = require('../../config/appConfig');
|
||||
const { responsiveSpacing, responsiveSize } = require('../../utils/responsive');
|
||||
const { StyleSheet } = require('react-native'); //StyleSheet
|
||||
const { APP_COLORS } = require('../../config/theme'); //Цветовая схема
|
||||
const { UI } = require('../../config/appConfig'); //Конфигурация UI
|
||||
const { responsiveSpacing, responsiveSize } = require('../../utils/responsive'); //Адаптивные размеры
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { StyleSheet } = require('react-native');
|
||||
const { APP_COLORS } = require('../../config/theme');
|
||||
const { UI } = require('../../config/appConfig');
|
||||
const { responsiveSpacing } = require('../../utils/responsive');
|
||||
const { StyleSheet } = require('react-native'); //StyleSheet
|
||||
const { APP_COLORS } = require('../../config/theme'); //Цветовая схема
|
||||
const { UI } = require('../../config/appConfig'); //Конфигурация UI
|
||||
const { responsiveSpacing } = require('../../utils/responsive'); //Адаптивные отступы
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,10 +7,10 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { StyleSheet } = require('react-native');
|
||||
const { APP_COLORS } = require('../../config/theme');
|
||||
const { UI } = require('../../config/appConfig');
|
||||
const { responsiveSpacing } = require('../../utils/responsive');
|
||||
const { StyleSheet } = require('react-native'); //StyleSheet
|
||||
const { APP_COLORS } = require('../../config/theme'); //Цветовая схема
|
||||
const { UI } = require('../../config/appConfig'); //Конфигурация UI
|
||||
const { responsiveSpacing } = require('../../utils/responsive'); //Адаптивные отступы
|
||||
|
||||
//-----------
|
||||
//Тело модуля
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
//Подключение библиотек
|
||||
//---------------------
|
||||
|
||||
const { Platform, NativeModules } = require('react-native');
|
||||
const { Platform, NativeModules } = require('react-native'); //Платформа и нативные модули
|
||||
const { WEB_DEVICE_ID_KEY } = require('../config/storageKeys'); //Ключи хранилища
|
||||
|
||||
//-----------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user